Skip to contentSkip to conversation

pinctrl: add BCM63XX pincontrol support

PATCH Superseded Álvaro Fernández Rojas 4 participants 44 messages Mar 4, 2021 – Mar 9, 2021

Subsystems (4)

v4 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v4 cover pinctrl: add BCM63XX pincontrol support

First of all, I've based this on the patches sent by Jonas Gorski back in 2016:
https://www.spinics.net/lists/linux-gpio/msg15983.html
http://patchwork.ozlabs.org/project/linux-gpio/patch/[email protected]/

I've tried to address all coments from Linus Walleij, but I know that this may still need some other modifications

This patchset adds appropriate binding documentation and drivers for pin controller cores found in the BCM63XX MIPS SoCs currently supported.

While the GPIO part is always the same, the pinmux part varies quite a lot between different SoCs. Sometimes they have defined groups which can be muxed into different functions, sometimes each function has a different group. Sometimes you can mux individual pins. Often it is a combination of single pins and groups.

Some core versions require the GPIO direction to be set according to the function, most do not. Sometimes the mux register(s) contain bits for unrelated other functions.

v4: fix gpiochip_irqchip_add_domain(), remove IRQ Kconfig selections and add
missing of_node_put().
v3: introduce new files for shared code and add more changes suggested by
Linus Walleij. Also add a new patch needed for properly parsing gpio-ranges.
v2: introduce changes suggested by Linus Walleij and remove interrupts
- In order to use GPIO_REGMAP, the need to get gpio_chip from gpio_regmap and use it for pinctrl_add_gpio_range() and gpio_chip.direction_input() and gpio_chip.direction_output().

Álvaro Fernández Rojas (15):
gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP
gpio: regmap: set gpio_chip of_node
pinctrl: bcm: add bcm63xx base code
Documentation: add BCM6328 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6328
Documentation: add BCM6358 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6358
Documentation: add BCM6362 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6362
Documentation: add BCM6368 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6368
Documentation: add BCM63268 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM63268
Documentation: add BCM6318 pincontroller binding documentation
pinctrl: add a pincontrol driver for BCM6318

 .../pinctrl/brcm,bcm6318-pinctrl.yaml         | 187 +++++
 .../pinctrl/brcm,bcm63268-pinctrl.yaml        | 208 ++++++
 .../pinctrl/brcm,bcm6328-pinctrl.yaml         | 171 +++++
 .../pinctrl/brcm,bcm6358-pinctrl.yaml         | 137 ++++
 .../pinctrl/brcm,bcm6362-pinctrl.yaml         | 250 +++++++
 .../pinctrl/brcm,bcm6368-pinctrl.yaml         | 261 +++++++
 drivers/gpio/gpio-regmap.c                    |   1 +
 drivers/pinctrl/bcm/Kconfig                   |  55 ++
 drivers/pinctrl/bcm/Makefile                  |   7 +
 drivers/pinctrl/bcm/pinctrl-bcm6318.c         | 496 ++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm63268.c        | 643 ++++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6328.c         | 403 +++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6358.c         | 369 ++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6362.c         | 617 +++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm6368.c         | 523 ++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm63xx.c         | 114 ++++
 drivers/pinctrl/bcm/pinctrl-bcm63xx.h         |  46 ++
 include/linux/gpio/driver.h                   |   9 +
 include/linux/gpio/regmap.h                   |   3 +
 19 files changed, 4500 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6318.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63268.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6328.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6358.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6362.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6368.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.h
Signature · 1 line
2.20.1
#1 lore raw

PATCH v4 1/15 gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP

The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP isn't enabled.

Fixes 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()")

---
v4: add patch (fix include instead of gpio-regmap.c)

 include/linux/gpio/driver.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/linux/gpio/driver.h +9 -0
index 286de0520574..ecf0032a0995 100644
@@ -624,8 +624,17 @@ void gpiochip_irq_domain_deactivate(struct irq_domain *domain,
 bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
 				unsigned int offset);
 
+#ifdef CONFIG_GPIOLIB_IRQCHIP
 int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
 				struct irq_domain *domain);
+#else
+static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
+					      struct irq_domain *domain)
+{
+	WARN_ON(1);
+	return -EINVAL;
+}
+#endif
 
 int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset);
 void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset);
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH v4 01/15] gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP

Quoted 4 lines · Álvaro Fernández Rojas

The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP isn't enabled.

Suggested-by ?
Quoted 33 lines
Fixes 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()")

---
v4: add patch (fix include instead of gpio-regmap.c)

 include/linux/gpio/driver.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/linux/gpio/driver.h +9 -1
index 286de0520574..ecf0032a0995 100644
@@ -624,8 +624,17 @@ void gpiochip_irq_domain_deactivate(struct irq_domain *domain,
 bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
                                unsigned int offset);
 
+#ifdef CONFIG_GPIOLIB_IRQCHIP
 int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
                                struct irq_domain *domain);
+#else
+static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
+                                             struct irq_domain *domain)
+{
+       WARN_ON(1);
+       return -EINVAL;
+}
+#endif
 
 int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset);
 void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset);
--

2.20.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

Re: [PATCH v4 01/15] gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP

In reply to Álvaro Fernández Rojas

Add missing tag:

Quoted 39 lines · Álvaro Fernández Rojas

The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP isn't enabled.

Fixes 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()")

---
v4: add patch (fix include instead of gpio-regmap.c)

include/linux/gpio/driver.h | 9 +++++++++

1 file changed, 9 insertions(+)
include/linux/gpio/driver.h +9 -0
index 286de0520574..ecf0032a0995 100644
@@ -624,8 +624,17 @@ void gpiochip_irq_domain_deactivate(struct irq_domain *domain,
 bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc,
 				unsigned int offset);
 
+#ifdef CONFIG_GPIOLIB_IRQCHIP
 int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
 				struct irq_domain *domain);
+#else
+static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc,
+					      struct irq_domain *domain)
+{
+	WARN_ON(1);
+	return -EINVAL;
+}
+#endif
 
 int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset);
 void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset);
Signature · 1 line
2.20.1
Reviewed-by on v4 1/15
#4 lore raw

Re: [PATCH v4 01/15] gpio: guard gpiochip_irqchip_add_domain() with GPIOLIB_IRQCHIP

In reply to Álvaro Fernández Rojas
Quoted 6 lines · Álvaro Fernández Rojas

The current code doesn't check if GPIOLIB_IRQCHIP is enabled, which results in a compilation error when trying to build gpio-regmap if CONFIG_GPIOLIB_IRQCHIP isn't enabled.

Fixes 6a45b0e2589f ("gpiolib: Introduce gpiochip_irqchip_add_domain()")

Yours,
Linus Walleij

#5 lore raw

PATCH v4 2/15 gpio: regmap: set gpio_chip of_node

In reply to Álvaro Fernández Rojas

This is needed for properly registering gpio regmap as a child of a regmap pin controller.

---
v4: fix documentation
v3: introduce patch needed for properly parsing gpio-ranges

 drivers/gpio/gpio-regmap.c  | 1 +
 include/linux/gpio/regmap.h | 3 +++
 2 files changed, 4 insertions(+)
drivers/gpio/gpio-regmap.c +1 -0
index 5412cb3b0b2a..1a43a90024bb 100644
@@ -249,6 +249,7 @@ struct gpio_regmap *gpio_regmap_register(const struct gpio_regmap_config *config
 
 	chip = &gpio->gpio_chip;
 	chip->parent = config->parent;
+	chip->of_node = config->of_node ?: dev_of_node(config->parent);
 	chip->base = -1;
 	chip->ngpio = config->ngpio;
 	chip->names = config->names;
include/linux/gpio/regmap.h +3 -0
index ad76f3d0a6ba..73105ff830fb 100644
@@ -4,6 +4,7 @@
 #define _LINUX_GPIO_REGMAP_H
 
 struct device;
+struct device_node;
 struct gpio_regmap;
 struct irq_domain;
 struct regmap;
@@ -16,6 +17,7 @@ struct regmap;
  * @parent:		The parent device
  * @regmap:		The regmap used to access the registers
  *			given, the name of the device is used
+ * @of_node:		(Optional) The device node
  * @label:		(Optional) Descriptive name for GPIO controller.
  *			If not given, the name of the device is used.
  * @ngpio:		Number of GPIOs
@@ -57,6 +59,7 @@ struct regmap;
 struct gpio_regmap_config {
 	struct device *parent;
 	struct regmap *regmap;
+	struct device_node *of_node;
 
 	const char *label;
 	int ngpio;
Signature · 1 line
2.20.1
#6 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 2 lines · Álvaro Fernández Rojas

This is needed for properly registering gpio regmap as a child of a regmap

gpio -> GPIO

Quoted 1 line

pin controller.

...

Quoted 3 lines

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Hi Andy,

Quoted 11 lines · Andy Shevchenko
Quoted 2 lines · Álvaro Fernández Rojas

This is needed for properly registering gpio regmap as a child of a regmap

gpio -> GPIO

Quoted 1 line

pin controller.

Quoted 7 lines

...

Quoted 3 lines

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Quoted 4 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#8 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 6 lines · Álvaro Fernández Rojas
Quoted 6 lines · Andy Shevchenko
Quoted 1 line · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Use struct fwnode_handle pointer instead of OF-specific one.

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#9 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Hi Andy,

Quoted 11 lines · Andy Shevchenko
Quoted 8 lines · Álvaro Fernández Rojas
Quoted 8 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Can we use fwnode from day 1, please?

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Use struct fwnode_handle pointer instead of OF-specific one.

But is that compatible with the current gpiolib-of code? :$

Quoted 5 lines

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Because gpio regmap a child node of the pin controller, which is the one probed (gpio regmap is probed from the pin controller).
Therefore the parent’s fwnode is useless, since the correct gpio_chip node is the child's one (we have pin-ranges declared in the child node, referencing the parent pinctrl node).

Quoted 4 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#10 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 12 lines · Álvaro Fernández Rojas
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Álvaro Fernández Rojas
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Use struct fwnode_handle pointer instead of OF-specific one.

But is that compatible with the current gpiolib-of code? :$

Yes (after a bit of amendment I have sent today as v2:
https://lore.kernel.org/linux-gpio/[email protected]/T/#u).

Quoted 7 lines
Quoted 4 lines

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Because gpio regmap a child node of the pin controller, which is the one probed (gpio regmap is probed from the pin controller).
Therefore the parent’s fwnode is useless, since the correct gpio_chip node is the child's one (we have pin-ranges declared in the child node, referencing the parent pinctrl node).

I see. Can you point me out to the code where we get the node and where it's being retrieved / filled?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#11 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 21 lines · Andy Shevchenko
Quoted 16 lines · Álvaro Fernández Rojas
Quoted 16 lines · Andy Shevchenko
Quoted 13 lines · Álvaro Fernández Rojas
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Use struct fwnode_handle pointer instead of OF-specific one.

But is that compatible with the current gpiolib-of code? :$

Yes (after a bit of amendment I have sent today as v2:
https://lore.kernel.org/linux-gpio/[email protected]/T/#u).

Well that doesn’t fulfill my definition of “current gpiolib-of code”… @Linus what should I do about this?

Quoted 11 lines
Quoted 8 lines
Quoted 5 lines

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Because gpio regmap a child node of the pin controller, which is the one probed (gpio regmap is probed from the pin controller).
Therefore the parent’s fwnode is useless, since the correct gpio_chip node is the child's one (we have pin-ranges declared in the child node, referencing the parent pinctrl node).

I see. Can you point me out to the code where we get the node and where it's being retrieved / filled?

Sure, this is where the child node is searched: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L100-L109
Then the gpio child node is probed and assigned here: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L51

Basically, I based that part of the code on the ingenic pin controller: https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/pinctrl/pinctrl-ingenic.c#L2485-L2491
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/Documentation/devicetree/bindings/pinctrl/ingenic%2Cpinctrl.yaml#L155-L176

Quoted 4 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#12 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 20 lines · Álvaro Fernández Rojas
Quoted 20 lines · Andy Shevchenko
Quoted 18 lines · Álvaro Fernández Rojas
Quoted 17 lines · Andy Shevchenko
Quoted 6 lines · Álvaro Fernández Rojas
Quoted 6 lines · Andy Shevchenko
Quoted 1 line · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Use struct fwnode_handle pointer instead of OF-specific one.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

But is that compatible with the current gpiolib-of code? :$

Yes (after a bit of amendment I have sent today as v2:
https://lore.kernel.org/linux-gpio/[email protected]/T/#u).

Well that doesn’t fulfill my definition of “current gpiolib-of code”… @Linus what should I do about this?

Well, fwnode is a generic, and I strongly against spreading OF-specific code when we have fwnode working. But let's hear Linus out, of course!

But it seems you are right and the library needs a few more amendments.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

Because gpio regmap a child node of the pin controller, which is the one probed (gpio regmap is probed from the pin controller).
Therefore the parent’s fwnode is useless, since the correct gpio_chip node is the child's one (we have pin-ranges declared in the child node, referencing the parent pinctrl node).

I see. Can you point me out to the code where we get the node and where it's being retrieved / filled?

Sure, this is where the child node is searched: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L100-L109
Then the gpio child node is probed and assigned here: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L51

So, this is not (*yet) in upstream, correct?

So, why not to switch to fwnode API in that driver as well?

When you do that and supply fwnode thru the regmap configuration, in the gpio-regmap we may assign it to of_node (via to_of_node() API).

Quoted 2 lines

Basically, I based that part of the code on the ingenic pin controller: https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/pinctrl/pinctrl-ingenic.c#L2485-L2491
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/Documentation/devicetree/bindings/pinctrl/ingenic%2Cpinctrl.yaml#L155-L176

This doesn't use remgap GPIO.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#13 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 1 line · Andy Shevchenko

On Thu, Mar 4, 2021 at 5:44 PM Álvaro Fernández Rojas <[email protected]> wrote:

Let me summarize what we can do this independently on any of my patches and be okay with.

In the regmap GPIO configuration you supply struct fwnode_handle *fwnode. You can you fwnode API in the actual GPIO controller driver. Inside gpio-regmap simply do this for now

gc->of_node = to_of_node(config->fwnode);

The last part is an amendment I have told about, but it can be done later on by switching the entire GPIO chip to use fwnode instead of of_node.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#14 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Am 2021-03-04 17:46, schrieb Andy Shevchenko:

Quoted 4 lines
Quoted 1 line · Andy Shevchenko

On Thu, Mar 4, 2021 at 5:44 PM Álvaro Fernández Rojas <[email protected]> wrote:

Quoted 8 lines

Let me summarize what we can do this independently on any of my patches and be okay with.

In the regmap GPIO configuration you supply struct fwnode_handle *fwnode. You can you fwnode API in the actual GPIO controller driver. Inside gpio-regmap simply do this for now

gc->of_node = to_of_node(config->fwnode);

If doing so, can we please have a comment saying that config->fwnode might be NULL in which case the fwnode of the parent is used?

Quoted 3 lines

The last part is an amendment I have told about, but it can be done later on by switching the entire GPIO chip to use fwnode instead of of_node.

Signature · 1 line
-michael
#15 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 14 lines · Michael Walle

Am 2021-03-04 17:46, schrieb Andy Shevchenko:

Quoted 13 lines
Quoted 2 lines · Andy Shevchenko

On Thu, Mar 4, 2021 at 5:44 PM Álvaro Fernández Rojas <[email protected]> wrote:

Let me summarize what we can do this independently on any of my patches and be okay with.

In the regmap GPIO configuration you supply struct fwnode_handle *fwnode.
You can you fwnode API in the actual GPIO controller driver. Inside gpio-regmap simply do this for now

Quoted 4 lines
Quoted 1 line

gc->of_node = to_of_node(config->fwnode);

If doing so, can we please have a comment saying that config->fwnode might be NULL in which case the fwnode of the parent is used?

Good comments are always welcome!

Quoted 3 lines
Quoted 3 lines

The last part is an amendment I have told about, but it can be done later on by switching the entire GPIO chip to use fwnode instead of of_node.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#16 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

In reply to Andy Shevchenko

Hi Andy,

Quoted 28 lines · Andy Shevchenko
Quoted 25 lines · Álvaro Fernández Rojas
Quoted 24 lines · Andy Shevchenko
Quoted 12 lines · Álvaro Fernández Rojas
Quoted 12 lines · Andy Shevchenko
Quoted 10 lines · Álvaro Fernández Rojas
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Use struct fwnode_handle pointer instead of OF-specific one.

But is that compatible with the current gpiolib-of code? :$

Yes (after a bit of amendment I have sent today as v2:
https://lore.kernel.org/linux-gpio/[email protected]/T/#u).

Quoted 8 lines
Quoted 2 lines

Well that doesn’t fulfill my definition of “current gpiolib-of code”… @Linus what should I do about this?

Well, fwnode is a generic, and I strongly against spreading OF-specific code when we have fwnode working. But let's hear Linus out, of course!

But it seems you are right and the library needs a few more amendments.

Yes, but I’m trying to do as few amendments as possible since I already have quite a large amount of patches :)

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 8 lines
Quoted 5 lines

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Because gpio regmap a child node of the pin controller, which is the one probed (gpio regmap is probed from the pin controller).
Therefore the parent’s fwnode is useless, since the correct gpio_chip node is the child's one (we have pin-ranges declared in the child node, referencing the parent pinctrl node).

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I see. Can you point me out to the code where we get the node and where it's being retrieved / filled?

Sure, this is where the child node is searched: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L100-L109
Then the gpio child node is probed and assigned here: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L51

So, this is not (*yet) in upstream, correct?

No it’s not, but I've already changed the approach several times and I’m starting to get tired about it...

Quoted 10 lines

So, why not to switch to fwnode API in that driver as well?

When you do that and supply fwnode thru the regmap configuration, in the gpio-regmap we may assign it to of_node (via to_of_node() API).

Quoted 2 lines

Basically, I based that part of the code on the ingenic pin controller: https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/pinctrl/pinctrl-ingenic.c#L2485-L2491
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/Documentation/devicetree/bindings/pinctrl/ingenic%2Cpinctrl.yaml#L155-L176

This doesn't use remgap GPIO.

Yes, I know, but there aren’t any pinctrl drivers using regmap GPIO right now, so I couldn’t base my code on anything else :)

Quoted 4 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#17 lore raw

Re: [PATCH v4 02/15] gpio: regmap: set gpio_chip of_node

Quoted 30 lines · Álvaro Fernández Rojas
Quoted 30 lines · Andy Shevchenko
Quoted 27 lines · Álvaro Fernández Rojas
Quoted 18 lines · Andy Shevchenko
Quoted 16 lines · Álvaro Fernández Rojas
Quoted 16 lines · Andy Shevchenko
Quoted 13 lines · Álvaro Fernández Rojas
Quoted 9 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

+ * @of_node: (Optional) The device node

+ struct device_node *of_node;

Can we use fwnode from day 1, please?

Could you explain this? I haven’t dealt with fwnode never :$ BTW, this is done to fix this check when parsing gpio ranges:
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/gpio/gpiolib-of.c#L933-L934

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Use struct fwnode_handle pointer instead of OF-specific one.

But is that compatible with the current gpiolib-of code? :$

Yes (after a bit of amendment I have sent today as v2:
https://lore.kernel.org/linux-gpio/[email protected]/T/#u).

Well that doesn’t fulfill my definition of “current gpiolib-of code”… @Linus what should I do about this?

Quoted 7 lines
Quoted 5 lines

Well, fwnode is a generic, and I strongly against spreading OF-specific code when we have fwnode working. But let's hear Linus out, of course!

But it seems you are right and the library needs a few more amendments.

Yes, but I’m trying to do as few amendments as possible since I already have quite a large amount of patches :)

I understand your goal.
But as far I can say you don't need to rely on my patch series.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines

Also here is the question, why do you need to have that field in the regmap config structure and can't simply use the parent's fwnode? Also I'm puzzled why it's not working w/o this patch: GPIO library effectively assigns parent's fwnode (okay, of_node right now).

Because gpio regmap a child node of the pin controller, which is the one probed (gpio regmap is probed from the pin controller).
Therefore the parent’s fwnode is useless, since the correct gpio_chip node is the child's one (we have pin-ranges declared in the child node, referencing the parent pinctrl node).

I see. Can you point me out to the code where we get the node and where it's being retrieved / filled?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Sure, this is where the child node is searched: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L100-L109
Then the gpio child node is probed and assigned here: https://github.com/Noltari/linux/blob/6d1ebb8ff26ed54592eef1fcd3b58834acb48c04/drivers/pinctrl/bcm/pinctrl-bcm63xx.c#L51

So, this is not (*yet) in upstream, correct?

No it’s not, but I've already changed the approach several times and I’m starting to get tired about it...

I feel your pain, although I think that the best way is avoid spreading OF-specifics over generic code.
Using fwnode API is pretty much straightforward. It has been designed in a way to make it less invasive for existing code to be converted. There are plenty of changes in the upstream that show how it looks like.

You may check drivers under drivers/leds/ which have been switched to fwnode (and AFAIK new code is usually not OF specific).

Quoted 11 lines
Quoted 9 lines

So, why not to switch to fwnode API in that driver as well?

When you do that and supply fwnode thru the regmap configuration, in the gpio-regmap we may assign it to of_node (via to_of_node() API).

Quoted 2 lines

Basically, I based that part of the code on the ingenic pin controller: https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/drivers/pinctrl/pinctrl-ingenic.c#L2485-L2491
https://github.com/torvalds/linux/blob/f69d02e37a85645aa90d18cacfff36dba370f797/Documentation/devicetree/bindings/pinctrl/ingenic%2Cpinctrl.yaml#L155-L176

This doesn't use remgap GPIO.

Yes, I know, but there aren’t any pinctrl drivers using regmap GPIO right now, so I couldn’t base my code on anything else :)

Be a pioneer!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#18 lore raw

PATCH v4 3/15 pinctrl: bcm: add bcm63xx base code

In reply to Álvaro Fernández Rojas

Add a helper for registering BCM63XX pin controllers.

---
v4: drop IRQ selects from Kconfig and add missing of_node_put()
v3: add new patch with shared code

 drivers/pinctrl/bcm/Kconfig           |   7 ++
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm63xx.c | 114 ++++++++++++++++++++++++++
 drivers/pinctrl/bcm/pinctrl-bcm63xx.h |  46 +++++++++++
 4 files changed, 168 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.c
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63xx.h
drivers/pinctrl/bcm/Kconfig +7 -0
index 0ed14de0134c..882f19bdc243 100644
@@ -29,6 +29,13 @@ config PINCTRL_BCM2835
 	help
 	   Say Y here to enable the Broadcom BCM2835 GPIO driver.
 
+config PINCTRL_BCM63XX
+	bool
+	select GENERIC_PINCONF
+	select GPIO_REGMAP
+	select PINCONF
+	select PINMUX
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 79d5e49fdd9a..0e3cf9b15c65 100644
@@ -3,6 +3,7 @@
 
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_BCM63XX)		+= pinctrl-bcm63xx.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
drivers/pinctrl/bcm/pinctrl-bcm63xx.c new file +114 -0

114 lines not on this page · raw message

drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
2.20.1
#19 lore raw

Re: [PATCH v4 03/15] pinctrl: bcm: add bcm63xx base code

Quoted 5 lines · Álvaro Fernández Rojas

Add a helper for registering BCM63XX pin controllers.

This SoB is in a strange place.

The order is wrong taking into account the From header (committer). So, it's not clear who is the author, who is a co-developer, and who is the committer (one person may utilize few roles).
Check for the rest of the series as well (basically this is the rule of thumb to recheck entire code for the comment you have got at any single place of it).

...

drivers/pinctrl/bcm/pinctrl-bcm63xx.c line 41

Quoted 9 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.c new file +8 -0
+static const struct of_device_id bcm63xx_gpio_of_match[] = {
+       { .compatible = "brcm,bcm6318-gpio", },
+       { .compatible = "brcm,bcm6328-gpio", },
+       { .compatible = "brcm,bcm6358-gpio", },
+       { .compatible = "brcm,bcm6362-gpio", },
+       { .compatible = "brcm,bcm6368-gpio", },
+       { .compatible = "brcm,bcm63268-gpio", },
 
+       { /* sentinel */ },

Comma is not needed in terminator line

Quoted 1 line

+};

...

Quoted 1 line

+ dev_info(dev, "registered\n");

Unneeded noise.

...

drivers/pinctrl/bcm/pinctrl-bcm63xx.h line 11

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +2 -0
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/regmap.h>

The rule of thumb is to include only the headers that the below code is direct user of.

The above are not used anyhow, while missed types.h and several forward declarations.

Quoted 1 line

+#include "../core.h"

Seems the same.

Quoted 11 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +11 -0
+#define BCM63XX_BANK_GPIOS 32
+
+struct bcm63xx_pinctrl_soc {
+       struct pinctrl_ops *pctl_ops;
+       struct pinmux_ops *pmx_ops;
+
+       const struct pinctrl_pin_desc *pins;
+       unsigned npins;
+
+       unsigned int ngpios;
+};

drivers/pinctrl/bcm/pinctrl-bcm63xx.h line 35

Quoted 10 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +10 -0
+
+struct bcm63xx_pinctrl {
+       struct device *dev;
+       struct regmap *regs;
+
+       struct pinctrl_desc pctl_desc;
+       struct pinctrl_dev *pctl_dev;
+
+       void *driver_data;
+};

--
With Best Regards,
Andy Shevchenko

#20 lore raw

Re: [PATCH v4 03/15] pinctrl: bcm: add bcm63xx base code

Hi Andy

Quoted 11 lines · Andy Shevchenko
Quoted 5 lines · Álvaro Fernández Rojas

Add a helper for registering BCM63XX pin controllers.

This SoB is in a strange place.

Why?
Can’t we both sign the patches?

Quoted 7 lines

The order is wrong taking into account the From header (committer). So, it's not clear who is the author, who is a co-developer, and who is the committer (one person may utilize few roles).
Check for the rest of the series as well (basically this is the rule of thumb to recheck entire code for the comment you have got at any single place of it).

Jonas was the original author of this patches (sent back in 2016) and I’m just continuing his work and trying to get those patches upstreamed. I don’t know how to do it correctly, so a little hint would be appreciated.

Quoted 11 lines

...

Quoted 7 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.c new file +7 -0
+static const struct of_device_id bcm63xx_gpio_of_match[] = {
+       { .compatible = "brcm,bcm6318-gpio", },
+       { .compatible = "brcm,bcm6328-gpio", },
+       { .compatible = "brcm,bcm6358-gpio", },
+       { .compatible = "brcm,bcm6362-gpio", },
+       { .compatible = "brcm,bcm6368-gpio", },
+       { .compatible = "brcm,bcm63268-gpio", },
Quoted 3 lines
Quoted 1 line

+ { /* sentinel */ },

Comma is not needed in terminator line

Ok, I will remove it.

Quoted 8 lines
Quoted 2 lines

+};

...

Quoted 1 line

+ dev_info(dev, "registered\n");

Unneeded noise.

Ok, I will remove it.

Quoted 8 lines

...

drivers/pinctrl/bcm/pinctrl-bcm63xx.h line 11

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +2 -0
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/regmap.h>

The rule of thumb is to include only the headers that the below code is direct user of.

Ok, so I will move them to pinctrl-bcm63xx.c. I added them because they were needed for pinctrl_desc.

Quoted 3 lines

The above are not used anyhow, while missed types.h and several forward declarations.

… so I should include linux/types.h and I don’t know what you mean by “several forward declarations”…

Quoted 4 lines
Quoted 2 lines

+#include "../core.h"

Seems the same.

Ok, I will move it to pinctrl-bcm63xx.c.

Quoted 19 lines
Quoted 19 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +18 -0
+#define BCM63XX_BANK_GPIOS 32
+
+struct bcm63xx_pinctrl_soc {
+       struct pinctrl_ops *pctl_ops;
+       struct pinmux_ops *pmx_ops;
+
+       const struct pinctrl_pin_desc *pins;
+       unsigned npins;
+
+       unsigned int ngpios;
+};
+
+struct bcm63xx_pinctrl {
+       struct device *dev;
+       struct regmap *regs;
+
+       struct pinctrl_desc pctl_desc;
+       struct pinctrl_dev *pctl_dev;
Quoted 8 lines

drivers/pinctrl/bcm/pinctrl-bcm63xx.h line 35

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +3 -0
+
+       void *driver_data;
+};

--
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#21 lore raw

Re: [PATCH v4 03/15] pinctrl: bcm: add bcm63xx base code

Quoted 6 lines · Álvaro Fernández Rojas
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

Add a helper for registering BCM63XX pin controllers.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This SoB is in a strange place.

Why?
Can’t we both sign the patches?

You can, but you have to follow the rules (see chapters 11-13 in the [1]).

Quoted 9 lines
Quoted 6 lines

The order is wrong taking into account the From header (committer). So, it's not clear who is the author, who is a co-developer, and who is the committer (one person may utilize few roles).
Check for the rest of the series as well (basically this is the rule of thumb to recheck entire code for the comment you have got at any single place of it).

Jonas was the original author of this patches (sent back in 2016) and I’m just continuing his work and trying to get those patches upstreamed. I don’t know how to do it correctly, so a little hint would be appreciated.

There are two ways (depends on the amount of work you have done):
- leave him as an original author (so Author field will have his name, not yours) and apply yours with Co-developed-by tag and SoB since you are co-developed and committed
- other way around

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

...

Quoted 8 lines
Quoted 5 lines

drivers/pinctrl/bcm/pinctrl-bcm63xx.h line 11

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +2 -0
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/regmap.h>

The rule of thumb is to include only the headers that the below code is direct user of.

Ok, so I will move them to pinctrl-bcm63xx.c. I added them because they were needed for pinctrl_desc.

Ah, for that yes, you need a header.

Quoted 4 lines
Quoted 2 lines

The above are not used anyhow, while missed types.h and several forward declarations.

… so I should include linux/types.h and I don’t know what you mean by “several forward declarations”…

Like

struct regmap;

which effectively tells the compiler that "hey, this type is defined somewhere else".

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#22 lore raw

Re: [PATCH v4 03/15] pinctrl: bcm: add bcm63xx base code

Hi Andy,

Quoted 26 lines · Andy Shevchenko
Quoted 6 lines · Álvaro Fernández Rojas
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

Add a helper for registering BCM63XX pin controllers.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This SoB is in a strange place.

Why?
Can’t we both sign the patches?

You can, but you have to follow the rules (see chapters 11-13 in the [1]).

Quoted 7 lines
Quoted 6 lines

The order is wrong taking into account the From header (committer). So, it's not clear who is the author, who is a co-developer, and who is the committer (one person may utilize few roles).
Check for the rest of the series as well (basically this is the rule of thumb to recheck entire code for the comment you have got at any single place of it).

Quoted 8 lines
Quoted 2 lines

Jonas was the original author of this patches (sent back in 2016) and I’m just continuing his work and trying to get those patches upstreamed. I don’t know how to do it correctly, so a little hint would be appreciated.

There are two ways (depends on the amount of work you have done):
- leave him as an original author (so Author field will have his name, not yours) and apply yours with Co-developed-by tag and SoB since you are co-developed and committed
- other way around

So I will move his SoB to the top, add a Co-developed-by referencing him before that and then leave my SoB as the last one. @Jonas are you OK with that?

Quoted 19 lines

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

...

Quoted 8 lines
Quoted 5 lines

drivers/pinctrl/bcm/pinctrl-bcm63xx.h line 11

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm63xx.h new file +2 -0
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/regmap.h>

The rule of thumb is to include only the headers that the below code is direct user of.

Ok, so I will move them to pinctrl-bcm63xx.c. I added them because they were needed for pinctrl_desc.

Ah, for that yes, you need a header.

Quoted 3 lines
Quoted 2 lines

The above are not used anyhow, while missed types.h and several forward declarations.

Quoted 12 lines
Quoted 1 line

… so I should include linux/types.h and I don’t know what you mean by “several forward declarations”…

Like

struct regmap;

which effectively tells the compiler that "hey, this type is defined somewhere else".

Signature · 2 lines
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#23 lore raw

Re: [PATCH v4 03/15] pinctrl: bcm: add bcm63xx base code

Quoted 28 lines · Álvaro Fernández Rojas
Quoted 28 lines · Andy Shevchenko
Quoted 6 lines · Álvaro Fernández Rojas
Quoted 6 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas

Add a helper for registering BCM63XX pin controllers.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

This SoB is in a strange place.

Why?
Can’t we both sign the patches?

You can, but you have to follow the rules (see chapters 11-13 in the [1]).

Quoted 9 lines
Quoted 6 lines

The order is wrong taking into account the From header (committer). So, it's not clear who is the author, who is a co-developer, and who is the committer (one person may utilize few roles).
Check for the rest of the series as well (basically this is the rule of thumb to recheck entire code for the comment you have got at any single place of it).

Jonas was the original author of this patches (sent back in 2016) and I’m just continuing his work and trying to get those patches upstreamed. I don’t know how to do it correctly, so a little hint would be appreciated.

Quoted 7 lines
Quoted 5 lines

There are two ways (depends on the amount of work you have done):
- leave him as an original author (so Author field will have his name, not yours) and apply yours with Co-developed-by tag and SoB since you are co-developed and committed
- other way around

So I will move his SoB to the top, add a Co-developed-by referencing him before that and then leave my SoB as the last one.

Yes, if it is what you, guys, agreed on and want to have. Something like this.

Co-developed-by: Jonas
SoB: Jonas
SoB: you (and From in the email should be yours as one who submitted the change)

Quoted 3 lines

@Jonas are you OK with that?

Quoted 1 line

[1]: https://www.kernel.org/doc/html/latest/process/submitting-patches.html#sign-your-work-the-developer-s-certificate-of-origin

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#24 lore raw

PATCH v4 4/15 Documentation: add BCM6328 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6328 SoCs.

---
v4: no changes
v3: add new gpio node
v2: remove interrupts

 .../pinctrl/brcm,bcm6328-pinctrl.yaml         | 171 ++++++++++++++++++
 1 file changed, 171 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml new file +171 -0
new file mode 100644
index 000000000000..d4e3c7897f19
@@ -0,0 +1,171 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6328-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6328 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6328-pinctrl
+
+patternProperties:
+  '^gpio$':
+    type: object
+    properties:
+      compatible:
+        const: brcm,bcm6328-gpio
+
+      data:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the data register (in bytes).
+
+      dirout:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the dirout register (in bytes).
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      gpio-ranges:
+        maxItems: 1
+
+    required:
+      - gpio-controller
+      - gpio-ranges
+      - '#gpio-cells'
+
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ serial_led_data, serial_led_clk, inet_act_led, pcie_clkreq,
+                  led, ephy0_act_led, ephy1_act_led, ephy2_act_led,
+                  ephy3_act_led, hsspi_cs1, usb_device_port, usb_host_port ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio6, gpio7, gpio11, gpio16, gpio17, gpio18, gpio19,
+                  gpio20, gpio25, gpio26, gpio27, gpio28, hsspi_cs1,
+                  usb_port1 ]
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_cntl@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6328-pinctrl";
+
+        gpio {
+          compatible = "brcm,bcm6328-gpio";
+          data = <0xc>;
+          dirout = <0x4>;
+
+          gpio-controller;
+          gpio-ranges = <&pinctrl 0 0 32>;
+          #gpio-cells = <2>;
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio6";
+          };
+
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio7";
+          };
+        };
+
+        pinctrl_inet_act_led: inet_act_led {
+          function = "inet_act_led";
+          pins = "gpio11";
+        };
+
+        pinctrl_pcie_clkreq: pcie_clkreq {
+          function = "pcie_clkreq";
+          pins = "gpio16";
+        };
+
+        pinctrl_ephy0_spd_led: ephy0_spd_led {
+          function = "led";
+          pins = "gpio17";
+        };
+
+        pinctrl_ephy1_spd_led: ephy1_spd_led {
+          function = "led";
+          pins = "gpio18";
+        };
+
+        pinctrl_ephy2_spd_led: ephy2_spd_led {
+          function = "led";
+          pins = "gpio19";
+        };
+
+        pinctrl_ephy3_spd_led: ephy3_spd_led {
+          function = "led";
+          pins = "gpio20";
+        };
+
+        pinctrl_ephy0_act_led: ephy0_act_led {
+          function = "ephy0_act_led";
+          pins = "gpio25";
+        };
+
+        pinctrl_ephy1_act_led: ephy1_act_led {
+          function = "ephy1_act_led";
+          pins = "gpio26";
+        };
+
+        pinctrl_ephy2_act_led: ephy2_act_led {
+          function = "ephy2_act_led";
+          pins = "gpio27";
+        };
+
+        pinctrl_ephy3_act_led: ephy3_act_led {
+          function = "ephy3_act_led";
+          pins = "gpio28";
+        };
+
+        pinctrl_hsspi_cs1: hsspi_cs1 {
+          function = "hsspi_cs1";
+          pins = "hsspi_cs1";
+        };
+
+        pinctrl_usb_port1_device: usb_port1_device {
+          function = "usb_device_port";
+          pins = "usb_port1";
+        };
+
+        pinctrl_usb_port1_host: usb_port1_host {
+          function = "usb_host_port";
+          pins = "usb_port1";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#25 lore raw

Re: [PATCH v4 04/15] Documentation: add BCM6328 pincontroller binding documentation

Am 2021-03-04 09:56, schrieb Álvaro Fernández Rojas:

Quoted 4 lines

Add binding documentation for the pincontrol core found in BCM6328 SoCs.

btw. the subject should (preferably) be prefixed with "dt-bindings:".

See Documentation/devicetree/bindings/submitting-patches.rst

-michael

#26 lore raw

PATCH v4 5/15 pinctrl: add a pincontrol driver for BCM6328

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode.

---
v4: no changes
v3: use new shared code
v2: switch to GPIO_REGMAP

 drivers/pinctrl/bcm/Kconfig           |   8 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6328.c | 403 ++++++++++++++++++++++++++
 3 files changed, 412 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6328.c
drivers/pinctrl/bcm/Kconfig +8 -0
index 882f19bdc243..d35e5d3fe26f 100644
@@ -36,6 +36,14 @@ config PINCTRL_BCM63XX
 	select PINCONF
 	select PINMUX
 
+config PINCTRL_BCM6328
+	bool "Broadcom BCM6328 GPIO driver"
+	depends on (BMIPS_GENERIC || COMPILE_TEST)
+	select PINCTRL_BCM63XX
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6328 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 0e3cf9b15c65..57e5434a6db6 100644
@@ -4,6 +4,7 @@
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM63XX)		+= pinctrl-bcm63xx.o
+obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.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
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +403 -0

403 lines not on this page · raw message

Signature · 1 line
2.20.1
#27 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Quoted 5 lines · Álvaro Fernández Rojas

Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode.

...

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 275

Quoted 7 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +6 -0
+static inline unsigned int bcm6328_mux_off(unsigned int pin)
+{
+       static const unsigned int bcm6328_mux[] = {
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
 
+               BCM6328_MUX_OTHER_REG

When it's not terminator add a comma, otherwise remove a comma.

Also, why is it inside a function? It's anyway global and constant.

Quoted 1 line

+ };

...

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 332

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +2 -0
+       regmap_update_bits(pc->regs, bcm6328_mux_off(pin),
+                          3UL << ((pin % 16) * 2),

3UL => #define BLABLA GENMASK(1, 0)

Quoted 1 line

+ mux << ((pin % 16) * 2));

...

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 392

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+static const struct of_device_id bcm6328_pinctrl_match[] = {
+       { .compatible = "brcm,bcm6328-pinctrl", },
+       { },

No comma.

Quoted 1 line

+};

Above comments to all your patches.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#28 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Hi Andy,

Quoted 18 lines · Andy Shevchenko
Quoted 5 lines · Álvaro Fernández Rojas

Add a pincontrol driver for BCM6328. BCM628 supports muxing 32 pins as GPIOs, as LEDs for the integrated LED controller, or various other functions. Its pincontrol mux registers also control other aspects, like switching the second USB port between host and device mode.

...

Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +5 -0
+static inline unsigned int bcm6328_mux_off(unsigned int pin)
+{
+       static const unsigned int bcm6328_mux[] = {
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
Quoted 3 lines
Quoted 1 line

+ BCM6328_MUX_OTHER_REG

When it's not terminator add a comma, otherwise remove a comma.

… so you want me to add a comma or not?

Quoted 2 lines

Also, why is it inside a function? It's anyway global and constant.

Because this is only used by this function and I’m used to doing this to comply with MISRA C 2004 at work :)

Quoted 9 lines
Quoted 2 lines

+ };

...

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 332

Quoted 2 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +2 -0
+       regmap_update_bits(pc->regs, bcm6328_mux_off(pin),
+                          3UL << ((pin % 16) * 2),

3UL => #define BLABLA GENMASK(1, 0)

Ok, I will add a define for this.

Quoted 10 lines
Quoted 2 lines

+ mux << ((pin % 16) * 2));

...

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 392

Quoted 3 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+static const struct of_device_id bcm6328_pinctrl_match[] = {
+       { .compatible = "brcm,bcm6328-pinctrl", },
+       { },

No comma.

Ok, I will remove the comma.

Quoted 4 lines
Quoted 2 lines

+};

Above comments to all your patches.

Ok, I will try to address all of this comments in v5.

Quoted 4 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko
#29 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Quoted 3 lines · Álvaro Fernández Rojas
Quoted 3 lines · Andy Shevchenko

On Thu, Mar 4, 2021 at 10:57 AM Álvaro Fernández Rojas <[email protected]> wrote:

...

Quoted 9 lines
Quoted 7 lines

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 275

Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +4 -0
+       static const unsigned int bcm6328_mux[] = {
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
 
+               BCM6328_MUX_OTHER_REG

When it's not terminator add a comma, otherwise remove a comma.

… so you want me to add a comma or not?

Hmm... you tell me! If this is a list which covers all possible cases _and_ the last one is the kinda maximum value (aka terminator), then comma is not needed, otherwise add it (to me feels like the latter should be done here).

Quoted 3 lines
Quoted 1 line

Also, why is it inside a function? It's anyway global and constant.

Because this is only used by this function and I’m used to doing this to comply with MISRA C 2004 at work :)

It makes code a bit harder to read.

Quoted 1 line
Quoted 1 line
Quoted 1 line

+ };

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#30 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Quoted 17 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas
Quoted 3 lines · Andy Shevchenko

On Thu, Mar 4, 2021 at 10:57 AM Álvaro Fernández Rojas <[email protected]> wrote:

...

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +4 -0
+       static const unsigned int bcm6328_mux[] = {
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
 
+               BCM6328_MUX_OTHER_REG
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

When it's not terminator add a comma, otherwise remove a comma.

… so you want me to add a comma or not?

Hmm... you tell me! If this is a list which covers all possible cases _and_ the last one is the kinda maximum value (aka terminator), then comma is not needed, otherwise add it (to me feels like the latter should be done here).

Well… Then it shouldn’t be needed, since this is a list which covers all possible cases and the last one is a terminator.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Also, why is it inside a function? It's anyway global and constant.

Because this is only used by this function and I’m used to doing this to comply with MISRA C 2004 at work :)

It makes code a bit harder to read.

Ok, I will make it global in the next version.

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

+ };

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#31 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Quoted 5 lines · Álvaro Fernández Rojas
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas
Quoted 3 lines · Andy Shevchenko

On Thu, Mar 4, 2021 at 10:57 AM Álvaro Fernández Rojas <[email protected]> wrote:

...

Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 275

Quoted 4 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
 
+               BCM6328_MUX_OTHER_REG

When it's not terminator add a comma, otherwise remove a comma.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

… so you want me to add a comma or not?

