Skip to contentSkip to conversation

dt-bindings: pinctrl: document Broadcom Northstar pin mux controller

PATCH Superseded Rafał Miłecki 2 participants 6 messages Sep 19, 2018 – Sep 20, 2018

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 dt-bindings: pinctrl: document Broadcom Northstar pin mux controller

From: Rafa? Mi?ecki <[email protected]>

Northstar has mux controller just like Northstar Plus and Northstar2. It's a bit different though (different registers & pins) so it requires its own binding.

It's needed to allow other block bindings specify required mux setup.

---
 .../devicetree/bindings/pinctrl/brcm,ns-pinmux.txt | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt new file +29 -0
new file mode 100644
index 000000000000..0e913721ae9e
@@ -0,0 +1,29 @@
+Broadcom Northstar pins mux controller
+
+Some of Northstar SoCs's pins can be used for various purposes thanks to the mux
+controller. This binding allows describing mux controller and listing available
+functions. They can be referenced later by other bindings to let system
+configure controller correctly.
+
+Required properties:
+- compatible: brcm,ns-pinmux
+- reg: iomem address range of CRU (Central Resource Unit) pin registers
+- reg-names: "cru_pins_control" - the only needed & supported reg right now
+
+List of supported functions and their groups:
+- "spi": "spi_grp"
+
+For documentation of subnodes see:
+Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+
+Example:
+	pinctrl at 1800c1c0 {
+		compatible = "brcm,ns-pinmux";
+		reg = <0x1800c1c0 0x24>;
+		reg-names = "cru_pins_control";
+
+		spi {
+			function = "spi";
+			groups = "spi_grp";
+		};
+	};
Signature · 1 line
2.13.7
#1 lore raw

PATCH 2/2 pinctrl: bcm: add Northstar driver

From: Rafa? Mi?ecki <[email protected]>

This driver provides support for Northstar mux controller. It differs from Northstar Plus one so a new binding and driver were needed.

Right now it includes support for SPI pins only which is caused by a lack of access to Broadcom's datasheet. SPI pins info was extracted from the Broadcom's SDK. Once more pins are discovered they can be added to the driver without breaking any existing setups.

---
 drivers/pinctrl/bcm/Kconfig      |  13 +++
 drivers/pinctrl/bcm/Makefile     |   1 +
 drivers/pinctrl/bcm/pinctrl-ns.c | 246 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 260 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-ns.c
drivers/pinctrl/bcm/Kconfig +13 -0
index 0f38d51f47c6..c8575399d6f7 100644
@@ -73,6 +73,19 @@ config PINCTRL_CYGNUS_MUX
 	  configuration, with the exception that certain individual pins
 	  can be overridden to GPIO function
 
+config PINCTRL_NS
+	bool "Broadcom Northstar pins driver"
+	depends on OF && (ARCH_BCM_5301X || COMPILE_TEST)
+	select PINMUX
+	select GENERIC_PINCONF
+	default ARCH_BCM_5301X
+	help
+	  Say yes here to enable the Broadcom NS SoC pins driver.
+
+	  The Broadcom Northstar pins driver supports muxing multi-purpose pins
+	  that can be used for various functions (e.g. SPI, I2C, UART) as well
+	  as GPIOs.
+
 config PINCTRL_NSP_GPIO
 	bool "Broadcom NSP GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_NSP || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 80ceb9dae944..79d5e49fdd9a 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_IPROC_GPIO)	+= pinctrl-iproc-gpio.o
 obj-$(CONFIG_PINCTRL_CYGNUS_MUX)	+= pinctrl-cygnus-mux.o
+obj-$(CONFIG_PINCTRL_NS)		+= pinctrl-ns.o
 obj-$(CONFIG_PINCTRL_NSP_GPIO)		+= pinctrl-nsp-gpio.o
 obj-$(CONFIG_PINCTRL_NS2_MUX)		+= pinctrl-ns2-mux.o
 obj-$(CONFIG_PINCTRL_NSP_MUX)		+= pinctrl-nsp-mux.o
