Skip to content

Commit ace77c7

Browse files
vaishnavachathcfriedt
authored andcommitted
drivers: CC1XX/CC26XX based boards: transition to pinctrl driver
This commit has the necessary changes to update the consumers of pinmux driver(SPI, I2C, UART) and update the board specific files to use the pinctrl interface. Signed-off-by: Vaishnav Achath <[email protected]>
1 parent e2ed8cf commit ace77c7

16 files changed

+255
-127
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2022 Vaishnav Achath
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h>
8+
9+
&pinctrl {
10+
/* UART0 */
11+
uart0_tx_default: uart0_tx_default {
12+
pinmux = <13 IOC_PORT_MCU_UART0_TX>;
13+
bias-disable;
14+
};
15+
uart0_rx_default: uart0_rx_default {
16+
pinmux = <12 IOC_PORT_MCU_UART0_RX>;
17+
bias-disable;
18+
input-enable;
19+
};
20+
21+
/* I2C0 */
22+
i2c0_scl_default: i2c0_scl_default {
23+
pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>;
24+
bias-pull-up;
25+
drive-open-drain;
26+
input-enable;
27+
};
28+
i2c0_sda_default: i2c0_sda_default {
29+
pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>;
30+
bias-pull-up;
31+
drive-open-drain;
32+
input-enable;
33+
};
34+
i2c0_scl_sleep: i2c0_scl_sleep {
35+
pinmux = <4 IOC_PORT_GPIO>;
36+
bias-disable;
37+
};
38+
i2c0_sda_sleep: i2c0_sda_sleep {
39+
pinmux = <5 IOC_PORT_GPIO>;
40+
bias-disable;
41+
};
42+
43+
/* SPI0 */
44+
spi0_sck_default: spi0_sck_default {
45+
pinmux = <10 IOC_PORT_MCU_SSI0_CLK>;
46+
bias-disable;
47+
};
48+
spi0_mosi_default: spi0_mosi_default {
49+
pinmux = <9 IOC_PORT_MCU_SSI0_TX>;
50+
bias-disable;
51+
};
52+
spi0_miso_default: spi0_miso_default {
53+
pinmux = <8 IOC_PORT_MCU_SSI0_RX>;
54+
bias-disable;
55+
input-enable;
56+
};
57+
spi0_cs_default: spi0_cs_default {
58+
pinmux = <11 IOC_PORT_MCU_SSI0_FSS>;
59+
bias-disable;
60+
};
61+
};

boards/arm/cc1352r1_launchxl/cc1352r1_launchxl.dts

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88

99
#include <ti/cc1352r.dtsi>
1010
#include "boosterpack_connector.dtsi"
11-
12-
/*
13-
* Define some constants from driverlib/ioc.h in TI HAL,
14-
* since we don't have a way to include the file directly.
15-
*/
16-
#define IOC_PORT_MCU_UART0_TX 0x00000010
17-
#define IOC_PORT_MCU_UART0_RX 0x0000000F
11+
#include "cc1352r1_launchxl-pinctrl.dtsi"
1812

1913
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
2014

@@ -92,22 +86,22 @@
9286
&uart0 {
9387
status = "okay";
9488
current-speed = <115200>;
95-
tx-pin = <13 IOC_PORT_MCU_UART0_TX>;
96-
rx-pin = <12 IOC_PORT_MCU_UART0_RX>;
89+
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
90+
pinctrl-names = "default";
9791
};
9892

9993
&i2c0 {
10094
status = "okay";
101-
scl-pin = <4>;
102-
sda-pin = <5>;
95+
pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
96+
pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
97+
pinctrl-names = "default", "sleep";
10398
};
10499

105100
&spi0 {
106101
status = "okay";
107-
sck-pin = <10>;
108-
mosi-pin = <9>;
109-
miso-pin = <8>;
110-
cs-pin = <11>;
102+
pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
103+
&spi0_miso_default &spi0_cs_default>;
104+
pinctrl-names = "default";
111105
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
112106
};
113107

boards/arm/cc1352r1_launchxl/cc1352r1_launchxl_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y
1313
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
1414
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15
1515

16-
CONFIG_PINMUX=y
16+
CONFIG_PINCTRL=y
1717
CONFIG_GPIO=y
1818
CONFIG_SERIAL=y
1919

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2022 Vaishnav Achath
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h>
8+
9+
&pinctrl {
10+
/* UART0 */
11+
uart0_tx_default: uart0_tx_default {
12+
pinmux = <13 IOC_PORT_MCU_UART0_TX>;
13+
bias-disable;
14+
};
15+
uart0_rx_default: uart0_rx_default {
16+
pinmux = <12 IOC_PORT_MCU_UART0_RX>;
17+
bias-disable;
18+
input-enable;
19+
};
20+
21+
/* I2C0 */
22+
i2c0_scl_default: i2c0_scl_default {
23+
pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>;
24+
bias-pull-up;
25+
drive-open-drain;
26+
input-enable;
27+
};
28+
i2c0_sda_default: i2c0_sda_default {
29+
pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>;
30+
bias-pull-up;
31+
drive-open-drain;
32+
input-enable;
33+
};
34+
i2c0_scl_sleep: i2c0_scl_sleep {
35+
pinmux = <4 IOC_PORT_GPIO>;
36+
bias-disable;
37+
};
38+
i2c0_sda_sleep: i2c0_sda_sleep {
39+
pinmux = <5 IOC_PORT_GPIO>;
40+
bias-disable;
41+
};
42+
43+
/* SPI0 */
44+
spi0_sck_default: spi0_sck_default {
45+
pinmux = <10 IOC_PORT_MCU_SSI0_CLK>;
46+
bias-disable;
47+
};
48+
spi0_mosi_default: spi0_mosi_default {
49+
pinmux = <9 IOC_PORT_MCU_SSI0_TX>;
50+
bias-disable;
51+
};
52+
spi0_miso_default: spi0_miso_default {
53+
pinmux = <8 IOC_PORT_MCU_SSI0_RX>;
54+
bias-disable;
55+
input-enable;
56+
};
57+
spi0_cs_default: spi0_cs_default {
58+
pinmux = <11 IOC_PORT_MCU_SSI0_FSS>;
59+
bias-disable;
60+
};
61+
};

boards/arm/cc1352r_sensortag/cc1352r_sensortag.dts

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,7 @@
99

1010
#include <ti/cc1352r.dtsi>
1111
#include "../cc1352r1_launchxl/boosterpack_connector.dtsi"
12-
13-
/*
14-
* Define some constants from driverlib/ioc.h in TI HAL,
15-
* since we don't have a way to include the file directly.
16-
*/
17-
#define IOC_PORT_MCU_UART0_TX 0x00000010
18-
#define IOC_PORT_MCU_UART0_RX 0x0000000F
12+
#include "cc1352r_sensortag-pinctrl.dtsi"
1913

2014
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
2115

@@ -101,14 +95,15 @@
10195
&uart0 {
10296
status = "okay";
10397
current-speed = <115200>;
104-
tx-pin = <13 IOC_PORT_MCU_UART0_TX>;
105-
rx-pin = <12 IOC_PORT_MCU_UART0_RX>;
98+
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
99+
pinctrl-names = "default";
106100
};
107101

108102
&i2c0 {
109103
status = "okay";
110-
scl-pin = <4>;
111-
sda-pin = <5>;
104+
pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
105+
pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
106+
pinctrl-names = "default", "sleep";
112107

113108
sensor0: sensor@44 {
114109
compatible = "ti,opt3001";
@@ -126,9 +121,9 @@
126121

127122
&spi0 {
128123
status = "okay";
129-
sck-pin = <10>;
130-
mosi-pin = <9>;
131-
miso-pin = <8>;
124+
pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
125+
&spi0_miso_default>;
126+
pinctrl-names = "default";
132127
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
133128

134129
sensor1: sensor@0 {

boards/arm/cc1352r_sensortag/cc1352r_sensortag_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y
1313
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
1414
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15
1515

16-
CONFIG_PINMUX=y
16+
CONFIG_PINCTRL=y
1717
CONFIG_GPIO=y
1818
CONFIG_SERIAL=y
1919

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* Copyright (c) 2022 Vaishnav Achath
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h>
8+
9+
&pinctrl {
10+
/* UART0 */
11+
uart0_tx_default: uart0_tx_default {
12+
pinmux = <3 IOC_PORT_MCU_UART0_TX>;
13+
bias-disable;
14+
};
15+
uart0_rx_default: uart0_rx_default {
16+
pinmux = <2 IOC_PORT_MCU_UART0_RX>;
17+
bias-disable;
18+
input-enable;
19+
};
20+
21+
/* I2C0 */
22+
i2c0_scl_default: i2c0_scl_default {
23+
pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>;
24+
bias-pull-up;
25+
drive-open-drain;
26+
input-enable;
27+
};
28+
i2c0_sda_default: i2c0_sda_default {
29+
pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>;
30+
bias-pull-up;
31+
drive-open-drain;
32+
input-enable;
33+
};
34+
i2c0_scl_sleep: i2c0_scl_sleep {
35+
pinmux = <4 IOC_PORT_GPIO>;
36+
bias-disable;
37+
};
38+
i2c0_sda_sleep: i2c0_sda_sleep {
39+
pinmux = <5 IOC_PORT_GPIO>;
40+
bias-disable;
41+
};
42+
43+
/* SPI0 */
44+
spi0_sck_default: spi0_sck_default {
45+
pinmux = <10 IOC_PORT_MCU_SSI0_CLK>;
46+
bias-disable;
47+
};
48+
spi0_mosi_default: spi0_mosi_default {
49+
pinmux = <9 IOC_PORT_MCU_SSI0_TX>;
50+
bias-disable;
51+
};
52+
spi0_miso_default: spi0_miso_default {
53+
pinmux = <8 IOC_PORT_MCU_SSI0_RX>;
54+
bias-disable;
55+
input-enable;
56+
};
57+
spi0_cs_default: spi0_cs_default {
58+
pinmux = <11 IOC_PORT_MCU_SSI0_FSS>;
59+
bias-disable;
60+
};
61+
};

boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl.dts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,7 @@
88

99
#include <ti/cc2652r.dtsi>
1010
#include "boosterpack_connector.dtsi"
11-
12-
/*
13-
* Define some constants from driverlib/ioc.h in TI HAL,
14-
* since we don't have a way to include the file directly.
15-
*/
16-
#define IOC_PORT_MCU_UART0_TX 0x00000010
17-
#define IOC_PORT_MCU_UART0_RX 0x0000000F
11+
#include "cc26x2r1_launchxl-pinctrl.dtsi"
1812

1913
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
2014

@@ -92,22 +86,23 @@
9286
&uart0 {
9387
status = "okay";
9488
current-speed = <115200>;
95-
tx-pin = <3 IOC_PORT_MCU_UART0_TX>;
96-
rx-pin = <2 IOC_PORT_MCU_UART0_RX>;
89+
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
90+
pinctrl-names = "default";
9791
};
9892

9993
&i2c0 {
10094
status = "okay";
101-
scl-pin = <4>;
102-
sda-pin = <5>;
95+
pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
96+
pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
97+
pinctrl-names = "default", "sleep";
10398
};
10499

105100
&spi0 {
106101
status = "okay";
107-
sck-pin = <10>;
108-
mosi-pin = <9>;
109-
miso-pin = <8>;
110-
cs-pin = <11>;
102+
pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
103+
&spi0_miso_default &spi0_cs_default>;
104+
pinctrl-names = "default";
105+
111106
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
112107
};
113108

boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl_defconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y
1313
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
1414
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=13
1515

16-
CONFIG_PINMUX=y
16+
CONFIG_PINCTRL=y
1717
CONFIG_GPIO=y
1818
CONFIG_SERIAL=y
1919

0 commit comments

Comments
 (0)