ieee802154: cc2520: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cc5250 driver to use new defines so we can remove the dts_fixup.h code for it. Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
parent
e0cd0c2b67
commit
2492d52f5c
3 changed files with 19 additions and 48 deletions
|
@ -15,12 +15,12 @@
|
|||
#include <gpio.h>
|
||||
|
||||
static struct cc2520_gpio_configuration cc2520_gpios[CC2520_GPIO_IDX_MAX] = {
|
||||
{ .dev = NULL, .pin = DT_CC2520_GPIO_VREG_EN, },
|
||||
{ .dev = NULL, .pin = DT_CC2520_GPIO_RESET, },
|
||||
{ .dev = NULL, .pin = DT_CC2520_GPIO_FIFO, },
|
||||
{ .dev = NULL, .pin = DT_CC2520_GPIO_CCA, },
|
||||
{ .dev = NULL, .pin = DT_CC2520_GPIO_SFD, },
|
||||
{ .dev = NULL, .pin = DT_CC2520_GPIO_FIFOP, },
|
||||
{ .dev = NULL, .pin = DT_TI_CC2520_0_VREG_EN_GPIOS_PIN, },
|
||||
{ .dev = NULL, .pin = DT_TI_CC2520_0_RESET_GPIOS_PIN, },
|
||||
{ .dev = NULL, .pin = DT_TI_CC2520_0_FIFO_GPIOS_PIN, },
|
||||
{ .dev = NULL, .pin = DT_TI_CC2520_0_CCA_GPIOS_PIN, },
|
||||
{ .dev = NULL, .pin = DT_TI_CC2520_0_SFD_GPIOS_PIN, },
|
||||
{ .dev = NULL, .pin = DT_TI_CC2520_0_FIFOP_GPIOS_PIN, },
|
||||
};
|
||||
|
||||
struct cc2520_gpio_configuration *cc2520_configure_gpios(void)
|
||||
|
@ -31,32 +31,32 @@ struct cc2520_gpio_configuration *cc2520_configure_gpios(void)
|
|||
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
|
||||
struct device *gpio;
|
||||
|
||||
gpio = device_get_binding(DT_CC2520_GPIO_VREG_EN_DRV_NAME);
|
||||
gpio = device_get_binding(DT_TI_CC2520_0_VREG_EN_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_VREG_EN].pin,
|
||||
flags_noint_out);
|
||||
cc2520_gpios[CC2520_GPIO_IDX_VREG_EN].dev = gpio;
|
||||
|
||||
gpio = device_get_binding(DT_CC2520_GPIO_RESET_DRV_NAME);
|
||||
gpio = device_get_binding(DT_TI_CC2520_0_RESET_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_RESET].pin,
|
||||
flags_noint_out);
|
||||
cc2520_gpios[CC2520_GPIO_IDX_RESET].dev = gpio;
|
||||
|
||||
gpio = device_get_binding(DT_CC2520_GPIO_SFD_DRV_NAME);
|
||||
gpio = device_get_binding(DT_TI_CC2520_0_SFD_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_SFD].pin,
|
||||
flags_int_in);
|
||||
cc2520_gpios[CC2520_GPIO_IDX_SFD].dev = gpio;
|
||||
|
||||
gpio = device_get_binding(DT_CC2520_GPIO_FIFOP_DRV_NAME);
|
||||
gpio = device_get_binding(DT_TI_CC2520_0_FIFOP_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_FIFOP].pin,
|
||||
flags_int_in);
|
||||
cc2520_gpios[CC2520_GPIO_IDX_FIFOP].dev = gpio;
|
||||
|
||||
gpio = device_get_binding(DT_CC2520_GPIO_FIFO_DRV_NAME);
|
||||
gpio = device_get_binding(DT_TI_CC2520_0_FIFO_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_FIFO].pin,
|
||||
flags_noint_in);
|
||||
cc2520_gpios[CC2520_GPIO_IDX_FIFO].dev = gpio;
|
||||
|
||||
gpio = device_get_binding(DT_CC2520_GPIO_CCA_DRV_NAME);
|
||||
gpio = device_get_binding(DT_TI_CC2520_0_CCA_GPIOS_CONTROLLER);
|
||||
gpio_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_CCA].pin,
|
||||
flags_noint_in);
|
||||
cc2520_gpios[CC2520_GPIO_IDX_CCA].dev = gpio;
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* This file is a temporary workaround for mapping of the generated information
|
||||
* to the current driver definitions. This will be removed when the drivers
|
||||
* are modified to handle the generated information, or the mapping of
|
||||
* generated data matches the driver definitions.
|
||||
*/
|
||||
|
||||
#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
|
||||
|
||||
#define DT_CC2520_GPIO_VREG_EN DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_VREG_EN_GPIOS_PIN
|
||||
#define DT_CC2520_GPIO_VREG_EN_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_VREG_EN_GPIOS_CONTROLLER
|
||||
#define DT_CC2520_GPIO_RESET DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_RESET_GPIOS_PIN
|
||||
#define DT_CC2520_GPIO_RESET_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_RESET_GPIOS_CONTROLLER
|
||||
#define DT_CC2520_GPIO_FIFO DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_FIFO_GPIOS_PIN
|
||||
#define DT_CC2520_GPIO_FIFO_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_FIFO_GPIOS_CONTROLLER
|
||||
#define DT_CC2520_GPIO_CCA DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_CCA_GPIOS_PIN
|
||||
#define DT_CC2520_GPIO_CCA_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_CCA_GPIOS_CONTROLLER
|
||||
#define DT_CC2520_GPIO_SFD DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_SFD_GPIOS_PIN
|
||||
#define DT_CC2520_GPIO_SFD_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_SFD_GPIOS_CONTROLLER
|
||||
#define DT_CC2520_GPIO_FIFOP DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_FIFOP_GPIOS_PIN
|
||||
#define DT_CC2520_GPIO_FIFOP_DRV_NAME DT_SNPS_DESIGNWARE_SPI_B0001400_TI_CC2520_0_FIFOP_GPIOS_CONTROLLER
|
|
@ -985,7 +985,7 @@ static inline int configure_spi(struct device *dev)
|
|||
{
|
||||
struct cc2520_context *cc2520 = dev->driver_data;
|
||||
|
||||
cc2520->spi = device_get_binding(DT_IEEE802154_CC2520_SPI_DRV_NAME);
|
||||
cc2520->spi = device_get_binding(DT_TI_CC2520_0_BUS_NAME);
|
||||
if (!cc2520->spi) {
|
||||
LOG_ERR("Unable to get SPI device");
|
||||
return -ENODEV;
|
||||
|
@ -993,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(
|
||||
DT_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME);
|
||||
DT_TI_CC2520_0_CS_GPIO_CONTROLLER);
|
||||
if (!cs_ctrl.gpio_dev) {
|
||||
LOG_ERR("Unable to get GPIO SPI CS device");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
cs_ctrl.gpio_pin = DT_IEEE802154_CC2520_GPIO_SPI_CS_PIN;
|
||||
cs_ctrl.gpio_pin = DT_TI_CC2520_0_CS_GPIO_PIN;
|
||||
cs_ctrl.delay = 0;
|
||||
|
||||
cc2520->spi_cfg.cs = &cs_ctrl;
|
||||
|
||||
LOG_DBG("SPI GPIO CS configured on %s:%u",
|
||||
DT_IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME,
|
||||
DT_IEEE802154_CC2520_GPIO_SPI_CS_PIN);
|
||||
DT_TI_CC2520_0_CS_GPIO_CONTROLLER,
|
||||
DT_TI_CC2520_0_CS_GPIO_PIN);
|
||||
#endif /* CONFIG_IEEE802154_CC2520_GPIO_SPI_CS */
|
||||
|
||||
cc2520->spi_cfg.frequency = DT_IEEE802154_CC2520_SPI_FREQ;
|
||||
cc2520->spi_cfg.frequency = DT_TI_CC2520_0_SPI_MAX_FREQUENCY;
|
||||
cc2520->spi_cfg.operation = SPI_WORD_SET(8);
|
||||
cc2520->spi_cfg.slave = DT_IEEE802154_CC2520_SPI_SLAVE;
|
||||
cc2520->spi_cfg.slave = DT_TI_CC2520_0_BASE_ADDRESS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue