Skip to contentSkip to conversation

powerpc: configure USB clock for MPC8315E

PATCH Superseded Kim Phillips 3 participants 3 messages Jan 30, 2008

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc: configure USB clock for MPC8315E

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

---
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(-)
arch/powerpc/boot/dts/mpc8315erdb.dts +1 -1
index b582032..59b1f05 100644
@@ -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>;
arch/powerpc/platforms/83xx/mpc83xx.h +2 -0
index 88bb748..68065e6 100644
@@ -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 */
arch/powerpc/platforms/83xx/usb.c +8 -4
index 681230a..14c83f1 100644
@@ -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")) {
Signature · 1 line
1.5.2.2
#2 lore raw
In reply to Kim Phillips

Hi,

Quoted 6 lines · Kim Phillips
arch/powerpc/platforms/83xx/usb.c +0 -0
index 681230a..14c83f1 100644
@@ -124,10 +124,14 @@ int mpc831x_usb_cfg(void)
 	}

arch/powerpc/platforms/83xx/usb.c int mpc831x_usb_cfg(void) · line 130

Quoted 10 lines
arch/powerpc/platforms/83xx/usb.c +4 -4
 
 	/* 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