aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-02-10 06:13:31 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-02-12 00:10:48 -0500
commit3a7b802d1a8c279876ec74094d71f3c6c45d8030 (patch)
tree22a433940280039b35d1f5222f53d190d49bc2db /arch/arm/mach-shmobile
parent7fdda6780aaa21c7a94e09975649649bb0f4a932 (diff)
ARM: mach-shmobile: G3EVM USBHS support
Add G3EVM platform data and a magic setup sequence to initialize the r8a66597 block aka USBHS in sh7367. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/board-g3evm.c58
-rw-r--r--arch/arm/mach-shmobile/clock-sh7367.c7
2 files changed, 65 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
index 28ee589caba6..f36c9a94d326 100644
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -26,6 +26,7 @@
26#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
27#include <linux/mtd/partitions.h> 27#include <linux/mtd/partitions.h>
28#include <linux/mtd/physmap.h> 28#include <linux/mtd/physmap.h>
29#include <linux/usb/r8a66597.h>
29#include <linux/io.h> 30#include <linux/io.h>
30#include <linux/gpio.h> 31#include <linux/gpio.h>
31#include <mach/sh7367.h> 32#include <mach/sh7367.h>
@@ -86,9 +87,49 @@ static struct platform_device nor_flash_device = {
86 .resource = nor_flash_resources, 87 .resource = nor_flash_resources,
87}; 88};
88 89
90/* USBHS */
91void usb_host_port_power(int port, int power)
92{
93 if (!power) /* only power-on supported for now */
94 return;
95
96 /* set VBOUT/PWEN and EXTLP0 in DVSTCTR */
97 __raw_writew(__raw_readw(0xe6890008) | 0x600, 0xe6890008);
98}
99
100static struct r8a66597_platdata usb_host_data = {
101 .on_chip = 1,
102 .port_power = usb_host_port_power,
103};
104
105static struct resource usb_host_resources[] = {
106 [0] = {
107 .name = "USBHS",
108 .start = 0xe6890000,
109 .end = 0xe68900e5,
110 .flags = IORESOURCE_MEM,
111 },
112 [1] = {
113 .start = 65,
114 .flags = IORESOURCE_IRQ,
115 },
116};
117
118static struct platform_device usb_host_device = {
119 .name = "r8a66597_hcd",
120 .id = 0,
121 .dev = {
122 .platform_data = &usb_host_data,
123 .dma_mask = NULL,
124 .coherent_dma_mask = 0xffffffff,
125 },
126 .num_resources = ARRAY_SIZE(usb_host_resources),
127 .resource = usb_host_resources,
128};
89 129
90static struct platform_device *g3evm_devices[] __initdata = { 130static struct platform_device *g3evm_devices[] __initdata = {
91 &nor_flash_device, 131 &nor_flash_device,
132 &usb_host_device,
92}; 133};
93 134
94static struct map_desc g3evm_io_desc[] __initdata = { 135static struct map_desc g3evm_io_desc[] __initdata = {
@@ -138,6 +179,23 @@ static void __init g3evm_init(void)
138 gpio_request(GPIO_FN_SCIFA1_CTS, NULL); 179 gpio_request(GPIO_FN_SCIFA1_CTS, NULL);
139 gpio_request(GPIO_FN_SCIFA1_RTS, NULL); 180 gpio_request(GPIO_FN_SCIFA1_RTS, NULL);
140 181
182 /* USBHS */
183 gpio_request(GPIO_FN_VBUS0, NULL);
184 gpio_request(GPIO_FN_PWEN, NULL);
185 gpio_request(GPIO_FN_OVCN, NULL);
186 gpio_request(GPIO_FN_OVCN2, NULL);
187 gpio_request(GPIO_FN_EXTLP, NULL);
188 gpio_request(GPIO_FN_IDIN, NULL);
189
190 /* enable clock in SYMSTPCR2 */
191 __raw_writel(__raw_readl(0xe6158048) & ~(1 << 22), 0xe6158048);
192
193 /* setup USB phy */
194 __raw_writew(0x0300, 0xe605810a); /* USBCR1 */
195 __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */
196 __raw_writew(0x6010, 0xe60581c6); /* CGPOSR */
197 __raw_writew(0x8a0a, 0xe605810c); /* USBCR2 */
198
141 sh7367_add_standard_devices(); 199 sh7367_add_standard_devices();
142 200
143 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices)); 201 platform_add_devices(g3evm_devices, ARRAY_SIZE(g3evm_devices));
diff --git a/arch/arm/mach-shmobile/clock-sh7367.c b/arch/arm/mach-shmobile/clock-sh7367.c
index 3b2e3f2fc7ea..58bd54e1113a 100644
--- a/arch/arm/mach-shmobile/clock-sh7367.c
+++ b/arch/arm/mach-shmobile/clock-sh7367.c
@@ -70,11 +70,18 @@ static struct clk r_clk = {
70 .rate = 32768, 70 .rate = 32768,
71}; 71};
72 72
73/* a static usb0 for now - enough to get r8a66597 working */
74static struct clk usb0_clk = {
75 .name = "usb0",
76};
77
73static struct clk_lookup lookups[] = { 78static struct clk_lookup lookups[] = {
74 { 79 {
75 .clk = &peripheral_clk, 80 .clk = &peripheral_clk,
76 }, { 81 }, {
77 .clk = &r_clk, 82 .clk = &r_clk,
83 }, {
84 .clk = &usb0_clk,
78 } 85 }
79}; 86};
80 87