ieee802154: cc2520: Move to DT only config support
Now that the in tree user of cc2520 uses device tree to configure SPI and GPIO params, we can remove and convert the driver to utilize DT only. This means removing the Kconfig options that come from DT and rename CONFIG_ to DT_ for those options. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
1634cf2248
commit
f249a0f4f2
3 changed files with 12 additions and 52 deletions
|
@ -9,8 +9,8 @@
|
|||
* generated data matches the driver definitions.
|
||||
*/
|
||||
|
||||
#define CONFIG_IEEE802154_CC2520_SPI_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_BUS_NAME
|
||||
#define CONFIG_IEEE802154_CC2520_SPI_SLAVE DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_BASE_ADDRESS
|
||||
#define CONFIG_IEEE802154_CC2520_SPI_FREQ DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_SPI_MAX_FREQUENCY
|
||||
#define CONFIG_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_CS_GPIOS_CONTROLLER
|
||||
#define CONFIG_IEEE802154_CC2520_GPIO_SPI_CS_PIN DT_SNPS_DESIGNWARE_SPI_B0001400_CS_GPIOS_PIN
|
||||
#define DT_IEEE802154_CC2520_SPI_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_BUS_NAME
|
||||
#define DT_IEEE802154_CC2520_SPI_SLAVE DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_BASE_ADDRESS
|
||||
#define DT_IEEE802154_CC2520_SPI_FREQ DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_SPI_MAX_FREQUENCY
|
||||
#define DT_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_CS_GPIOS_CONTROLLER
|
||||
#define DT_IEEE802154_CC2520_GPIO_SPI_CS_PIN DT_SNPS_DESIGNWARE_SPI_B0001400_CS_GPIOS_PIN
|
||||
|
|
|
@ -18,51 +18,12 @@ config IEEE802154_CC2520_DRV_NAME
|
|||
help
|
||||
This option sets the driver name
|
||||
|
||||
config IEEE802154_CC2520_SPI_DRV_NAME
|
||||
string "SPI driver's name to use to access CC2520"
|
||||
depends on !HAS_DTS_SPI
|
||||
help
|
||||
This option is mandatory to set which SPI controller to use in order
|
||||
to actually control the CC2520 chip.
|
||||
|
||||
config IEEE802154_CC2520_SPI_FREQ
|
||||
int "SPI system frequency"
|
||||
depends on !HAS_DTS_SPI
|
||||
default 0
|
||||
help
|
||||
This option sets the SPI controller's frequency. Beware this value
|
||||
depends on the SPI controller being used and also on the system
|
||||
clock.
|
||||
|
||||
config IEEE802154_CC2520_SPI_SLAVE
|
||||
int "SPI slave linked to CC2520"
|
||||
depends on !HAS_DTS_SPI
|
||||
default 0
|
||||
help
|
||||
This option sets the SPI slave number SPI controller has to switch
|
||||
to when dealing with CC2520 chip.
|
||||
|
||||
config IEEE802154_CC2520_GPIO_SPI_CS
|
||||
bool "Manage SPI CS through a GPIO pin"
|
||||
help
|
||||
This option is useful if one needs to manage SPI CS through a GPIO
|
||||
pin to by-pass the SPI controller's CS logic.
|
||||
|
||||
config IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME
|
||||
string "GPIO driver's name to use to drive SPI CS through"
|
||||
depends on IEEE802154_CC2520_GPIO_SPI_CS && !HAS_DTS_SPI
|
||||
help
|
||||
This option is mandatory to set which GPIO controller to use in order
|
||||
to actually emulate the SPI CS.
|
||||
|
||||
config IEEE802154_CC2520_GPIO_SPI_CS_PIN
|
||||
int "GPIO PIN to use to drive SPI CS through"
|
||||
default 0
|
||||
depends on IEEE802154_CC2520_GPIO_SPI_CS && !HAS_DTS_SPI
|
||||
help
|
||||
This option is mandatory to set which GPIO pin to use in order
|
||||
to actually emulate the SPI CS.
|
||||
|
||||
config IEEE802154_CC2520_RX_STACK_SIZE
|
||||
int "Driver's internal RX thread stack size"
|
||||
default 800
|
||||
|
|
|
@ -985,8 +985,7 @@ static inline int configure_spi(struct device *dev)
|
|||
{
|
||||
struct cc2520_context *cc2520 = dev->driver_data;
|
||||
|
||||
cc2520->spi = device_get_binding(
|
||||
CONFIG_IEEE802154_CC2520_SPI_DRV_NAME);
|
||||
cc2520->spi = device_get_binding(DT_IEEE802154_CC2520_SPI_DRV_NAME);
|
||||
if (!cc2520->spi) {
|
||||
LOG_ERR("Unable to get SPI device");
|
||||
return -ENODEV;
|
||||
|
@ -994,25 +993,25 @@ static inline int configure_spi(struct device *dev)
|
|||
|
||||
#if defined(CONFIG_IEEE802154_CC2520_GPIO_SPI_CS)
|
||||
cs_ctrl.gpio_dev = device_get_binding(
|
||||
CONFIG_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME);
|
||||
DT_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME);
|
||||
if (!cs_ctrl.gpio_dev) {
|
||||
LOG_ERR("Unable to get GPIO SPI CS device");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
cs_ctrl.gpio_pin = CONFIG_IEEE802154_CC2520_GPIO_SPI_CS_PIN;
|
||||
cs_ctrl.gpio_pin = DT_IEEE802154_CC2520_GPIO_SPI_CS_PIN;
|
||||
cs_ctrl.delay = 0;
|
||||
|
||||
cc2520->spi_cfg.cs = &cs_ctrl;
|
||||
|
||||
LOG_DBG("SPI GPIO CS configured on %s:%u",
|
||||
CONFIG_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME,
|
||||
CONFIG_IEEE802154_CC2520_GPIO_SPI_CS_PIN);
|
||||
DT_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME,
|
||||
DT_IEEE802154_CC2520_GPIO_SPI_CS_PIN);
|
||||
#endif /* CONFIG_IEEE802154_CC2520_GPIO_SPI_CS */
|
||||
|
||||
cc2520->spi_cfg.frequency = CONFIG_IEEE802154_CC2520_SPI_FREQ;
|
||||
cc2520->spi_cfg.frequency = DT_IEEE802154_CC2520_SPI_FREQ;
|
||||
cc2520->spi_cfg.operation = SPI_WORD_SET(8);
|
||||
cc2520->spi_cfg.slave = CONFIG_IEEE802154_CC2520_SPI_SLAVE;
|
||||
cc2520->spi_cfg.slave = DT_IEEE802154_CC2520_SPI_SLAVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue