Skip to content

Add pin control driver for BCM2712 SoC

Andrea della Porta linux-arm-kernel linux-devicetree linux-gpio 3 versions – Applied

Status from this message: I applied patches 1 & 2 now, please apply patch 3 to the

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 19 repliesApplied
  2. v33 patches 16 repliesSuperseded
  3. v17 patches 4 repliesSuperseded

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/3dt-bindings: pinctrl: Add support for Broadcom STB pin controllerDocumentation/devicetree/bindings/pinctrl/brcm,bcm2712c0-pinctrl.yaml+137 -04 replies
2/3pinctrl: bcm: Add STB family pin controller driverdrivers/pinctrl/bcm/Kconfig drivers/pinctrl/bcm/Kconfig.stb drivers/pinctrl/bcm/Makefile +3 more+1306 -09 replies
3/3arm64: defconfig: Enable BCM2712 on-chip pin controller driverarch/arm64/configs/defconfig+2 -03 replies

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by.

PatchPhil ElwellRob Herring (Arm)
1/3R-b
2/3R-b
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] Add pin control driver for BCM2712 SoC

Hi,

The following patches add a pin control driver for the BCM2712 SoC.

Device driver is follow up version on what Andrea posted in April [1].

It is based on sources from here [2]. Since its first inception, this patchset has undergone heavy rework in order to split the driver in a generic core API useful for several STB pin controller and a specific implementation for BCM2712 SoC found on RaspberryPi 5.

A separate patchset will add peripheral nodes that rely on the SoC pin controller to setup and config the pins.

All this have been tested as kernel was directly booted RPi5 via kernel= config.txt option and cmdline.txt file with following content (Note I am using Tumbleweed RPi raw images)

$ cat /boot/efi/cmdline.txt
root=/dev/mmcblk0p3 rootwait rw systemd.show_status=1 console=tty ignore_loglevel earlycon console=ttyAMA10,115200

With all these patches Bluetooth and Wifi are working fine (tm) with firmware files provided by openSUSE Tumbleweed.

All comments and suggestions are welcome!

Happy hacking!
Ivan and Andrea

[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://github.com/raspberrypi/linux/blob/rpi-6.6.y/drivers/pinctrl/bcm/pinctrl-bcm2712.c
[3] https://lore.kernel.org/lkml/[email protected]/#t
[4] https://lore.kernel.org/all/[email protected]/

CHANGES in V4:

--- DT BINDINGS ---

- brcm,bcm2712c0-pinctrl.yaml: added blank lines between paragraphs in descriptions.

- brcm,bcm2712c0-pinctrl.yaml: descriptions are now layout in the same order everywhere.

--- DRIVER ---

- pinctrl-brcmstb.c: this is now the core driver that will manage the generic functions of any STB pin controller. The new pinctrl-brcmstb.h header contains the APIs that can be leveraged by specific implementations. I've applied quite a conservative approach in determining what is generic and what is not. It's easier to specialize some generic code when we need it that the other way around.

- pinctrl-brcmstb.h: new file! Header contains the APIs that can be leveraged by specific implementations.

- pinctrl-brcmstb-bcm2712.c: new file! The custom implementation for BCM2712 SoC. It specifies the pinsi/functions for this chipset and calls the probe function from the core driver. Some values are now set from this file since they are considered chip-specific, e.g. func_mask, func_gpio and func_names.

- PIN macro renamed to BRCMSTB_PIN.

- enum brcmstb_funcs renamed to bcm2712_funcs.

- avoid wrapping some lines above 80 char containing GPIO declarations for the sake of readability.

- renamed the chipset specific structs from brcmst_* to bcm2712_*.

- AGPIO_* renamed to AON_GPIO_* and SGPIO_* to AON_SGPIO_*.

- FUNC macro renamed to BRCMSTB_FUNC.

- brcmstb_reg_rd() and brcmstb_reg_wr() have been inlined, substituted by their inner implementation based on readl/writel.

- spin_lock_* replaced by guards. Asa a result, the flags var definition is dropped.

- implemented .function_is_gpio() in pinmux_ops. As a result, this driver is marked as strict.

- used of_device_get_match_data() directly in place of retrieving it through of_match_node()->data;

- added a comment to better specify the differences between AGPIO and SGPIO.

--- KBUILD ---

- Kconfig.stb: new file! to be included by top level Kconfig to enable the Broadcom STB specific drivers (e.g. BCM2712 pin controller). Enabled only if PINCTRL_BRCMSTB is enabled from top level.

- Kconfig: amended to enable the generic support for Broadcom STB pin controller family. Includes Kconfig.stb.

- Makefile: added pinctrl-brcmstb-bcm2712.o

Andrea della Porta (1):
arm64: defconfig: Enable BCM2712 on-chip pin controller driver

Ivan T. Ivanov (2):
dt-bindings: pinctrl: Add support for Broadcom STB pin controller
pinctrl: bcm: Add STB family pin controller driver

 .../pinctrl/brcm,bcm2712c0-pinctrl.yaml       | 137 ++++
 arch/arm64/configs/defconfig                  |   2 +
 drivers/pinctrl/bcm/Kconfig                   |  12 +
 drivers/pinctrl/bcm/Kconfig.stb               |  10 +
 drivers/pinctrl/bcm/Makefile                  |   2 +
 drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c | 747 ++++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-brcmstb.c         | 442 +++++++++++
 drivers/pinctrl/bcm/pinctrl-brcmstb.h         |  93 +++
 8 files changed, 1445 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm2712c0-pinctrl.yaml
 create mode 100644 drivers/pinctrl/bcm/Kconfig.stb
 create mode 100644 drivers/pinctrl/bcm/pinctrl-brcmstb-bcm2712.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-brcmstb.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-brcmstb.h
Signature · 1 line
2.35.3