ieee802154: cc2520: quark_se_c1000_devboard: Move all GPIOs to DTS

Added support to the ti,cc2520 binding for optional GPIO signals and
moved the quark_se_c1000_devboard to define those signals in the DTS.
This lets us remove board.h and some #defines & fake Kconfig symbols
from the quark_se_c1000_devboard board.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala
2018-11-16 08:05:44 -06:00
committed by Anas Nashif
parent 27469810ac
commit 25d17db96b
6 changed files with 68 additions and 44 deletions

View File

@@ -19,13 +19,6 @@ config GPIO
config IEEE802154_CC2520_GPIO_SPI_CS
default y
config IEEE802154_CC2520_GPIO_0_NAME
string
default "GPIO_0"
config IEEE802154_CC2520_GPIO_1_NAME
string
default "GPIO_1"
endif # IEEE802154_CC2520
if USB_DEVICE_STACK

View File

@@ -5,7 +5,6 @@
*/
#include <kernel.h>
#include "board.h"
#include <uart.h>
#include <device.h>
#include <init.h>
@@ -16,12 +15,12 @@
#include <gpio.h>
static struct cc2520_gpio_configuration cc2520_gpios[CC2520_GPIO_IDX_MAX] = {
{ .dev = NULL, .pin = CC2520_GPIO_VREG_EN, },
{ .dev = NULL, .pin = CC2520_GPIO_RESET, },
{ .dev = NULL, .pin = CC2520_GPIO_FIFO, },
{ .dev = NULL, .pin = CC2520_GPIO_CCA, },
{ .dev = NULL, .pin = CC2520_GPIO_SFD, },
{ .dev = NULL, .pin = CC2520_GPIO_FIFOP, },
{ .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, },
};
struct cc2520_gpio_configuration *cc2520_configure_gpios(void)
@@ -32,28 +31,34 @@ struct cc2520_gpio_configuration *cc2520_configure_gpios(void)
GPIO_INT_ACTIVE_HIGH | GPIO_INT_DEBOUNCE);
struct device *gpio;
gpio = device_get_binding(CONFIG_IEEE802154_CC2520_GPIO_1_NAME);
gpio = device_get_binding(DT_CC2520_GPIO_VREG_EN_DRV_NAME);
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_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_RESET].pin,
flags_noint_out);
cc2520_gpios[CC2520_GPIO_IDX_VREG_EN].dev = gpio;
cc2520_gpios[CC2520_GPIO_IDX_RESET].dev = gpio;
gpio = device_get_binding(CONFIG_IEEE802154_CC2520_GPIO_0_NAME);
gpio = device_get_binding(DT_CC2520_GPIO_SFD_DRV_NAME);
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_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_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_pin_configure(gpio, cc2520_gpios[CC2520_GPIO_IDX_CCA].pin,
flags_noint_in);
cc2520_gpios[CC2520_GPIO_IDX_FIFOP].dev = gpio;
cc2520_gpios[CC2520_GPIO_IDX_FIFO].dev = gpio;
cc2520_gpios[CC2520_GPIO_IDX_SFD].dev = gpio;
cc2520_gpios[CC2520_GPIO_IDX_CCA].dev = gpio;
return cc2520_gpios;

View File

@@ -1,22 +0,0 @@
/*
* Copyright (c) 2015 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#if defined(CONFIG_IEEE802154_CC2520)
/* GPIO numbers where the TI cc2520 chip is connected to */
#define CC2520_GPIO_VREG_EN 0 /* PIN ?, ATP_AON_INT0 (out) */
#define CC2520_GPIO_RESET 1 /* PIN ?, ATP_AON_INT1 (out) */
#define CC2520_GPIO_FIFO 4 /* PIN 4, GPIO4 (in) */
#define CC2520_GPIO_FIFOP 5 /* PIN 5, GPIO5 (in) */
#define CC2520_GPIO_CCA 6 /* PIN 6, GPIO6 (in) */
#define CC2520_GPIO_SFD 29 /* PIN 33, GPIO29 (in) */
#endif /* CONFIG_IEEE802154_CC2520 */
#endif /* __BOARD_H__ */

View File

@@ -14,3 +14,16 @@
#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

View File

@@ -86,5 +86,11 @@
label = "cc2520";
spi-max-frequency = <8000000>;
status = "ok";
vreg-en-gpios = <&gpio0 0 0>;
reset-gpios = <&gpio0 1 0>;
fifo-gpios = <&gpio1 4 0>;
cca-gpios = <&gpio1 6 0>;
sfd-gpios = <&gpio1 29 0>;
fifop-gpios = <&gpio1 5 0>;
};
};

View File

@@ -20,4 +20,33 @@ properties:
description: compatible strings
constraint: "ti,cc2520"
vreg-en-gpios:
type: compound
category: optional
generation: define, use-prop-name
reset-gpios:
type: compound
category: optional
generation: define, use-prop-name
fifo-gpios:
type: compound
category: optional
generation: define, use-prop-name
cca-gpios:
type: compound
category: optional
generation: define, use-prop-name
sfd-gpios:
type: compound
category: optional
generation: define, use-prop-name
fifop-gpios:
type: compound
category: optional
generation: define, use-prop-name
...