drivers/pinctrl/bcm/pinctrl-ns.c new file +246 -0

246 lines not on this page · raw message

Signature · 1 line
2.13.7
#4 lore raw

PATCH 1/2 dt-bindings: pinctrl: document Broadcom Northstar pin mux controller

In reply to Rafał Miłecki
Quoted 21 lines · Rafa? Mi?ecki

From: Rafa? Mi?ecki <[email protected]>

Northstar has mux controller just like Northstar Plus and Northstar2. It's a bit different though (different registers & pins) so it requires its own binding.

It's needed to allow other block bindings specify required mux setup.

---
 .../devicetree/bindings/pinctrl/brcm,ns-pinmux.txt | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt new file +1 -0
new file mode 100644
index 000000000000..0e913721ae9e
@@ -0,0 +1,29 @@
+Broadcom Northstar pins mux controller

Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt line 11

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt new file +10 -0
+
+Some of Northstar SoCs's pins can be used for various purposes thanks to the mux
+controller. This binding allows describing mux controller and listing available
+functions. They can be referenced later by other bindings to let system
+configure controller correctly.
+
+Required properties:
+- compatible: brcm,ns-pinmux
+- reg: iomem address range of CRU (Central Resource Unit) pin registers
+- reg-names: "cru_pins_control" - the only needed & supported reg right now

Technically the register range that you cover is named CRU_GPIO_CONTROLx with x being in [0-8].

Other than that:

Signature · 1 line
Florian
#2 lore raw

PATCH 2/2 pinctrl: bcm: add Northstar driver

In reply to Rafał Miłecki
Quoted 12 lines · Rafa? Mi?ecki

From: Rafa? Mi?ecki <[email protected]>

This driver provides support for Northstar mux controller. It differs from Northstar Plus one so a new binding and driver were needed.

Right now it includes support for SPI pins only which is caused by a lack of access to Broadcom's datasheet. SPI pins info was extracted from the Broadcom's SDK. Once more pins are discovered they can be added to the driver without breaking any existing setups.

---

[snip]

drivers/pinctrl/bcm/pinctrl-ns.c line 43

Quoted 6 lines
drivers/pinctrl/bcm/pinctrl-ns.c new file +6 -0
+static const struct pinctrl_pin_desc ns_pinctrl_pins[] = {
+	{ 0, "spi_clk" },
+	{ 1, "spi_ss" },
+	{ 2, "spi_mosi" },
+	{ 3, "spi_miso" },
+};

In case you are interested, here are the additional functions:

4: i2c_scl
5: i2c_sda

6: mdc
7: mdio

8: pwm0
9: pwm1
10: pwm2
11: pwm3

12: uart1_rx
13: uart1_tx
14: uart1_cts
15: uart1_rts

On BCM53012:

16: uart2_rx
17: uart2_tx
22: sdio_card_power_ctl
23: sdio_en_1p8

On BCM53013:

21: 25Mhz crystal output for I2S

Not an expert on pinctrl drivers, but it looks reasonable to me.

Signature · 1 line
Florian
#5 lore raw

PATCH 1/2 dt-bindings: pinctrl: document Broadcom Northstar pin mux controller

In reply to Florian Fainelli
Quoted 27 lines · Florian Fainelli
Quoted 26 lines · Rafa? Mi?ecki

From: Rafa? Mi?ecki <[email protected]>

Northstar has mux controller just like Northstar Plus and Northstar2. It's a bit different though (different registers & pins) so it requires its own binding.

It's needed to allow other block bindings specify required mux setup.

---
 .../devicetree/bindings/pinctrl/brcm,ns-pinmux.txt | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt new file +6 -0
new file mode 100644
index 000000000000..0e913721ae9e
@@ -0,0 +1,29 @@
+Broadcom Northstar pins mux controller
+
+Some of Northstar SoCs's pins can be used for various purposes thanks to the mux
+controller. This binding allows describing mux controller and listing available
+functions. They can be referenced later by other bindings to let system
+configure controller correctly.
Quoted 8 lines

Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt line 11

