dts: bindings: cc13xx-cc26xx: add port info for uart tx and rx pins

Adding port information for uart tx and rx pins in dts, so that it can
be more systematically retrieved in the uart driver.

Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
This commit is contained in:
Vincent Wan 2020-04-16 11:33:22 -07:00 committed by Kumar Gala
commit 984988285b
4 changed files with 33 additions and 14 deletions

View file

@ -9,6 +9,13 @@
#include <ti/cc1352r.dtsi>
#include "boosterpack_connector.dtsi"
/*
* Define some constants from driverlib/ioc.h in TI HAL,
* since we don't have a way to include the file directly.
*/
#define IOC_PORT_MCU_UART0_TX 0x00000010
#define IOC_PORT_MCU_UART0_RX 0x0000000F
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
/ {
@ -69,8 +76,8 @@
&uart0 {
status = "okay";
current-speed = <115200>;
tx-pin = <13>;
rx-pin = <12>;
tx-pin = <13 IOC_PORT_MCU_UART0_TX>;
rx-pin = <12 IOC_PORT_MCU_UART0_RX>;
};
&i2c0 {

View file

@ -9,6 +9,13 @@
#include <ti/cc2652r.dtsi>
#include "boosterpack_connector.dtsi"
/*
* Define some constants from driverlib/ioc.h in TI HAL,
* since we don't have a way to include the file directly.
*/
#define IOC_PORT_MCU_UART0_TX 0x00000010
#define IOC_PORT_MCU_UART0_RX 0x0000000F
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
/ {
@ -69,8 +76,8 @@
&uart0 {
status = "okay";
current-speed = <115200>;
tx-pin = <3>;
rx-pin = <2>;
tx-pin = <3 IOC_PORT_MCU_UART0_TX>;
rx-pin = <2 IOC_PORT_MCU_UART0_RX>;
};
&i2c0 {

View file

@ -19,6 +19,11 @@
#include <ti/drivers/Power.h>
#include <ti/drivers/power/PowerCC26X2.h>
#define GET_PIN(n, pin_name) \
DT_INST_PROP_BY_IDX(n, pin_name, 0)
#define GET_PORT(n, pin_name) \
DT_INST_PROP_BY_IDX(n, pin_name, 1)
struct uart_cc13xx_cc26xx_data {
struct uart_config uart_config;
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
@ -534,10 +539,10 @@ static int uart_cc13xx_cc26xx_init_0(struct device *dev)
}
#endif
/* Configure IOC module to map UART signals to pins */
IOCPortConfigureSet(DT_PROP(DT_NODELABEL(uart0), tx_pin),
IOC_PORT_MCU_UART0_TX, IOC_STD_OUTPUT);
IOCPortConfigureSet(DT_PROP(DT_NODELABEL(uart0), rx_pin),
IOC_PORT_MCU_UART0_RX, IOC_STD_INPUT);
IOCPortConfigureSet(GET_PIN(0, tx_pin), GET_PORT(0, tx_pin),
IOC_STD_OUTPUT);
IOCPortConfigureSet(GET_PIN(0, rx_pin), GET_PORT(0, rx_pin),
IOC_STD_INPUT);
/* Configure and enable UART */
ret = uart_cc13xx_cc26xx_configure(dev,
@ -637,10 +642,10 @@ static int uart_cc13xx_cc26xx_init_1(struct device *dev)
#endif
/* Configure IOC module to map UART signals to pins */
IOCPortConfigureSet(DT_PROP(DT_NODELABEL(uart1), tx_pin),
IOC_PORT_MCU_UART1_TX, IOC_STD_OUTPUT);
IOCPortConfigureSet(DT_PROP(DT_NODELABEL(uart1), rx_pin),
IOC_PORT_MCU_UART1_RX, IOC_STD_INPUT);
IOCPortConfigureSet(GET_PIN(1, tx_pin), GET_PORT(1, tx_pin),
IOC_STD_OUTPUT);
IOCPortConfigureSet(GET_PIN(1, rx_pin), GET_PORT(1, rx_pin),
IOC_STD_INPUT);
/* Configure and enable UART */
ret = uart_cc13xx_cc26xx_configure(dev,

View file

@ -15,11 +15,11 @@ properties:
required: true
tx-pin:
type: int
type: array
required: true
description: TX pin
rx-pin:
type: int
type: array
required: true
description: RX pin