linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU
@ 2013-01-11 15:45 Lee Jones
  2013-01-11 15:45 ` [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree Lee Jones
  2013-01-18 19:39 ` [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU Linus Walleij
  0 siblings, 2 replies; 5+ messages in thread
From: Lee Jones @ 2013-01-11 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

The AB8500 Pinctrl driver uses PRCMU register addresses to
control Pinctrl related functions. For this to happen, the
Pinctrl driver needs the PRCMU base to work from. We can do
that using standard Open Firmware (of_*) function calls, but
first we need a mechanism to gain access to the PRCMU
device node. We're going to use a Phandle in this case.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 arch/arm/boot/dts/dbx5x0.dtsi |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index db69f3c..3381ba6 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -170,10 +170,9 @@
 			gpio-bank = <8>;
 		};
 
-		pinctrl at 80157000 {
-			// This is actually the PRCMU base address
-			reg = <0x80157000 0x2000>;
+		pinctrl {
 			compatible = "stericsson,nmk_pinctrl";
+			prcm = <&prcmu>;
 		};
 
 		usb at a03e0000 {
@@ -190,7 +189,7 @@
 			interrupts = <0 25 0x4>;
 		};
 
-		prcmu at 80157000 {
+		prcmu: prcmu at 80157000 {
 			compatible = "stericsson,db8500-prcmu";
 			reg = <0x80157000 0x2000>;
 			interrupts = <0 47 0x4>;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree
  2013-01-11 15:45 [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU Lee Jones
@ 2013-01-11 15:45 ` Lee Jones
  2013-01-18 19:59   ` Linus Walleij
  2013-01-18 19:39 ` [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2013-01-11 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

The Nomadik Pinctrl driver requires access to some PRCMU registers
in order to run with full functionality. When Device Tree is
disabled the required PRCMU base address is passed in via platform
data, so in order for Device Tree booting to be as functional, we
need a similar mechanism to fetch it from Device Tree.

The new semantics goes like this: Parse the Device Tree and look
for the PRCMU node using a provided Phandle. Obtain the ioremaped
address from that node. If one was supplied via platform data
over-write it with anything found in Device Tree. Fail if either
the prcm_base can't be found if we're running on anything other
than an STN8815 ASIC.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/pinctrl/pinctrl-nomadik.c |   29 ++++++++++++++++++-----------
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
index 292c909..4954302 100644
--- a/drivers/pinctrl/pinctrl-nomadik.c
+++ b/drivers/pinctrl/pinctrl-nomadik.c
@@ -25,6 +25,7 @@
 #include <linux/irqdomain.h>
 #include <linux/slab.h>
 #include <linux/of_device.h>
+#include <linux/of_address.h>
 #include <linux/pinctrl/pinctrl.h>
 #include <linux/pinctrl/pinmux.h>
 #include <linux/pinctrl/pinconf.h>
@@ -1856,6 +1857,7 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
 {
 	const struct platform_device_id *platid = platform_get_device_id(pdev);
 	struct device_node *np = pdev->dev.of_node;
+	struct device_node *prcm_np;
 	struct nmk_pinctrl *npct;
 	struct resource *res;
 	unsigned int version = 0;
@@ -1884,21 +1886,26 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)
 	if (version == PINCTRL_NMK_DB8540)
 		nmk_pinctrl_db8540_init(&npct->soc);
 
+	if (np) {
+		prcm_np = of_parse_phandle(np, "prcm", 0);
+		if (prcm_np)
+			npct->prcm_base = of_iomap(prcm_np, 0);
+	}
+
+	/* Allow platform passed information to over-write DT. */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res) {
+	if (res)
 		npct->prcm_base = devm_ioremap(&pdev->dev, res->start,
 					       resource_size(res));
-		if (!npct->prcm_base) {
-			dev_err(&pdev->dev,
-				"failed to ioremap PRCM registers\n");
-			return -ENOMEM;
+	if (!npct->prcm_base) {
+		if (version == PINCTRL_NMK_STN8815) {
+			dev_info(&pdev->dev,
+				 "No PRCM base, "
+				 "assuming no ALT-Cx control is available\n");
+		} else {
+			dev_err(&pdev->dev, "missing PRCM base address\n");
+			return -EINVAL;
 		}
-	} else if (version == PINCTRL_NMK_STN8815) {
-		dev_info(&pdev->dev,
-			 "No PRCM base, assume no ALT-Cx control is available\n");
-	} else {
-		dev_err(&pdev->dev, "missing PRCM base address\n");
-		return -EINVAL;
 	}
 
 	/*
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU
  2013-01-11 15:45 [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU Lee Jones
  2013-01-11 15:45 ` [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree Lee Jones
@ 2013-01-18 19:39 ` Linus Walleij
  1 sibling, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2013-01-18 19:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 11, 2013 at 4:45 PM, Lee Jones <lee.jones@linaro.org> wrote:

> The AB8500 Pinctrl driver uses PRCMU register addresses to
> control Pinctrl related functions. For this to happen, the
> Pinctrl driver needs the PRCMU base to work from. We can do
> that using standard Open Firmware (of_*) function calls, but
> first we need a mechanism to gain access to the PRCMU
> device node. We're going to use a Phandle in this case.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Patch applied to the pinctrl tree (so as to be adjacent to
the patch altering the code).

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree
  2013-01-11 15:45 ` [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree Lee Jones
@ 2013-01-18 19:59   ` Linus Walleij
  2013-01-18 22:45     ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2013-01-18 19:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 11, 2013 at 4:45 PM, Lee Jones <lee.jones@linaro.org> wrote:

> The Nomadik Pinctrl driver requires access to some PRCMU registers
> in order to run with full functionality. When Device Tree is
> disabled the required PRCMU base address is passed in via platform
> data, so in order for Device Tree booting to be as functional, we
> need a similar mechanism to fetch it from Device Tree.
>
> The new semantics goes like this: Parse the Device Tree and look
> for the PRCMU node using a provided Phandle. Obtain the ioremaped
> address from that node. If one was supplied via platform data
> over-write it with anything found in Device Tree. Fail if either
> the prcm_base can't be found if we're running on anything other
> than an STN8815 ASIC.
>
> Signed-off-by: Lee Jones <lee.jones@linaro.org>

Applied as well, notice I had to add this hunk to the first
patch to have things working:

diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
index 05d97f6..96f518b 100644
--- a/arch/arm/boot/dts/dbx5x0.dtsi
+++ b/arch/arm/boot/dts/dbx5x0.dtsi
@@ -192,6 +192,7 @@
                prcmu: prcmu at 80157000 {
                        compatible = "stericsson,db8500-prcmu";
                        reg = <0x80157000 0x1000>;
+                       reg-names = "prcmu";
                        interrupts = <0 47 0x4>;
                        #address-cells = <1>;
                        #size-cells = <1>;

Lest the code won't find the prcmu registers.

Yours,
Linus Walleij

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree
  2013-01-18 19:59   ` Linus Walleij
@ 2013-01-18 22:45     ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2013-01-18 22:45 UTC (permalink / raw)
  To: linux-arm-kernel

It worked when I tested it?

Sent from my mobile Linux device.
On Jan 18, 2013 7:59 PM, "Linus Walleij" <linus.walleij@linaro.org> wrote:

> On Fri, Jan 11, 2013 at 4:45 PM, Lee Jones <lee.jones@linaro.org> wrote:
>
> > The Nomadik Pinctrl driver requires access to some PRCMU registers
> > in order to run with full functionality. When Device Tree is
> > disabled the required PRCMU base address is passed in via platform
> > data, so in order for Device Tree booting to be as functional, we
> > need a similar mechanism to fetch it from Device Tree.
> >
> > The new semantics goes like this: Parse the Device Tree and look
> > for the PRCMU node using a provided Phandle. Obtain the ioremaped
> > address from that node. If one was supplied via platform data
> > over-write it with anything found in Device Tree. Fail if either
> > the prcm_base can't be found if we're running on anything other
> > than an STN8815 ASIC.
> >
> > Signed-off-by: Lee Jones <lee.jones@linaro.org>
>
> Applied as well, notice I had to add this hunk to the first
> patch to have things working:
>
> diff --git a/arch/arm/boot/dts/dbx5x0.dtsi b/arch/arm/boot/dts/dbx5x0.dtsi
> index 05d97f6..96f518b 100644
> --- a/arch/arm/boot/dts/dbx5x0.dtsi
> +++ b/arch/arm/boot/dts/dbx5x0.dtsi
> @@ -192,6 +192,7 @@
>                 prcmu: prcmu at 80157000 {
>                         compatible = "stericsson,db8500-prcmu";
>                         reg = <0x80157000 0x1000>;
> +                       reg-names = "prcmu";
>                         interrupts = <0 47 0x4>;
>                         #address-cells = <1>;
>                         #size-cells = <1>;
>
> Lest the code won't find the prcmu registers.
>
> Yours,
> Linus Walleij
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130118/bc606977/attachment-0001.html>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-01-18 22:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-11 15:45 [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU Lee Jones
2013-01-11 15:45 ` [PATCH 2/2] pinctrl: nomadik: Allow prcm_base to be extracted from Device Tree Lee Jones
2013-01-18 19:59   ` Linus Walleij
2013-01-18 22:45     ` Lee Jones
2013-01-18 19:39 ` [PATCH 1/2] ARM: ux500: Provide a link from AB8500 Pinctrl to the PRCMU Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).