aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2012-01-18 20:32:05 -0500
committerPaul Mundt <lethal@linux-sh.org>2012-01-18 21:16:10 -0500
commit0ada2da51800a4914887a9bcf22d563be80e50be (patch)
tree59eef891f5f2e26db854eeea48532bb9821c15d4 /arch
parentc2bc3a316a7281f67e36b34dac2802cbe36a9128 (diff)
ARM: mach-shmobile: mackerel: use renesas_usbhs instead of r8a66597_hcd
Current renesas_usbhs driver can use both USB host/gadget. This patch removes current r8a66597_hcd driver settings, and adds renesas_usbhs host driver settings for mackerel USB1 port. You can still use this port as "gadget" with small modify. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c73
1 files changed, 9 insertions, 64 deletions
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index 9b42fbd10f8e..f0cc307df640 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -43,7 +43,6 @@
43#include <linux/smsc911x.h> 43#include <linux/smsc911x.h>
44#include <linux/sh_intc.h> 44#include <linux/sh_intc.h>
45#include <linux/tca6416_keypad.h> 45#include <linux/tca6416_keypad.h>
46#include <linux/usb/r8a66597.h>
47#include <linux/usb/renesas_usbhs.h> 46#include <linux/usb/renesas_usbhs.h>
48#include <linux/dma-mapping.h> 47#include <linux/dma-mapping.h>
49 48
@@ -145,11 +144,6 @@
145 * 1-2 short | VBUS 5V | Host 144 * 1-2 short | VBUS 5V | Host
146 * open | external VBUS | Function 145 * open | external VBUS | Function
147 * 146 *
148 * *1
149 * CN31 is used as
150 * CONFIG_USB_R8A66597_HCD Host
151 * CONFIG_USB_RENESAS_USBHS Function
152 *
153 * CAUTION 147 * CAUTION
154 * 148 *
155 * renesas_usbhs driver can use external interrupt mode 149 * renesas_usbhs driver can use external interrupt mode
@@ -161,15 +155,6 @@
161 * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0", 155 * mackerel can not use external interrupt (IRQ7-PORT167) mode on "USB0",
162 * because Touchscreen is using IRQ7-PORT40. 156 * because Touchscreen is using IRQ7-PORT40.
163 * It is impossible to use IRQ7 demux on this board. 157 * It is impossible to use IRQ7 demux on this board.
164 *
165 * We can use external interrupt mode USB-Function on "USB1".
166 * USB1 can become Host by r8a66597, and become Function by renesas_usbhs.
167 * But don't select both drivers in same time.
168 * These uses same IRQ number for request_irq(), and aren't supporting
169 * IRQF_SHARED / IORESOURCE_IRQ_SHAREABLE.
170 *
171 * Actually these are old/new version of USB driver.
172 * This mean its register will be broken if it supports shared IRQ,
173 */ 158 */
174 159
175/* 160/*
@@ -676,51 +661,16 @@ static struct platform_device usbhs0_device = {
676 * Use J30 to select between Host and Function. This setting 661 * Use J30 to select between Host and Function. This setting
677 * can however not be detected by software. Hotplug of USBHS1 662 * can however not be detected by software. Hotplug of USBHS1
678 * is provided via IRQ8. 663 * is provided via IRQ8.
664 *
665 * Current USB1 works as "USB Host".
666 * - set J30 "short"
667 *
668 * If you want to use it as "USB gadget",
669 * - J30 "open"
670 * - modify usbhs1_get_id() USBHS_HOST -> USBHS_GADGET
671 * - add .get_vbus = usbhs_get_vbus in usbhs1_private
679 */ 672 */
680#define IRQ8 evt2irq(0x0300) 673#define IRQ8 evt2irq(0x0300)
681
682/* USBHS1 USB Host support via r8a66597_hcd */
683static void usb1_host_port_power(int port, int power)
684{
685 if (!power) /* only power-on is supported for now */
686 return;
687
688 /* set VBOUT/PWEN and EXTLP1 in DVSTCTR */
689 __raw_writew(__raw_readw(0xE68B0008) | 0x600, 0xE68B0008);
690}
691
692static struct r8a66597_platdata usb1_host_data = {
693 .on_chip = 1,
694 .port_power = usb1_host_port_power,
695};
696
697static struct resource usb1_host_resources[] = {
698 [0] = {
699 .name = "USBHS1",
700 .start = 0xe68b0000,
701 .end = 0xe68b00e6 - 1,
702 .flags = IORESOURCE_MEM,
703 },
704 [1] = {
705 .start = evt2irq(0x1ce0) /* USB1_USB1I0 */,
706 .flags = IORESOURCE_IRQ,
707 },
708};
709
710static struct platform_device usb1_host_device = {
711 .name = "r8a66597_hcd",
712 .id = 1,
713 .dev = {
714 .dma_mask = NULL, /* not use dma */
715 .coherent_dma_mask = 0xffffffff,
716 .platform_data = &usb1_host_data,
717 },
718 .num_resources = ARRAY_SIZE(usb1_host_resources),
719 .resource = usb1_host_resources,
720};
721
722/* USBHS1 USB Function support via renesas_usbhs */
723
724#define USB_PHY_MODE (1 << 4) 674#define USB_PHY_MODE (1 << 4)
725#define USB_PHY_INT_EN ((1 << 3) | (1 << 2)) 675#define USB_PHY_INT_EN ((1 << 3) | (1 << 2))
726#define USB_PHY_ON (1 << 1) 676#define USB_PHY_ON (1 << 1)
@@ -776,7 +726,7 @@ static void usbhs1_hardware_exit(struct platform_device *pdev)
776 726
777static int usbhs1_get_id(struct platform_device *pdev) 727static int usbhs1_get_id(struct platform_device *pdev)
778{ 728{
779 return USBHS_GADGET; 729 return USBHS_HOST;
780} 730}
781 731
782static u32 usbhs1_pipe_cfg[] = { 732static u32 usbhs1_pipe_cfg[] = {
@@ -807,7 +757,6 @@ static struct usbhs_private usbhs1_private = {
807 .hardware_exit = usbhs1_hardware_exit, 757 .hardware_exit = usbhs1_hardware_exit,
808 .get_id = usbhs1_get_id, 758 .get_id = usbhs1_get_id,
809 .phy_reset = usbhs_phy_reset, 759 .phy_reset = usbhs_phy_reset,
810 .get_vbus = usbhs_get_vbus,
811 }, 760 },
812 .driver_param = { 761 .driver_param = {
813 .buswait_bwait = 4, 762 .buswait_bwait = 4,
@@ -1311,7 +1260,6 @@ static struct platform_device *mackerel_devices[] __initdata = {
1311 &nor_flash_device, 1260 &nor_flash_device,
1312 &smc911x_device, 1261 &smc911x_device,
1313 &lcdc_device, 1262 &lcdc_device,
1314 &usb1_host_device,
1315 &usbhs1_device, 1263 &usbhs1_device,
1316 &usbhs0_device, 1264 &usbhs0_device,
1317 &leds_device, 1265 &leds_device,
@@ -1473,9 +1421,6 @@ static void __init mackerel_init(void)
1473 gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */ 1421 gpio_pull_down(GPIO_PORT167CR); /* VBUS0_1 pull down */
1474 gpio_request(GPIO_FN_IDIN_1_113, NULL); 1422 gpio_request(GPIO_FN_IDIN_1_113, NULL);
1475 1423
1476 /* USB phy tweak to make the r8a66597_hcd host driver work */
1477 __raw_writew(0x8a0a, 0xe6058130); /* USBCR4 */
1478
1479 /* enable FSI2 port A (ak4643) */ 1424 /* enable FSI2 port A (ak4643) */
1480 gpio_request(GPIO_FN_FSIAIBT, NULL); 1425 gpio_request(GPIO_FN_FSIAIBT, NULL);
1481 gpio_request(GPIO_FN_FSIAILR, NULL); 1426 gpio_request(GPIO_FN_FSIAILR, NULL);