Commit 9d81b74f authored by Vebjorn Myklebust's avatar Vebjorn Myklebust Committed by Benjamin Cabé
Browse files

drivers: pinctrl: Add support for cc23x0 pinctrl



Add support for pinctrl to cc23x0 SoC. Like for other TI SoCs,
a node approach is implemented (no grouping approach).

Signed-off-by: default avatarLars Thalian Morstad <l-morstad@ti.com>
Signed-off-by: default avatarVebjorn Myklebust <v.myklebust@ti.com>
Signed-off-by: default avatarStoyan Bogdanov <sbogdanov@baylibre.com>
Signed-off-by: default avatarJulien Panis <jpanis@baylibre.com>
parent d28f3b81
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ zephyr_library_sources_ifdef(CONFIG_PINCTRL_IMX pinctrl_imx.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_SIFIVE pinctrl_sifive.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_NXP_IOCON pinctrl_lpc_iocon.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_CC13XX_CC26XX pinctrl_cc13xx_cc26xx.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_CC23X0 pinctrl_cc23x0.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_ESP32 pinctrl_esp32.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_RV32M1 pinctrl_rv32m1.c)
zephyr_library_sources_ifdef(CONFIG_PINCTRL_INFINEON_CAT1 pinctrl_ifx_cat1.c)
+1 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ source "drivers/pinctrl/Kconfig.imx"
source "drivers/pinctrl/Kconfig.sifive"
source "drivers/pinctrl/Kconfig.lpc_iocon"
source "drivers/pinctrl/Kconfig.cc13xx_cc26xx"
source "drivers/pinctrl/Kconfig.cc23x0"
source "drivers/pinctrl/Kconfig.esp32"
source "drivers/pinctrl/Kconfig.rv32m1"
source "drivers/pinctrl/Kconfig.ifx_cat1"
+11 −0
Original line number Diff line number Diff line
# Copyright (c) 2024 Texas Instruments Incorporated
# Copyright (c) 2024 BayLibre, SAS
#
# SPDX-License-Identifier: Apache-2.0

config PINCTRL_CC23X0
	bool "TI SimpleLink CC23X0 pinctrl driver"
	default y
	depends on DT_HAS_TI_CC23X0_PINCTRL_ENABLED
	help
	  Enable the TI SimpleLink CC23X0 pinctrl driver
+36 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2024 Texas Instruments Incorporated
 * Copyright (c) 2024 BayLibre, SAS
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#define DT_DRV_COMPAT ti_cc23x0_pinctrl

#include <zephyr/drivers/pinctrl.h>

#include <inc/hw_types.h>

#define IOC_BASE_REG     DT_REG_ADDR(DT_NODELABEL(pinctrl))
#define IOC_BASE_PIN_REG 0x00000100
#define IOC_ADDR(index)  (IOC_BASE_REG + IOC_BASE_PIN_REG + (sizeof(uint32_t) * (index)))

static int pinctrl_cc23x0_set(uint32_t pin, uint32_t func, uint32_t mode)
{
	uint32_t iocfg_reg = IOC_ADDR(pin);

	HWREG(iocfg_reg) = mode | func;

	return 0;
}

int pinctrl_configure_pins(const pinctrl_soc_pin_t *pins, uint8_t pin_cnt, uintptr_t reg)
{
	ARG_UNUSED(reg);

	for (uint8_t i = 0U; i < pin_cnt; i++) {
		pinctrl_cc23x0_set(pins[i].pin, pins[i].iofunc, pins[i].iomode);
	}

	return 0;
}
+62 −0
Original line number Diff line number Diff line
# Copyright (c) 2024 Texas Instruments Incorporated
# Copyright (c) 2024 BayLibre, SAS
# SPDX-License-Identifier: Apache-2.0

description: |
    TI SimpleLink CC23X0 pinctrl node.

    Device pin configuration should be placed in the child nodes of this node.
    Populate the 'pinmux' field with a pair consisting of a pin number and its IO
    functions.

    The node has the 'pinctrl' node label set in your SoC's devicetree,
    so you can modify it like this:

      &pinctrl {
              /* your modifications go here */
      };

    All device pin configurations should be placed in child nodes of the
    'pinctrl' node, as in the i2c0 example shown at the end.

    Here is a list of
    supported standard pin properties:

    - bias-disable: Disable pull-up/down.
    - bias-pull-down: Enable pull-down resistor.
    - bias-pull-up: Enable pull-up resistor.
    - drive-open-drain: Output driver is open-drain.
    - drive-open-source: Output driver is open-source.
    - input-enable: enable input.
    - input-schmitt-enable: enable input schmitt circuit.

compatible: "ti,cc23x0-pinctrl"

include: base.yaml

properties:
  reg:
    required: true

child-binding:
  description: |
    This binding gives a base representation of the CC23X0
    pins configuration.

  include:
    - name: pincfg-node.yaml
      property-allowlist:
        - bias-disable
        - bias-pull-down
        - bias-pull-up
        - drive-open-drain
        - drive-open-source
        - input-enable
        - input-schmitt-enable

  properties:
    pinmux:
      required: true
      type: array
      description: |
        CC23X0 pin's configuration (IO pin, IO function).
Loading