Hmm... you tell me! If this is a list which covers all possible cases _and_ the last one is the kinda maximum value (aka terminator), then comma is not needed, otherwise add it (to me feels like the latter should be done here).

Well… Then it shouldn’t be needed, since this is a list which covers all possible cases and the last one is a terminator.

Honestly the name suggests otherwise. And looking into the code there is no guarantee you won't split that _OTHER_ area to something with new compatible hardware.
Renaming to BCM6328_MUX_MAX_REG will clear that this is terminator, but it means its value shouldn't be used except as to understand the amount of supported registers of this enumerator.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#32 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Hi Andy,

Quoted 25 lines · Andy Shevchenko
Quoted 5 lines · Álvaro Fernández Rojas
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas
Quoted 3 lines · Andy Shevchenko

On Thu, Mar 4, 2021 at 10:57 AM Álvaro Fernández Rojas <[email protected]> wrote:

...

Quoted 14 lines
Quoted 13 lines
Quoted 8 lines
Quoted 6 lines

drivers/pinctrl/bcm/pinctrl-bcm6328.c line 275

Quoted 4 lines
drivers/pinctrl/bcm/pinctrl-bcm6328.c new file +3 -0
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
 
+               BCM6328_MUX_OTHER_REG

When it's not terminator add a comma, otherwise remove a comma.

… so you want me to add a comma or not?

Hmm... you tell me! If this is a list which covers all possible cases _and_ the last one is the kinda maximum value (aka terminator), then comma is not needed, otherwise add it (to me feels like the latter should be done here).

Quoted 5 lines
Quoted 1 line

Well… Then it shouldn’t be needed, since this is a list which covers all possible cases and the last one is a terminator.

Honestly the name suggests otherwise. And looking into the code there is no guarantee you won't split that _OTHER_ area to something with new compatible hardware.

Every BCM63XX device has its own specific pin controllers.
It seems that on every new SoC created by Broadcom they decided that the previous pin controller approach was a bad decision or something xD. Therefore I don’t think there will be such “new compatible hardware”...

Quoted 3 lines

Renaming to BCM6328_MUX_MAX_REG will clear that this is terminator, but it means its value shouldn't be used except as to understand the amount of supported registers of this enumerator.

No, I don’t think this is a good idea.
Please, take a look at:
https://github.com/jameshilliard/gfiber-gflt100/blob/b292e8c271addbda62104bece90e3c8018714194/shared/opensource/include/bcm963xx/6328_map_part.h#L410-L441
As you can see, BCM6328_MUX_LO_REG and BCM6328_MUX_HI_REG are used for specific GPIOs, but BCM6328_MUX_OTHER_REG is used for pins which lack a direct GPIO assignment.

Quoted 5 lines
Signature · 3 lines
-- 
With Best Regards,
Andy Shevchenko

Best regards,
Álvaro.

#33 lore raw

Re: [PATCH v4 05/15] pinctrl: add a pincontrol driver for BCM6328

Quoted 34 lines · Álvaro Fernández Rojas
Quoted 24 lines · Andy Shevchenko
Quoted 5 lines · Álvaro Fernández Rojas
Quoted 5 lines · Andy Shevchenko
Quoted 3 lines · Álvaro Fernández Rojas
Quoted 3 lines · Andy Shevchenko

On Thu, Mar 4, 2021 at 10:57 AM Álvaro Fernández Rojas <[email protected]> wrote:

...

Quoted 14 lines
Quoted 13 lines
Quoted 8 lines
Quoted 6 lines

Review

Quoted 4 lines
(quoted diff) +3 -0
+               BCM6328_MUX_LO_REG,
+               BCM6328_MUX_HI_REG,
 
+               BCM6328_MUX_OTHER_REG

When it's not terminator add a comma, otherwise remove a comma.

… so you want me to add a comma or not?

Hmm... you tell me! If this is a list which covers all possible cases _and_ the last one is the kinda maximum value (aka terminator), then comma is not needed, otherwise add it (to me feels like the latter should be done here).

Quoted 5 lines
Quoted 1 line

Well… Then it shouldn’t be needed, since this is a list which covers all possible cases and the last one is a terminator.

Honestly the name suggests otherwise. And looking into the code there is no guarantee you won't split that _OTHER_ area to something with new compatible hardware.

Every BCM63XX device has its own specific pin controllers.
It seems that on every new SoC created by Broadcom they decided that the previous pin controller approach was a bad decision or something xD. Therefore I don’t think there will be such “new compatible hardware”...

Quoted 8 lines
Quoted 3 lines

Renaming to BCM6328_MUX_MAX_REG will clear that this is terminator, but it means its value shouldn't be used except as to understand the amount of supported registers of this enumerator.

No, I don’t think this is a good idea.
Please, take a look at:
https://github.com/jameshilliard/gfiber-gflt100/blob/b292e8c271addbda62104bece90e3c8018714194/shared/opensource/include/bcm963xx/6328_map_part.h#L410-L441
As you can see, BCM6328_MUX_LO_REG and BCM6328_MUX_HI_REG are used for specific GPIOs, but BCM6328_MUX_OTHER_REG is used for pins which lack a direct GPIO assignment.

Understood. Thanks for elaboration. Go ahead with current approach, thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#34 lore raw

PATCH v4 6/15 Documentation: add BCM6358 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6358 SoCs.

---
v4: no changes
v3: add new gpio node
v2: remove interrupts

 .../pinctrl/brcm,bcm6358-pinctrl.yaml         | 137 ++++++++++++++++++
 1 file changed, 137 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml new file +137 -0
new file mode 100644
index 000000000000..eb14dd4cdaaa
@@ -0,0 +1,137 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6358-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6358 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6358-pinctrl
+
+patternProperties:
+  '^gpio$':
+    type: object
+    properties:
+      compatible:
+        const: brcm,bcm6358-gpio
+
+      data:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the data register (in bytes).
+
+      dirout:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the dirout register (in bytes).
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      gpio-ranges:
+        maxItems: 1
+
+    required:
+      - gpio-controller
+      - gpio-ranges
+      - '#gpio-cells'
+
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ ebi_cs, uart1, serial_led, legacy_led, led, spi_cs, utopia,
+                  pwm_syn_clk, sys_irq ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ ebi_cs_grp, uart1_grp, serial_led_grp, legacy_led_grp,
+                  led_grp, spi_cs_grp, utopia_grp, pwm_syn_clk, sys_irq_grp ]
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_cntl@fffe0080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0xfffe0080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6358-pinctrl";
+
+        gpio {
+          compatible = "brcm,bcm6358-gpio";
+          data = <0xc>;
+          dirout = <0x4>;
+
+          gpio-controller;
+          gpio-ranges = <&pinctrl 0 0 40>;
+          #gpio-cells = <2>;
+        };
+
+        pinctrl_ebi_cs: ebi_cs {
+          function = "ebi_cs";
+          groups = "ebi_cs_grp";
+        };
+
+        pinctrl_uart1: uart1 {
+          function = "uart1";
+          groups = "uart1_grp";
+        };
+
+        pinctrl_serial_led: serial_led {
+          function = "serial_led";
+          groups = "serial_led_grp";
+        };
+
+        pinctrl_legacy_led: legacy_led {
+          function = "legacy_led";
+          groups = "legacy_led_grp";
+        };
+
+        pinctrl_led: led {
+          function = "led";
+          groups = "led_grp";
+        };
+
+        pinctrl_spi_cs_23: spi_cs {
+          function = "spi_cs";
+          groups = "spi_cs_grp";
+        };
+
+        pinctrl_utopia: utopia {
+          function = "utopia";
+          groups = "utopia_grp";
+        };
+
+        pinctrl_pwm_syn_clk: pwm_syn_clk {
+          function = "pwm_syn_clk";
+          groups = "pwm_syn_clk_grp";
+        };
+
+        pinctrl_sys_irq: sys_irq {
+          function = "sys_irq";
+          groups = "sys_irq_grp";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#35 lore raw

PATCH v4 7/15 pinctrl: add a pincontrol driver for BCM6358

In reply to Álvaro Fernández Rojas

Add a pincotrol driver for BCM6358. BCM6358 allow overlaying different functions onto the GPIO pins. It does not support configuring individual pins but only whole groups. These groups may overlap, and still require the directions to be set correctly in the GPIO register. In addition the functions register controls other, not directly mux related functions.

---
v4: no changes
v3: use new shared code
v2: switch to GPIO_REGMAP

 drivers/pinctrl/bcm/Kconfig           |   8 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6358.c | 369 ++++++++++++++++++++++++++
 3 files changed, 378 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6358.c
drivers/pinctrl/bcm/Kconfig +8 -0
index d35e5d3fe26f..ced7cc6ab44f 100644
@@ -44,6 +44,14 @@ config PINCTRL_BCM6328
 	help
 	   Say Y here to enable the Broadcom BCM6328 GPIO driver.
 
+config PINCTRL_BCM6358
+	bool "Broadcom BCM6358 GPIO driver"
+	depends on (BMIPS_GENERIC || COMPILE_TEST)
+	select PINCTRL_BCM63XX
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6358 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 57e5434a6db6..c3f5b7b2f2f0 100644
@@ -5,6 +5,7 @@ obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM63XX)		+= pinctrl-bcm63xx.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
+obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.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
drivers/pinctrl/bcm/pinctrl-bcm6358.c new file +369 -0

