Skip to contentSkip to conversation

ARM: shmobile: Add rcar-gpio clock support

PATCH Superseded Geert Uytterhoeven 4 participants 15 messages Mar 27, 2014 – Mar 31, 2014 1 message not in the archive

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: shmobile: Add rcar-gpio clock support

This series adds support to control the MSTP clocks of the GPIO blocks on R-Car SoCs. Currently we depend on reset state / the bootloader to have the right clocks enabled. If they're not enabled, GPIO will fail, but not crash:
- No heartbeat LED (if you had it enabled),
- Keypad switches don't work,
- System doesn't wake-up from suspend when pressing a keypad switch.

After applying this series, the MSTP clocks of the GPIO blocks will be enabled automatically by runtime PM (or statically, if CONFIG_PM_RUNTIME=n) during boot up.

[1/7] gpio: rcar: Add helper variable dev = &pdev->dev [2/7] gpio: rcar: Add optional functional clock to bindings [3/7] gpio: rcar: Add minimal runtime PM support [4/7] ARM: shmobile: r8a7790 dtsi: Add GPIO clocks [5/7] ARM: shmobile: r8a7791 dtsi: Add GPIO clocks [6/7] ARM: shmobile: r8a7790 legacy: Add GPIO clocks [7/7] ARM: shmobile: r8a7791 legacy: Add GPIO clocks

For multiplatform, this depends on the series "[PATCH 0/5] ARM: shmobile:
Enable drivers/sh/pm_runtime.c on multi-platform" (or any other method to enable drivers/sh/pm_runtime.c) to actually work.

For legacy, this slightly conflicts with that series, as sh_pm_runtime_init() will be called too late to actually work.

However, it should be safe to apply this series, even without the prerequisites.

This was tested on r8a7791/Koelsch, both legacy and multiplatform. The changes for r8a7790 were straight-forward.
Similar changes will have to be made for r8a7778 and r8a7779, but I don't have datasheets for those.

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#1 lore raw

PATCH 1/7 gpio: rcar: Add helper variable dev = &pdev->dev

From: Geert Uytterhoeven <[email protected]>

---
 drivers/gpio/gpio-rcar.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpio/gpio-rcar.c +16 -16
index ca76ce751540..03c91482432c 100644
@@ -356,12 +356,13 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 	struct resource *io, *irq;
 	struct gpio_chip *gpio_chip;
 	struct irq_chip *irq_chip;
-	const char *name = dev_name(&pdev->dev);
+	struct device *dev = &pdev->dev;
+	const char *name = dev_name(dev);
 	int ret;
 
-	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
+	p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
 	if (!p) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+		dev_err(dev, "failed to allocate driver data\n");
 		ret = -ENOMEM;
 		goto err0;
 	}
@@ -380,15 +381,14 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
 	if (!io || !irq) {
-		dev_err(&pdev->dev, "missing IRQ or IOMEM\n");
+		dev_err(dev, "missing IRQ or IOMEM\n");
 		ret = -EINVAL;
 		goto err0;
 	}
 
-	p->base = devm_ioremap_nocache(&pdev->dev, io->start,
-				       resource_size(io));
+	p->base = devm_ioremap_nocache(dev, io->start, resource_size(io));
 	if (!p->base) {
-		dev_err(&pdev->dev, "failed to remap I/O memory\n");
+		dev_err(dev, "failed to remap I/O memory\n");
 		ret = -ENXIO;
 		goto err0;
 	}
@@ -402,7 +402,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 	gpio_chip->set = gpio_rcar_set;
 	gpio_chip->to_irq = gpio_rcar_to_irq;
 	gpio_chip->label = name;
-	gpio_chip->dev = &pdev->dev;
+	gpio_chip->dev = dev;
 	gpio_chip->owner = THIS_MODULE;
 	gpio_chip->base = p->config.gpio_base;
 	gpio_chip->ngpio = p->config.number_of_pins;
@@ -421,30 +421,30 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 					      &gpio_rcar_irq_domain_ops, p);
 	if (!p->irq_domain) {
 		ret = -ENXIO;
-		dev_err(&pdev->dev, "cannot initialize irq domain\n");
+		dev_err(dev, "cannot initialize irq domain\n");
 		goto err0;
 	}
 
-	if (devm_request_irq(&pdev->dev, irq->start,
-			     gpio_rcar_irq_handler, IRQF_SHARED, name, p)) {
-		dev_err(&pdev->dev, "failed to request IRQ\n");
+	if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
+			     IRQF_SHARED, name, p)) {
+		dev_err(dev, "failed to request IRQ\n");
 		ret = -ENOENT;
 		goto err1;
 	}
 
 	ret = gpiochip_add(gpio_chip);
 	if (ret) {
-		dev_err(&pdev->dev, "failed to add GPIO controller\n");
+		dev_err(dev, "failed to add GPIO controller\n");
 		goto err1;
 	}
 
-	dev_info(&pdev->dev, "driving %d GPIOs\n", p->config.number_of_pins);
+	dev_info(dev, "driving %d GPIOs\n", p->config.number_of_pins);
 
 	/* warn in case of mismatch if irq base is specified */
 	if (p->config.irq_base) {
 		ret = irq_find_mapping(p->irq_domain, 0);
 		if (p->config.irq_base != ret)
-			dev_warn(&pdev->dev, "irq base mismatch (%u/%u)\n",
+			dev_warn(dev, "irq base mismatch (%u/%u)\n",
 				 p->config.irq_base, ret);
 	}
 
@@ -452,7 +452,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 		ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0,
 					     gpio_chip->base, gpio_chip->ngpio);
 		if (ret < 0)
-			dev_warn(&pdev->dev, "failed to add pin range\n");
+			dev_warn(dev, "failed to add pin range\n");
 	}
 
 	return 0;
Signature · 1 line
1.7.9.5
Acked-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] gpio: rcar: Add helper variable dev = &pdev->dev

Hi Geert,

Thank you for the patch.

Quoted 6 lines · On Thursday 27 March 2014 21:47:36 Geert Uytterhoeven wrote:

From: Geert Uytterhoeven <[email protected]>

I'm not sure if I would have bothered, but I have nothing against this :-)

Quoted 100 lines
---
 drivers/gpio/gpio-rcar.c |   32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/gpio/gpio-rcar.c +16 -16
index ca76ce751540..03c91482432c 100644
@@ -356,12 +356,13 @@ static int gpio_rcar_probe(struct platform_device
 *pdev) struct resource *io, *irq;
 	struct gpio_chip *gpio_chip;
 	struct irq_chip *irq_chip;
-	const char *name = dev_name(&pdev->dev);
+	struct device *dev = &pdev->dev;
+	const char *name = dev_name(dev);
 	int ret;
 
-	p = devm_kzalloc(&pdev->dev, sizeof(*p), GFP_KERNEL);
+	p = devm_kzalloc(dev, sizeof(*p), GFP_KERNEL);
 	if (!p) {
-		dev_err(&pdev->dev, "failed to allocate driver data\n");
+		dev_err(dev, "failed to allocate driver data\n");
 		ret = -ENOMEM;
 		goto err0;
 	}
@@ -380,15 +381,14 @@ static int gpio_rcar_probe(struct platform_device
 *pdev) irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
 	if (!io || !irq) {
-		dev_err(&pdev->dev, "missing IRQ or IOMEM\n");
+		dev_err(dev, "missing IRQ or IOMEM\n");
 		ret = -EINVAL;
 		goto err0;
 	}
 
-	p->base = devm_ioremap_nocache(&pdev->dev, io->start,
-				       resource_size(io));
+	p->base = devm_ioremap_nocache(dev, io->start, resource_size(io));
 	if (!p->base) {
-		dev_err(&pdev->dev, "failed to remap I/O memory\n");
+		dev_err(dev, "failed to remap I/O memory\n");
 		ret = -ENXIO;
 		goto err0;
 	}
