linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS
@ 2011-04-19  6:04 Heiko Schocher
  2012-03-18 23:25 ` Anatolij Gustschin
  2012-03-19  8:51 ` [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT Anatolij Gustschin
  0 siblings, 2 replies; 6+ messages in thread
From: Heiko Schocher @ 2011-04-19  6:04 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: devictree-discuss, Heiko Schocher, Grant Likely, Wolfgang Denk

If firmware does not setup the "GPS Port Configuration Register"
and the "CDM 48MHz Fractional Divider Configuration Register",
it can be corrected through DTS.

Signed-off-by: Heiko Schocher <hs@denx.de>
cc: devictree-discuss@lists.ozlabs.org
cc: linuxppc-dev@lists.ozlabs.org
cc: Grant Likely <glikely@secretlab.ca>
cc: Wolfgang Denk <wd@denx.de>
---
 .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   16 +++++++++++
 arch/powerpc/platforms/52xx/mpc52xx_common.c       |   27 ++++++++++++++++++++
 2 files changed, 43 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
index 4ccb2cd..0c1c6c8 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
@@ -155,6 +155,9 @@ Each GPIO controller node should have the empty property gpio-controller and
 according to the bit numbers in the GPIO control registers. The second cell
 is for flags which is currently unused.
 
+If firmware does not setup port_config correct, it can be modified
+through the "fsl,init-port-config" property in the "fsl,mpc5200-gpio" node.
+
 fsl,mpc5200-fec nodes
 ---------------------
 The FEC node can specify one of the following properties to configure
@@ -196,3 +199,16 @@ External interrupts:
 fsl,mpc5200-mscan nodes
 -----------------------
 See file can.txt in this directory.
+
+fsl,mpc5200-cdm nodes
+---------------------
+- setup "CDM 48MHz Fractional Divider Configuration Register"
+  If firmware does not setup this register correct, you can
+  modify it with the following properties:
+
+  - fsl,init-ext-48mhz-en
+    see MPC5200BUM Table 5-11 Bits 0-7
+  - fsl,init-fd-enable
+    see MPC5200BUM Table 5-11 Bits 8-15
+  - fsl,init-fd-counters
+    see MPC5200BUM Table 5-11 Bits 16-31
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 41f3a7e..41099f3 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -136,6 +136,8 @@ void __init
 mpc52xx_map_common_devices(void)
 {
 	struct device_node *np;
+	const u32 *prop;
+	int plen;
 
 	/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
 	 * possibly from a interrupt context. wdt is only implement
@@ -153,11 +155,36 @@ mpc52xx_map_common_devices(void)
 	/* Clock Distribution Module, used by PSC clock setting function */
 	np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
 	mpc52xx_cdm = of_iomap(np, 0);
+	prop = of_get_property(np, "fsl,init-ext-48mhz-en", &plen);
+	if (prop) {
+		pr_debug("ext-48mhz-en: old:%x new:%x\n",
+			in_8(&mpc52xx_cdm->ext_48mhz_en), *prop);
+		out_8(&mpc52xx_cdm->ext_48mhz_en, *prop);
+	}
+	prop = of_get_property(np, "fsl,init-fd-enable", &plen);
+	if (prop) {
+		pr_debug("fd-enable: old:%x new:%x\n",
+			in_8(&mpc52xx_cdm->fd_enable), *prop);
+		out_8(&mpc52xx_cdm->fd_enable, *prop);
+	}
+	prop = of_get_property(np, "fsl,init-fd-counters", &plen);
+	if (prop) {
+		pr_debug("fd-counters: old:%x new:%x\n",
+			in_be16(&mpc52xx_cdm->fd_counters), *prop);
+		out_be16(&mpc52xx_cdm->fd_counters, *prop);
+	}
 	of_node_put(np);
 
 	/* simple_gpio registers */
 	np = of_find_matching_node(NULL, mpc52xx_gpio_simple);
 	simple_gpio = of_iomap(np, 0);
+	/* fixup the port_config register */
+	prop = of_get_property(np, "fsl,init-port-config", &plen);
+	if (prop) {
+		pr_info("port-config: old:%x new:%x\n",
+			in_be32(&simple_gpio->port_config), *prop);
+		out_be32(&simple_gpio->port_config, *prop);
+	}
 	of_node_put(np);
 
 	/* wkup_gpio registers */
-- 
1.7.4.4

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

* Re: [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS
  2011-04-19  6:04 [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS Heiko Schocher
@ 2012-03-18 23:25 ` Anatolij Gustschin
  2012-03-19  8:37   ` Wolfram Sang
  2012-03-19  8:51 ` [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT Anatolij Gustschin
  1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2012-03-18 23:25 UTC (permalink / raw)
  To: Heiko Schocher; +Cc: linuxppc-dev, Wolfgang Denk

Hi Heiko,

On Tue, 19 Apr 2011 08:04:05 +0200
Heiko Schocher <hs@denx.de> wrote:

> If firmware does not setup the "GPS Port Configuration Register"
> and the "CDM 48MHz Fractional Divider Configuration Register",
> it can be corrected through DTS.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> cc: devictree-discuss@lists.ozlabs.org
> cc: linuxppc-dev@lists.ozlabs.org
> cc: Grant Likely <glikely@secretlab.ca>
> cc: Wolfgang Denk <wd@denx.de>
> ---
>  .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   16 +++++++++++
>  arch/powerpc/platforms/52xx/mpc52xx_common.c       |   27 ++++++++++++++++++++
>  2 files changed, 43 insertions(+), 0 deletions(-)

Applied slightly modified patch to mpc5xxx next.

Thanks,
Anatolij

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

* Re: [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS
  2012-03-18 23:25 ` Anatolij Gustschin
@ 2012-03-19  8:37   ` Wolfram Sang
  2012-03-19  8:53     ` Anatolij Gustschin
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2012-03-19  8:37 UTC (permalink / raw)
  To: Anatolij Gustschin; +Cc: Heiko Schocher, linuxppc-dev, Wolfgang Denk

[-- Attachment #1: Type: text/plain, Size: 1159 bytes --]

On Mon, Mar 19, 2012 at 12:25:07AM +0100, Anatolij Gustschin wrote:
> Hi Heiko,
> 
> On Tue, 19 Apr 2011 08:04:05 +0200
> Heiko Schocher <hs@denx.de> wrote:
> 
> > If firmware does not setup the "GPS Port Configuration Register"
> > and the "CDM 48MHz Fractional Divider Configuration Register",
> > it can be corrected through DTS.
> > 
> > Signed-off-by: Heiko Schocher <hs@denx.de>
> > cc: devictree-discuss@lists.ozlabs.org
> > cc: linuxppc-dev@lists.ozlabs.org
> > cc: Grant Likely <glikely@secretlab.ca>
> > cc: Wolfgang Denk <wd@denx.de>
> > ---
> >  .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   16 +++++++++++
> >  arch/powerpc/platforms/52xx/mpc52xx_common.c       |   27 ++++++++++++++++++++
> >  2 files changed, 43 insertions(+), 0 deletions(-)
> 
> Applied slightly modified patch to mpc5xxx next.

Given that the patch was sent nearly one year ago and it even got
modified, could please resend it to the list before applying?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

* [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT
  2011-04-19  6:04 [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS Heiko Schocher
  2012-03-18 23:25 ` Anatolij Gustschin
@ 2012-03-19  8:51 ` Anatolij Gustschin
  2012-03-20 16:28   ` Anatolij Gustschin
  1 sibling, 1 reply; 6+ messages in thread
From: Anatolij Gustschin @ 2012-03-19  8:51 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: devictree-discuss, Heiko Schocher, Grant Likely, Wolfgang Denk

From: Heiko Schocher <hs@denx.de>

If firmware does not setup the "GPS Port Configuration Register"
and the "CDM 48MHz Fractional Divider Configuration Register",
it can be corrected by additional properties in the device tree.
Add appropriate code to utility functions and document used
bindings.

Signed-off-by: Heiko Schocher <hs@denx.de>
cc: devictree-discuss@lists.ozlabs.org
cc: linuxppc-dev@lists.ozlabs.org
cc: Grant Likely <glikely@secretlab.ca>
cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   17 ++++++++++++
 arch/powerpc/platforms/52xx/mpc52xx_common.c       |   27 ++++++++++++++++++++
 2 files changed, 44 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
index 4ccb2cd..4478585 100644
--- a/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
+++ b/Documentation/devicetree/bindings/powerpc/fsl/mpc5200.txt
@@ -155,6 +155,10 @@ Each GPIO controller node should have the empty property gpio-controller and
 according to the bit numbers in the GPIO control registers. The second cell
 is for flags which is currently unused.
 
+If firmware does not setup pin-multiplexing (port_config) correct, it
+can be modified through the "fsl,init-port-config" property in the
+"fsl,mpc5200-gpio" node.
+
 fsl,mpc5200-fec nodes
 ---------------------
 The FEC node can specify one of the following properties to configure
@@ -196,3 +200,16 @@ External interrupts:
 fsl,mpc5200-mscan nodes
 -----------------------
 See file can.txt in this directory.
+
+fsl,mpc5200-cdm nodes
+---------------------
+- setup "CDM 48MHz Fractional Divider Configuration Register"
+  If firmware does not setup this register correct, you can
+  modify it using the following properties:
+
+  - fsl,init-ext-48mhz-en
+    see MPC5200BUM Table 5-11 Bits 5-7
+  - fsl,init-fd-enable
+    see MPC5200BUM Table 5-11 Bit 15
+  - fsl,init-fd-counters
+    see MPC5200BUM Table 5-11 Bits 16-31
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_common.c b/arch/powerpc/platforms/52xx/mpc52xx_common.c
index 369fd54..a499848 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_common.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_common.c
@@ -137,6 +137,8 @@ void __init
 mpc52xx_map_common_devices(void)
 {
 	struct device_node *np;
+	const u32 *prop;
+	int plen;
 
 	/* mpc52xx_wdt is mapped here and used in mpc52xx_restart,
 	 * possibly from a interrupt context. wdt is only implement
@@ -154,11 +156,36 @@ mpc52xx_map_common_devices(void)
 	/* Clock Distribution Module, used by PSC clock setting function */
 	np = of_find_matching_node(NULL, mpc52xx_cdm_ids);
 	mpc52xx_cdm = of_iomap(np, 0);
+	prop = of_get_property(np, "fsl,init-ext-48mhz-en", &plen);
+	if (prop) {
+		pr_debug("ext-48mhz-en: old:%x new:%x\n",
+			in_8(&mpc52xx_cdm->ext_48mhz_en), *prop);
+		out_8(&mpc52xx_cdm->ext_48mhz_en, *prop & 0x07);
+	}
+	prop = of_get_property(np, "fsl,init-fd-enable", &plen);
+	if (prop) {
+		pr_debug("fd-enable: old:%x new:%x\n",
+			in_8(&mpc52xx_cdm->fd_enable), *prop);
+		out_8(&mpc52xx_cdm->fd_enable, *prop & 0x01);
+	}
+	prop = of_get_property(np, "fsl,init-fd-counters", &plen);
+	if (prop) {
+		pr_debug("fd-counters: old:%x new:%x\n",
+			in_be16(&mpc52xx_cdm->fd_counters), *prop);
+		out_be16(&mpc52xx_cdm->fd_counters, *prop & 0x7777);
+	}
 	of_node_put(np);
 
 	/* simple_gpio registers */
 	np = of_find_matching_node(NULL, mpc52xx_gpio_simple);
 	simple_gpio = of_iomap(np, 0);
+	/* fixup the port_config register */
+	prop = of_get_property(np, "fsl,init-port-config", &plen);
+	if (prop) {
+		pr_debug("port-config: old:%x new:%x\n",
+			in_be32(&simple_gpio->port_config), *prop);
+		out_be32(&simple_gpio->port_config, *prop);
+	}
 	of_node_put(np);
 
 	/* wkup_gpio registers */
-- 
1.7.7.6

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

* Re: [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS
  2012-03-19  8:37   ` Wolfram Sang
@ 2012-03-19  8:53     ` Anatolij Gustschin
  0 siblings, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2012-03-19  8:53 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Heiko Schocher, linuxppc-dev, Wolfgang Denk

Hi Wolfram,

On Mon, 19 Mar 2012 09:37:24 +0100
Wolfram Sang <w.sang@pengutronix.de> wrote:
...
> > Applied slightly modified patch to mpc5xxx next.
> 
> Given that the patch was sent nearly one year ago and it even got
> modified, could please resend it to the list before applying?

Yes, done.

Thanks,
Anatolij

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

* Re: [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT
  2012-03-19  8:51 ` [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT Anatolij Gustschin
@ 2012-03-20 16:28   ` Anatolij Gustschin
  0 siblings, 0 replies; 6+ messages in thread
From: Anatolij Gustschin @ 2012-03-20 16:28 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Heiko Schocher, Grant Likely, Wolfgang Denk

On Mon, 19 Mar 2012 09:51:22 +0100
Anatolij Gustschin <agust@denx.de> wrote:

> From: Heiko Schocher <hs@denx.de>
> 
> If firmware does not setup the "GPS Port Configuration Register"
> and the "CDM 48MHz Fractional Divider Configuration Register",
> it can be corrected by additional properties in the device tree.
> Add appropriate code to utility functions and document used
> bindings.
> 
> Signed-off-by: Heiko Schocher <hs@denx.de>
> cc: devicetree-discuss@lists.ozlabs.org
> cc: linuxppc-dev@lists.ozlabs.org
> cc: Grant Likely <glikely@secretlab.ca>
> cc: Wolfgang Denk <wd@denx.de>
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  .../devicetree/bindings/powerpc/fsl/mpc5200.txt    |   17 ++++++++++++
>  arch/powerpc/platforms/52xx/mpc52xx_common.c       |   27 ++++++++++++++++++++
>  2 files changed, 44 insertions(+), 0 deletions(-)

Applied for mpc5xxx next, thanks.

Anatolij

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

end of thread, other threads:[~2012-03-20 16:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-19  6:04 [PATCH][RFC] mpc52xx, common: setup port_config and cdm settings through DTS Heiko Schocher
2012-03-18 23:25 ` Anatolij Gustschin
2012-03-19  8:37   ` Wolfram Sang
2012-03-19  8:53     ` Anatolij Gustschin
2012-03-19  8:51 ` [PATCH] powerpc/mpc52xx: setup port_config and CDM settings through DT Anatolij Gustschin
2012-03-20 16:28   ` Anatolij Gustschin

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).