Commit bae273cf authored by Grzegorz Daniluk's avatar Grzegorz Daniluk

use HAS_GENSDBFS to include/exclude sdbfs generation code

parent a9add108
......@@ -757,8 +757,6 @@ int storage_read_hdl_cfg(void)
return 0;
}
#ifdef CONFIG_GENSDBFS
extern uint32_t _binary_tools_sdbfs_default_bin_start[];
extern uint32_t _binary_tools_sdbfs_default_bin_end[];
......@@ -770,7 +768,7 @@ static inline unsigned long SDB_ALIGN(unsigned long x, int blocksize)
int storage_sdbfs_erase(int mem_type, uint32_t base_adr, uint32_t blocksize,
uint8_t i2c_adr)
{
if (mem_type == MEM_FLASH && blocksize == 0)
if (!HAS_GENSDBFS || (mem_type == MEM_FLASH && blocksize == 0))
return -EINVAL;
if (mem_type == MEM_FLASH) {
......@@ -805,7 +803,7 @@ int storage_gensdbfs(int mem_type, uint32_t base_adr, uint32_t blocksize,
int cur_adr, size;
uint32_t val;
if (mem_type == MEM_FLASH && base_adr == 0)
if (!HAS_GENSDBFS || (mem_type == MEM_FLASH && base_adr == 0))
return -EINVAL;
if (mem_type == MEM_FLASH && blocksize == 0)
......@@ -902,5 +900,3 @@ int storage_gensdbfs(int mem_type, uint32_t base_adr, uint32_t blocksize,
return mem_type;
}
#endif
......@@ -46,6 +46,12 @@
#define EE_RET_CORRPT -3
#define EE_RET_POSERR -4
#ifdef CONFIG_GENSDBFS
#define HAS_GENSDBFS 1
#else
#define HAS_GENSDBFS 0
#endif
extern uint32_t cal_phase_transition;
extern uint8_t has_eeprom;
......@@ -86,11 +92,9 @@ extern struct storage_config storage_cfg;
int storage_read_hdl_cfg(void);
#ifdef CONFIG_GENSDBFS
int storage_sdbfs_erase(int mem_type, uint32_t base_adr, uint32_t blocksize,
uint8_t i2c_adr);
int storage_gensdbfs(int mem_type, uint32_t base_adr, uint32_t blocksize,
uint8_t i2c_adr);
#endif
#endif
......@@ -20,17 +20,14 @@
static int cmd_sdb(const char *args[])
{
#ifdef CONFIG_GENSDBFS
uint8_t i2c_adr = FMC_EEPROM_ADR;
int blocksize = 1;
#endif
if (!args[0]) {
sdb_print_devices();
return 0;
}
#ifdef CONFIG_GENSDBFS
if (!args[1])
if (!args[1] || !HAS_GENSDBFS)
return -EINVAL;
/* interpret args[3] as i2c adr or blocksize depending on memory type */
......@@ -67,7 +64,7 @@ static int cmd_sdb(const char *args[])
storage_cfg.blocksize, 0);
return 0;
}
#endif
return -EINVAL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment