diff options
author | Kuninori Morimoto <morimoto.kuninori@renesas.com> | 2009-10-28 02:31:57 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-10-28 03:07:19 -0400 |
commit | 3714a9a026bba09a58e7cf06e0c23c67da6841c2 (patch) | |
tree | 086b57aa030eb040479979e7de6030b4163bba7f | |
parent | 5b380ec11d198a07aa6bf3a9e851531e91bf4234 (diff) |
sh: mach-ecovec24: Add USB1 gadget support
USB1 can change to host/function by checking PTB3.
This patch add USB1 gadget support and check PTB3 when boot,
and change name to usb1_common_XXX from usb1_host_XXX.
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/boards/mach-ecovec24/setup.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c index da851a3b714a..c3d05e5be2e9 100644 --- a/arch/sh/boards/mach-ecovec24/setup.c +++ b/arch/sh/boards/mach-ecovec24/setup.c | |||
@@ -188,30 +188,18 @@ static struct platform_device usb0_host_device = { | |||
188 | .resource = usb0_host_resources, | 188 | .resource = usb0_host_resources, |
189 | }; | 189 | }; |
190 | 190 | ||
191 | /* | 191 | /* USB1 host/function */ |
192 | * USB1 | ||
193 | * | ||
194 | * CN5 can use both host/function, | ||
195 | * and we can determine it by checking PTB[3] | ||
196 | * | ||
197 | * This time only USB1 host is supported. | ||
198 | */ | ||
199 | void usb1_port_power(int port, int power) | 192 | void usb1_port_power(int port, int power) |
200 | { | 193 | { |
201 | if (!gpio_get_value(GPIO_PTB3)) { | ||
202 | printk(KERN_ERR "USB1 function is not supported\n"); | ||
203 | return; | ||
204 | } | ||
205 | |||
206 | gpio_set_value(GPIO_PTB5, power); | 194 | gpio_set_value(GPIO_PTB5, power); |
207 | } | 195 | } |
208 | 196 | ||
209 | static struct r8a66597_platdata usb1_host_data = { | 197 | static struct r8a66597_platdata usb1_common_data = { |
210 | .on_chip = 1, | 198 | .on_chip = 1, |
211 | .port_power = usb1_port_power, | 199 | .port_power = usb1_port_power, |
212 | }; | 200 | }; |
213 | 201 | ||
214 | static struct resource usb1_host_resources[] = { | 202 | static struct resource usb1_common_resources[] = { |
215 | [0] = { | 203 | [0] = { |
216 | .start = 0xa4d90000, | 204 | .start = 0xa4d90000, |
217 | .end = 0xa4d90124 - 1, | 205 | .end = 0xa4d90124 - 1, |
@@ -224,16 +212,16 @@ static struct resource usb1_host_resources[] = { | |||
224 | }, | 212 | }, |
225 | }; | 213 | }; |
226 | 214 | ||
227 | static struct platform_device usb1_host_device = { | 215 | static struct platform_device usb1_common_device = { |
228 | .name = "r8a66597_hcd", | 216 | /* .name will be added in arch_setup */ |
229 | .id = 1, | 217 | .id = 1, |
230 | .dev = { | 218 | .dev = { |
231 | .dma_mask = NULL, /* not use dma */ | 219 | .dma_mask = NULL, /* not use dma */ |
232 | .coherent_dma_mask = 0xffffffff, | 220 | .coherent_dma_mask = 0xffffffff, |
233 | .platform_data = &usb1_host_data, | 221 | .platform_data = &usb1_common_data, |
234 | }, | 222 | }, |
235 | .num_resources = ARRAY_SIZE(usb1_host_resources), | 223 | .num_resources = ARRAY_SIZE(usb1_common_resources), |
236 | .resource = usb1_host_resources, | 224 | .resource = usb1_common_resources, |
237 | }; | 225 | }; |
238 | 226 | ||
239 | /* LCDC */ | 227 | /* LCDC */ |
@@ -484,7 +472,7 @@ static struct platform_device *ecovec_devices[] __initdata = { | |||
484 | &nor_flash_device, | 472 | &nor_flash_device, |
485 | &sh_eth_device, | 473 | &sh_eth_device, |
486 | &usb0_host_device, | 474 | &usb0_host_device, |
487 | &usb1_host_device, /* USB1 host support */ | 475 | &usb1_common_device, |
488 | &lcdc_device, | 476 | &lcdc_device, |
489 | &ceu0_device, | 477 | &ceu0_device, |
490 | &ceu1_device, | 478 | &ceu1_device, |
@@ -589,6 +577,14 @@ static int __init arch_setup(void) | |||
589 | ctrl_outw(0x0600, 0xa40501d4); | 577 | ctrl_outw(0x0600, 0xa40501d4); |
590 | ctrl_outw(0x0600, 0xa4050192); | 578 | ctrl_outw(0x0600, 0xa4050192); |
591 | 579 | ||
580 | if (gpio_get_value(GPIO_PTB3)) { | ||
581 | printk(KERN_INFO "USB1 function is selected\n"); | ||
582 | usb1_common_device.name = "r8a66597_udc"; | ||
583 | } else { | ||
584 | printk(KERN_INFO "USB1 host is selected\n"); | ||
585 | usb1_common_device.name = "r8a66597_hcd"; | ||
586 | } | ||
587 | |||
592 | /* enable LCDC */ | 588 | /* enable LCDC */ |
593 | gpio_request(GPIO_FN_LCDD23, NULL); | 589 | gpio_request(GPIO_FN_LCDD23, NULL); |
594 | gpio_request(GPIO_FN_LCDD22, NULL); | 590 | gpio_request(GPIO_FN_LCDD22, NULL); |