aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Yang <leoli@freescale.com>2007-02-07 00:47:56 -0500
committerKumar Gala <galak@kernel.crashing.org>2007-02-08 01:40:56 -0500
commitc161698287f501e7ea229672383af7aefe8a2056 (patch)
treea0ee3662a884525885cfae308f5b3ebcd8711207
parentea5b7a61b606854bd17272cb0a751b6d0a8bfa6b (diff)
[POWERPC] 83xx: Add USB setup code for MPC8349E MDS-PB
Add board specific initialization code for USB to work in both MPH and DR mode for MPC8349E MDS-PB board. Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c73
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h18
2 files changed, 91 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index f30393f0b832..873ec543c361 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -43,6 +43,76 @@ unsigned long isa_io_base = 0;
43unsigned long isa_mem_base = 0; 43unsigned long isa_mem_base = 0;
44#endif 44#endif
45 45
46#define BCSR5_INT_USB 0x02
47/* Note: This is only for PB, not for PB+PIB
48 * On PB only port0 is connected using ULPI */
49static int mpc834x_usb_cfg(void)
50{
51 unsigned long sccr, sicrl;
52 void __iomem *immap;
53 void __iomem *bcsr_regs = NULL;
54 u8 bcsr5;
55 struct device_node *np = NULL;
56 int port0_is_dr = 0;
57
58 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-dr")) != NULL)
59 port0_is_dr = 1;
60 if ((np = of_find_compatible_node(np, "usb", "fsl-usb2-mph")) != NULL){
61 if (port0_is_dr) {
62 printk(KERN_WARNING
63 "There is only one USB port on PB board! \n");
64 return -1;
65 } else if (!port0_is_dr)
66 /* No usb port enabled */
67 return -1;
68 }
69
70 immap = ioremap(get_immrbase(), 0x1000);
71 if (!immap)
72 return -1;
73
74 /* Configure clock */
75 sccr = in_be32(immap + MPC83XX_SCCR_OFFS);
76 if (port0_is_dr)
77 sccr |= MPC83XX_SCCR_USB_DRCM_11; /* 1:3 */
78 else
79 sccr |= MPC83XX_SCCR_USB_MPHCM_11; /* 1:3 */
80 out_be32(immap + MPC83XX_SCCR_OFFS, sccr);
81
82 /* Configure Pin */
83 sicrl = in_be32(immap + MPC83XX_SICRL_OFFS);
84 /* set port0 only */
85 if (port0_is_dr)
86 sicrl |= MPC83XX_SICRL_USB0;
87 else
88 sicrl &= ~(MPC83XX_SICRL_USB0);
89 out_be32(immap + MPC83XX_SICRL_OFFS, sicrl);
90
91 iounmap(immap);
92
93 /* Map BCSR area */
94 np = of_find_node_by_name(NULL, "bcsr");
95 if (np != 0) {
96 struct resource res;
97
98 of_address_to_resource(np, 0, &res);
99 bcsr_regs = ioremap(res.start, res.end - res.start + 1);
100 of_node_put(np);
101 }
102 if (!bcsr_regs)
103 return -1;
104
105 /*
106 * if SYS board is plug into PIB board,
107 * force to use the PHY on SYS board
108 */
109 bcsr5 = in_8(bcsr_regs + 5);
110 if (!(bcsr5 & BCSR5_INT_USB))
111 out_8(bcsr_regs + 5, (bcsr5 | BCSR5_INT_USB));
112 iounmap(bcsr_regs);
113 return 0;
114}
115
46/* ************************************************************************ 116/* ************************************************************************
47 * 117 *
48 * Setup the architecture 118 * Setup the architecture
@@ -65,6 +135,7 @@ static void __init mpc834x_sys_setup_arch(void)
65 loops_per_jiffy = 50000000 / HZ; 135 loops_per_jiffy = 50000000 / HZ;
66 of_node_put(np); 136 of_node_put(np);
67 } 137 }
138
68#ifdef CONFIG_PCI 139#ifdef CONFIG_PCI
69 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;) 140 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
70 add_bridge(np); 141 add_bridge(np);
@@ -72,6 +143,8 @@ static void __init mpc834x_sys_setup_arch(void)
72 ppc_md.pci_exclude_device = mpc83xx_exclude_device; 143 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
73#endif 144#endif
74 145
146 mpc834x_usb_cfg();
147
75#ifdef CONFIG_ROOT_NFS 148#ifdef CONFIG_ROOT_NFS
76 ROOT_DEV = Root_NFS; 149 ROOT_DEV = Root_NFS;
77#else 150#else
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 01cae106912b..9cd03b59c8f4 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -4,6 +4,24 @@
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/device.h> 5#include <linux/device.h>
6 6
7/* System Clock Control Register */
8#define MPC83XX_SCCR_OFFS 0xA08
9#define MPC83XX_SCCR_USB_MPHCM_11 0x00c00000
10#define MPC83XX_SCCR_USB_MPHCM_01 0x00400000
11#define MPC83XX_SCCR_USB_MPHCM_10 0x00800000
12#define MPC83XX_SCCR_USB_DRCM_11 0x00300000
13#define MPC83XX_SCCR_USB_DRCM_01 0x00100000
14#define MPC83XX_SCCR_USB_DRCM_10 0x00200000
15
16/* system i/o configuration register low */
17#define MPC83XX_SICRL_OFFS 0x114
18#define MPC83XX_SICRL_USB0 0x40000000
19#define MPC83XX_SICRL_USB1 0x20000000
20
21/* system i/o configuration register high */
22#define MPC83XX_SICRH_OFFS 0x118
23#define MPC83XX_SICRH_USB_UTMI 0x00020000
24
7/* 25/*
8 * Declaration for the various functions exported by the 26 * Declaration for the various functions exported by the
9 * mpc83xx_* files. Mostly for use by mpc83xx_setup 27 * mpc83xx_* files. Mostly for use by mpc83xx_setup