linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] powerpc: update flash size and partition in mpc8272ads dts
@ 2008-08-06  7:04 Li Yang
  2008-08-06  7:04 ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Li Yang
  0 siblings, 1 reply; 20+ messages in thread
From: Li Yang @ 2008-08-06  7:04 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Li Yang

Make the flash size 8M to be consistent with the module comes with board.
Add predefined partitions for the flash.  Add ethernet port aliases.

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/boot/dts/mpc8272ads.dts |   38 +++++++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
index 2a1929a..b2ce4c0 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -17,6 +17,11 @@
 	#address-cells = <1>;
 	#size-cells = <1>;
 
+	aliases {
+		ethernet0 = &enet0;
+		ethernet1 = &enet1;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -46,15 +51,38 @@
 		#size-cells = <1>;
 		reg = <0xf0010100 0x40>;
 
-		ranges = <0x0 0x0 0xfe000000 0x2000000
+		ranges = <0x0 0x0 0xff800000 0x800000
 		          0x1 0x0 0xf4500000 0x8000
 		          0x3 0x0 0xf8200000 0x8000>;
 
 		flash@0,0 {
-			compatible = "jedec-flash";
-			reg = <0x0 0x0 0x2000000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "cfi-flash";
+			probe-type = "CFI";
+			reg = <0x0 0x0 0x800000>;
 			bank-width = <4>;
 			device-width = <1>;
+			hrcw@0 {
+				label = "hrcw";
+				reg = <0x0 0x40000>;
+			};
+			fs@40000 {
+				label = "fs";
+				reg = <0x40000 0x540000>;
+			};
+			kernel@580000 {
+				label = "kernel";
+				reg = <0x580000 0x180000>;
+			};
+			u-boot@700000 {
+				label = "u-boot";
+				reg = <0x700000 0x40000>;
+			};
+			u-boot-env@740000 {
+				label = "u-boot-env";
+				reg = <0x740000 0x40000>;
+			};
 		};
 
 		board-control@1,0 {
@@ -192,7 +220,7 @@
 				};
 			};
 