369 lines not on this page · raw message

Signature · 1 line
2.20.1
#36 lore raw

PATCH v4 8/15 Documentation: add BCM6362 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6362 SoCs.

---
v4: no changes
v3: add new gpio node
v2: remove interrupts

 .../pinctrl/brcm,bcm6362-pinctrl.yaml         | 250 ++++++++++++++++++
 1 file changed, 250 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml new file +250 -0
new file mode 100644
index 000000000000..f33b56cd883f
@@ -0,0 +1,250 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6362-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6362 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6362-pinctrl
+
+patternProperties:
+  '^gpio$':
+    type: object
+    properties:
+      compatible:
+        const: brcm,bcm6362-gpio
+
+      data:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the data register (in bytes).
+
+      dirout:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the dirout register (in bytes).
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      gpio-ranges:
+        maxItems: 1
+
+    required:
+      - gpio-controller
+      - gpio-ranges
+      - '#gpio-cells'
+
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ usb_device_led, sys_irq, serial_led_clk, serial_led_data,
+                  robosw_led_data, robosw_led_clk, robosw_led0, robosw_led1,
+                  inet_led, spi_cs2, spi_cs3, ntr_pulse, uart1_scts,
+                  uart1_srts, uart1_sdin, uart1_sdout, adsl_spi_miso,
+                  adsl_spi_mosi, adsl_spi_clk, adsl_spi_cs, ephy0_led,
+                  ephy1_led, ephy2_led, ephy3_led, ext_irq0, ext_irq1,
+                  ext_irq2, ext_irq3, nand ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7,
+                  gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14,
+                  gpio15, gpio16, gpio17, gpio18, gpio19, gpio20, gpio21,
+                  gpio22, gpio23, gpio24, gpio25, gpio26, gpio27, nand_grp ]
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_cntl@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6362-pinctrl";
+
+        gpio {
+          compatible = "brcm,bcm6362-gpio";
+          data = <0xc>;
+          dirout = <0x4>;
+
+          gpio-controller;
+          gpio-ranges = <&pinctrl 0 0 48>;
+          #gpio-cells = <2>;
+        };
+
+        pinctrl_usb_device_led: usb_device_led {
+          function = "usb_device_led";
+          pins = "gpio0";
+        };
+
+        pinctrl_sys_irq: sys_irq {
+          function = "sys_irq";
+          pins = "gpio1";
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio2";
+          };
+
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio3";
+          };
+        };
+
+        pinctrl_robosw_led_data: robosw_led_data {
+          function = "robosw_led_data";
+          pins = "gpio4";
+        };
+
+        pinctrl_robosw_led_clk: robosw_led_clk {
+          function = "robosw_led_clk";
+          pins = "gpio5";
+        };
+
+        pinctrl_robosw_led0: robosw_led0 {
+          function = "robosw_led0";
+          pins = "gpio6";
+        };
+
+        pinctrl_robosw_led1: robosw_led1 {
+          function = "robosw_led1";
+          pins = "gpio7";
+        };
+
+        pinctrl_inet_led: inet_led {
+          function = "inet_led";
+          pins = "gpio8";
+        };
+
+        pinctrl_spi_cs2: spi_cs2 {
+          function = "spi_cs2";
+          pins = "gpio9";
+        };
+
+        pinctrl_spi_cs3: spi_cs3 {
+          function = "spi_cs3";
+          pins = "gpio10";
+        };
+
+        pinctrl_ntr_pulse: ntr_pulse {
+          function = "ntr_pulse";
+          pins = "gpio11";
+        };
+
+        pinctrl_uart1_scts: uart1_scts {
+          function = "uart1_scts";
+          pins = "gpio12";
+        };
+
+        pinctrl_uart1_srts: uart1_srts {
+          function = "uart1_srts";
+          pins = "gpio13";
+        };
+
+        pinctrl_uart1: uart1 {
+          pinctrl_uart1_sdin: uart1_sdin {
+            function = "uart1_sdin";
+            pins = "gpio14";
+          };
+
+          pinctrl_uart1_sdout: uart1_sdout {
+            function = "uart1_sdout";
+            pins = "gpio15";
+          };
+        };
+
+        pinctrl_adsl_spi: adsl_spi {
+          pinctrl_adsl_spi_miso: adsl_spi_miso {
+            function = "adsl_spi_miso";
+            pins = "gpio16";
+          };
+
+          pinctrl_adsl_spi_mosi: adsl_spi_mosi {
+            function = "adsl_spi_mosi";
+            pins = "gpio17";
+          };
+
+          pinctrl_adsl_spi_clk: adsl_spi_clk {
+            function = "adsl_spi_clk";
+            pins = "gpio18";
+          };
+
+          pinctrl_adsl_spi_cs: adsl_spi_cs {
+            function = "adsl_spi_cs";
+            pins = "gpio19";
+          };
+        };
+
+        pinctrl_ephy0_led: ephy0_led {
+          function = "ephy0_led";
+          pins = "gpio20";
+        };
+
+        pinctrl_ephy1_led: ephy1_led {
+          function = "ephy1_led";
+          pins = "gpio21";
+        };
+
+        pinctrl_ephy2_led: ephy2_led {
+          function = "ephy2_led";
+          pins = "gpio22";
+        };
+
+        pinctrl_ephy3_led: ephy3_led {
+          function = "ephy3_led";
+          pins = "gpio23";
+        };
+
+        pinctrl_ext_irq0: ext_irq0 {
+          function = "ext_irq0";
+          pins = "gpio24";
+        };
+
+        pinctrl_ext_irq1: ext_irq1 {
+          function = "ext_irq1";
+          pins = "gpio25";
+        };
+
+        pinctrl_ext_irq2: ext_irq2 {
+          function = "ext_irq2";
+          pins = "gpio26";
+        };
+
+        pinctrl_ext_irq3: ext_irq3 {
+          function = "ext_irq3";
+          pins = "gpio27";
+        };
+
+        pinctrl_nand: nand {
+          function = "nand";
+          group = "nand_grp";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#37 lore raw

PATCH v4 9/15 pinctrl: add a pincontrol driver for BCM6362

In reply to Álvaro Fernández Rojas

Add a pincotrol driver for BCM6362. BCM6362 allows muxing individual GPIO pins to the LED controller, to be available by the integrated wifi, or other functions. It also supports overlay groups, of which only NAND is documented.

---
v4: no changes
v3: use new shared code
v2: switch to GPIO_REGMAP

 drivers/pinctrl/bcm/Kconfig           |   8 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6362.c | 617 ++++++++++++++++++++++++++
 3 files changed, 626 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6362.c
drivers/pinctrl/bcm/Kconfig +8 -0
index ced7cc6ab44f..d3101d5e750f 100644
@@ -52,6 +52,14 @@ config PINCTRL_BCM6358
 	help
 	   Say Y here to enable the Broadcom BCM6358 GPIO driver.
 
+config PINCTRL_BCM6362
+	bool "Broadcom BCM6362 GPIO driver"
+	depends on (BMIPS_GENERIC || COMPILE_TEST)
+	select PINCTRL_BCM63XX
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6362 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index c3f5b7b2f2f0..b9b09e5b914c 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM63XX)		+= pinctrl-bcm63xx.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
+obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.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
drivers/pinctrl/bcm/pinctrl-bcm6362.c new file +617 -0

617 lines not on this page · raw message

Signature · 1 line
2.20.1
#38 lore raw

PATCH v4 10/15 Documentation: add BCM6368 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6368 SoCs.

---
v4: no changes
v3: add new gpio node
v2: remove interrupts

 .../pinctrl/brcm,bcm6368-pinctrl.yaml         | 261 ++++++++++++++++++
 1 file changed, 261 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml new file +261 -0
new file mode 100644
index 000000000000..6a289c93d6b4
@@ -0,0 +1,261 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6368-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6368 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6368-pinctrl
+
+patternProperties:
+  '^gpio$':
+    type: object
+    properties:
+      compatible:
+        const: brcm,bcm6368-gpio
+
+      data:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the data register (in bytes).
+
+      dirout:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the dirout register (in bytes).
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      gpio-ranges:
+        maxItems: 1
+
+    required:
+      - gpio-controller
+      - gpio-ranges
+      - '#gpio-cells'
+
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ analog_afe_0, analog_afe_1, sys_irq, serial_led_data,
+                  serial_led_clk, inet_led, ephy0_led, ephy1_led, ephy2_led,
+                  ephy3_led, robosw_led_data, robosw_led_clk, robosw_led0,
+                  robosw_led1, usb_device_led, pci_req1, pci_gnt1, pci_intb,
+                  pci_req0, pci_gnt0, pcmcia_cd1, pcmcia_cd2, pcmcia_vs1,
+                  pcmcia_vs2, ebi_cs2, ebi_cs3, spi_cs2, spi_cs3, spi_cs4,
+                  spi_cs5, uart1 ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7,
+                  gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14,
+                  gpio16, gpio17, gpio18, gpio19, gpio20, gpio22, gpio23,
+                  gpio24, gpio25, gpio26, gpio27, gpio28, gpio29, gpio30,
+                  gpio31, uart1_grp ]
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_cntl@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6368-pinctrl";
+
+        gpio {
+          compatible = "brcm,bcm6368-gpio";
+          data = <0xc>;
+          dirout = <0x4>;
+
+          gpio-controller;
+          gpio-ranges = <&pinctrl 0 0 38>;
+          #gpio-cells = <2>;
+        };
+
+        pinctrl_analog_afe_0: analog_afe_0 {
+          function = "analog_afe_0";
+          pins = "gpio0";
+        };
+
+        pinctrl_analog_afe_1: analog_afe_1 {
+          function = "analog_afe_1";
+          pins = "gpio1";
+        };
+
+        pinctrl_sys_irq: sys_irq {
+          function = "sys_irq";
+          pins = "gpio2";
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio3";
+          };
+
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio4";
+          };
+        };
+
+        pinctrl_inet_led: inet_led {
+          function = "inet_led";
+          pins = "gpio5";
+        };
+
+        pinctrl_ephy0_led: ephy0_led {
+          function = "ephy0_led";
+          pins = "gpio6";
+        };
+
+        pinctrl_ephy1_led: ephy1_led {
+          function = "ephy1_led";
+          pins = "gpio7";
+        };
+
+        pinctrl_ephy2_led: ephy2_led {
+          function = "ephy2_led";
+          pins = "gpio8";
+        };
+
+        pinctrl_ephy3_led: ephy3_led {
+          function = "ephy3_led";
+          pins = "gpio9";
+        };
+
+        pinctrl_robosw_led_data: robosw_led_data {
+          function = "robosw_led_data";
+          pins = "gpio10";
+        };
+
+        pinctrl_robosw_led_clk: robosw_led_clk {
+          function = "robosw_led_clk";
+          pins = "gpio11";
+        };
+
+        pinctrl_robosw_led0: robosw_led0 {
+          function = "robosw_led0";
+          pins = "gpio12";
+        };
+
+        pinctrl_robosw_led1: robosw_led1 {
+          function = "robosw_led1";
+          pins = "gpio13";
+        };
+
+        pinctrl_usb_device_led: usb_device_led {
+          function = "usb_device_led";
+          pins = "gpio14";
+        };
+
+        pinctrl_pci: pci {
+          pinctrl_pci_req1: pci_req1 {
+            function = "pci_req1";
+            pins = "gpio16";
+          };
+
+          pinctrl_pci_gnt1: pci_gnt1 {
+            function = "pci_gnt1";
+            pins = "gpio17";
+          };
+
+          pinctrl_pci_intb: pci_intb {
+            function = "pci_intb";
+            pins = "gpio18";
+          };
+
+          pinctrl_pci_req0: pci_req0 {
+            function = "pci_req0";
+            pins = "gpio19";
+          };
+
+          pinctrl_pci_gnt0: pci_gnt0 {
+            function = "pci_gnt0";
+            pins = "gpio20";
+          };
+        };
+
+        pinctrl_pcmcia: pcmcia {
+          pinctrl_pcmcia_cd1: pcmcia_cd1 {
+            function = "pcmcia_cd1";
+            pins = "gpio22";
+          };
+
+          pinctrl_pcmcia_cd2: pcmcia_cd2 {
+            function = "pcmcia_cd2";
+            pins = "gpio23";
+          };
+
+          pinctrl_pcmcia_vs1: pcmcia_vs1 {
+            function = "pcmcia_vs1";
+            pins = "gpio24";
+          };
+
+          pinctrl_pcmcia_vs2: pcmcia_vs2 {
+            function = "pcmcia_vs2";
+            pins = "gpio25";
+          };
+        };
+
+        pinctrl_ebi_cs2: ebi_cs2 {
+          function = "ebi_cs2";
+          pins = "gpio26";
+        };
+
+        pinctrl_ebi_cs3: ebi_cs3 {
+          function = "ebi_cs3";
+          pins = "gpio27";
+        };
+
+        pinctrl_spi_cs2: spi_cs2 {
+          function = "spi_cs2";
+          pins = "gpio28";
+        };
+
+        pinctrl_spi_cs3: spi_cs3 {
+          function = "spi_cs3";
+          pins = "gpio29";
+        };
+
+        pinctrl_spi_cs4: spi_cs4 {
+          function = "spi_cs4";
+          pins = "gpio30";
+        };
+
+        pinctrl_spi_cs5: spi_cs5 {
+          function = "spi_cs5";
+          pins = "gpio31";
+        };
+
+        pinctrl_uart1: uart1 {
+          function = "uart1";
+          group = "uart1_grp";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#39 lore raw

PATCH v4 11/15 pinctrl: add a pincontrol driver for BCM6368

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM6368. BCM6368 allows muxing the first 32 GPIOs onto alternative functions. Not all are documented.

---
v4: no changes
v3: use new shared code
v2: switch to GPIO_REGMAP

 drivers/pinctrl/bcm/Kconfig           |   8 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6368.c | 523 ++++++++++++++++++++++++++
 3 files changed, 532 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6368.c
drivers/pinctrl/bcm/Kconfig +8 -0
index d3101d5e750f..aabd4b762aed 100644
@@ -60,6 +60,14 @@ config PINCTRL_BCM6362
 	help
 	   Say Y here to enable the Broadcom BCM6362 GPIO driver.
 
+config PINCTRL_BCM6368
+	bool "Broadcom BCM6368 GPIO driver"
+	depends on (BMIPS_GENERIC || COMPILE_TEST)
+	select PINCTRL_BCM63XX
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6368 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index b9b09e5b914c..a1331bb9680e 100644
@@ -7,6 +7,7 @@ obj-$(CONFIG_PINCTRL_BCM63XX)		+= pinctrl-bcm63xx.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
+obj-$(CONFIG_PINCTRL_BCM6368)		+= pinctrl-bcm6368.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
drivers/pinctrl/bcm/pinctrl-bcm6368.c new file +523 -0

523 lines not on this page · raw message

Signature · 1 line
2.20.1
#40 lore raw

PATCH v4 12/15 Documentation: add BCM63268 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in the BCM63268 family SoCs.

---
v4: no changes
v3: add new gpio node
v2: remove interrupts

 .../pinctrl/brcm,bcm63268-pinctrl.yaml        | 208 ++++++++++++++++++
 1 file changed, 208 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml new file +208 -0
new file mode 100644
index 000000000000..1668ab567e35
@@ -0,0 +1,208 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm63268-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM63268 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm63268-pinctrl
+
+patternProperties:
+  '^gpio$':
+    type: object
+    properties:
+      compatible:
+        const: brcm,bcm63268-gpio
+
+      data:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the data register (in bytes).
+
+      dirout:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the dirout register (in bytes).
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      gpio-ranges:
+        maxItems: 1
+
+    required:
+      - gpio-controller
+      - gpio-ranges
+      - '#gpio-cells'
+
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ serial_led_clk, serial_led_data, hsspi_cs4, hsspi_cs5,
+                  hsspi_cs6, hsspi_cs7, adsl_spi_miso, adsl_spi_mosi,
+                  vreq_clk, pcie_clkreq_b, robosw_led_clk, robosw_led_data,
+                  nand, gpio35_alt, dectpd, vdsl_phy_override_0,
+                  vdsl_phy_override_1, vdsl_phy_override_2,
+                  vdsl_phy_override_3, dsl_gpio8, dsl_gpio9 ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio16, gpio17, gpio8, gpio9, gpio18, gpio19,
+                  gpio22, gpio23, gpio30, gpio31, nand_grp, gpio35
+                  dectpd_grp, vdsl_phy_override_0_grp,
+                  vdsl_phy_override_1_grp, vdsl_phy_override_2_grp,
+                  vdsl_phy_override_3_grp, dsl_gpio8, dsl_gpio9 ]
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_cntl@100000c0 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x100000c0 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm63268-pinctrl";
+
+        gpio {
+          compatible = "brcm,bcm63268-gpio";
+          data = <0xc>;
+          dirout = <0x4>;
+
+          gpio-controller;
+          gpio-ranges = <&pinctrl 0 0 52>;
+          #gpio-cells = <2>;
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio0";
+          };
+
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio1";
+          };
+        };
+
+        pinctrl_hsspi_cs4: hsspi_cs4 {
+          function = "hsspi_cs4";
+          pins = "gpio16";
+        };
+
+        pinctrl_hsspi_cs5: hsspi_cs5 {
+          function = "hsspi_cs5";
+          pins = "gpio17";
+        };
+
+        pinctrl_hsspi_cs6: hsspi_cs6 {
+          function = "hsspi_cs6";
+          pins = "gpio8";
+        };
+
+        pinctrl_hsspi_cs7: hsspi_cs7 {
+          function = "hsspi_cs7";
+          pins = "gpio9";
+        };
+
+        pinctrl_adsl_spi: adsl_spi {
+          pinctrl_adsl_spi_miso: adsl_spi_miso {
+            function = "adsl_spi_miso";
+            pins = "gpio18";
+          };
+
+          pinctrl_adsl_spi_mosi: adsl_spi_mosi {
+            function = "adsl_spi_mosi";
+            pins = "gpio19";
+          };
+        };
+
+        pinctrl_vreq_clk: vreq_clk {
+          function = "vreq_clk";
+          pins = "gpio22";
+        };
+
+        pinctrl_pcie_clkreq_b: pcie_clkreq_b {
+          function = "pcie_clkreq_b";
+          pins = "gpio23";
+        };
+
+        pinctrl_robosw_led_clk: robosw_led_clk {
+          function = "robosw_led_clk";
+          pins = "gpio30";
+        };
+
+        pinctrl_robosw_led_data: robosw_led_data {
+          function = "robosw_led_data";
+          pins = "gpio31";
+        };
+
+        pinctrl_nand: nand {
+          function = "nand";
+          group = "nand_grp";
+        };
+
+        pinctrl_gpio35_alt: gpio35_alt {
+          function = "gpio35_alt";
+          pin = "gpio35";
+        };
+
+        pinctrl_dectpd: dectpd {
+          function = "dectpd";
+          group = "dectpd_grp";
+        };
+
+        pinctrl_vdsl_phy_override_0: vdsl_phy_override_0 {
+          function = "vdsl_phy_override_0";
+          group = "vdsl_phy_override_0_grp";
+        };
+
+        pinctrl_vdsl_phy_override_1: vdsl_phy_override_1 {
+          function = "vdsl_phy_override_1";
+          group = "vdsl_phy_override_1_grp";
+        };
+
+        pinctrl_vdsl_phy_override_2: vdsl_phy_override_2 {
+          function = "vdsl_phy_override_2";
+          group = "vdsl_phy_override_2_grp";
+        };
+
+        pinctrl_vdsl_phy_override_3: vdsl_phy_override_3 {
+          function = "vdsl_phy_override_3";
+          group = "vdsl_phy_override_3_grp";
+        };
+
+        pinctrl_dsl_gpio8: dsl_gpio8 {
+          function = "dsl_gpio8";
+          group = "dsl_gpio8";
+        };
+
+        pinctrl_dsl_gpio9: dsl_gpio9 {
+          function = "dsl_gpio9";
+          group = "dsl_gpio9";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#41 lore raw

PATCH v4 13/15 pinctrl: add a pincontrol driver for BCM63268

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM63268. BCM63268 allows muxing GPIOs to different functions. Depending on the mux, these are either single pin configurations or whole pin groups.

---
v4: no changes
v3: use new shared code
v2: switch to GPIO_REGMAP

 drivers/pinctrl/bcm/Kconfig            |   8 +
 drivers/pinctrl/bcm/Makefile           |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm63268.c | 643 +++++++++++++++++++++++++
 3 files changed, 652 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm63268.c
drivers/pinctrl/bcm/Kconfig +8 -0
index aabd4b762aed..186985846120 100644
@@ -68,6 +68,14 @@ config PINCTRL_BCM6368
 	help
 	   Say Y here to enable the Broadcom BCM6368 GPIO driver.
 
+config PINCTRL_BCM63268
+	bool "Broadcom BCM63268 GPIO driver"
+	depends on (BMIPS_GENERIC || COMPILE_TEST)
+	select PINCTRL_BCM63XX
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM63268 GPIO driver.
+
 config PINCTRL_IPROC_GPIO
 	bool "Broadcom iProc GPIO (with PINCONF) driver"
 	depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index a1331bb9680e..4117847fd279 100644
@@ -8,6 +8,7 @@ obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
 obj-$(CONFIG_PINCTRL_BCM6368)		+= pinctrl-bcm6368.o
+obj-$(CONFIG_PINCTRL_BCM63268)		+= pinctrl-bcm63268.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
drivers/pinctrl/bcm/pinctrl-bcm63268.c new file +643 -0

643 lines not on this page · raw message

Signature · 1 line
2.20.1
#42 lore raw

PATCH v4 14/15 Documentation: add BCM6318 pincontroller binding documentation

In reply to Álvaro Fernández Rojas

Add binding documentation for the pincontrol core found in BCM6318 SoCs.

---
v4: no changes
v3: add new gpio node
v2: remove interrupts

 .../pinctrl/brcm,bcm6318-pinctrl.yaml         | 187 ++++++++++++++++++
 1 file changed, 187 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml new file +187 -0
new file mode 100644
index 000000000000..979b9d06de15
@@ -0,0 +1,187 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm6318-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM6318 pin controller
+
+maintainers:
+  - Álvaro Fernández Rojas <[email protected]>
+  - Jonas Gorski <[email protected]>
+
+description: |+
+  The pin controller node should be the child of a syscon node.
+
+  Refer to the the bindings described in
+  Documentation/devicetree/bindings/mfd/syscon.yaml
+
+properties:
+  compatible:
+    const: brcm,bcm6318-pinctrl
+
+patternProperties:
+  '^gpio$':
+    type: object
+    properties:
+      compatible:
+        const: brcm,bcm6318-gpio
+
+      data:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the data register (in bytes).
+
+      dirout:
+        $ref: /schemas/types.yaml#/definitions/uint32
+        description: |
+          Offset in the register map for the dirout register (in bytes).
+
+      gpio-controller: true
+
+      "#gpio-cells":
+        const: 2
+
+      gpio-ranges:
+        maxItems: 1
+
+    required:
+      - gpio-controller
+      - gpio-ranges
+      - '#gpio-cells'
+
+  '^.*$':
+    if:
+      type: object
+    then:
+      properties:
+        function:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ ephy0_spd_led, ephy1_spd_led, ephy2_spd_led, ephy3_spd_led,
+                  ephy0_act_led, ephy1_act_led, ephy2_act_led, ephy3_act_led,
+                  serial_led_data, serial_led_clk, inet_act_led, inet_fail_led,
+                  dsl_led, post_fail_led, wlan_wps_led, usb_pwron,
+                  usb_device_led, usb_active ]
+
+        pins:
+          $ref: "/schemas/types.yaml#/definitions/string"
+          enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7,
+                  gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio40 ]
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    gpio_cntl@10000080 {
+      compatible = "syscon", "simple-mfd";
+      reg = <0x10000080 0x80>;
+
+      pinctrl: pinctrl {
+        compatible = "brcm,bcm6318-pinctrl";
+
+        gpio {
+          compatible = "brcm,bcm6318-gpio";
+          data = <0xc>;
+          dirout = <0x4>;
+
+          gpio-controller;
+          gpio-ranges = <&pinctrl 0 0 50>;
+          #gpio-cells = <2>;
+        };
+
+        pinctrl_ephy0_spd_led: ephy0_spd_led {
+          function = "ephy0_spd_led";
+          pins = "gpio0";
+        };
+
+        pinctrl_ephy1_spd_led: ephy1_spd_led {
+          function = "ephy1_spd_led";
+          pins = "gpio1";
+        };
+
+        pinctrl_ephy2_spd_led: ephy2_spd_led {
+          function = "ephy2_spd_led";
+          pins = "gpio2";
+        };
+
+        pinctrl_ephy3_spd_led: ephy3_spd_led {
+          function = "ephy3_spd_led";
+          pins = "gpio3";
+        };
+
+        pinctrl_ephy0_act_led: ephy0_act_led {
+          function = "ephy0_act_led";
+          pins = "gpio4";
+        };
+
+        pinctrl_ephy1_act_led: ephy1_act_led {
+          function = "ephy1_act_led";
+          pins = "gpio5";
+        };
+
+        pinctrl_ephy2_act_led: ephy2_act_led {
+          function = "ephy2_act_led";
+          pins = "gpio6";
+        };
+
+        pinctrl_ephy3_act_led: ephy3_act_led {
+          function = "ephy3_act_led";
+          pins = "gpio7";
+        };
+
+        pinctrl_serial_led: serial_led {
+          pinctrl_serial_led_data: serial_led_data {
+            function = "serial_led_data";
+            pins = "gpio6";
+          };
+
+          pinctrl_serial_led_clk: serial_led_clk {
+            function = "serial_led_clk";
+            pins = "gpio7";
+          };
+        };
+
+        pinctrl_inet_act_led: inet_act_led {
+          function = "inet_act_led";
+          pins = "gpio8";
+        };
+
+        pinctrl_inet_fail_led: inet_fail_led {
+          function = "inet_fail_led";
+          pins = "gpio9";
+        };
+
+        pinctrl_dsl_led: dsl_led {
+          function = "dsl_led";
+          pins = "gpio10";
+        };
+
+        pinctrl_post_fail_led: post_fail_led {
+          function = "post_fail_led";
+          pins = "gpio11";
+        };
+
+        pinctrl_wlan_wps_led: wlan_wps_led {
+          function = "wlan_wps_led";
+          pins = "gpio12";
+        };
+
+        pinctrl_usb_pwron: usb_pwron {
+          function = "usb_pwron";
+          pins = "gpio13";
+        };
+
+        pinctrl_usb_device_led: usb_device_led {
+          function = "usb_device_led";
+          pins = "gpio13";
+        };
+
+        pinctrl_usb_active: usb_active {
+          function = "usb_active";
+          pins = "gpio40";
+        };
+      };
+    };
Signature · 1 line
2.20.1
#43 lore raw

