Skip to contentSkip to conversation

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

PATCH New Rafał Miłecki 4 participants 9 messages Sep 26, 2018 – Oct 16, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

---
V2: Use "cru_gpio_control"
Add more functions & groups
Include Florian's Reviewed-by
V3: Use 3 different bindings as available pins depend on the chipset.
Strings match Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt

---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt       | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +42 -0
new file mode 100644
index 000000000000..af906f196e8c
@@ -0,0 +1,42 @@
+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.
+
+A list of pins varies across chipsets so few bindings are available.
+
+Required properties:
+- compatible: must be one of:
+	"brcm,bcm4708-pinmux"
+	"brcm,bcm4709-pinmux"
+	"brcm,bcm53012-pinmux"
+- reg: iomem address range of CRU (Central Resource Unit) pin registers
+- reg-names: "cru_gpio_control" - the only needed & supported reg right now
+
+Functions and their groups available for all chipsets:
+- "spi": "spi_grp"
+- "i2c": "i2c_grp"
+- "pwm": "pwm0_grp", "pwm1_grp", "pwm2_grp", "pwm3_grp"
+- "uart1": "uart1_grp"
+
+Additionally available on BCM4709 and BCM53012:
+- "mdio": "mdio_grp"
+- "uart2": "uart2_grp"
+- "sdio": "sdio_pwr_grp", "sdio_1p8v_grp"
+
+For documentation of subnodes see:
+Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+
+Example:
+	pinctrl at 1800c1c0 {
+		compatible = "brcm,bcm4708-pinmux";
+		reg = <0x1800c1c0 0x24>;
+		reg-names = "cru_gpio_control";
+
+		spi {
+			function = "spi";
+			groups = "spi_grp";
+		};
+	};
Signature · 1 line
2.13.7
#1 lore raw

PATCH v3 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.

---
V2: Define more pins, groups, functions
Simplify ns_pinctrl_set_mux() as Northstar uses 1:1 mapping
V3: Support 3 different bindings and different sets of pins, groups
and functions. This requires building arrays dynamically on init.

---
 drivers/pinctrl/bcm/Kconfig      |  13 ++
 drivers/pinctrl/bcm/Makefile     |   1 +
 drivers/pinctrl/bcm/pinctrl-ns.c | 372 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 386 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 +372 -0

372 lines not on this page · raw message

Signature · 1 line
2.13.7
#2 lore raw

PATCH v3 2/2 pinctrl: bcm: add Northstar driver

Quoted 11 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.

---
V2: Define more pins, groups, functions
Simplify ns_pinctrl_set_mux() as Northstar uses 1:1 mapping
V3: Support 3 different bindings and different sets of pins, groups
and functions. This requires building arrays dynamically on init.

Patch applied.

Yours,
Linus Walleij

#3 lore raw

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

In reply to Rafał Miłecki
Quoted 8 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.

Quoted 8 lines

---
V2: Use "cru_gpio_control"
Add more functions & groups
Include Florian's Reviewed-by
V3: Use 3 different bindings as available pins depend on the chipset.
Strings match Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt

Patch applied.

Yours,
Linus Walleij

maintainer
#4 lore raw

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

In reply to Rafał Miłecki
Quoted 32 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.

---
V2: Use "cru_gpio_control"
Add more functions & groups
Include Florian's Reviewed-by
V3: Use 3 different bindings as available pins depend on the chipset.
Strings match Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt

---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt       | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +5 -0
new file mode 100644
index 000000000000..af906f196e8c
@@ -0,0 +1,42 @@
+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

Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt line 15

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +10 -0
+configure controller correctly.
+
+A list of pins varies across chipsets so few bindings are available.
+
+Required properties:
+- compatible: must be one of:
+	"brcm,bcm4708-pinmux"
+	"brcm,bcm4709-pinmux"
+	"brcm,bcm53012-pinmux"
+- reg: iomem address range of CRU (Central Resource Unit) pin registers

Perhaps 'cru' in the compatible if that's what the h/w is called?

Also, if this is a sub-block, then it should be a child of the block which should be defined here.

Quoted 13 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +13 -0
+- reg-names: "cru_gpio_control" - the only needed & supported reg right now
+
+Functions and their groups available for all chipsets:
+- "spi": "spi_grp"
+- "i2c": "i2c_grp"
+- "pwm": "pwm0_grp", "pwm1_grp", "pwm2_grp", "pwm3_grp"
+- "uart1": "uart1_grp"
+
+Additionally available on BCM4709 and BCM53012:
+- "mdio": "mdio_grp"
+- "uart2": "uart2_grp"
+- "sdio": "sdio_pwr_grp", "sdio_1p8v_grp"
+

Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt line 38

Quoted 10 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +10 -0
+For documentation of subnodes see:
+Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt
+
+Example:
+	pinctrl at 1800c1c0 {
+		compatible = "brcm,bcm4708-pinmux";
+		reg = <0x1800c1c0 0x24>;
+		reg-names = "cru_gpio_control";
+
+		spi {

You'll find this now causes dtc warnings. 'spi' is reserved for SPI controller nodes. So 'spi-pins' perhaps.

Quoted 7 lines
Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +4 -0
+			function = "spi";
+			groups = "spi_grp";
+		};
+	};
Signature · 1 line
2.13.7
#5 lore raw

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

Rafa?, could you patch the bindings with Rob comments so I don't have to pull the patch out of my tree or revert it?

Yours,
Linus Walleij

#6 lore raw

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

In reply to Rob Herring
Quoted 57 lines · Rob Herring
Quoted 52 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.

---
V2: Use "cru_gpio_control"
Add more functions & groups
Include Florian's Reviewed-by
V3: Use 3 different bindings as available pins depend on the chipset.
Strings match
Documentation/devicetree/bindings/arm/bcm/brcm,bcm4708.txt

---
 .../bindings/pinctrl/brcm,bcm4708-pinmux.txt       | 42 
++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 

Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt

(quoted diff) +0 -0

a/Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt b/Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file mode 100644
index 000000000000..af906f196e8c
--- /dev/null
+++
b/Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt

Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +3 -0
@@ -0,0 +1,42 @@
+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

Documentation/devicetree/bindings/pinctrl/brcm,bcm4708-pinmux.txt new file +10 -0
+configure controller correctly.
+
+A list of pins varies across chipsets so few bindings are available.
+
+Required properties:
+- compatible: must be one of:
+	"brcm,bcm4708-pinmux"
+	"brcm,bcm4709-pinmux"
+	"brcm,bcm53012-pinmux"
+- reg: iomem address range of CRU (Central Resource Unit) pin 
Quoted 1 line

registers

Perhaps 'cru' in the compatible if that's what the h/w is called?

Quoted 2 lines

Also, if this is a sub-block, then it should be a child of the block which should be defined here.

It took me some time to do some extra research on the whole CRU thing.

Valuable resources:
[1] bcm5301x_dmu.c (from the SDK)
[2] bcm5301x_pcie.c (from the SDK)
[3] https://patchwork.kernel.org/patch/7888651/
[4] https://patchwork.kernel.org/patch/5051471/

First of all CRU seems to be a sub-block of the DMU (which stands for "Device Management Unit" according to the [1]). DMU seems to be independent block at 0x1800c000 with a size of 0x1000.

It isn't actually clear what the CRU stands for. In Broadcom's case:
1. According to the [3] it's "Clock and Reset Unit"
2. According to the [4] it's a "central resource unit" Other vendors seem to use CRU name for "Clock and Reset Unit".

In any case, you're right Rob, it's a sub-block, a set of random registers that control SoC.

So I think that:
1) We should have a node for DMU and CRU
2) We should not include "cru" in bindings as pinmuxing seems to be part of SoC that just happens to be controlled using CRU registers

#7 lore raw

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

Quoted 22 lines · Rafa? Mi?ecki
Quoted 4 lines

Perhaps 'cru' in the compatible if that's what the h/w is called?

Also, if this is a sub-block, then it should be a child of the block which should be defined here.

It took me some time to do some extra research on the whole CRU thing.

Valuable resources:
[1] bcm5301x_dmu.c (from the SDK)
[2] bcm5301x_pcie.c (from the SDK)
[3] https://patchwork.kernel.org/patch/7888651/
[4] https://patchwork.kernel.org/patch/5051471/

First of all CRU seems to be a sub-block of the DMU (which stands for "Device Management Unit" according to the [1]). DMU seems to be independent block at 0x1800c000 with a size of 0x1000.

It isn't actually clear what the CRU stands for. In Broadcom's case:
1. According to the [3] it's "Clock and Reset Unit"
2. According to the [4] it's a "central resource unit" Other vendors seem to use CRU name for "Clock and Reset Unit".

Quoted 7 lines

In any case, you're right Rob, it's a sub-block, a set of random registers that control SoC.

So I think that:
1) We should have a node for DMU and CRU
2) We should not include "cru" in bindings as pinmuxing seems to be part of SoC that just happens to be controlled using CRU registers

OK do you want me to revert the patches or do you want to fix this stuff on top of the patches that are already in the tree? I'm fine either way.

Yours,
Linus Walleij

#8 lore raw

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

Quoted 27 lines · Linus Walleij
Quoted 25 lines · Rafa? Mi?ecki
Quoted 4 lines

Perhaps 'cru' in the compatible if that's what the h/w is called?

Also, if this is a sub-block, then it should be a child of the block which should be defined here.

It took me some time to do some extra research on the whole CRU thing.

Valuable resources:
[1] bcm5301x_dmu.c (from the SDK)
[2] bcm5301x_pcie.c (from the SDK)
[3] https://patchwork.kernel.org/patch/7888651/
[4] https://patchwork.kernel.org/patch/5051471/

First of all CRU seems to be a sub-block of the DMU (which stands for "Device Management Unit" according to the [1]). DMU seems to be independent block at 0x1800c000 with a size of 0x1000.

It isn't actually clear what the CRU stands for. In Broadcom's case:
1. According to the [3] it's "Clock and Reset Unit"
2. According to the [4] it's a "central resource unit" Other vendors seem to use CRU name for "Clock and Reset Unit".

In any case, you're right Rob, it's a sub-block, a set of random registers that control SoC.

Quoted 8 lines
Quoted 4 lines

So I think that:
1) We should have a node for DMU and CRU
2) We should not include "cru" in bindings as pinmuxing seems to be part of SoC that just happens to be controlled using CRU registers

OK do you want me to revert the patches or do you want to fix this stuff on top of the patches that are already in the tree? I'm fine either way.

I'm fine either way, thanks for taking care of my work!

Signature · 1 line
Rafa?