linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Li Yang <leoli@freescale.com>
To: linuxppc-dev@ozlabs.org, galak@kernel.crashing.org
Cc: Li Yang <leoli@freescale.com>
Subject: [PATCH 4/6] powerpc: add USB peripheral support to MPC8272ADS
Date: Wed,  6 Aug 2008 15:04:43 +0800	[thread overview]
Message-ID: <1218006285-27138-4-git-send-email-leoli@freescale.com> (raw)
In-Reply-To: <1218006285-27138-3-git-send-email-leoli@freescale.com>

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

  reply	other threads:[~2008-08-06  6:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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     ` Li Yang [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1218006285-27138-4-git-send-email-leoli@freescale.com \
    --to=leoli@freescale.com \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).