boards/x86: Use dts for configuring the cc2520 device

Only the SPI bus for now.
Make cc2520's Kconfig aware of DTS on these settings.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2018-11-05 20:15:07 +01:00 committed by Anas Nashif
commit 1b3b0153a6
4 changed files with 22 additions and 13 deletions

View file

@ -16,19 +16,8 @@ config SPI
config GPIO config GPIO
default y default y
config IEEE802154_CC2520_SPI_DRV_NAME
default SPI_1_NAME
config IEEE802154_CC2520_SPI_FREQ
default 8000000
config IEEE802154_CC2520_SPI_SLAVE
default 1
config IEEE802154_CC2520_GPIO_SPI_CS config IEEE802154_CC2520_GPIO_SPI_CS
default y default y
config IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME
default "GPIO_0"
config IEEE802154_CC2520_GPIO_SPI_CS_PIN
default 11
config IEEE802154_CC2520_GPIO_0_NAME config IEEE802154_CC2520_GPIO_0_NAME
string string

View file

@ -0,0 +1,16 @@
/*
* 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 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

View file

@ -78,4 +78,5 @@
&spi1 { &spi1 {
status = "ok"; status = "ok";
}; };

View file

@ -20,12 +20,14 @@ config IEEE802154_CC2520_DRV_NAME
config IEEE802154_CC2520_SPI_DRV_NAME config IEEE802154_CC2520_SPI_DRV_NAME
string "SPI driver's name to use to access CC2520" string "SPI driver's name to use to access CC2520"
depends on !HAS_DTS_SPI
help help
This option is mandatory to set which SPI controller to use in order This option is mandatory to set which SPI controller to use in order
to actually control the CC2520 chip. to actually control the CC2520 chip.
config IEEE802154_CC2520_SPI_FREQ config IEEE802154_CC2520_SPI_FREQ
int "SPI system frequency" int "SPI system frequency"
depends on !HAS_DTS_SPI
default 0 default 0
help help
This option sets the SPI controller's frequency. Beware this value This option sets the SPI controller's frequency. Beware this value
@ -34,6 +36,7 @@ config IEEE802154_CC2520_SPI_FREQ
config IEEE802154_CC2520_SPI_SLAVE config IEEE802154_CC2520_SPI_SLAVE
int "SPI slave linked to CC2520" int "SPI slave linked to CC2520"
depends on !HAS_DTS_SPI
default 0 default 0
help help
This option sets the SPI slave number SPI controller has to switch This option sets the SPI slave number SPI controller has to switch
@ -47,7 +50,7 @@ config IEEE802154_CC2520_GPIO_SPI_CS
config IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME config IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME
string "GPIO driver's name to use to drive SPI CS through" string "GPIO driver's name to use to drive SPI CS through"
depends on IEEE802154_CC2520_GPIO_SPI_CS depends on IEEE802154_CC2520_GPIO_SPI_CS && !HAS_DTS_SPI
help help
This option is mandatory to set which GPIO controller to use in order This option is mandatory to set which GPIO controller to use in order
to actually emulate the SPI CS. to actually emulate the SPI CS.
@ -55,7 +58,7 @@ config IEEE802154_CC2520_GPIO_SPI_CS_DRV_NAME
config IEEE802154_CC2520_GPIO_SPI_CS_PIN config IEEE802154_CC2520_GPIO_SPI_CS_PIN
int "GPIO PIN to use to drive SPI CS through" int "GPIO PIN to use to drive SPI CS through"
default 0 default 0
depends on IEEE802154_CC2520_GPIO_SPI_CS depends on IEEE802154_CC2520_GPIO_SPI_CS && !HAS_DTS_SPI
help help
This option is mandatory to set which GPIO pin to use in order This option is mandatory to set which GPIO pin to use in order
to actually emulate the SPI CS. to actually emulate the SPI CS.