Skip to content

Commit

Permalink
DTS: flash: spi_nor: use DT_ for freq and other parameters
Browse files Browse the repository at this point in the history
Use DT_ instead of CONFIG_ for spi freq, spi bus name, flash device
name and flash base address.

Signed-off-by: Rajavardhan Gundi <[email protected]>
  • Loading branch information
rgundi authored and nashif committed Jan 17, 2019
1 parent 0dc0c9d commit f885fd1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions boards/xtensa/intel_s1000_crb/dts_fixup.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@
#define DT_CODEC_RESET_GPIO_PIN \
DT_SNPS_DESIGNWARE_I2C_80400_TI_TLV320DAC_18_RESET_GPIOS_PIN

#define CONFIG_SPI_NOR_SPI_NAME \
#define DT_SPI_NOR_SPI_NAME \
DT_SNPS_DESIGNWARE_SPI_E000_SPI_FLASH_0_BUS_NAME

#define CONFIG_SPI_NOR_SPI_FREQ_0 \
#define DT_SPI_NOR_SPI_FREQ_0 \
DT_SNPS_DESIGNWARE_SPI_E000_SPI_FLASH_0_SPI_MAX_FREQUENCY

#define CONFIG_SPI_NOR_DRV_NAME \
#define DT_SPI_NOR_DRV_NAME \
DT_SNPS_DESIGNWARE_SPI_E000_SPI_FLASH_0_LABEL

#define CONFIG_SPI_NOR_SPI_SLAVE \
#define DT_SPI_NOR_SPI_SLAVE \
DT_SNPS_DESIGNWARE_SPI_E000_SPI_FLASH_0_BASE_ADDRESS
/* End of Board Level DTS fixup file */
8 changes: 4 additions & 4 deletions drivers/flash/spi_nor.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,14 @@ static int spi_nor_configure(struct device *dev)
struct spi_nor_data *data = dev->driver_data;
const struct spi_nor_config *params = dev->config->config_info;

data->spi = device_get_binding(CONFIG_SPI_NOR_SPI_NAME);
data->spi = device_get_binding(DT_SPI_NOR_SPI_NAME);
if (!data->spi) {
return -EINVAL;
}

data->spi_cfg.frequency = CONFIG_SPI_NOR_SPI_FREQ_0;
data->spi_cfg.frequency = DT_SPI_NOR_SPI_FREQ_0;
data->spi_cfg.operation = SPI_WORD_SET(8);
data->spi_cfg.slave = CONFIG_SPI_NOR_SPI_SLAVE;
data->spi_cfg.slave = DT_SPI_NOR_SPI_SLAVE;

#if defined(CONFIG_SPI_NOR_GPIO_SPI_CS)
data->cs_ctrl.gpio_dev =
Expand Down Expand Up @@ -402,7 +402,7 @@ static const struct spi_nor_config flash_id = {

static struct spi_nor_data spi_nor_memory_data;

DEVICE_AND_API_INIT(spi_flash_memory, CONFIG_SPI_NOR_DRV_NAME,
DEVICE_AND_API_INIT(spi_flash_memory, DT_SPI_NOR_DRV_NAME,
&spi_nor_init, &spi_nor_memory_data,
&flash_id, POST_KERNEL, CONFIG_SPI_NOR_INIT_PRIORITY,
&spi_nor_api);
2 changes: 1 addition & 1 deletion tests/boards/intel_s1000_crb/src/spi_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void test_flash(void)
u8_t buf[TEST_DATA_LEN];
int i;

flash_dev = device_get_binding(CONFIG_SPI_NOR_DRV_NAME);
flash_dev = device_get_binding(DT_SPI_NOR_DRV_NAME);

if (!flash_dev) {
LOG_ERR("SPI flash driver was not found!\n");
Expand Down

0 comments on commit f885fd1

Please sign in to comment.