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 <vaishnav@beagleboard.org>
This commit is contained in:
parent
e2ed8cf130
commit
ace77c71e9
16 changed files with 255 additions and 127 deletions
61
boards/arm/cc1352r1_launchxl/cc1352r1_launchxl-pinctrl.dtsi
Normal file
61
boards/arm/cc1352r1_launchxl/cc1352r1_launchxl-pinctrl.dtsi
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Vaishnav Achath
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h>
|
||||||
|
|
||||||
|
&pinctrl {
|
||||||
|
/* UART0 */
|
||||||
|
uart0_tx_default: uart0_tx_default {
|
||||||
|
pinmux = <13 IOC_PORT_MCU_UART0_TX>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
uart0_rx_default: uart0_rx_default {
|
||||||
|
pinmux = <12 IOC_PORT_MCU_UART0_RX>;
|
||||||
|
bias-disable;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* I2C0 */
|
||||||
|
i2c0_scl_default: i2c0_scl_default {
|
||||||
|
pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>;
|
||||||
|
bias-pull-up;
|
||||||
|
drive-open-drain;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
i2c0_sda_default: i2c0_sda_default {
|
||||||
|
pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>;
|
||||||
|
bias-pull-up;
|
||||||
|
drive-open-drain;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
i2c0_scl_sleep: i2c0_scl_sleep {
|
||||||
|
pinmux = <4 IOC_PORT_GPIO>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
i2c0_sda_sleep: i2c0_sda_sleep {
|
||||||
|
pinmux = <5 IOC_PORT_GPIO>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* SPI0 */
|
||||||
|
spi0_sck_default: spi0_sck_default {
|
||||||
|
pinmux = <10 IOC_PORT_MCU_SSI0_CLK>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
spi0_mosi_default: spi0_mosi_default {
|
||||||
|
pinmux = <9 IOC_PORT_MCU_SSI0_TX>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
spi0_miso_default: spi0_miso_default {
|
||||||
|
pinmux = <8 IOC_PORT_MCU_SSI0_RX>;
|
||||||
|
bias-disable;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
spi0_cs_default: spi0_cs_default {
|
||||||
|
pinmux = <11 IOC_PORT_MCU_SSI0_FSS>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
};
|
|
@ -8,13 +8,7 @@
|
||||||
|
|
||||||
#include <ti/cc1352r.dtsi>
|
#include <ti/cc1352r.dtsi>
|
||||||
#include "boosterpack_connector.dtsi"
|
#include "boosterpack_connector.dtsi"
|
||||||
|
#include "cc1352r1_launchxl-pinctrl.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)
|
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
|
||||||
|
|
||||||
|
@ -92,22 +86,22 @@
|
||||||
&uart0 {
|
&uart0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <13 IOC_PORT_MCU_UART0_TX>;
|
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
|
||||||
rx-pin = <12 IOC_PORT_MCU_UART0_RX>;
|
pinctrl-names = "default";
|
||||||
};
|
};
|
||||||
|
|
||||||
&i2c0 {
|
&i2c0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
scl-pin = <4>;
|
pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
|
||||||
sda-pin = <5>;
|
pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
|
||||||
|
pinctrl-names = "default", "sleep";
|
||||||
};
|
};
|
||||||
|
|
||||||
&spi0 {
|
&spi0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
sck-pin = <10>;
|
pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
|
||||||
mosi-pin = <9>;
|
&spi0_miso_default &spi0_cs_default>;
|
||||||
miso-pin = <8>;
|
pinctrl-names = "default";
|
||||||
cs-pin = <11>;
|
|
||||||
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y
|
||||||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
|
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
|
||||||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15
|
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15
|
||||||
|
|
||||||
CONFIG_PINMUX=y
|
CONFIG_PINCTRL=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
||||||
|
|
61
boards/arm/cc1352r_sensortag/cc1352r_sensortag-pinctrl.dtsi
Normal file
61
boards/arm/cc1352r_sensortag/cc1352r_sensortag-pinctrl.dtsi
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Vaishnav Achath
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h>
|
||||||
|
|
||||||
|
&pinctrl {
|
||||||
|
/* UART0 */
|
||||||
|
uart0_tx_default: uart0_tx_default {
|
||||||
|
pinmux = <13 IOC_PORT_MCU_UART0_TX>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
uart0_rx_default: uart0_rx_default {
|
||||||
|
pinmux = <12 IOC_PORT_MCU_UART0_RX>;
|
||||||
|
bias-disable;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* I2C0 */
|
||||||
|
i2c0_scl_default: i2c0_scl_default {
|
||||||
|
pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>;
|
||||||
|
bias-pull-up;
|
||||||
|
drive-open-drain;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
i2c0_sda_default: i2c0_sda_default {
|
||||||
|
pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>;
|
||||||
|
bias-pull-up;
|
||||||
|
drive-open-drain;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
i2c0_scl_sleep: i2c0_scl_sleep {
|
||||||
|
pinmux = <4 IOC_PORT_GPIO>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
i2c0_sda_sleep: i2c0_sda_sleep {
|
||||||
|
pinmux = <5 IOC_PORT_GPIO>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* SPI0 */
|
||||||
|
spi0_sck_default: spi0_sck_default {
|
||||||
|
pinmux = <10 IOC_PORT_MCU_SSI0_CLK>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
spi0_mosi_default: spi0_mosi_default {
|
||||||
|
pinmux = <9 IOC_PORT_MCU_SSI0_TX>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
spi0_miso_default: spi0_miso_default {
|
||||||
|
pinmux = <8 IOC_PORT_MCU_SSI0_RX>;
|
||||||
|
bias-disable;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
spi0_cs_default: spi0_cs_default {
|
||||||
|
pinmux = <11 IOC_PORT_MCU_SSI0_FSS>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
};
|
|
@ -9,13 +9,7 @@
|
||||||
|
|
||||||
#include <ti/cc1352r.dtsi>
|
#include <ti/cc1352r.dtsi>
|
||||||
#include "../cc1352r1_launchxl/boosterpack_connector.dtsi"
|
#include "../cc1352r1_launchxl/boosterpack_connector.dtsi"
|
||||||
|
#include "cc1352r_sensortag-pinctrl.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)
|
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
|
||||||
|
|
||||||
|
@ -101,14 +95,15 @@
|
||||||
&uart0 {
|
&uart0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <13 IOC_PORT_MCU_UART0_TX>;
|
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
|
||||||
rx-pin = <12 IOC_PORT_MCU_UART0_RX>;
|
pinctrl-names = "default";
|
||||||
};
|
};
|
||||||
|
|
||||||
&i2c0 {
|
&i2c0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
scl-pin = <4>;
|
pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
|
||||||
sda-pin = <5>;
|
pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
|
||||||
|
pinctrl-names = "default", "sleep";
|
||||||
|
|
||||||
sensor0: sensor@44 {
|
sensor0: sensor@44 {
|
||||||
compatible = "ti,opt3001";
|
compatible = "ti,opt3001";
|
||||||
|
@ -126,9 +121,9 @@
|
||||||
|
|
||||||
&spi0 {
|
&spi0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
sck-pin = <10>;
|
pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
|
||||||
mosi-pin = <9>;
|
&spi0_miso_default>;
|
||||||
miso-pin = <8>;
|
pinctrl-names = "default";
|
||||||
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
||||||
|
|
||||||
sensor1: sensor@0 {
|
sensor1: sensor@0 {
|
||||||
|
|
|
@ -13,7 +13,7 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y
|
||||||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
|
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
|
||||||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15
|
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=15
|
||||||
|
|
||||||
CONFIG_PINMUX=y
|
CONFIG_PINCTRL=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
||||||
|
|
61
boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl-pinctrl.dtsi
Normal file
61
boards/arm/cc26x2r1_launchxl/cc26x2r1_launchxl-pinctrl.dtsi
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022 Vaishnav Achath
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/pinctrl/cc13xx_cc26xx-pinctrl.h>
|
||||||
|
|
||||||
|
&pinctrl {
|
||||||
|
/* UART0 */
|
||||||
|
uart0_tx_default: uart0_tx_default {
|
||||||
|
pinmux = <3 IOC_PORT_MCU_UART0_TX>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
uart0_rx_default: uart0_rx_default {
|
||||||
|
pinmux = <2 IOC_PORT_MCU_UART0_RX>;
|
||||||
|
bias-disable;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* I2C0 */
|
||||||
|
i2c0_scl_default: i2c0_scl_default {
|
||||||
|
pinmux = <4 IOC_PORT_MCU_I2C_MSSCL>;
|
||||||
|
bias-pull-up;
|
||||||
|
drive-open-drain;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
i2c0_sda_default: i2c0_sda_default {
|
||||||
|
pinmux = <5 IOC_PORT_MCU_I2C_MSSDA>;
|
||||||
|
bias-pull-up;
|
||||||
|
drive-open-drain;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
i2c0_scl_sleep: i2c0_scl_sleep {
|
||||||
|
pinmux = <4 IOC_PORT_GPIO>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
i2c0_sda_sleep: i2c0_sda_sleep {
|
||||||
|
pinmux = <5 IOC_PORT_GPIO>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* SPI0 */
|
||||||
|
spi0_sck_default: spi0_sck_default {
|
||||||
|
pinmux = <10 IOC_PORT_MCU_SSI0_CLK>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
spi0_mosi_default: spi0_mosi_default {
|
||||||
|
pinmux = <9 IOC_PORT_MCU_SSI0_TX>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
spi0_miso_default: spi0_miso_default {
|
||||||
|
pinmux = <8 IOC_PORT_MCU_SSI0_RX>;
|
||||||
|
bias-disable;
|
||||||
|
input-enable;
|
||||||
|
};
|
||||||
|
spi0_cs_default: spi0_cs_default {
|
||||||
|
pinmux = <11 IOC_PORT_MCU_SSI0_FSS>;
|
||||||
|
bias-disable;
|
||||||
|
};
|
||||||
|
};
|
|
@ -8,13 +8,7 @@
|
||||||
|
|
||||||
#include <ti/cc2652r.dtsi>
|
#include <ti/cc2652r.dtsi>
|
||||||
#include "boosterpack_connector.dtsi"
|
#include "boosterpack_connector.dtsi"
|
||||||
|
#include "cc26x2r1_launchxl-pinctrl.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)
|
#define BTN_GPIO_FLAGS (GPIO_ACTIVE_LOW | GPIO_PULL_UP)
|
||||||
|
|
||||||
|
@ -92,22 +86,23 @@
|
||||||
&uart0 {
|
&uart0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
current-speed = <115200>;
|
current-speed = <115200>;
|
||||||
tx-pin = <3 IOC_PORT_MCU_UART0_TX>;
|
pinctrl-0 = <&uart0_rx_default &uart0_tx_default>;
|
||||||
rx-pin = <2 IOC_PORT_MCU_UART0_RX>;
|
pinctrl-names = "default";
|
||||||
};
|
};
|
||||||
|
|
||||||
&i2c0 {
|
&i2c0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
scl-pin = <4>;
|
pinctrl-0 = <&i2c0_scl_default &i2c0_sda_default>;
|
||||||
sda-pin = <5>;
|
pinctrl-1 = <&i2c0_scl_sleep &i2c0_sda_sleep>;
|
||||||
|
pinctrl-names = "default", "sleep";
|
||||||
};
|
};
|
||||||
|
|
||||||
&spi0 {
|
&spi0 {
|
||||||
status = "okay";
|
status = "okay";
|
||||||
sck-pin = <10>;
|
pinctrl-0 = <&spi0_sck_default &spi0_mosi_default
|
||||||
mosi-pin = <9>;
|
&spi0_miso_default &spi0_cs_default>;
|
||||||
miso-pin = <8>;
|
pinctrl-names = "default";
|
||||||
cs-pin = <11>;
|
|
||||||
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
cs-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ CONFIG_CC13X2_CC26X2_BOOTLOADER_ENABLE=y
|
||||||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
|
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_ENABLE=y
|
||||||
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=13
|
CONFIG_CC13X2_CC26X2_BOOTLOADER_BACKDOOR_PIN=13
|
||||||
|
|
||||||
CONFIG_PINMUX=y
|
CONFIG_PINCTRL=y
|
||||||
CONFIG_GPIO=y
|
CONFIG_GPIO=y
|
||||||
CONFIG_SERIAL=y
|
CONFIG_SERIAL=y
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
#include <kernel.h>
|
#include <kernel.h>
|
||||||
#include <drivers/i2c.h>
|
#include <drivers/i2c.h>
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
#include <pm/device.h>
|
#include <pm/device.h>
|
||||||
#include <pm/policy.h>
|
#include <pm/policy.h>
|
||||||
|
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
LOG_MODULE_REGISTER(i2c_cc13xx_cc26xx);
|
LOG_MODULE_REGISTER(i2c_cc13xx_cc26xx);
|
||||||
|
|
||||||
#include <driverlib/i2c.h>
|
#include <driverlib/i2c.h>
|
||||||
#include <driverlib/ioc.h>
|
|
||||||
#include <driverlib/prcm.h>
|
#include <driverlib/prcm.h>
|
||||||
|
|
||||||
#include <ti/drivers/Power.h>
|
#include <ti/drivers/Power.h>
|
||||||
|
@ -36,8 +36,7 @@ struct i2c_cc13xx_cc26xx_data {
|
||||||
|
|
||||||
struct i2c_cc13xx_cc26xx_config {
|
struct i2c_cc13xx_cc26xx_config {
|
||||||
uint32_t base;
|
uint32_t base;
|
||||||
uint32_t scl_pin;
|
const struct pinctrl_dev_config *pcfg;
|
||||||
uint32_t sda_pin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int i2c_cc13xx_cc26xx_transmit(const struct device *dev,
|
static int i2c_cc13xx_cc26xx_transmit(const struct device *dev,
|
||||||
|
@ -330,7 +329,10 @@ static int i2c_cc13xx_cc26xx_pm_action(const struct device *dev,
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case PM_DEVICE_ACTION_RESUME:
|
case PM_DEVICE_ACTION_RESUME:
|
||||||
Power_setDependency(PowerCC26XX_PERIPH_I2C0);
|
Power_setDependency(PowerCC26XX_PERIPH_I2C0);
|
||||||
IOCPinTypeI2c(config->base, config->sda_pin, config->scl_pin);
|
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
|
||||||
|
if (ret < 0) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
ret = i2c_cc13xx_cc26xx_configure(dev, data->dev_config);
|
ret = i2c_cc13xx_cc26xx_configure(dev, data->dev_config);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
I2CMasterIntEnable(config->base);
|
I2CMasterIntEnable(config->base);
|
||||||
|
@ -340,10 +342,10 @@ static int i2c_cc13xx_cc26xx_pm_action(const struct device *dev,
|
||||||
I2CMasterIntDisable(config->base);
|
I2CMasterIntDisable(config->base);
|
||||||
I2CMasterDisable(config->base);
|
I2CMasterDisable(config->base);
|
||||||
/* Reset pin type to default GPIO configuration */
|
/* Reset pin type to default GPIO configuration */
|
||||||
IOCPortConfigureSet(config->scl_pin,
|
ret = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_SLEEP);
|
||||||
IOC_PORT_GPIO, IOC_STD_OUTPUT);
|
if (ret < 0) {
|
||||||
IOCPortConfigureSet(config->sda_pin,
|
return ret;
|
||||||
IOC_PORT_GPIO, IOC_STD_OUTPUT);
|
}
|
||||||
Power_releaseDependency(PowerCC26XX_PERIPH_I2C0);
|
Power_releaseDependency(PowerCC26XX_PERIPH_I2C0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -398,8 +400,11 @@ static int i2c_cc13xx_cc26xx_init(const struct device *dev)
|
||||||
i2c_cc13xx_cc26xx_isr, DEVICE_DT_INST_GET(0), 0);
|
i2c_cc13xx_cc26xx_isr, DEVICE_DT_INST_GET(0), 0);
|
||||||
irq_enable(DT_INST_IRQN(0));
|
irq_enable(DT_INST_IRQN(0));
|
||||||
|
|
||||||
/* Configure IOC module to route SDA and SCL signals */
|
err = pinctrl_apply_state(config->pcfg, PINCTRL_STATE_DEFAULT);
|
||||||
IOCPinTypeI2c(config->base, config->sda_pin, config->scl_pin);
|
if (err < 0) {
|
||||||
|
LOG_ERR("Failed to configure pinctrl state");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
cfg = i2c_map_dt_bitrate(DT_INST_PROP(0, clock_frequency));
|
cfg = i2c_map_dt_bitrate(DT_INST_PROP(0, clock_frequency));
|
||||||
err = i2c_cc13xx_cc26xx_configure(dev, cfg | I2C_MODE_MASTER);
|
err = i2c_cc13xx_cc26xx_configure(dev, cfg | I2C_MODE_MASTER);
|
||||||
|
@ -418,10 +423,11 @@ static const struct i2c_driver_api i2c_cc13xx_cc26xx_driver_api = {
|
||||||
.transfer = i2c_cc13xx_cc26xx_transfer
|
.transfer = i2c_cc13xx_cc26xx_transfer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PINCTRL_DT_INST_DEFINE(0);
|
||||||
|
|
||||||
static const struct i2c_cc13xx_cc26xx_config i2c_cc13xx_cc26xx_config = {
|
static const struct i2c_cc13xx_cc26xx_config i2c_cc13xx_cc26xx_config = {
|
||||||
.base = DT_INST_REG_ADDR(0),
|
.base = DT_INST_REG_ADDR(0),
|
||||||
.sda_pin = DT_INST_PROP(0, sda_pin),
|
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
|
||||||
.scl_pin = DT_INST_PROP(0, scl_pin)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct i2c_cc13xx_cc26xx_data i2c_cc13xx_cc26xx_data = {
|
static struct i2c_cc13xx_cc26xx_data i2c_cc13xx_cc26xx_data = {
|
||||||
|
|
|
@ -12,19 +12,14 @@
|
||||||
#include <pm/device.h>
|
#include <pm/device.h>
|
||||||
#include <pm/policy.h>
|
#include <pm/policy.h>
|
||||||
#include <drivers/uart.h>
|
#include <drivers/uart.h>
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
|
|
||||||
#include <driverlib/ioc.h>
|
|
||||||
#include <driverlib/prcm.h>
|
#include <driverlib/prcm.h>
|
||||||
#include <driverlib/uart.h>
|
#include <driverlib/uart.h>
|
||||||
|
|
||||||
#include <ti/drivers/Power.h>
|
#include <ti/drivers/Power.h>
|
||||||
#include <ti/drivers/power/PowerCC26X2.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_config {
|
struct uart_cc13xx_cc26xx_config {
|
||||||
uint32_t reg;
|
uint32_t reg;
|
||||||
uint32_t sys_clk_freq;
|
uint32_t sys_clk_freq;
|
||||||
|
@ -32,6 +27,7 @@ struct uart_cc13xx_cc26xx_config {
|
||||||
|
|
||||||
struct uart_cc13xx_cc26xx_data {
|
struct uart_cc13xx_cc26xx_data {
|
||||||
struct uart_config uart_config;
|
struct uart_config uart_config;
|
||||||
|
const struct pinctrl_dev_config *pcfg;
|
||||||
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
#ifdef CONFIG_UART_INTERRUPT_DRIVEN
|
||||||
uart_irq_callback_user_data_t callback;
|
uart_irq_callback_user_data_t callback;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
|
@ -597,11 +593,10 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = {
|
||||||
\
|
\
|
||||||
UART_CC13XX_CC26XX_POWER_UART(n); \
|
UART_CC13XX_CC26XX_POWER_UART(n); \
|
||||||
\
|
\
|
||||||
/* Configure IOC module to map UART signals to pins */ \
|
ret = pinctrl_apply_state(data->pcfg, PINCTRL_STATE_DEFAULT); \
|
||||||
IOCPortConfigureSet(GET_PIN(n, tx_pin), GET_PORT(n, tx_pin),\
|
if (ret < 0) { \
|
||||||
IOC_STD_OUTPUT); \
|
return ret; \
|
||||||
IOCPortConfigureSet(GET_PIN(n, rx_pin), GET_PORT(n, rx_pin),\
|
} \
|
||||||
IOC_STD_INPUT); \
|
|
||||||
\
|
\
|
||||||
/* Configure and enable UART */ \
|
/* Configure and enable UART */ \
|
||||||
ret = uart_cc13xx_cc26xx_configure(dev, &data->uart_config);\
|
ret = uart_cc13xx_cc26xx_configure(dev, &data->uart_config);\
|
||||||
|
@ -614,6 +609,7 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = {
|
||||||
|
|
||||||
|
|
||||||
#define UART_CC13XX_CC26XX_INIT(n) \
|
#define UART_CC13XX_CC26XX_INIT(n) \
|
||||||
|
PINCTRL_DT_INST_DEFINE(n); \
|
||||||
UART_CC13XX_CC26XX_INIT_FUNC(n); \
|
UART_CC13XX_CC26XX_INIT_FUNC(n); \
|
||||||
\
|
\
|
||||||
static const struct uart_cc13xx_cc26xx_config \
|
static const struct uart_cc13xx_cc26xx_config \
|
||||||
|
@ -632,6 +628,7 @@ static const struct uart_driver_api uart_cc13xx_cc26xx_driver_api = {
|
||||||
.data_bits = UART_CFG_DATA_BITS_8, \
|
.data_bits = UART_CFG_DATA_BITS_8, \
|
||||||
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE, \
|
.flow_ctrl = UART_CFG_FLOW_CTRL_NONE, \
|
||||||
}, \
|
}, \
|
||||||
|
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||||
UART_CC13XX_CC26XX_INT_FIELDS \
|
UART_CC13XX_CC26XX_INT_FIELDS \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
LOG_MODULE_REGISTER(spi_cc13xx_cc26xx);
|
LOG_MODULE_REGISTER(spi_cc13xx_cc26xx);
|
||||||
|
|
||||||
#include <drivers/spi.h>
|
#include <drivers/spi.h>
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
#include <pm/device.h>
|
#include <pm/device.h>
|
||||||
#include <pm/policy.h>
|
#include <pm/policy.h>
|
||||||
|
|
||||||
#include <driverlib/prcm.h>
|
#include <driverlib/prcm.h>
|
||||||
#include <driverlib/ssi.h>
|
#include <driverlib/ssi.h>
|
||||||
#include <driverlib/ioc.h>
|
|
||||||
|
|
||||||
#include <ti/drivers/Power.h>
|
#include <ti/drivers/Power.h>
|
||||||
#include <ti/drivers/power/PowerCC26X2.h>
|
#include <ti/drivers/power/PowerCC26X2.h>
|
||||||
|
@ -25,10 +25,7 @@ LOG_MODULE_REGISTER(spi_cc13xx_cc26xx);
|
||||||
|
|
||||||
struct spi_cc13xx_cc26xx_config {
|
struct spi_cc13xx_cc26xx_config {
|
||||||
uint32_t base;
|
uint32_t base;
|
||||||
uint32_t sck_pin;
|
const struct pinctrl_dev_config *pcfg;
|
||||||
uint32_t mosi_pin;
|
|
||||||
uint32_t miso_pin;
|
|
||||||
uint32_t cs_pin;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct spi_cc13xx_cc26xx_data {
|
struct spi_cc13xx_cc26xx_data {
|
||||||
|
@ -44,6 +41,7 @@ static int spi_cc13xx_cc26xx_configure(const struct device *dev,
|
||||||
struct spi_cc13xx_cc26xx_data *data = dev->data;
|
struct spi_cc13xx_cc26xx_data *data = dev->data;
|
||||||
struct spi_context *ctx = &data->ctx;
|
struct spi_context *ctx = &data->ctx;
|
||||||
uint32_t prot;
|
uint32_t prot;
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (spi_context_configured(ctx, config)) {
|
if (spi_context_configured(ctx, config)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -106,8 +104,11 @@ static int spi_cc13xx_cc26xx_configure(const struct device *dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IOCPinTypeSsiMaster(cfg->base, cfg->miso_pin, cfg->mosi_pin,
|
ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||||
cfg->cs_pin, cfg->sck_pin);
|
if (ret < 0) {
|
||||||
|
LOG_ERR("applying SPI pinctrl state failed");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ctx->config = config;
|
ctx->config = config;
|
||||||
|
|
||||||
|
@ -311,16 +312,13 @@ static const struct spi_driver_api spi_cc13xx_cc26xx_driver_api = {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SPI_CC13XX_CC26XX_INIT(n) \
|
#define SPI_CC13XX_CC26XX_INIT(n) \
|
||||||
|
PINCTRL_DT_INST_DEFINE(n); \
|
||||||
SPI_CC13XX_CC26XX_INIT_FUNC(n) \
|
SPI_CC13XX_CC26XX_INIT_FUNC(n) \
|
||||||
\
|
\
|
||||||
static const struct spi_cc13xx_cc26xx_config \
|
static const struct spi_cc13xx_cc26xx_config \
|
||||||
spi_cc13xx_cc26xx_config_##n = { \
|
spi_cc13xx_cc26xx_config_##n = { \
|
||||||
.base = DT_INST_REG_ADDR(n), \
|
.base = DT_INST_REG_ADDR(n), \
|
||||||
.sck_pin = DT_INST_PROP(n, sck_pin), \
|
.pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n) \
|
||||||
.mosi_pin = DT_INST_PROP(n, mosi_pin), \
|
|
||||||
.miso_pin = DT_INST_PROP(n, miso_pin), \
|
|
||||||
.cs_pin = COND_CODE_1(DT_INST_NODE_HAS_PROP(n, cs_pin), \
|
|
||||||
(DT_INST_PROP(n, cs_pin)), (IOID_UNUSED)) \
|
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
static struct spi_cc13xx_cc26xx_data \
|
static struct spi_cc13xx_cc26xx_data \
|
||||||
|
|
|
@ -46,8 +46,8 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
soc {
|
soc {
|
||||||
pinmux: pinmux@40081000 {
|
pinctrl: pinctrl@40081000 {
|
||||||
compatible = "ti,cc13xx-cc26xx-pinmux";
|
compatible = "ti,cc13xx-cc26xx-pinctrl";
|
||||||
reg = <0x40081000 0x1000>;
|
reg = <0x40081000 0x1000>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: TI CC13xx / CC26xx I2C node
|
||||||
|
|
||||||
compatible: "ti,cc13xx-cc26xx-i2c"
|
compatible: "ti,cc13xx-cc26xx-i2c"
|
||||||
|
|
||||||
include: i2c-controller.yaml
|
include: [i2c-controller.yaml, pinctrl-device.yaml, base.yaml]
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
reg:
|
reg:
|
||||||
|
@ -13,13 +13,3 @@ properties:
|
||||||
|
|
||||||
interrupts:
|
interrupts:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
sda-pin:
|
|
||||||
type: int
|
|
||||||
required: true
|
|
||||||
description: SDA pin
|
|
||||||
|
|
||||||
scl-pin:
|
|
||||||
type: int
|
|
||||||
required: true
|
|
||||||
description: SCL pin
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: TI SimpleLink CC13xx / CC26xx UART node
|
||||||
|
|
||||||
compatible: "ti,cc13xx-cc26xx-uart"
|
compatible: "ti,cc13xx-cc26xx-uart"
|
||||||
|
|
||||||
include: uart-controller.yaml
|
include: [uart-controller.yaml, pinctrl-device.yaml, base.yaml]
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
reg:
|
reg:
|
||||||
|
@ -13,13 +13,3 @@ properties:
|
||||||
|
|
||||||
interrupts:
|
interrupts:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
tx-pin:
|
|
||||||
type: array
|
|
||||||
required: true
|
|
||||||
description: TX pin
|
|
||||||
|
|
||||||
rx-pin:
|
|
||||||
type: array
|
|
||||||
required: true
|
|
||||||
description: RX pin
|
|
||||||
|
|
|
@ -5,28 +5,8 @@ description: TI SimpleLink CC13xx / CC26xx SPI node
|
||||||
|
|
||||||
compatible: "ti,cc13xx-cc26xx-spi"
|
compatible: "ti,cc13xx-cc26xx-spi"
|
||||||
|
|
||||||
include: spi-controller.yaml
|
include: [spi-controller.yaml, pinctrl-device.yaml, base.yaml]
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
reg:
|
reg:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
sck-pin:
|
|
||||||
type: int
|
|
||||||
required: true
|
|
||||||
description: SCK pin
|
|
||||||
|
|
||||||
mosi-pin:
|
|
||||||
type: int
|
|
||||||
required: true
|
|
||||||
description: MOSI pin
|
|
||||||
|
|
||||||
miso-pin:
|
|
||||||
type: int
|
|
||||||
required: true
|
|
||||||
description: MISO pin
|
|
||||||
|
|
||||||
cs-pin:
|
|
||||||
type: int
|
|
||||||
required: false
|
|
||||||
description: CS pin
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue