public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
* [PATCH v2] powerpc: configure USB clock for MPC8315E
@ 2008-01-30 17:08 Kim Phillips
  2008-01-30 17:24 ` Kumar Gala
  2008-01-30 17:27 ` Olof Johansson
  0 siblings, 2 replies; 3+ messages in thread
From: Kim Phillips @ 2008-01-30 17:08 UTC (permalink / raw)
  To: linuxppc-dev, Kumar Gala; +Cc: Jerry Huang

SCCR USB bits are in a different location on the mpc8315.

Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale•com>
Signed-off-by: Kim Phillips <kim.phillips@freescale•com>
---
changed to match compatible on non-board specific "fsl,mpc8315-usb2-dr".

 arch/powerpc/boot/dts/mpc8315erdb.dts |    2 +-
 arch/powerpc/platforms/83xx/mpc83xx.h |    2 ++
 arch/powerpc/platforms/83xx/usb.c     |   12 ++++++++----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8315erdb.dts b/arch/powerpc/boot/dts/mpc8315erdb.dts
index b582032..59b1f05 100644
--- a/arch/powerpc/boot/dts/mpc8315erdb.dts
+++ b/arch/powerpc/boot/dts/mpc8315erdb.dts
@@ -133,7 +133,7 @@
 		};
 
 		usb@23000 {
-			compatible = "fsl-usb2-dr";
+			compatible = "fsl-usb2-dr", "fsl,mpc8315-usb2-dr";
 			reg = <0x23000 0x1000>;
 			#address-cells = <1>;
 			#size-cells = <0>;
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 88bb748..68065e6 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -14,6 +14,8 @@
 #define MPC83XX_SCCR_USB_DRCM_11   0x00300000
 #define MPC83XX_SCCR_USB_DRCM_01   0x00100000
 #define MPC83XX_SCCR_USB_DRCM_10   0x00200000
+#define MPC8315_SCCR_USB_MASK      0x00c00000
+#define MPC8315_SCCR_USB_DRCM_11   0x00c00000
 #define MPC837X_SCCR_USB_DRCM_11   0x00c00000
 
 /* system i/o configuration register low */
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index 681230a..14c83f1 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -124,10 +124,14 @@ int mpc831x_usb_cfg(void)
 	}
 
 	/* Configure clock */
-	temp = in_be32(immap + MPC83XX_SCCR_OFFS);
-	temp &= ~MPC83XX_SCCR_USB_MASK;
-	temp |= MPC83XX_SCCR_USB_DRCM_11;  /* 1:3 */
-	out_be32(immap + MPC83XX_SCCR_OFFS, temp);
+	if (of_find_compatible_node(NULL, NULL, "fsl,mpc8315-usb2-dr"))
+		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
+		                MPC8315_SCCR_USB_MASK,
+		                MPC8315_SCCR_USB_DRCM_11);
+	else
+		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
+		                MPC83XX_SCCR_USB_MASK,
+		                MPC83XX_SCCR_USB_DRCM_11);
 
 	/* Configure pin mux for ULPI.  There is no pin mux for UTMI */
 	if (prop && !strcmp(prop, "ulpi")) {
-- 
1.5.2.2

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

* Re: [PATCH v2] powerpc: configure USB clock for MPC8315E
  2008-01-30 17:08 [PATCH v2] powerpc: configure USB clock for MPC8315E Kim Phillips
@ 2008-01-30 17:24 ` Kumar Gala
  2008-01-30 17:27 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Kumar Gala @ 2008-01-30 17:24 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev, Jerry Huang


On Jan 30, 2008, at 11:08 AM, Kim Phillips wrote:

> SCCR USB bits are in a different location on the mpc8315.
>
> Signed-off-by: Jerry Huang <Chang-Ming.Huang@freescale•com>
> Signed-off-by: Kim Phillips <kim.phillips@freescale•com>
> ---
> changed to match compatible on non-board specific "fsl,mpc8315-usb2- 
> dr".

Try again.  The SCCR isn't a function of the USB block.  Its more a  
function of the mpc8315 soc platform.

- k

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

* Re: [PATCH v2] powerpc: configure USB clock for MPC8315E
  2008-01-30 17:08 [PATCH v2] powerpc: configure USB clock for MPC8315E Kim Phillips
  2008-01-30 17:24 ` Kumar Gala
@ 2008-01-30 17:27 ` Olof Johansson
  1 sibling, 0 replies; 3+ messages in thread
From: Olof Johansson @ 2008-01-30 17:27 UTC (permalink / raw)
  To: Kim Phillips; +Cc: linuxppc-dev, Jerry Huang

Hi,

On Wed, Jan 30, 2008 at 11:08:57AM -0600, Kim Phillips wrote:
> diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
> index 681230a..14c83f1 100644
> --- a/arch/powerpc/platforms/83xx/usb.c
> +++ b/arch/powerpc/platforms/83xx/usb.c
> @@ -124,10 +124,14 @@ int mpc831x_usb_cfg(void)
>  	}
>  
>  	/* Configure clock */
> -	temp = in_be32(immap + MPC83XX_SCCR_OFFS);
> -	temp &= ~MPC83XX_SCCR_USB_MASK;
> -	temp |= MPC83XX_SCCR_USB_DRCM_11;  /* 1:3 */
> -	out_be32(immap + MPC83XX_SCCR_OFFS, temp);
> +	if (of_find_compatible_node(NULL, NULL, "fsl,mpc8315-usb2-dr"))
> +		clrsetbits_be32(immap + MPC83XX_SCCR_OFFS,
> +		                MPC8315_SCCR_USB_MASK,
> +		                MPC8315_SCCR_USB_DRCM_11);

You need an of_node_put here.

Also, it's weird to check for the global presence of a compatible
device. You already have the device node pointer in the function, why
don't you just check to see if that device is compatible instead?


-Olof

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

end of thread, other threads:[~2008-01-30 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 17:08 [PATCH v2] powerpc: configure USB clock for MPC8315E Kim Phillips
2008-01-30 17:24 ` Kumar Gala
2008-01-30 17:27 ` Olof Johansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox