diff --git a/boards/arm/cc1352r1_launchxl/cc1352r1_launchxl.dts b/boards/arm/cc1352r1_launchxl/cc1352r1_launchxl.dts index b1a53115c70..510fe9cd098 100644 --- a/boards/arm/cc1352r1_launchxl/cc1352r1_launchxl.dts +++ b/boards/arm/cc1352r1_launchxl/cc1352r1_launchxl.dts @@ -9,6 +9,13 @@ #include #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 { diff --git a/boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl.dts b/boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl.dts index 21ee3683fd4..5d996275d29 100644 --- a/boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl.dts +++ b/boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl.dts @@ -9,6 +9,13 @@ #include #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 { diff --git a/drivers/serial/uart_cc13xx_cc26xx.c b/drivers/serial/uart_cc13xx_cc26xx.c index 8c29cecce63..5b9736bbf5f 100644 --- a/drivers/serial/uart_cc13xx_cc26xx.c +++ b/drivers/serial/uart_cc13xx_cc26xx.c @@ -19,6 +19,11 @@ #include #include +#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, diff --git a/dts/bindings/serial/ti,cc13xx-cc26xx-uart.yaml b/dts/bindings/serial/ti,cc13xx-cc26xx-uart.yaml index e5a04eb35cf..c6f4ad5fb59 100644 --- a/dts/bindings/serial/ti,cc13xx-cc26xx-uart.yaml +++ b/dts/bindings/serial/ti,cc13xx-cc26xx-uart.yaml @@ -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