@@ -402,7 +402,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 gpio_chip->set = gpio_rcar_set;
 	gpio_chip->to_irq = gpio_rcar_to_irq;
 	gpio_chip->label = name;
-	gpio_chip->dev = &pdev->dev;
+	gpio_chip->dev = dev;
 	gpio_chip->owner = THIS_MODULE;
 	gpio_chip->base = p->config.gpio_base;
 	gpio_chip->ngpio = p->config.number_of_pins;
@@ -421,30 +421,30 @@ static int gpio_rcar_probe(struct platform_device
 *pdev) &gpio_rcar_irq_domain_ops, p);
 	if (!p->irq_domain) {
 		ret = -ENXIO;
-		dev_err(&pdev->dev, "cannot initialize irq domain\n");
+		dev_err(dev, "cannot initialize irq domain\n");
 		goto err0;
 	}
 
-	if (devm_request_irq(&pdev->dev, irq->start,
-			     gpio_rcar_irq_handler, IRQF_SHARED, name, p)) {
-		dev_err(&pdev->dev, "failed to request IRQ\n");
+	if (devm_request_irq(dev, irq->start, gpio_rcar_irq_handler,
+			     IRQF_SHARED, name, p)) {
+		dev_err(dev, "failed to request IRQ\n");
 		ret = -ENOENT;
 		goto err1;
 	}
 
 	ret = gpiochip_add(gpio_chip);
 	if (ret) {
-		dev_err(&pdev->dev, "failed to add GPIO controller\n");
+		dev_err(dev, "failed to add GPIO controller\n");
 		goto err1;
 	}
 
-	dev_info(&pdev->dev, "driving %d GPIOs\n", p->config.number_of_pins);
+	dev_info(dev, "driving %d GPIOs\n", p->config.number_of_pins);
 
 	/* warn in case of mismatch if irq base is specified */
 	if (p->config.irq_base) {
 		ret = irq_find_mapping(p->irq_domain, 0);
 		if (p->config.irq_base != ret)
-			dev_warn(&pdev->dev, "irq base mismatch (%u/%u)\n",
+			dev_warn(dev, "irq base mismatch (%u/%u)\n",
 				 p->config.irq_base, ret);
 	}
 
@@ -452,7 +452,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 ret = gpiochip_add_pin_range(gpio_chip, p->config.pctl_name, 0,
 gpio_chip->base, gpio_chip->ngpio);
 		if (ret < 0)
-			dev_warn(&pdev->dev, "failed to add pin range\n");
+			dev_warn(dev, "failed to add pin range\n");
 	}
 
 	return 0;
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

PATCH 2/7 gpio: rcar: Add optional functional clock to bindings

In reply to Geert Uytterhoeven

From: Geert Uytterhoeven <[email protected]>

---
 .../devicetree/bindings/gpio/renesas,gpio-rcar.txt |    4 ++++
 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +4 -0
index f61cef74a212..9ccbe50dcec2 100644
@@ -21,6 +21,10 @@ Required Properties:
     GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
   - gpio-ranges: Range of pins managed by the GPIO controller.
 
+Optional properties:
+
+  - clocks: Must contain a reference to the functional clock.
+
 Please refer to gpio.txt in this directory for details of gpio-ranges property
 and the common GPIO bindings used by client devices.
 
Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCH 2/7] gpio: rcar: Add optional functional clock to bindings

Hi Geert,

Thank you for the patch.

Quoted 17 lines · On Thursday 27 March 2014 21:47:37 Geert Uytterhoeven wrote:

From: Geert Uytterhoeven <[email protected]>

---
 .../devicetree/bindings/gpio/renesas,gpio-rcar.txt |    4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt index f61cef74a212..9ccbe50dcec2 100644

Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt Required Properties: · line 27

Quoted 7 lines
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +4 -0
@@ -21,6 +21,10 @@ Required Properties:
     GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
   - gpio-ranges: Range of pins managed by the GPIO controller.
 
+Optional properties:
+
+  - clocks: Must contain a reference to the functional clock.
+

I would make the property mandatory. Obviously the driver needs to consider it as optional in order not to break the DT ABI, but the specification should make it mandatory in order to ensure that all future implementations will specify the clock.

Quoted 2 lines
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +0 -0
 Please refer to gpio.txt in this directory for details of gpio-ranges

property and the common GPIO bindings used by client devices.

Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

Re: [PATCH 2/7] gpio: rcar: Add optional functional clock to bindings

Hi Laurent,

Quoted 6 lines · Laurent Pinchart
Quoted 6 lines
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +0 -0
@@ -21,6 +21,10 @@ Required Properties:
     GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
   - gpio-ranges: Range of pins managed by the GPIO controller.
 
Quoted 9 lines

Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt Required Properties: · line 27

Quoted 4 lines
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +4 -0
+Optional properties:
+
+  - clocks: Must contain a reference to the functional clock.
+

I would make the property mandatory. Obviously the driver needs to consider it as optional in order not to break the DT ABI, but the specification should make it mandatory in order to ensure that all future implementations will specify the clock.

I think it has to stay optional: unless I misinterpreted the datasheet, r8a7778 doesn't have MSTP bits for the GPIO modules. I guess it's the same for other R-Car Gen1 like r8a7779. So it looks like the bits were added in R-Car Gen2.

Hence I'll just add ", if present", unless the Best Practice is to put such properties under "Required properties" or "Recommended properties"?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#7 lore raw

Re: [PATCH 2/7] gpio: rcar: Add optional functional clock to bindings

Hi Geert,

Quoted 18 lines · On Monday 31 March 2014 11:55:52 Geert Uytterhoeven wrote:
Quoted 7 lines · Laurent Pinchart
Quoted 7 lines
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +0 -0
@@ -21,6 +21,10 @@ Required Properties:
     GPIO_ACTIVE_HIGH and GPIO_ACTIVE_LOW flags are supported.
   - gpio-ranges: Range of pins managed by the GPIO controller.
 
Quoted 9 lines

Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt Required Properties: · line 27

Quoted 4 lines
Documentation/devicetree/bindings/gpio/renesas,gpio-rcar.txt +4 -0
+Optional properties:
+
+  - clocks: Must contain a reference to the functional clock.
+

I would make the property mandatory. Obviously the driver needs to consider it as optional in order not to break the DT ABI, but the specification should make it mandatory in order to ensure that all future implementations will specify the clock.

Quoted 4 lines

I think it has to stay optional: unless I misinterpreted the datasheet, r8a7778 doesn't have MSTP bits for the GPIO modules. I guess it's the same for other R-Car Gen1 like r8a7779. So it looks like the bits were added in R-Car Gen2.

Good point. It might also be that older SoCs have MSTP bits for the GPIO cores but don't document them. Anyway, we have no information, so we can't specify a clock.

Quoted 2 lines

Hence I'll just add ", if present", unless the Best Practice is to put such properties under "Required properties" or "Recommended properties"?

I'm fine with keeping in under "Optional Properties". I would phrase it as "Must contain a reference to the functional clock. The property is mandatory if the hardware implements a controllable functional clock for the GPIO instance." (or something similar).

Signature · 3 lines
Regards,

Laurent Pinchart
#8 lore raw

PATCH 3/7 gpio: rcar: Add minimal runtime PM support

In reply to Geert Uytterhoeven

From: Geert Uytterhoeven <[email protected]>

This is just enough to automatically enable the functional clock, if present. Clock management during suspend/resume is still to be added.

---
 drivers/gpio/gpio-rcar.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpio/gpio-rcar.c +8 -0
index 03c91482432c..c6995f6c3c40 100644
@@ -26,6 +26,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 
@@ -377,6 +378,9 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, p);
 
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
@@ -460,6 +464,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 err1:
 	irq_domain_remove(p->irq_domain);
 err0:
+	pm_runtime_put_sync(dev);
+	pm_runtime_disable(dev);
 	return ret;
 }
 
@@ -473,6 +479,8 @@ static int gpio_rcar_remove(struct platform_device *pdev)
 		return ret;
 
 	irq_domain_remove(p->irq_domain);
+	pm_runtime_put_sync(&pdev->dev);
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 }
 
Signature · 1 line
1.7.9.5
#9 lore raw

Re: [PATCH 3/7] gpio: rcar: Add minimal runtime PM support

Hi Geert,

Thank you for the patch.

Quoted 37 lines · On Thursday 27 March 2014 21:47:38 Geert Uytterhoeven wrote:

From: Geert Uytterhoeven <[email protected]>

This is just enough to automatically enable the functional clock, if present. Clock management during suspend/resume is still to be added.

---
 drivers/gpio/gpio-rcar.c |    8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpio/gpio-rcar.c +4 -0
index 03c91482432c..c6995f6c3c40 100644
@@ -26,6 +26,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/spinlock.h>
 #include <linux/slab.h>
 
@@ -377,6 +378,9 @@ static int gpio_rcar_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, p);
 
+	pm_runtime_enable(dev);
+	pm_runtime_get_sync(dev);
+
 	io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
 
@@ -460,6 +464,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)

err1:

drivers/gpio/gpio-rcar.c static int gpio_rcar_probe(struct platform_device *pdev) · line 467

Quoted 3 lines
drivers/gpio/gpio-rcar.c +1 -0
 	irq_domain_remove(p->irq_domain);
 err0:
+	pm_runtime_put_sync(dev);

Do we really need the sync version, isn't pm_runtime_put() enough ?

drivers/gpio/gpio-rcar.c static int gpio_rcar_remove(struct platform_device · line 482

Quoted 9 lines
drivers/gpio/gpio-rcar.c +2 -0
+	pm_runtime_disable(dev);
 	return ret;
 }
@@ -473,6 +479,8 @@ static int gpio_rcar_remove(struct platform_device
 *pdev) return ret;
 
 	irq_domain_remove(p->irq_domain);
+	pm_runtime_put_sync(&pdev->dev);

Same comment here.

Quoted 3 lines
drivers/gpio/gpio-rcar.c +1 -0
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 }
Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

Re: [PATCH 3/7] gpio: rcar: Add minimal runtime PM support

Hi Laurent,

Quoted 7 lines · Laurent Pinchart
Quoted 5 lines
(quoted diff) +0 -0
@@ -460,6 +464,8 @@ static int gpio_rcar_probe(struct platform_device *pdev)

err1:

      irq_domain_remove(p->irq_domain);

err0:
+ pm_runtime_put_sync(dev);

Do we really need the sync version, isn't pm_runtime_put() enough ?

No we don't, copy-and-paste from rcar-thermal (which I'll fix, too).

Thanks!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#11 lore raw

PATCH 4/7 ARM: shmobile: r8a7790 dtsi: Add GPIO clocks

In reply to Geert Uytterhoeven

From: Geert Uytterhoeven <[email protected]>

---
 arch/arm/boot/dts/r8a7790.dtsi |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/boot/dts/r8a7790.dtsi +12 -1
