aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorRupjyoti Sarmah <rsarmah@amcc.com>2010-12-14 21:27:10 -0500
committerJosh Boyer <jwboyer@linux.vnet.ibm.com>2011-02-02 06:58:26 -0500
commit8960f7ff508064de1896d8539911411179b8433c (patch)
tree8b48440645cb0dca94caaeac347986ef4fef7ac2 /arch/powerpc
parentc89b3458d8cc1925a9ca90408ff3bfe43dab6522 (diff)
powerpc/44x: PHY fixup for USB on canyonlands board
This fix is a reset for USB PHY that requires some amount of time for power to be stable on Canyonlands. Signed-off-by: Rupjyoti Sarmah <rsarmah@apm.com> Signed-off-by: Josh Boyer <jwboyer@linux.vnet.ibm.com>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/boot/dts/canyonlands.dts11
-rw-r--r--arch/powerpc/platforms/44x/44x.h4
-rw-r--r--arch/powerpc/platforms/44x/Kconfig1
-rw-r--r--arch/powerpc/platforms/44x/Makefile1
-rw-r--r--arch/powerpc/platforms/44x/canyonlands.c134
-rw-r--r--arch/powerpc/platforms/44x/ppc44x_simple.c1
6 files changed, 150 insertions, 2 deletions
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index 54caec687382..2779f08313a5 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -246,6 +246,11 @@
246 }; 246 };
247 }; 247 };
248 248
249 cpld@2,0 {
250 compatible = "amcc,ppc460ex-bcsr";
251 reg = <2 0x0 0x9>;
252 };
253
249 ndfc@3,0 { 254 ndfc@3,0 {
250 compatible = "ibm,ndfc"; 255 compatible = "ibm,ndfc";
251 reg = <0x00000003 0x00000000 0x00002000>; 256 reg = <0x00000003 0x00000000 0x00002000>;
@@ -320,6 +325,12 @@
320 interrupts = <0x3 0x4>; 325 interrupts = <0x3 0x4>;
321 }; 326 };
322 327
328 GPIO0: gpio@ef600b00 {
329 compatible = "ibm,ppc4xx-gpio";
330 reg = <0xef600b00 0x00000048>;
331 gpio-controller;
332 };
333
323 ZMII0: emac-zmii@ef600d00 { 334 ZMII0: emac-zmii@ef600d00 {
324 compatible = "ibm,zmii-460ex", "ibm,zmii"; 335 compatible = "ibm,zmii-460ex", "ibm,zmii";
325 reg = <0xef600d00 0x0000000c>; 336 reg = <0xef600d00 0x0000000c>;
diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h
index dbc4d2b4301a..63f703ecd23c 100644
--- a/arch/powerpc/platforms/44x/44x.h
+++ b/arch/powerpc/platforms/44x/44x.h
@@ -4,4 +4,8 @@
4extern u8 as1_readb(volatile u8 __iomem *addr); 4extern u8 as1_readb(volatile u8 __iomem *addr);
5extern void as1_writeb(u8 data, volatile u8 __iomem *addr); 5extern void as1_writeb(u8 data, volatile u8 __iomem *addr);
6 6
7#define GPIO0_OSRH 0xC
8#define GPIO0_TSRH 0x14
9#define GPIO0_ISR1H 0x34
10
7#endif /* __POWERPC_PLATFORMS_44X_44X_H */ 11#endif /* __POWERPC_PLATFORMS_44X_44X_H */
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index 0f979c5c756b..f485fc5f6d5e 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -115,7 +115,6 @@ config CANYONLANDS
115 bool "Canyonlands" 115 bool "Canyonlands"
116 depends on 44x 116 depends on 44x
117 default n 117 default n
118 select PPC44x_SIMPLE
119 select 460EX 118 select 460EX
120 select PCI 119 select PCI
121 select PPC4xx_PCI_EXPRESS 120 select PPC4xx_PCI_EXPRESS
diff --git a/arch/powerpc/platforms/44x/Makefile b/arch/powerpc/platforms/44x/Makefile
index c04d16df8488..553db6007217 100644
--- a/arch/powerpc/platforms/44x/Makefile
+++ b/arch/powerpc/platforms/44x/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_WARP) += warp.o
9obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o 9obj-$(CONFIG_XILINX_VIRTEX_5_FXT) += virtex.o
10obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o 10obj-$(CONFIG_XILINX_ML510) += virtex_ml510.o
11obj-$(CONFIG_ISS4xx) += iss4xx.o 11obj-$(CONFIG_ISS4xx) += iss4xx.o
12obj-$(CONFIG_CANYONLANDS)+= canyonlands.o
diff --git a/arch/powerpc/platforms/44x/canyonlands.c b/arch/powerpc/platforms/44x/canyonlands.c
new file mode 100644
index 000000000000..afc5e8ea3775
--- /dev/null
+++ b/arch/powerpc/platforms/44x/canyonlands.c
@@ -0,0 +1,134 @@
1/*
2 * This contain platform specific code for APM PPC460EX based Canyonlands
3 * board.
4 *
5 * Copyright (c) 2010, Applied Micro Circuits Corporation
6 * Author: Rupjyoti Sarmah <rsarmah@apm.com>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
21 * MA 02111-1307 USA
22 *
23 */
24#include <linux/kernel.h>
25#include <linux/init.h>
26#include <asm/pci-bridge.h>
27#include <asm/ppc4xx.h>
28#include <asm/udbg.h>
29#include <asm/uic.h>
30#include <linux/of_platform.h>
31#include <linux/delay.h>
32#include "44x.h"
33
34#define BCSR_USB_EN 0x11
35
36static __initdata struct of_device_id ppc460ex_of_bus[] = {
37 { .compatible = "ibm,plb4", },
38 { .compatible = "ibm,opb", },
39 { .compatible = "ibm,ebc", },
40 { .compatible = "simple-bus", },
41 {},
42};
43
44static int __init ppc460ex_device_probe(void)
45{
46 of_platform_bus_probe(NULL, ppc460ex_of_bus, NULL);
47
48 return 0;
49}
50machine_device_initcall(canyonlands, ppc460ex_device_probe);
51
52/* Using this code only for the Canyonlands board. */
53
54static int __init ppc460ex_probe(void)
55{
56 unsigned long root = of_get_flat_dt_root();
57 if (of_flat_dt_is_compatible(root, "amcc,canyonlands")) {
58 ppc_pci_set_flags(PPC_PCI_REASSIGN_ALL_RSRC);
59 return 1;
60 }
61 return 0;
62}
63
64/* USB PHY fixup code on Canyonlands kit. */
65
66static int __init ppc460ex_canyonlands_fixup(void)
67{
68 u8 __iomem *bcsr ;
69 void __iomem *vaddr;
70 struct device_node *np;
71 int ret = 0;
72
73 np = of_find_compatible_node(NULL, NULL, "amcc,ppc460ex-bcsr");
74 if (!np) {
75 printk(KERN_ERR "failed did not find amcc, ppc460ex bcsr node\n");
76 return -ENODEV;
77 }
78
79 bcsr = of_iomap(np, 0);
80 of_node_put(np);
81
82 if (!bcsr) {
83 printk(KERN_CRIT "Could not remap bcsr\n");
84 ret = -ENODEV;
85 goto err_bcsr;
86 }
87
88 np = of_find_compatible_node(NULL, NULL, "ibm,ppc4xx-gpio");
89 if (!np) {
90 printk(KERN_ERR "failed did not find ibm,ppc4xx-gpio node\n");
91 return -ENODEV;
92 }
93
94 vaddr = of_iomap(np, 0);
95 of_node_put(np);
96
97 if (!vaddr) {
98 printk(KERN_CRIT "Could not get gpio node address\n");
99 ret = -ENODEV;
100 goto err_gpio;
101 }
102 /* Disable USB, through the BCSR7 bits */
103 setbits8(&bcsr[7], BCSR_USB_EN);
104
105 /* Wait for a while after reset */
106 msleep(100);
107
108 /* Enable USB here */
109 clrbits8(&bcsr[7], BCSR_USB_EN);
110
111 /*
112 * Configure multiplexed gpio16 and gpio19 as alternate1 output
113 * source after USB reset. In this configuration gpio16 will be
114 * USB2HStop and gpio19 will be USB2DStop. For more details refer to
115 * table 34-7 of PPC460EX user manual.
116 */
117 setbits32((vaddr + GPIO0_OSRH), 0x42000000);
118 setbits32((vaddr + GPIO0_TSRH), 0x42000000);
119err_gpio:
120 iounmap(vaddr);
121err_bcsr:
122 iounmap(bcsr);
123 return ret;
124}
125machine_device_initcall(canyonlands, ppc460ex_canyonlands_fixup);
126define_machine(canyonlands) {
127 .name = "Canyonlands",
128 .probe = ppc460ex_probe,
129 .progress = udbg_progress,
130 .init_IRQ = uic_init_tree,
131 .get_irq = uic_get_irq,
132 .restart = ppc4xx_reset_system,
133 .calibrate_decr = generic_calibrate_decr,
134};
diff --git a/arch/powerpc/platforms/44x/ppc44x_simple.c b/arch/powerpc/platforms/44x/ppc44x_simple.c
index 7ddcba3b9397..c81c19c0b3d4 100644
--- a/arch/powerpc/platforms/44x/ppc44x_simple.c
+++ b/arch/powerpc/platforms/44x/ppc44x_simple.c
@@ -53,7 +53,6 @@ static char *board[] __initdata = {
53 "amcc,arches", 53 "amcc,arches",
54 "amcc,bamboo", 54 "amcc,bamboo",
55 "amcc,bluestone", 55 "amcc,bluestone",
56 "amcc,canyonlands",
57 "amcc,glacier", 56 "amcc,glacier",
58 "ibm,ebony", 57 "ibm,ebony",
59 "amcc,eiger", 58 "amcc,eiger",