aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile/board-g4evm.c
diff options
context:
space:
mode:
authorNISHIMOTO Hiroki <nishimoto.hiroki@renesas.com>2010-02-12 03:11:18 -0500
committerPaul Mundt <lethal@linux-sh.org>2010-02-14 23:43:41 -0500
commitaa18ef609b65a76e4531b09dd0c196be3e04eb94 (patch)
tree49c5b933843a85c7ca48aad88506d319ff336033 /arch/arm/mach-shmobile/board-g4evm.c
parent276b4f623cfd30320c004269725683ba8f262bb6 (diff)
ARM: mach-shmobile: G4EVM USBHS support
Add G4EVM platform data and a magic setup sequence to initialize the r8a66597 block aka USBHS in sh7377. Signed-off-by: NISHIMOTO Hiroki <nishimoto.hiroki@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/arm/mach-shmobile/board-g4evm.c')
-rw-r--r--arch/arm/mach-shmobile/board-g4evm.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index ef4b0f59af49..5acd623f93e7 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.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/sh7377.h> 32#include <mach/sh7377.h>
@@ -86,9 +87,50 @@ 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 .end = 65,
115 .flags = IORESOURCE_IRQ,
116 },
117};
118
119static struct platform_device usb_host_device = {
120 .name = "r8a66597_hcd",
121 .id = 0,
122 .dev = {
123 .platform_data = &usb_host_data,
124 .dma_mask = NULL,
125 .coherent_dma_mask = 0xffffffff,
126 },
127 .num_resources = ARRAY_SIZE(usb_host_resources),
128 .resource = usb_host_resources,
129};
89 130
90static struct platform_device *g4evm_devices[] __initdata = { 131static struct platform_device *g4evm_devices[] __initdata = {
91 &nor_flash_device, 132 &nor_flash_device,
133 &usb_host_device,
92}; 134};
93 135
94static struct map_desc g4evm_io_desc[] __initdata = { 136static struct map_desc g4evm_io_desc[] __initdata = {
@@ -137,6 +179,23 @@ static void __init g4evm_init(void)
137 gpio_direction_output(GPIO_PORT113, 1); 179 gpio_direction_output(GPIO_PORT113, 1);
138 gpio_export(GPIO_PORT113, 1); 180 gpio_export(GPIO_PORT113, 1);
139 181
182 /* USBHS */
183 gpio_request(GPIO_FN_VBUS_0, 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 SMSTPCR3 */
191 __raw_writel(__raw_readl(0xe615013c) & ~(1 << 22), 0xe615013c);
192
193 /* setup USB phy */
194 __raw_writew(0x0200, 0xe605810a); /* USBCR1 */
195 __raw_writew(0x00e0, 0xe60581c0); /* CPFCH */
196 __raw_writew(0x6010, 0xe60581c6); /* CGPOSR */
197 __raw_writew(0x8a0a, 0xe605810c); /* USBCR2 */
198
140 sh7377_add_standard_devices(); 199 sh7377_add_standard_devices();
141 200
142 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices)); 201 platform_add_devices(g4evm_devices, ARRAY_SIZE(g4evm_devices));