Quoted 5 lines
Documentation/devicetree/bindings/pinctrl/brcm,ns-pinmux.txt new file +5 -0
+
+Required properties:
+- compatible: brcm,ns-pinmux
+- reg: iomem address range of CRU (Central Resource Unit) pin registers
+- reg-names: "cru_pins_control" - the only needed & supported reg right now

Technically the register range that you cover is named CRU_GPIO_CONTROLx with x being in [0-8].

Thanks! Do you think
reg-names: "cru_gpio_controls"
will be fine? Or should I keep it singular like:
reg-names: "cru_gpio_control"
?

Signature · 1 line
Rafa?
#3 lore raw

PATCH 2/2 pinctrl: bcm: add Northstar driver

In reply to Florian Fainelli
Quoted 43 lines · Florian Fainelli
Quoted 12 lines · Rafa? Mi?ecki

From: Rafa? Mi?ecki <[email protected]>

This driver provides support for Northstar mux controller. It differs from Northstar Plus one so a new binding and driver were needed.

Right now it includes support for SPI pins only which is caused by a lack of access to Broadcom's datasheet. SPI pins info was extracted from the Broadcom's SDK. Once more pins are discovered they can be added to the driver without breaking any existing setups.

---

[snip]

drivers/pinctrl/bcm/pinctrl-ns.c line 43

Quoted 6 lines
drivers/pinctrl/bcm/pinctrl-ns.c new file +6 -0
+static const struct pinctrl_pin_desc ns_pinctrl_pins[] = {
+	{ 0, "spi_clk" },
+	{ 1, "spi_ss" },
+	{ 2, "spi_mosi" },
+	{ 3, "spi_miso" },
+};

In case you are interested, here are the additional functions:

4: i2c_scl
5: i2c_sda

6: mdc
7: mdio

8: pwm0
9: pwm1
10: pwm2
11: pwm3

12: uart1_rx
13: uart1_tx
14: uart1_cts
15: uart1_rts

On BCM53012:

Quoted 8 lines

16: uart2_rx
17: uart2_tx
22: sdio_card_power_ctl
23: sdio_en_1p8

On BCM53013:

21: 25Mhz crystal output for I2S

I believe what you provided are name of bits in the cru_genpll_control0 register. FWIW that info would be part of ns_pins_data rather than ns_pinctrl_pins.

I was aware of most of them thanks to analyzing bcm5301x_dmu.c from the SDK but some are still new to me, so thanks for that!

What I'm really missing are SoC pin numbers for all above. E.g. what hardware pin number is used for the uart2_rx? Or sdio_card_power_ctl? And all the other ones.

If you could provide that info it'd be extremely helpful.

***

If you take a look at pinctrl-nsp-mux.c, you'll see that there isn't 1:1 mapping used on Broadcom platforms.

E.g. Northstar Plus has SoC pins 4 and 5 used for I2C:
i2c_pins[] = {4, 5};
but they are controlled by BIT(3) and BIT(4) of the BASE0 register:
NSP_PIN_GROUP(i2c, NSP_MUX_BASE0, 3, 0x03, 0x00),
(0x03 << 3)

Another NSP example: SoC pins 16 and 17 are used for UART2:
uart2_pins[] = {16, 17};
but they are controlled by BIT(15) and BIT(16) of the BASE0 register:
NSP_PIN_GROUP(uart2, NSP_MUX_BASE0, 15, 0x03, 0x00),
(0x03 << 15)

Of course, some pins map 1:1, e.g. pin 26 for LED of switch port 5:
switch_p05_led0_pins[] = {26};
maps nicely to BIT(26) of the BASE0 register:
NSP_PIN_GROUP(switch_p05_led0, NSP_MUX_BASE0, 26, 0x01, 0x01), (0x01 << 26)
but it clearly isn't a rule.