-			ethernet@11300 {
+			enet0: ethernet@11300 {
 				device_type = "network";
 				compatible = "fsl,mpc8272-fcc-enet",
 				             "fsl,cpm2-fcc-enet";
@@ -205,7 +233,7 @@
 				fsl,cpm-command = <0x12000300>;
 			};
 
-			ethernet@11320 {
+			enet1: ethernet@11320 {
 				device_type = "network";
 				compatible = "fsl,mpc8272-fcc-enet",
 				             "fsl,cpm2-fcc-enet";
-- 
1.5.5.1.248.g4b17

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

* [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module
  2008-08-06  7:04 [PATCH 1/6] powerpc: update flash size and partition in mpc8272ads dts Li Yang
@ 2008-08-06  7:04 ` Li Yang
  2008-08-06  7:04   ` [PATCH 3/6] powerpc: update QE/CPM2 headers for USB support Li Yang
  2008-08-06 15:24   ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Anton Vorontsov
  0 siblings, 2 replies; 20+ messages in thread
From: Li Yang @ 2008-08-06  7:04 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Li Yang

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/sysdev/cpm2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
index f1c3395..021480e 100644
--- a/arch/powerpc/sysdev/cpm2.c
+++ b/arch/powerpc/sysdev/cpm2.c
@@ -52,6 +52,7 @@ cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */
  * the communication processor devices.
  */
 cpm2_map_t __iomem *cpm2_immr;
+EXPORT_SYMBOL(cpm2_immr);
 
 #define CPM_MAP_SIZE	(0x40000)	/* 256k - the PQ3 reserve this amount
 					   of space for CPM as it is larger
-- 
1.5.5.1.248.g4b17

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

* [PATCH 3/6] powerpc: update QE/CPM2 headers for USB support
  2008-08-06  7:04 ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Li Yang
@ 2008-08-06  7:04   ` Li Yang
  2008-08-06  7:04     ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Li Yang
  2008-08-06 15:24   ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Anton Vorontsov
  1 sibling, 1 reply; 20+ messages in thread
From: Li Yang @ 2008-08-06  7:04 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Li Yang

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/include/asm/immap_cpm2.h |    9 +++------
 arch/powerpc/include/asm/immap_qe.h   |    9 +++------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/arch/powerpc/include/asm/immap_cpm2.h b/arch/powerpc/include/asm/immap_cpm2.h
index 4080bab..d4f069b 100644
--- a/arch/powerpc/include/asm/immap_cpm2.h
+++ b/arch/powerpc/include/asm/immap_cpm2.h
@@ -554,14 +554,11 @@ typedef struct usb_ctlr {
 	u8	usb_usadr;
 	u8	usb_uscom;
 	u8	res1[1];
-	u16	usb_usep1;
-	u16	usb_usep2;
-	u16	usb_usep3;
-	u16	usb_usep4;
+	__be16  usb_usep[4];
 	u8	res2[4];
-	u16	usb_usber;
+	__be16  usb_usber;
 	u8	res3[2];
-	u16	usb_usbmr;
+	__be16  usb_usbmr;
 	u8	usb_usbs;
 	u8	res4[7];
 } usb_cpm2_t;
diff --git a/arch/powerpc/include/asm/immap_qe.h b/arch/powerpc/include/asm/immap_qe.h
index 3c2fced..08d616a 100644
--- a/arch/powerpc/include/asm/immap_qe.h
+++ b/arch/powerpc/include/asm/immap_qe.h
@@ -215,10 +215,7 @@ struct usb_ctlr {
 	u8	usb_usadr;
 	u8	usb_uscom;
 	u8	res1[1];
-	__be16	usb_usep1;
-	__be16	usb_usep2;
-	__be16	usb_usep3;
-	__be16	usb_usep4;
+	__be16  usb_usep[4];
 	u8	res2[4];
 	__be16	usb_usber;
 	u8	res3[2];
@@ -472,8 +469,8 @@ extern phys_addr_t get_qe_base(void);
 
 static inline unsigned long immrbar_virt_to_phys(void *address)
 {
-	if ( ((u32)address >= (u32)qe_immr) &&
-			((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) )
+	if (((u32)address >= (u32)qe_immr) &&
+			((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)))
 		return (unsigned long)(address - (u32)qe_immr +
 				(u32)get_qe_base());
 	return (unsigned long)virt_to_phys(address);
-- 
1.5.5.1.248.g4b17

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

* [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS
  2008-08-06  7:04   ` [PATCH 3/6] powerpc: update QE/CPM2 headers for USB support Li Yang
@ 2008-08-06  7:04     ` Li Yang
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
                         ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Li Yang @ 2008-08-06  7:04 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Li Yang

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/boot/dts/mpc8272ads.dts      |    8 ++++++++
 arch/powerpc/platforms/82xx/mpc8272_ads.c |   25 +++++++++++++++++++++++++
 arch/powerpc/platforms/82xx/pq2ads.h      |    3 +++
 3 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
index b2ce4c0..75cc94c 100644
--- a/arch/powerpc/boot/dts/mpc8272ads.dts
+++ b/arch/powerpc/boot/dts/mpc8272ads.dts
@@ -256,6 +256,14 @@
 				#address-cells = <1>;
 				#size-cells = <0>;
 			};
+
+			usb@11b60 {
+				compatible = "fsl,qe_udc";
+				reg = <0x11b60 0x40 0x8b00 0x100>;
+				interrupts = <11 8>;
+				interrupt-parent = <&PIC>;
+				mode = "slave";
+			};
 		};
 
 		PIC: interrupt-controller@10c00 {
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index 8054c68..69781e6 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -23,6 +23,7 @@
 #include <asm/udbg.h>
 #include <asm/machdep.h>
 #include <asm/time.h>
+#include <asm/fs_pd.h>
 
 #include <platforms/82xx/pq2.h>
 
@@ -100,11 +101,22 @@ static struct cpm_pin mpc8272_ads_pins[] = {
 	/* I2C */
 	{3, 14, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_OPENDRAIN},
 	{3, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_OPENDRAIN},
+
+	/* USB */
+	{2, 20, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* output enable */
+	{2, 11, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* RP */
+	{2, 10, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* RN */
+	{3, 25, CPM_PIN_INPUT | CPM_PIN_PRIMARY}, /* Rxd */
+	{3, 24, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* TN */
+	{3, 23, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY}, /* TP */
+	{2, 24, CPM_PIN_INPUT | CPM_PIN_PRIMARY},  /* Usb_clk */
 };
 
 static void __init init_ioports(void)
 {
 	int i;
+	cpmux_t __iomem *im_cpmux;
+	u32 reg;
 
 	for (i = 0; i < ARRAY_SIZE(mpc8272_ads_pins); i++) {
 		struct cpm_pin *pin = &mpc8272_ads_pins[i];
@@ -119,6 +131,13 @@ static void __init init_ioports(void)
 	cpm2_clk_setup(CPM_CLK_FCC1, CPM_CLK10, CPM_CLK_TX);
 	cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK15, CPM_CLK_RX);
 	cpm2_clk_setup(CPM_CLK_FCC2, CPM_CLK16, CPM_CLK_TX);
+
+	/* USB use clock of SCC3 */
+	cpm2_clk_setup(CPM_CLK_SCC3, CPM_CLK8, CPM_CLK_TX);
+	/* SCC3 cannot be used in NMSI mode */
+	im_cpmux = cpm2_map(im_cpmux);
+	reg = in_be32(&im_cpmux->cmx_scr);
+	out_be32(&im_cpmux->cmx_scr, reg | CMXSCR_SC3);
 }
 
 static void __init mpc8272_ads_setup_arch(void)
@@ -150,6 +169,12 @@ static void __init mpc8272_ads_setup_arch(void)
 	clrbits32(&bcsr[3], BCSR3_FETHIEN2);
 	setbits32(&bcsr[3], BCSR3_FETH2_RST);
 
+	/* Enabling USB support in BCSR */
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
+	if (np != NULL) {
+		clrbits32(&bcsr[3], BCSR3_USB_EN);
+		clrbits32(&bcsr[3], BCSR3_USB_HI_SPEED);
+	}
 	iounmap(bcsr);
 
 	init_ioports();
diff --git a/arch/powerpc/platforms/82xx/pq2ads.h b/arch/powerpc/platforms/82xx/pq2ads.h
index 984db42..d0e82e2 100644
--- a/arch/powerpc/platforms/82xx/pq2ads.h
+++ b/arch/powerpc/platforms/82xx/pq2ads.h
@@ -43,6 +43,9 @@
 #define BCSR1_RS232_EN2		((uint)0x01000000)      /* 0 ==enable */
 #define BCSR3_FETHIEN2		((uint)0x10000000)      /* 0 == enable*/
 #define BCSR3_FETH2_RST		((uint)0x80000000)      /* 0 == reset */
+#define BCSR3_USB_EN      ((uint)0x80000000)        /* 0 == enable*/
+#define BCSR3_USB_HI_SPEED     ((uint)0x40000000)   /* 0 == highspeed */
+#define BCSR3_USBVCC     ((uint)0x20000000)         /* 0 == disable */
 
 /* cpm serial driver works with constants below */
 
-- 
1.5.5.1.248.g4b17

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

* [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-06  7:04     ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Li Yang
@ 2008-08-06  7:04       ` Li Yang
  2008-08-06  7:04         ` [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine Li Yang
                           ` (3 more replies)
  2008-08-06  7:48       ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Stephen Rothwell
  2008-08-06 17:19       ` Scott Wood
  2 siblings, 4 replies; 20+ messages in thread
From: Li Yang @ 2008-08-06  7:04 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Li Yang

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/boot/dts/mpc836x_mds.dts     |   15 ++++++-
 arch/powerpc/platforms/83xx/mpc836x_mds.c |   19 ++++++++-
 arch/powerpc/platforms/83xx/mpc83xx.h     |    1 +
 arch/powerpc/platforms/83xx/usb.c         |   67 +++++++++++++++++++++++++++++
 4 files changed, 100 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
index a3b76a7..596377b 100644
--- a/arch/powerpc/boot/dts/mpc836x_mds.dts
+++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
@@ -235,6 +235,17 @@
 					0  2  1  0  1  0>; /* MDC */
 			};
 
+			pio_usb: usb_pin@01 {
+				pio-map = <
+			/* port  pin  dir  open_drain  assignment  has_irq */
+					1  2  1  0  3  0        /* USBOE  */
+					1  3  1  0  3  0        /* USBTP  */
+					1  8  1  0  1  0        /* USBTN  */
+					1 10  2  0  3  0        /* USBRXD */
+					1  9  2  1  3  0        /* USBRP  */
+					1 11  2  1  3  0>;      /* USBRN  */
+			};
+
 		};
 	};
 
@@ -280,11 +291,13 @@
 		};
 
 		usb@6c0 {
-			compatible = "qe_udc";
+			compatible = "fsl,qe_udc";
 			reg = <0x6c0 0x40 0x8b00 0x100>;
 			interrupts = <11>;
 			interrupt-parent = <&qeic>;
 			mode = "slave";
+			usb-clock = <21>;
+			pio-handle = <&pio_usb>;
 		};
 
 		enet0: ucc@2000 {
diff --git a/arch/powerpc/platforms/83xx/mpc836x_mds.c b/arch/powerpc/platforms/83xx/mpc836x_mds.c
index 9d46e5b..92afd40 100644
--- a/arch/powerpc/platforms/83xx/mpc836x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc836x_mds.c
@@ -93,6 +93,12 @@ static void __init mpc836x_mds_setup_arch(void)
 
 		for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
 			par_io_of_config(np);
+
+		np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
+		if (np) {
+			par_io_of_config(np);
+			qe_usb_clock_set(np);
+		}
 	}
 
 	if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
@@ -127,9 +133,20 @@ static void __init mpc836x_mds_setup_arch(void)
 			iounmap(immap);
 		}
 
-		iounmap(bcsr_regs);
 		of_node_put(np);
 	}
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
+	if (np != NULL) {
+		/* Set the TESCs run on RGMII mode */
+		bcsr_regs[8] &= ~0xf0;
+		/* Enable the USB Device PHY */
+		bcsr_regs[13] &= ~0x0f;
+		udelay(1000);
+		bcsr_regs[13] |= 0x05;
+		of_node_put(np);
+	}
+	iounmap(bcsr_regs);
 #endif				/* CONFIG_QUICC_ENGINE */
 }
 
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 2a7cbab..d025b47 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -63,5 +63,6 @@ extern void mpc83xx_restart(char *cmd);
 extern long mpc83xx_time_init(void);
 extern int mpc834x_usb_cfg(void);
 extern int mpc831x_usb_cfg(void);
+extern int qe_usb_clock_set(struct device_node *np);
 
 #endif				/* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/usb.c b/arch/powerpc/platforms/83xx/usb.c
index cc99c28..3d04ab5 100644
--- a/arch/powerpc/platforms/83xx/usb.c
+++ b/arch/powerpc/platforms/83xx/usb.c
@@ -18,6 +18,7 @@
 #include <asm/io.h>
 #include <asm/prom.h>
 #include <sysdev/fsl_soc.h>
+#include <asm/qe.h>
 
 #include "mpc83xx.h"
 
@@ -240,3 +241,69 @@ int mpc837x_usb_cfg(void)
 	return ret;
 }
 #endif /* CONFIG_PPC_MPC837x */
+
+#ifdef CONFIG_QUICC_ENGINE
+/* QE USB_CLOCK configure functions */
+int qe_usb_clock_set(struct device_node *np)
+{
+	u32 tmpreg = 0;
+	struct qe_mux *qemux = NULL;
+	const int *clock;
+
+	qemux = &qe_immr->qmx;
+
+	clock = of_get_property(np, "usb-clock", NULL);
+	if (!clock)
+		return -EINVAL;
+
+	/* CLK21 -> USBCLK on MPC8360-PB*/
+	tmpreg = in_be32(&qemux->cmxgcr) & ~QE_CMXGCR_USBCS;
+	switch (*clock) {
+	case 21:
+		tmpreg |= 0x8;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 20, 2, 0, 1, 0);  /* PC20 for CLK21 */
+		break;
+	case 19:
+		tmpreg |= 0x7;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 18, 2, 0, 1, 0);  /* PC18 for CLK19 */
+		break;
+	case 17:
+		tmpreg |= 0x6;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 16, 2, 0, 1, 0);  /* PC16 for CLK17 */
+		break;
+	case 13:
+		tmpreg |= 0x5;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 12, 2, 0, 1, 0);  /* PC12 for CLK13 */
+		break;
+	case 9:
+		tmpreg |= 0x4;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 8, 2, 0, 1, 0);  /* PC8 for CLK9 */
+		break;
+	case 7:
+		tmpreg |= 0x3;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 6, 2, 0, 1, 0);  /* PC6 for CLK7 */
+		break;
+	case 5:
+		tmpreg |= 0x2;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 4, 2, 0, 1, 0);  /* PC4 for CLK5 */
+		break;
+	case 3:
+		tmpreg |= 0x1;
+		out_be32(&qemux->cmxgcr, tmpreg);
+		par_io_config_pin(2, 2, 2, 0, 1, 0);  /* PC2 for CLK3 */
+		break;
+	default:
+		printk(KERN_ERR "Unsupport usb-clock input pin\n");
+	}
+
+	return 0;
+}
+#endif
+
-- 
1.5.5.1.248.g4b17

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

* [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
@ 2008-08-06  7:04         ` Li Yang
  2008-08-06 17:27           ` Scott Wood
  2008-08-06  7:50         ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Stephen Rothwell
                           ` (2 subsequent siblings)
  3 siblings, 1 reply; 20+ messages in thread
From: Li Yang @ 2008-08-06  7:04 UTC (permalink / raw)
  To: linuxppc-dev, galak; +Cc: Li Yang

Initialize base and size of SEC memory region and bus priority for SEC.

Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/include/asm/immap_cpm2.h     |    7 +++++--
 arch/powerpc/platforms/82xx/mpc8272_ads.c |    1 +
 arch/powerpc/platforms/82xx/pq2.c         |   19 +++++++++++++++++++
 arch/powerpc/platforms/82xx/pq2.h         |    1 +
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/immap_cpm2.h b/arch/powerpc/include/asm/immap_cpm2.h
index d4f069b..71de9d0 100644
--- a/arch/powerpc/include/asm/immap_cpm2.h
+++ b/arch/powerpc/include/asm/immap_cpm2.h
@@ -115,10 +115,13 @@ typedef struct	mem_ctlr {
 	u32	memc_immr;
 	u32	memc_pcibr0;
 	u32	memc_pcibr1;
-	u8	res10[16];
+	u32	secbr;
+	u8	res10[4];
+	u32	secmr;
+	u8	res11[4];
 	u32	memc_pcimsk0;
 	u32	memc_pcimsk1;
-	u8	res11[52];
+	u8	res12[52];
 } memctl_cpm2_t;
 
 /* System Integration Timers.
diff --git a/arch/powerpc/platforms/82xx/mpc8272_ads.c b/arch/powerpc/platforms/82xx/mpc8272_ads.c
index 69781e6..a98d97c 100644
--- a/arch/powerpc/platforms/82xx/mpc8272_ads.c
+++ b/arch/powerpc/platforms/82xx/mpc8272_ads.c
@@ -179,6 +179,7 @@ static void __init mpc8272_ads_setup_arch(void)
 
 	init_ioports();
 	pq2_init_pci();
+	pq2_init_sec();
 
 	if (ppc_md.progress)
 		ppc_md.progress("mpc8272_ads_setup_arch(), finish", 0);
diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
index 1b75902..bacb136 100644
--- a/arch/powerpc/platforms/82xx/pq2.c
+++ b/arch/powerpc/platforms/82xx/pq2.c
@@ -22,6 +22,8 @@
 #include <platforms/82xx/pq2.h>
 
 #define RMR_CSRE 0x00000001
+#define PQ2_SECMR_128K 0xfffe0000
+#define PQ2_ALRH_SEC 0x30126745
 
 void pq2_restart(char *cmd)
 {
@@ -35,6 +37,23 @@ void pq2_restart(char *cmd)
 	panic("Restart failed\n");
 }
 
+void __init pq2_init_sec(void)
+{
+	struct device_node *np = NULL;
+	struct resource res;
+
+	np = of_find_compatible_node(NULL, NULL, "fsl,talitos");
+	if (!np)
+		return;
+
+	of_address_to_resource(np, 0, &res);
+	printk(KERN_INFO "Setting SECBR and SECMR\n");
+	out_be32(&cpm2_immr->im_memctl.secbr, (u32)res.start);
+	out_be32(&cpm2_immr->im_memctl.secmr, PQ2_SECMR_128K);
+	out_be32(&cpm2_immr->im_siu_conf.siu_82xx.sc_ppc_alrh, PQ2_ALRH_SEC);
+	of_node_put(np);
+}
+
 #ifdef CONFIG_PCI
 static int pq2_pci_exclude_device(struct pci_controller *hose,
                                   u_char bus, u8 devfn)
diff --git a/arch/powerpc/platforms/82xx/pq2.h b/arch/powerpc/platforms/82xx/pq2.h
index a41f84a..98d3c3c 100644
--- a/arch/powerpc/platforms/82xx/pq2.h
+++ b/arch/powerpc/platforms/82xx/pq2.h
@@ -2,6 +2,7 @@
 #define _PQ2_H
 
 void pq2_restart(char *cmd);
+void pq2_init_sec(void);
 
 #ifdef CONFIG_PCI
 int pq2ads_pci_init_irq(void);
-- 
1.5.5.1.248.g4b17

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

* Re: [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS
  2008-08-06  7:04     ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Li Yang
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
@ 2008-08-06  7:48       ` Stephen Rothwell
  2008-08-06 17:19       ` Scott Wood
  2 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2008-08-06  7:48 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

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

Hi Li,

On Wed,  6 Aug 2008 15:04:43 +0800 Li Yang <leoli@freescale.com> wrote:
>
> @@ -150,6 +169,12 @@ static void __init mpc8272_ads_setup_arch(void)
>  	clrbits32(&bcsr[3], BCSR3_FETHIEN2);
>  	setbits32(&bcsr[3], BCSR3_FETH2_RST);
>  
> +	/* Enabling USB support in BCSR */
> +	np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
> +	if (np != NULL) {

		of_node_put(np);

> +		clrbits32(&bcsr[3], BCSR3_USB_EN);
> +		clrbits32(&bcsr[3], BCSR3_USB_HI_SPEED);
> +	}
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

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

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

* Re: [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
  2008-08-06  7:04         ` [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine Li Yang
@ 2008-08-06  7:50         ` Stephen Rothwell
  2008-08-06 12:07         ` Anton Vorontsov
  2008-08-06 17:29         ` Scott Wood
  3 siblings, 0 replies; 20+ messages in thread
From: Stephen Rothwell @ 2008-08-06  7:50 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

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

Hi Li,

On Wed,  6 Aug 2008 15:04:44 +0800 Li Yang <leoli@freescale.com> wrote:
>
> @@ -93,6 +93,12 @@ static void __init mpc836x_mds_setup_arch(void)
>  
>  		for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
>  			par_io_of_config(np);
> +
> +		np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
> +		if (np) {
> +			par_io_of_config(np);
> +			qe_usb_clock_set(np);

			of_node_put(np);

> +		}
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

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

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

* Re: [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
  2008-08-06  7:04         ` [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine Li Yang
  2008-08-06  7:50         ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Stephen Rothwell
@ 2008-08-06 12:07         ` Anton Vorontsov
  2008-08-07  9:31           ` Li Yang
  2008-08-06 17:29         ` Scott Wood
  3 siblings, 1 reply; 20+ messages in thread
From: Anton Vorontsov @ 2008-08-06 12:07 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

Hello Li,

On Wed, Aug 06, 2008 at 03:04:44PM +0800, Li Yang wrote:
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
>  arch/powerpc/boot/dts/mpc836x_mds.dts     |   15 ++++++-
>  arch/powerpc/platforms/83xx/mpc836x_mds.c |   19 ++++++++-
>  arch/powerpc/platforms/83xx/mpc83xx.h     |    1 +
>  arch/powerpc/platforms/83xx/usb.c         |   67 +++++++++++++++++++++++++++++
>  4 files changed, 100 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
> index a3b76a7..596377b 100644
> --- a/arch/powerpc/boot/dts/mpc836x_mds.dts
> +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
> @@ -235,6 +235,17 @@
>  					0  2  1  0  1  0>; /* MDC */
>  			};
>  
> +			pio_usb: usb_pin@01 {
> +				pio-map = <
> +			/* port  pin  dir  open_drain  assignment  has_irq */
> +					1  2  1  0  3  0        /* USBOE  */
> +					1  3  1  0  3  0        /* USBTP  */
> +					1  8  1  0  1  0        /* USBTN  */
> +					1 10  2  0  3  0        /* USBRXD */
> +					1  9  2  1  3  0        /* USBRP  */
> +					1 11  2  1  3  0>;      /* USBRN  */
> +			};
> +
>  		};
>  	};
>  
> @@ -280,11 +291,13 @@
>  		};
>  
>  		usb@6c0 {
> -			compatible = "qe_udc";
> +			compatible = "fsl,qe_udc";

You might want to reuse existing bindings as described in
Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt.

>  			reg = <0x6c0 0x40 0x8b00 0x100>;
>  			interrupts = <11>;
>  			interrupt-parent = <&qeic>;
>  			mode = "slave";

I'd suggest to rename this to "peripheral" as we use for fsl dual-role
usb controller.

> +			usb-clock = <21>;
> +			pio-handle = <&pio_usb>;

Can we not introduce new pio maps? The pio setup should be done
by the firmware, or at least fixed up via the board file, as in
arch/powerpc/platforms/83xx/mpc832x_rdb.c.

[...]
> +#ifdef CONFIG_QUICC_ENGINE
> +/* QE USB_CLOCK configure functions */
> +int qe_usb_clock_set(struct device_node *np)

We already have this function, in arch/powerpc/sysdev/qe_lib/usb.c

It does not parse any of properties though, driver should do this.

> +{
> +	u32 tmpreg = 0;
> +	struct qe_mux *qemux = NULL;
> +	const int *clock;
> +
> +	qemux = &qe_immr->qmx;
> +
> +	clock = of_get_property(np, "usb-clock", NULL);
> +	if (!clock)
> +		return -EINVAL;
> +
> +	/* CLK21 -> USBCLK on MPC8360-PB*/
> +	tmpreg = in_be32(&qemux->cmxgcr) & ~QE_CMXGCR_USBCS;
> +	switch (*clock) {
> +	case 21:
> +		tmpreg |= 0x8;
> +		out_be32(&qemux->cmxgcr, tmpreg);
> +		par_io_config_pin(2, 20, 2, 0, 1, 0);  /* PC20 for CLK21 */

No, pio config is very board-specific. This should be done by the
firmware (ideally) or by the board file.

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

* Re: [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module
  2008-08-06  7:04 ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Li Yang
  2008-08-06  7:04   ` [PATCH 3/6] powerpc: update QE/CPM2 headers for USB support Li Yang
@ 2008-08-06 15:24   ` Anton Vorontsov
  2008-08-07 10:19     ` Li Yang
  1 sibling, 1 reply; 20+ messages in thread
From: Anton Vorontsov @ 2008-08-06 15:24 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Wed, Aug 06, 2008 at 03:04:41PM +0800, Li Yang wrote:
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
>  arch/powerpc/sysdev/cpm2.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
> index f1c3395..021480e 100644
> --- a/arch/powerpc/sysdev/cpm2.c
> +++ b/arch/powerpc/sysdev/cpm2.c
> @@ -52,6 +52,7 @@ cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */
>   * the communication processor devices.
>   */
>  cpm2_map_t __iomem *cpm2_immr;
> +EXPORT_SYMBOL(cpm2_immr);

This is uneeded if you'll start using cpm_muram_* functions
from include/asm-powerpc/cpm.h.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

* Re: [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS
  2008-08-06  7:04     ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Li Yang
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
  2008-08-06  7:48       ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Stephen Rothwell
@ 2008-08-06 17:19       ` Scott Wood
  2008-08-07  3:50         ` Li Yang
  2 siblings, 1 reply; 20+ messages in thread
From: Scott Wood @ 2008-08-06 17:19 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Wed, Aug 06, 2008 at 03:04:43PM +0800, Li Yang wrote:
> Signed-off-by: Li Yang <leoli@freescale.com>
> ---
>  arch/powerpc/boot/dts/mpc8272ads.dts      |    8 ++++++++
>  arch/powerpc/platforms/82xx/mpc8272_ads.c |   25 +++++++++++++++++++++++++
>  arch/powerpc/platforms/82xx/pq2ads.h      |    3 +++
>  3 files changed, 36 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
> index b2ce4c0..75cc94c 100644
> --- a/arch/powerpc/boot/dts/mpc8272ads.dts
> +++ b/arch/powerpc/boot/dts/mpc8272ads.dts
> @@ -256,6 +256,14 @@
>  				#address-cells = <1>;
>  				#size-cells = <0>;
>  			};
> +
> +			usb@11b60 {
> +				compatible = "fsl,qe_udc";

"fsl,mpc8272-usb", "fsl,cpm2-usb".

Where is fsl,qe_udc documented or used (other than in the BCSR setup)?
What does "udc" mean (the only reference to it in the 8272 manual is
under ATM)?

> +				mode = "slave";

Please document this property.

-Scott

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

* Re: [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine
  2008-08-06  7:04         ` [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine Li Yang
@ 2008-08-06 17:27           ` Scott Wood
  0 siblings, 0 replies; 20+ messages in thread
From: Scott Wood @ 2008-08-06 17:27 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Wed, Aug 06, 2008 at 03:04:45PM +0800, Li Yang wrote:
> diff --git a/arch/powerpc/platforms/82xx/pq2.c b/arch/powerpc/platforms/82xx/pq2.c
> index 1b75902..bacb136 100644
> --- a/arch/powerpc/platforms/82xx/pq2.c
> +++ b/arch/powerpc/platforms/82xx/pq2.c
> @@ -22,6 +22,8 @@
>  #include <platforms/82xx/pq2.h>
>  
>  #define RMR_CSRE 0x00000001
> +#define PQ2_SECMR_128K 0xfffe0000
> +#define PQ2_ALRH_SEC 0x30126745
>  
>  void pq2_restart(char *cmd)
>  {
> @@ -35,6 +37,23 @@ void pq2_restart(char *cmd)
>  	panic("Restart failed\n");
>  }
>  
> +void __init pq2_init_sec(void)
> +{
> +	struct device_node *np = NULL;
> +	struct resource res;
> +
> +	np = of_find_compatible_node(NULL, NULL, "fsl,talitos");

This is an obsolete binding. 
See "Documentation/powerpc/dts-bindings/fsl/sec.txt".

> +	if (!np)
> +		return;
> +
> +	of_address_to_resource(np, 0, &res);
> +	printk(KERN_INFO "Setting SECBR and SECMR\n");

This is an unnecessary printk().

> +	out_be32(&cpm2_immr->im_memctl.secbr, (u32)res.start);
> +	out_be32(&cpm2_immr->im_memctl.secmr, PQ2_SECMR_128K);
> +	out_be32(&cpm2_immr->im_siu_conf.siu_82xx.sc_ppc_alrh, PQ2_ALRH_SEC);

Please put some comments here explaining what you're doing, such as 
/* Map the SEC registers */, and /* Lower the SEC arbitration priority */.

-Scott

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

* Re: [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
                           ` (2 preceding siblings ...)
  2008-08-06 12:07         ` Anton Vorontsov
@ 2008-08-06 17:29         ` Scott Wood
  2008-08-07  3:32           ` Li Yang
  3 siblings, 1 reply; 20+ messages in thread
From: Scott Wood @ 2008-08-06 17:29 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Wed, Aug 06, 2008 at 03:04:44PM +0800, Li Yang wrote:
>  		usb@6c0 {
> -			compatible = "qe_udc";
> +			compatible = "fsl,qe_udc";
[snip]
> +
> +		np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
> +		if (np) {
> +			par_io_of_config(np);
> +			qe_usb_clock_set(np);
> +		}

What about existing device trees in use?

> +		printk(KERN_ERR "Unsupport usb-clock input pin\n");

s/Unsupport/Unsupported/

-Scott

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

* Re: [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-06 17:29         ` Scott Wood
@ 2008-08-07  3:32           ` Li Yang
  0 siblings, 0 replies; 20+ messages in thread
From: Li Yang @ 2008-08-07  3:32 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

On Wed, 2008-08-06 at 12:29 -0500, Scott Wood wrote:
> On Wed, Aug 06, 2008 at 03:04:44PM +0800, Li Yang wrote:
> >  		usb@6c0 {
> > -			compatible = "qe_udc";
> > +			compatible = "fsl,qe_udc";
> [snip]
> > +
> > +		np = of_find_compatible_node(NULL, NULL, "fsl,qe_udc");
> > +		if (np) {
> > +			par_io_of_config(np);
> > +			qe_usb_clock_set(np);
> > +		}
> 
> What about existing device trees in use?

This node was never used in existing device trees for mainline kernel.

- Leo

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

* Re: [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS
  2008-08-06 17:19       ` Scott Wood
@ 2008-08-07  3:50         ` Li Yang
  2008-08-07 14:19           ` Scott Wood
  0 siblings, 1 reply; 20+ messages in thread
From: Li Yang @ 2008-08-07  3:50 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

On Wed, 2008-08-06 at 12:19 -0500, Scott Wood wrote:
> On Wed, Aug 06, 2008 at 03:04:43PM +0800, Li Yang wrote:
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > ---
> >  arch/powerpc/boot/dts/mpc8272ads.dts      |    8 ++++++++
> >  arch/powerpc/platforms/82xx/mpc8272_ads.c |   25 +++++++++++++++++++++++++
> >  arch/powerpc/platforms/82xx/pq2ads.h      |    3 +++
> >  3 files changed, 36 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/powerpc/boot/dts/mpc8272ads.dts b/arch/powerpc/boot/dts/mpc8272ads.dts
> > index b2ce4c0..75cc94c 100644
> > --- a/arch/powerpc/boot/dts/mpc8272ads.dts
> > +++ b/arch/powerpc/boot/dts/mpc8272ads.dts
> > @@ -256,6 +256,14 @@
> >  				#address-cells = <1>;
> >  				#size-cells = <0>;
> >  			};
> > +
> > +			usb@11b60 {
> > +				compatible = "fsl,qe_udc";
> 
> "fsl,mpc8272-usb", "fsl,cpm2-usb".
> 
> Where is fsl,qe_udc documented or used (other than in the BCSR setup)?
> What does "udc" mean (the only reference to it in the 8272 manual is
> under ATM)?

udc is a common name for USB device mode drivers to work with Linux
gadget.  We will have two separate drivers for USB host and device.
Probably we can have two compatibles "fsl,qe_udc" and "fsl,qe-usb-host"

- Leo

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

* Re: [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-06 12:07         ` Anton Vorontsov
@ 2008-08-07  9:31           ` Li Yang
  2008-08-07 13:23             ` Anton Vorontsov
  0 siblings, 1 reply; 20+ messages in thread
From: Li Yang @ 2008-08-07  9:31 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev

Hi Anton,

On Wed, 2008-08-06 at 16:07 +0400, Anton Vorontsov wrote:
> Hello Li,
> 
> On Wed, Aug 06, 2008 at 03:04:44PM +0800, Li Yang wrote:
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > ---
> >  arch/powerpc/boot/dts/mpc836x_mds.dts     |   15 ++++++-
> >  arch/powerpc/platforms/83xx/mpc836x_mds.c |   19 ++++++++-
> >  arch/powerpc/platforms/83xx/mpc83xx.h     |    1 +
> >  arch/powerpc/platforms/83xx/usb.c         |   67 +++++++++++++++++++++++++++++
> >  4 files changed, 100 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/powerpc/boot/dts/mpc836x_mds.dts b/arch/powerpc/boot/dts/mpc836x_mds.dts
> > index a3b76a7..596377b 100644
> > --- a/arch/powerpc/boot/dts/mpc836x_mds.dts
> > +++ b/arch/powerpc/boot/dts/mpc836x_mds.dts
> > @@ -235,6 +235,17 @@
> >  					0  2  1  0  1  0>; /* MDC */
> >  			};
> >  
> > +			pio_usb: usb_pin@01 {
> > +				pio-map = <
> > +			/* port  pin  dir  open_drain  assignment  has_irq */
> > +					1  2  1  0  3  0        /* USBOE  */
> > +					1  3  1  0  3  0        /* USBTP  */
> > +					1  8  1  0  1  0        /* USBTN  */
> > +					1 10  2  0  3  0        /* USBRXD */
> > +					1  9  2  1  3  0        /* USBRP  */
> > +					1 11  2  1  3  0>;      /* USBRN  */
> > +			};
> > +
> >  		};
> >  	};
> >  
> > @@ -280,11 +291,13 @@
> >  		};
> >  
> >  		usb@6c0 {
> > -			compatible = "qe_udc";
> > +			compatible = "fsl,qe_udc";
> 
> You might want to reuse existing bindings as described in
> Documentation/powerpc/dts-bindings/fsl/cpm_qe/qe/usb.txt.

Ok.  I didn't notice your addition to the binding.  I will try to update
it for device mode.

> 
> >  			reg = <0x6c0 0x40 0x8b00 0x100>;
> >  			interrupts = <11>;
> >  			interrupt-parent = <&qeic>;
> >  			mode = "slave";
> 
> I'd suggest to rename this to "peripheral" as we use for fsl dual-role
> usb controller.

As there will be two drivers chosen by compatible, I'm now inclined to
put this information in compatible.

> 
> > +			usb-clock = <21>;
> > +			pio-handle = <&pio_usb>;
> 
> Can we not introduce new pio maps? The pio setup should be done
> by the firmware, or at least fixed up via the board file, as in
> arch/powerpc/platforms/83xx/mpc832x_rdb.c.

Actually I am more apt to leaving full hardware access to kernel than
firmware, especially for devices that are not used in firmware.  The
reason why I made the pin-configuration flexible is that for development
boards the role of pins are often changeable.

> 
> [...]
> > +#ifdef CONFIG_QUICC_ENGINE
> > +/* QE USB_CLOCK configure functions */
> > +int qe_usb_clock_set(struct device_node *np)
> 
> We already have this function, in arch/powerpc/sysdev/qe_lib/usb.c

I just saw this.  Will try to reuse it.

> 
> It does not parse any of properties though, driver should do this.
> 
> > +{
> > +	u32 tmpreg = 0;
> > +	struct qe_mux *qemux = NULL;
> > +	const int *clock;
> > +
> > +	qemux = &qe_immr->qmx;
> > +
> > +	clock = of_get_property(np, "usb-clock", NULL);
> > +	if (!clock)
> > +		return -EINVAL;
> > +
> > +	/* CLK21 -> USBCLK on MPC8360-PB*/
> > +	tmpreg = in_be32(&qemux->cmxgcr) & ~QE_CMXGCR_USBCS;
> > +	switch (*clock) {
> > +	case 21:
> > +		tmpreg |= 0x8;
> > +		out_be32(&qemux->cmxgcr, tmpreg);
> > +		par_io_config_pin(2, 20, 2, 0, 1, 0);  /* PC20 for CLK21 */
> 
> No, pio config is very board-specific. This should be done by the
> firmware (ideally) or by the board file.

Pio config is board and board configuration specific.  It's better to
make it configurable by device tree.

- Leo

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

* Re: [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module
  2008-08-06 15:24   ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Anton Vorontsov
@ 2008-08-07 10:19     ` Li Yang
  2008-08-07 11:38       ` Anton Vorontsov
  0 siblings, 1 reply; 20+ messages in thread
From: Li Yang @ 2008-08-07 10:19 UTC (permalink / raw)
  To: avorontsov; +Cc: linuxppc-dev

On Wed, 2008-08-06 at 19:24 +0400, Anton Vorontsov wrote:
> On Wed, Aug 06, 2008 at 03:04:41PM +0800, Li Yang wrote:
> > Signed-off-by: Li Yang <leoli@freescale.com>
> > ---
> >  arch/powerpc/sysdev/cpm2.c |    1 +
> >  1 files changed, 1 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
> > index f1c3395..021480e 100644
> > --- a/arch/powerpc/sysdev/cpm2.c
> > +++ b/arch/powerpc/sysdev/cpm2.c
> > @@ -52,6 +52,7 @@ cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */
> >   * the communication processor devices.
> >   */
> >  cpm2_map_t __iomem *cpm2_immr;
> > +EXPORT_SYMBOL(cpm2_immr);
> 
> This is uneeded if you'll start using cpm_muram_* functions
> from include/asm-powerpc/cpm.h.

Right.  But there are still a few in tree drivers rely on this such as
fs_enet.

Ps: In your cpm_muram_init() you re-mapped the muram space separately .
Are we planning to get rid of cpm2_immr completely and manage memory
mapping by each block?

- Leo

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

* Re: [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module
  2008-08-07 10:19     ` Li Yang
@ 2008-08-07 11:38       ` Anton Vorontsov
  0 siblings, 0 replies; 20+ messages in thread
From: Anton Vorontsov @ 2008-08-07 11:38 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Thu, Aug 07, 2008 at 06:19:22PM +0800, Li Yang wrote:
> On Wed, 2008-08-06 at 19:24 +0400, Anton Vorontsov wrote:
> > On Wed, Aug 06, 2008 at 03:04:41PM +0800, Li Yang wrote:
> > > Signed-off-by: Li Yang <leoli@freescale.com>
> > > ---
> > >  arch/powerpc/sysdev/cpm2.c |    1 +
> > >  1 files changed, 1 insertions(+), 0 deletions(-)
> > > 
> > > diff --git a/arch/powerpc/sysdev/cpm2.c b/arch/powerpc/sysdev/cpm2.c
> > > index f1c3395..021480e 100644
> > > --- a/arch/powerpc/sysdev/cpm2.c
> > > +++ b/arch/powerpc/sysdev/cpm2.c
> > > @@ -52,6 +52,7 @@ cpm_cpm2_t __iomem *cpmp; /* Pointer to comm processor space */
> > >   * the communication processor devices.
> > >   */
> > >  cpm2_map_t __iomem *cpm2_immr;
> > > +EXPORT_SYMBOL(cpm2_immr);
> > 
> > This is uneeded if you'll start using cpm_muram_* functions
> > from include/asm-powerpc/cpm.h.
> 
> Right.  But there are still a few in tree drivers rely on this such as
> fs_enet.

Probably they should be fixed... Only two users left:

$ git-grep cpm2_immr drivers/
drivers/mtd/maps/wr_sbc82xx_flash.c:    volatile memctl_cpm2_t *mc = &cpm2_immr->im_memctl;
drivers/mtd/maps/wr_sbc82xx_flash.c:    mc = &cpm2_immr->im_memctl;
drivers/net/fs_enet/fs_enet-main.c:     fs_enet_immap = cpm2_immr;
drivers/net/fs_enet/mac-fcc.c:  fep->fcc.mem = (void __iomem *)cpm2_immr;

I think wr_sbc82xx_flash.c is superseded by the physmap_of driver. There
is no single CONFIG_MTD_SBC8240 enabled in the powerpc/configs.

Plus, I wonder how they didn't break the build all that time w/o
EXPORT_SYMBOL(). Probably nobody tried to build them as modules.

> Ps: In your cpm_muram_init() you re-mapped the muram space separately .
> Are we planning to get rid of cpm2_immr completely and manage memory
> mapping by each block?

At least I always thought so...

Thanks,

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

* Re: [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS
  2008-08-07  9:31           ` Li Yang
@ 2008-08-07 13:23             ` Anton Vorontsov
  0 siblings, 0 replies; 20+ messages in thread
From: Anton Vorontsov @ 2008-08-07 13:23 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Thu, Aug 07, 2008 at 05:31:44PM +0800, Li Yang wrote:
[...]
> > 
> > >  			reg = <0x6c0 0x40 0x8b00 0x100>;
> > >  			interrupts = <11>;
> > >  			interrupt-parent = <&qeic>;
> > >  			mode = "slave";
> > 
> > I'd suggest to rename this to "peripheral" as we use for fsl dual-role
> > usb controller.
> 
> As there will be two drivers chosen by compatible, I'm now inclined to
> put this information in compatible.

Please don't. I deliberately wrote bindings w/o specifing "udc" or
"host" in the compatible entry.

"udc"/"host" is the modes of an USB controller, but the controller
itself is the same: "fsl,mpc8323-qe-usb" (the first chip with QE USB).

So the driver should always match this device, but it can return
-ENODEV if mode is unspecified or !peripheral.

> > > +			usb-clock = <21>;
> > > +			pio-handle = <&pio_usb>;
> > 
> > Can we not introduce new pio maps? The pio setup should be done
> > by the firmware, or at least fixed up via the board file, as in
> > arch/powerpc/platforms/83xx/mpc832x_rdb.c.
> 
> Actually I am more apt to leaving full hardware access to kernel than
> firmware, especially for devices that are not used in firmware.  The
> reason why I made the pin-configuration flexible is that for development
> boards the role of pins are often changeable.
[...]
> Pio config is board and board configuration specific.  It's better to
> make it configurable by device tree.

Device tree isn't configuration file. The bad thing about pio-map is that
it is passing raw values instead of actually describing the hardware.

For example,

pio-map = <1  6  2  0  1  0>;

The thing describes bankB/pin6.. but you'll can't tell what exactly
this pin supposed to do. :-/

Basically "pio-map" is expanded version of this:

fsl,cpodr-reg = <0x...>;
fsl,cppar1-reg = <0x...>;
fsl,cppar2-reg = <0x...>;
...


Instead, it would be great to have something like this:

usb@... {
	/*
	 *      gpio/pinmux    pin
	 *      controller
	 */
	pio-map = <&pinmuxA     1 /* bindings says first pin is clk */
		   &pinmuxB    14 /* bindings says second pin is usboe */
		   ...>;
};

ucc@... {
	pio-map = <&pinmuxA     2 /* bindings says first pin is clk */
		   &pinmuxB    24 /* bindings says second pin is rxd0 */
		   &pinmuxB    21 /* bindings says second pin is rxd1 */
		   ...>;
};

Then drivers would call something like this in probe():

clk = qe_get_clock(node, "fsl,fullspeed-clock");
qe_set_pinmux(pin0, QE_PIN_FUNC_CLK(clk));
qe_set_pinmux(pin1, QE_PIN_FUNC_USB_OE);
...or ucc ethernet...
qe_set_pinmux(pin[rx_n], QE_PIN_FUNC_UCC_RXD(ucc_num, rx_n));

Obviously, this is quite hard to implement (and expensive, too), since
each SoC implementation has its own function<->pin<->regvalue mapping..

Thus nobody even think to bother with this.


Anyway, I'm not that opposed to the current pio-maps, but it
would be great if we could avoid them where possible.

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

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

* Re: [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS
  2008-08-07  3:50         ` Li Yang
@ 2008-08-07 14:19           ` Scott Wood
  0 siblings, 0 replies; 20+ messages in thread
From: Scott Wood @ 2008-08-07 14:19 UTC (permalink / raw)
  To: Li Yang; +Cc: linuxppc-dev

On Thu, Aug 07, 2008 at 11:50:14AM +0800, Li Yang wrote:
> udc is a common name for USB device mode drivers to work with Linux
> gadget.  We will have two separate drivers for USB host and device.
> Probably we can have two compatibles "fsl,qe_udc" and "fsl,qe-usb-host"

1. If you have separate compatibles, what do you need the "mode" property
for?
2. mpc8272 is not QE.
3. fsl,cpm2-usb-slave would be much more readable than fsl,qe_udc.

-Scott

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

end of thread, other threads:[~2008-08-07 14:19 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-06  7:04 [PATCH 1/6] powerpc: update flash size and partition in mpc8272ads dts Li Yang
2008-08-06  7:04 ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Li Yang
2008-08-06  7:04   ` [PATCH 3/6] powerpc: update QE/CPM2 headers for USB support Li Yang
2008-08-06  7:04     ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Li Yang
2008-08-06  7:04       ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Li Yang
2008-08-06  7:04         ` [PATCH 6/6] powerpc: add 82xx platform level support to SEC engine Li Yang
2008-08-06 17:27           ` Scott Wood
2008-08-06  7:50         ` [PATCH 5/6] powerpc: add USB peripheral support to MPC836xMDS Stephen Rothwell
2008-08-06 12:07         ` Anton Vorontsov
2008-08-07  9:31           ` Li Yang
2008-08-07 13:23             ` Anton Vorontsov
2008-08-06 17:29         ` Scott Wood
2008-08-07  3:32           ` Li Yang
2008-08-06  7:48       ` [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS Stephen Rothwell
2008-08-06 17:19       ` Scott Wood
2008-08-07  3:50         ` Li Yang
2008-08-07 14:19           ` Scott Wood
2008-08-06 15:24   ` [PATCH 2/6] powerpc: export cpm2_immr symbol for CPM2 drivers to compile as module Anton Vorontsov
2008-08-07 10:19     ` Li Yang
2008-08-07 11:38       ` Anton Vorontsov

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