index da69afc9e5cb..b0ddf58ac872 100644
@@ -113,6 +113,7 @@
 		gpio-ranges = <&pfc 0 0 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7790_CLK_GPIO0>;
 	};
 
 	gpio1: gpio@e6051000 {
@@ -124,6 +125,7 @@
 		gpio-ranges = <&pfc 0 32 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7790_CLK_GPIO1>;
 	};
 
 	gpio2: gpio@e6052000 {
@@ -135,6 +137,7 @@
 		gpio-ranges = <&pfc 0 64 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7790_CLK_GPIO2>;
 	};
 
 	gpio3: gpio@e6053000 {
@@ -146,6 +149,7 @@
 		gpio-ranges = <&pfc 0 96 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7790_CLK_GPIO3>;
 	};
 
 	gpio4: gpio@e6054000 {
@@ -157,6 +161,7 @@
 		gpio-ranges = <&pfc 0 128 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7790_CLK_GPIO4>;
 	};
 
 	gpio5: gpio@e6055000 {
@@ -168,6 +173,7 @@
 		gpio-ranges = <&pfc 0 160 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7790_CLK_GPIO5>;
 	};
 
 	thermal@e61f0000 {
@@ -757,15 +763,20 @@
 		mstp9_clks: mstp9_clks@e6150994 {
 			compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
-			clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7790_CLK_QSPI>,
+			clocks = <&cp_clk>, <&cp_clk>, <&cp_clk>,
+				 <&cp_clk>, <&cp_clk>, <&cp_clk>,
+				 <&p_clk>, <&p_clk>, <&cpg_clocks R8A7790_CLK_QSPI>,
 				 <&p_clk>, <&p_clk>, <&p_clk>, <&p_clk>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
+				R8A7790_CLK_GPIO5 R8A7790_CLK_GPIO4 R8A7790_CLK_GPIO3
+				R8A7790_CLK_GPIO2 R8A7790_CLK_GPIO1 R8A7790_CLK_GPIO0
 				R8A7790_CLK_RCAN1 R8A7790_CLK_RCAN0 R8A7790_CLK_QSPI_MOD
 				R8A7790_CLK_I2C3 R8A7790_CLK_I2C2 R8A7790_CLK_I2C1
 				R8A7790_CLK_I2C0
 			>;
 			clock-output-names =
+				"gpio5", "gpio4", "gpio3", "gpio2", "gpio1", "gpio0",
 				"rcan1", "rcan0", "qspi_mod", "i2c3", "i2c2", "i2c1", "i2c0";
 		};
 	};
Signature · 1 line
1.7.9.5

A message that is not in the archive (sent off-list or not yet received): 1395953262-4290-1-git-send-email-geert-Td1EMuHUCqxL1ZNQvxDV9g@public.gmane.org

#13 lore raw

PATCH 5/7 ARM: shmobile: r8a7791 dtsi: Add GPIO clocks

From: Geert Uytterhoeven <[email protected]>

---
 arch/arm/boot/dts/r8a7791.dtsi |   19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)