PATCH v4 15/15 pinctrl: add a pincontrol driver for BCM6318

In reply to Álvaro Fernández Rojas

Add a pincontrol driver for BCM6318. BCM6318 allows muxing most GPIOs to different functions. BCM6318 is similar to BCM6328 with the addition of a pad register, and the GPIO meaning of the mux register changes based on the GPIO number.

---
v4: no changes
v3: use new shared code
v2: switch to GPIO_REGMAP

 drivers/pinctrl/bcm/Kconfig           |   8 +
 drivers/pinctrl/bcm/Makefile          |   1 +
 drivers/pinctrl/bcm/pinctrl-bcm6318.c | 496 ++++++++++++++++++++++++++
 3 files changed, 505 insertions(+)
 create mode 100644 drivers/pinctrl/bcm/pinctrl-bcm6318.c
drivers/pinctrl/bcm/Kconfig +8 -0
index 186985846120..33660e8fec05 100644
@@ -36,6 +36,14 @@ config PINCTRL_BCM63XX
 	select PINCONF
 	select PINMUX
 
+config PINCTRL_BCM6318
+	bool "Broadcom BCM6318 GPIO driver"
+	depends on (BMIPS_GENERIC || COMPILE_TEST)
+	select PINCTRL_BCM63XX
+	default BMIPS_GENERIC
+	help
+	   Say Y here to enable the Broadcom BCM6318 GPIO driver.
+
 config PINCTRL_BCM6328
 	bool "Broadcom BCM6328 GPIO driver"
 	depends on (BMIPS_GENERIC || COMPILE_TEST)
drivers/pinctrl/bcm/Makefile +1 -0
index 4117847fd279..00c7b7775e63 100644
@@ -4,6 +4,7 @@
 obj-$(CONFIG_PINCTRL_BCM281XX)		+= pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)		+= pinctrl-bcm2835.o
 obj-$(CONFIG_PINCTRL_BCM63XX)		+= pinctrl-bcm63xx.o
+obj-$(CONFIG_PINCTRL_BCM6318)		+= pinctrl-bcm6318.o
 obj-$(CONFIG_PINCTRL_BCM6328)		+= pinctrl-bcm6328.o
 obj-$(CONFIG_PINCTRL_BCM6358)		+= pinctrl-bcm6358.o
 obj-$(CONFIG_PINCTRL_BCM6362)		+= pinctrl-bcm6362.o
drivers/pinctrl/bcm/pinctrl-bcm6318.c new file +496 -0

496 lines not on this page · raw message

Signature · 1 line
2.20.1