From: Li Yang <leoli@freescale.com>
To: galak@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org, linux-usb-devel@lists.sourceforge.net
Subject: [PATCH] Add USB to MPC8349 PB platform support
Date: Fri, 14 Jul 2006 19:52:26 +0800 [thread overview]
Message-ID: <44B7857A.2060101@freescale.com> (raw)
This adds USB platform support to MPC8349 PB. It works with the fsl_usb2_udc driver.
Signed-off-by: Li Yang <leoli@freescale.com>
---
arch/powerpc/platforms/83xx/Kconfig | 4 ++
arch/powerpc/platforms/83xx/mpc834x_sys.c | 72 +++++++++++++++++++++++++++++
arch/powerpc/platforms/83xx/mpc834x_sys.h | 24 ++++++++++
3 files changed, 113 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index 7675e67..8404cdf 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -24,4 +31,14 @@ config MPC834x
select PPC_INDIRECT_PCI
default y if MPC834x_SYS
+config 834x_USB_SUPPORT
+ bool
+ default y if MPC834x_SYS && (USB || USB_GADGET)
+
endmenu
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index 7e789d2..f10d4ae 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -36,6 +36,7 @@ #include <asm/irq.h>
#include <asm/prom.h>
#include <asm/udbg.h>
#include <sysdev/fsl_soc.h>
+#include <linux/fsl_devices.h>
#include "mpc83xx.h"
@@ -71,6 +72,72 @@ mpc83xx_map_irq(struct pci_dev *dev, uns
}
#endif /* CONFIG_PCI */
+#ifdef CONFIG_834x_USB_SUPPORT
+void mpc834x_usb_board_cfg(void)
+{
+ unsigned char __iomem *bcsr;
+ volatile unsigned char *bcsr5_p;
+
+ /*
+ * if SYS board is plug into PIB board,
+ * force to use the PHY on SYS board
+ * */
+ bcsr = ioremap(BCSR_PHYS_ADDR, BCSR_SIZE);
+ bcsr5_p = bcsr + BCSR5_OFF;
+ if ( (*bcsr5_p & BCSR5_INT_USB) == 0 )
+ *bcsr5_p = (*bcsr5_p | BCSR5_INT_USB);
+ iounmap(bcsr);
+}
+
+/* Note: This is only for PB, not for PB+PIB
+ * On PB only port0 is connected using ULPI */
+static int mpc834x_usb_cfg(void)
+{
+ unsigned long sccr, sicrl;
+ volatile unsigned long *p;
+ unsigned long __iomem *immap;
+ struct device_node *np = NULL;
+ int port0_is_dr = 0;
+
+ if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL)
+ port0_is_dr = 1;
+ if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){
+ if (port0_is_dr) {
+ printk(KERN_WARNING
+ "There is only one USB port on PB board! \n");
+ return -1;
+ } else if (!port0_is_dr)
+ /* No usb port enabled */
+ return -1;
+ }
+
+ immap = ioremap(get_immrbase(), 0x100000);
+
+ /* Configure clock */
+ p = (volatile unsigned long *)((u32)immap + MPC83XX_SCCR_OFFS);
+ sccr = *p;
+ if (port0_is_dr)
+ sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
+ else
+ sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
+ *p = sccr;
+
+ /* Configure Pin */
+ p = (volatile unsigned long *)((u32)immap + MPC83XX_SICRL_OFFS);
+ sicrl = *p;
+ /* set port0 only */
+ if (port0_is_dr)
+ sicrl |= MPC83XX_SICRL_USB0;
+ else
+ sicrl &= ~(MPC83XX_SICRL_USB0);
+ *p = sicrl;
+
+ iounmap(immap);
+ return 0;
+}
+
+#endif /* CONFIG_834x_USB_SUPPORT */
+
/* ************************************************************************
*
* Setup the architecture
@@ -102,6 +169,11 @@ #ifdef CONFIG_PCI
ppc_md.pci_exclude_device = mpc83xx_exclude_device;
#endif
+#ifdef CONFIG_834x_USB_SUPPORT
+ mpc834x_usb_cfg();
+ mpc834x_usb_board_cfg();
+#endif
+
#ifdef CONFIG_ROOT_NFS
ROOT_DEV = Root_NFS;
#else
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
index fedecb7..30e45e8 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.h
@@ -20,4 +20,28 @@ #define PIRQB MPC83xx_IRQ_EXT5
#define PIRQC MPC83xx_IRQ_EXT6
#define PIRQD MPC83xx_IRQ_EXT7
+#define BCSR_PHYS_ADDR ((uint)0xf8000000)
+#define BCSR_SIZE ((uint)(32 * 1024))
+
+#define BCSR5_OFF 0x05
+#define BCSR5_INT_USB 0x02
+
+#define MPC83XX_SCCR_OFFS 0xA08
+#define MPC83XX_SCCR_USB_MPHCM_11 0x00c00000
+#define MPC83XX_SCCR_USB_MPHCM_01 0x00400000
+#define MPC83XX_SCCR_USB_MPHCM_10 0x00800000
+#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
+#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
+#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
+
+/* system i/o configuration register low */
+#define MPC83XX_SICRL_OFFS 0x114
+#define MPC83XX_SICRL_USB0 0x40000000
+#define MPC83XX_SICRL_USB1 0x20000000
+
+/* system i/o configuration register high */
+#define MPC83XX_SICRH_OFFS 0x118
+#define MPC83XX_SICRH_USB_UTMI 0x00020000
+
+
#endif /* __MACH_MPC83XX_SYS_H__ */
next reply other threads:[~2006-07-14 11:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-14 11:52 Li Yang [this message]
2006-07-14 13:49 ` [PATCH] Add USB to MPC8349 PB platform support Kumar Gala
2006-07-14 16:21 ` Li Yang
2006-07-17 19:16 ` Kumar Gala
2006-07-17 20:08 ` Hollis Blanchard
2006-07-17 22:57 ` [linux-usb-devel] " David Brownell
2006-07-18 6:34 ` Li Yang-r58472
2006-07-18 6:34 ` Li Yang-r58472
2006-07-19 20:13 ` Timur Tabi
2006-07-19 20:48 ` Kumar Gala
2006-07-17 20:17 ` Dan Malek
2006-07-17 21:39 ` Kumar Gala
2006-07-17 22:12 ` Dan Malek
2006-07-18 7:40 ` Li Yang-r58472
2006-07-18 13:52 ` Kumar Gala
2006-07-18 15:19 ` Dan Malek
2006-07-18 15:53 ` Wolfgang Denk
2006-07-19 6:30 ` Li Yang-r58472
2006-07-19 13:14 ` Kumar Gala
2006-07-19 15:42 ` Dan Malek
2006-07-19 18:59 ` Li Yang
2006-07-19 19:19 ` [linux-usb-devel] " Pete Zaitcev
2006-07-20 6:45 ` Li Yang-r58472
2006-08-01 15:36 ` David Brownell
2006-07-19 20:19 ` Marc Leeman
2006-07-19 20:55 ` Kumar Gala
2006-07-20 7:21 ` Marc Leeman
2006-07-20 13:19 ` Kumar Gala
2006-07-19 20:09 ` Kumar Gala
2006-07-20 6:32 ` Li Yang-r58472
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=44B7857A.2060101@freescale.com \
--to=leoli@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=linux-usb-devel@lists.sourceforge.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.