arch/arm/boot/dts/r8a7791.dtsi +16 -3
index 1004355496f2..06972d275171 100644
@@ -76,6 +76,7 @@
 		gpio-ranges = <&pfc 0 0 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO0>;
 	};
 
 	gpio1: gpio@e6051000 {
@@ -87,6 +88,7 @@
 		gpio-ranges = <&pfc 0 32 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO1>;
 	};
 
 	gpio2: gpio@e6052000 {
@@ -98,6 +100,7 @@
 		gpio-ranges = <&pfc 0 64 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO2>;
 	};
 
 	gpio3: gpio@e6053000 {
@@ -109,6 +112,7 @@
 		gpio-ranges = <&pfc 0 96 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO3>;
 	};
 
 	gpio4: gpio@e6054000 {
@@ -120,6 +124,7 @@
 		gpio-ranges = <&pfc 0 128 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO4>;
 	};
 
 	gpio5: gpio@e6055000 {
@@ -131,6 +136,7 @@
 		gpio-ranges = <&pfc 0 160 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO5>;
 	};
 
 	gpio6: gpio@e6055400 {
@@ -142,6 +148,7 @@
 		gpio-ranges = <&pfc 0 192 32>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO6>;
 	};
 
 	gpio7: gpio@e6055800 {
@@ -153,6 +160,7 @@
 		gpio-ranges = <&pfc 0 224 26>;
 		#interrupt-cells = <2>;
 		interrupt-controller;
+		clocks = <&mstp9_clks R8A7791_CLK_GPIO7>;
 	};
 
 	thermal@e61f0000 {
@@ -805,18 +813,23 @@
 		mstp9_clks: mstp9_clks@e6150994 {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
 			reg = <0 0xe6150994 0 4>, <0 0xe61509a4 0 4>;
-			clocks = <&p_clk>, <&p_clk>, <&cpg_clocks R8A7791_CLK_QSPI>, <&p_clk>,
+			clocks = <&cp_clk>, <&cp_clk>, <&cp_clk>, <&cp_clk>,
+				 <&cp_clk>, <&cp_clk>, <&cp_clk>, <&cp_clk>,
+				 <&p_clk>, <&p_clk>, <&cpg_clocks R8A7791_CLK_QSPI>, <&p_clk>,
 				 <&cp_clk>, <&p_clk>, <&p_clk>, <&p_clk>,
 				 <&p_clk>, <&p_clk>;
 			#clock-cells = <1>;
 			renesas,clock-indices = <
+				R8A7791_CLK_GPIO7 R8A7791_CLK_GPIO6 R8A7791_CLK_GPIO5 R8A7791_CLK_GPIO4
+				R8A7791_CLK_GPIO3 R8A7791_CLK_GPIO2 R8A7791_CLK_GPIO1 R8A7791_CLK_GPIO0
 				R8A7791_CLK_RCAN1 R8A7791_CLK_RCAN0 R8A7791_CLK_QSPI_MOD R8A7791_CLK_I2C5
 				R8A7791_CLK_IICDVFS R8A7791_CLK_I2C4 R8A7791_CLK_I2C3 R8A7791_CLK_I2C2
 				R8A7791_CLK_I2C1 R8A7791_CLK_I2C0
 			>;
 			clock-output-names =
-				"rcan1", "rcan0", "qspi_mod", "i2c5", "i2c6", "i2c4", "i2c3",
-				"i2c2", "i2c1", "i2c0";
+				"gpio7", "gpio6", "gpio5", "gpio4", "gpio3", "gpio2", "gpio1", "gpio0",
+				"rcan1", "rcan0", "qspi_mod", "i2c5", "i2c6", "i2c4", "i2c3", "i2c2",
+				"i2c1", "i2c0";
 		};
 		mstp11_clks: mstp11_clks@e615099c {
 			compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks";
Signature · 6 lines
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#14 lore raw

PATCH 6/7 ARM: shmobile: r8a7790 legacy: Add GPIO clocks

In reply to Geert Uytterhoeven

From: Geert Uytterhoeven <[email protected]>

---
 arch/arm/mach-shmobile/clock-r8a7790.c |   13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/mach-shmobile/clock-r8a7790.c +13 -0
index a6089a6ceabd..2569aab525e4 100644
@@ -214,6 +214,7 @@ enum {
 	MSTP1009, MSTP1008, MSTP1007, MSTP1006, MSTP1005,
 	MSTP931, MSTP930, MSTP929, MSTP928,
 	MSTP917,
+	MSTP912, MSTP911, MSTP910, MSTP909, MSTP908, MSTP907,
 	MSTP815, MSTP814,
 	MSTP813,
 	MSTP811, MSTP810, MSTP809, MSTP808,
@@ -258,6 +259,12 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP929] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 29, MSTPSR9, 0), /* I2C2 */
 	[MSTP928] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */
 	[MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */
+	[MSTP912] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 12, MSTPSR9, 0), /* GPIO0 */
+	[MSTP911] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 11, MSTPSR9, 0), /* GPIO1 */
+	[MSTP910] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 10, MSTPSR9, 0), /* GPIO2 */
+	[MSTP909] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 9, MSTPSR9, 0), /* GPIO3 */
+	[MSTP908] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 8, MSTPSR9, 0), /* GPIO4 */
+	[MSTP907] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 7, MSTPSR9, 0), /* GPIO5 */
 	[MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */
 	[MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */
 	[MSTP813] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR8, 13, MSTPSR8, 0), /* Ether */
@@ -355,6 +362,12 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]),
+	CLKDEV_DEV_ID("gpio_rcar.0", &mstp_clks[MSTP912]),
+	CLKDEV_DEV_ID("gpio_rcar.1", &mstp_clks[MSTP911]),
+	CLKDEV_DEV_ID("gpio_rcar.2", &mstp_clks[MSTP910]),
+	CLKDEV_DEV_ID("gpio_rcar.3", &mstp_clks[MSTP909]),
+	CLKDEV_DEV_ID("gpio_rcar.4", &mstp_clks[MSTP908]),
+	CLKDEV_DEV_ID("gpio_rcar.5", &mstp_clks[MSTP907]),
 	CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]),
 	CLKDEV_DEV_ID("r8a7790-vin.0", &mstp_clks[MSTP811]),
 	CLKDEV_DEV_ID("r8a7790-vin.1", &mstp_clks[MSTP810]),
Signature · 1 line
1.7.9.5
#15 lore raw

PATCH 7/7 ARM: shmobile: r8a7791 legacy: Add GPIO clocks

In reply to Geert Uytterhoeven

From: Geert Uytterhoeven <[email protected]>

---
 arch/arm/mach-shmobile/clock-r8a7791.c |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/mach-shmobile/clock-r8a7791.c +17 -0
index 5929062aa480..0eed1a0c52c0 100644
@@ -172,6 +172,7 @@ enum {
 	MSTP1108, MSTP1107, MSTP1106,
 	MSTP931, MSTP930, MSTP929, MSTP928, MSTP927, MSTP925,
 	MSTP917,
+	MSTP912, MSTP911, MSTP910, MSTP909, MSTP908, MSTP907, MSTP905, MSTP904,
 	MSTP815, MSTP814,
 	MSTP813,
 	MSTP811, MSTP810, MSTP809,
@@ -197,6 +198,14 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP927] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 27, MSTPSR9, 0), /* I2C4 */
 	[MSTP925] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 25, MSTPSR9, 0), /* I2C5 */
 	[MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */
+	[MSTP912] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 12, MSTPSR9, 0), /* GPIO0 */
+	[MSTP911] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 11, MSTPSR9, 0), /* GPIO1 */
+	[MSTP910] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 10, MSTPSR9, 0), /* GPIO2 */
+	[MSTP909] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 9, MSTPSR9, 0), /* GPIO3 */
+	[MSTP908] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 8, MSTPSR9, 0), /* GPIO4 */
+	[MSTP907] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 7, MSTPSR9, 0), /* GPIO5 */
+	[MSTP905] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 5, MSTPSR9, 0), /* GPIO6 */
+	[MSTP904] = SH_CLK_MSTP32_STS(&cp_clk, SMSTPCR9, 4, MSTPSR9, 0), /* GPIO7 */
 	[MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */
 	[MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */
 	[MSTP813] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR8, 13, MSTPSR8, 0), /* Ether */
@@ -281,6 +290,14 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.4", &mstp_clks[MSTP927]),
 	CLKDEV_DEV_ID("i2c-rcar_gen2.5", &mstp_clks[MSTP925]),
+	CLKDEV_DEV_ID("gpio_rcar.0", &mstp_clks[MSTP912]),
+	CLKDEV_DEV_ID("gpio_rcar.1", &mstp_clks[MSTP911]),
+	CLKDEV_DEV_ID("gpio_rcar.2", &mstp_clks[MSTP910]),
+	CLKDEV_DEV_ID("gpio_rcar.3", &mstp_clks[MSTP909]),
+	CLKDEV_DEV_ID("gpio_rcar.4", &mstp_clks[MSTP908]),
+	CLKDEV_DEV_ID("gpio_rcar.5", &mstp_clks[MSTP907]),
+	CLKDEV_DEV_ID("gpio_rcar.6", &mstp_clks[MSTP905]),
+	CLKDEV_DEV_ID("gpio_rcar.7", &mstp_clks[MSTP904]),
 	CLKDEV_DEV_ID("r8a7791-ether", &mstp_clks[MSTP813]), /* Ether */
 	CLKDEV_DEV_ID("r8a7791-vin.0", &mstp_clks[MSTP811]),
 	CLKDEV_DEV_ID("r8a7791-vin.1", &mstp_clks[MSTP810]),
Signature · 1 line
1.7.9.5