aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/83xx/mpc837x_mds.c
diff options
context:
space:
mode:
authorLi Yang <leoli@freescale.com>2008-01-08 15:18:45 +0800
committerKumar Gala <galak@kernel.crashing.org>2008-01-23 19:33:03 -0600
commite10241d8a1a68955e2f3e74befd9fa6ce61ba2bc (patch)
treeb213f00dbbb0e8a7cb744aae4764d59dc7a04cfc /arch/powerpc/platforms/83xx/mpc837x_mds.c
parent[POWERPC] 83xx: add device trees for MPC837x MDS board (diff)
downloadlinux-dev-e10241d8a1a68955e2f3e74befd9fa6ce61ba2bc.tar.xz
linux-dev-e10241d8a1a68955e2f3e74befd9fa6ce61ba2bc.zip
[POWERPC] 83xx: Add MPC837x USB platform support
Add chip specific and board specific initialization for MPC837x USB. Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/83xx/mpc837x_mds.c')
-rw-r--r--arch/powerpc/platforms/83xx/mpc837x_mds.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/83xx/mpc837x_mds.c b/arch/powerpc/platforms/83xx/mpc837x_mds.c
index cfd05487f26e..8a9c26973605 100644
--- a/arch/powerpc/platforms/83xx/mpc837x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc837x_mds.c
@@ -22,6 +22,56 @@
#include "mpc83xx.h"
+#define BCSR12_USB_SER_MASK 0x8a
+#define BCSR12_USB_SER_PIN 0x80
+#define BCSR12_USB_SER_DEVICE 0x02
+extern int mpc837x_usb_cfg(void);
+
+static int mpc837xmds_usb_cfg(void)
+{
+ struct device_node *np;
+ const void *phy_type, *mode;
+ void __iomem *bcsr_regs = NULL;
+ u8 bcsr12;
+ int ret;
+
+ ret = mpc837x_usb_cfg();
+ if (ret)
+ return ret;
+ /* Map BCSR area */
+ np = of_find_node_by_name(NULL, "bcsr");
+ if (np) {
+ struct resource res;
+
+ of_address_to_resource(np, 0, &res);
+ bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+ of_node_put(np);
+ }
+ if (!bcsr_regs)
+ return -1;
+
+ np = of_find_node_by_name(NULL, "usb");
+ if (!np)
+ return -ENODEV;
+ phy_type = of_get_property(np, "phy_type", NULL);
+ if (phy_type && !strcmp(phy_type, "ulpi")) {
+ clrbits8(bcsr_regs + 12, BCSR12_USB_SER_PIN);
+ } else if (phy_type && !strcmp(phy_type, "serial")) {
+ mode = of_get_property(np, "dr_mode", NULL);
+ bcsr12 = in_8(bcsr_regs + 12) & ~BCSR12_USB_SER_MASK;
+ bcsr12 |= BCSR12_USB_SER_PIN;
+ if (mode && !strcmp(mode, "peripheral"))
+ bcsr12 |= BCSR12_USB_SER_DEVICE;
+ out_8(bcsr_regs + 12, bcsr12);
+ } else {
+ printk(KERN_ERR "USB DR: unsupported PHY\n");
+ }
+
+ of_node_put(np);
+ iounmap(bcsr_regs);
+ return 0;
+}
+
/* ************************************************************************
*
* Setup the architecture
@@ -40,6 +90,7 @@ static void __init mpc837x_mds_setup_arch(void)
for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
mpc83xx_add_bridge(np);
#endif
+ mpc837xmds_usb_cfg();
}
static struct of_device_id mpc837x_ids[] = {