1 --- a/arch/arm/mach-gemini/devices.c
2 +++ b/arch/arm/mach-gemini/devices.c
3 @@ -188,3 +188,64 @@ int platform_register_ethernet(struct ge
5 return platform_device_register(ðernet_device);
8 +static struct resource usb0_resources[] = {
10 + .start = GEMINI_USB0_BASE,
11 + .end = GEMINI_USB0_BASE + 0xfff,
12 + .flags = IORESOURCE_MEM,
17 + .flags = IORESOURCE_IRQ,
21 +static struct resource usb1_resources[] = {
23 + .start = GEMINI_USB1_BASE,
24 + .end = GEMINI_USB1_BASE + 0xfff,
25 + .flags = IORESOURCE_MEM,
30 + .flags = IORESOURCE_IRQ,
34 +static u64 usb0_dmamask = 0xffffffffUL;
35 +static u64 usb1_dmamask = 0xffffffffUL;
37 +static struct platform_device usb_device[] = {
39 + .name = "ehci-fotg2",
42 + .dma_mask = &usb0_dmamask,
43 + .coherent_dma_mask = 0xffffffff,
45 + .num_resources = ARRAY_SIZE(usb0_resources),
46 + .resource = usb0_resources,
49 + .name = "ehci-fotg2",
52 + .dma_mask = &usb1_dmamask,
53 + .coherent_dma_mask = 0xffffffff,
55 + .num_resources = ARRAY_SIZE(usb1_resources),
56 + .resource = usb1_resources,
60 +int __init platform_register_usb(unsigned int id)
65 + return platform_device_register(&usb_device[id]);
68 --- a/arch/arm/mach-gemini/common.h
69 +++ b/arch/arm/mach-gemini/common.h
70 @@ -30,6 +30,7 @@ extern int platform_register_pflash(unsi
71 unsigned int nr_parts);
72 extern int platform_register_watchdog(void);
73 extern int platform_register_ethernet(struct gemini_gmac_platform_data *pdata);
74 +extern int platform_register_usb(unsigned int id);
76 extern void gemini_restart(enum reboot_mode mode, const char *cmd);
78 --- a/drivers/usb/host/ehci-hcd.c
79 +++ b/drivers/usb/host/ehci-hcd.c
80 @@ -351,11 +351,13 @@ static void ehci_silence_controller(stru
81 ehci->rh_state = EHCI_RH_HALTED;
82 ehci_turn_off_all_ports(ehci);
84 +#ifndef CONFIG_ARCH_GEMINI
85 /* make BIOS/etc use companion controller during reboot */
86 ehci_writel(ehci, 0, &ehci->regs->configured_flag);
88 /* unblock posted writes */
89 ehci_readl(ehci, &ehci->regs->configured_flag);
91 spin_unlock_irq(&ehci->lock);
94 @@ -607,7 +609,9 @@ static int ehci_run (struct usb_hcd *hcd
95 // Philips, Intel, and maybe others need CMD_RUN before the
96 // root hub will detect new devices (why?); NEC doesn't
97 ehci->command &= ~(CMD_LRESET|CMD_IAAD|CMD_PSE|CMD_ASE|CMD_RESET);
98 +#ifndef CONFIG_ARCH_GEMINI
99 ehci->command |= CMD_RUN;
101 ehci_writel(ehci, ehci->command, &ehci->regs->command);
102 dbg_cmd (ehci, "init", ehci->command);
104 @@ -627,9 +631,11 @@ static int ehci_run (struct usb_hcd *hcd
106 down_write(&ehci_cf_port_reset_rwsem);
107 ehci->rh_state = EHCI_RH_RUNNING;
108 +#ifndef CONFIG_ARCH_GEMINI
109 ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag);
110 ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */
113 up_write(&ehci_cf_port_reset_rwsem);
114 ehci->last_periodic_enable = ktime_get_real();
116 @@ -767,9 +773,10 @@ static irqreturn_t ehci_irq (struct usb_
119 /* resume root hub? */
120 +#ifndef CONFIG_ARCH_GEMINI
121 if (ehci->rh_state == EHCI_RH_SUSPENDED)
122 usb_hcd_resume_root_hub(hcd);
125 /* get per-port change detect bits */
128 @@ -1250,6 +1257,11 @@ MODULE_DESCRIPTION(DRIVER_DESC);
129 MODULE_AUTHOR (DRIVER_AUTHOR);
130 MODULE_LICENSE ("GPL");
132 +#ifdef CONFIG_ARCH_GEMINI
133 +#include "ehci-fotg2.c"
134 +#define PLATFORM_DRIVER ehci_fotg2_driver
137 #ifdef CONFIG_USB_EHCI_FSL
138 #include "ehci-fsl.c"
139 #define PLATFORM_DRIVER ehci_fsl_driver
140 --- a/drivers/usb/host/ehci-timer.c
141 +++ b/drivers/usb/host/ehci-timer.c
142 @@ -208,7 +208,9 @@ static void ehci_handle_controller_death
144 /* Clean up the mess */
145 ehci->rh_state = EHCI_RH_HALTED;
146 +#ifndef CONFIG_ARCH_GEMINI
147 ehci_writel(ehci, 0, &ehci->regs->configured_flag);
149 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
151 end_unlink_async(ehci);
152 --- a/drivers/usb/host/ehci.h
153 +++ b/drivers/usb/host/ehci.h
154 @@ -656,7 +656,12 @@ static inline unsigned int
155 ehci_port_speed(struct ehci_hcd *ehci, unsigned int portsc)
157 if (ehci_is_TDI(ehci)) {
158 - switch ((portsc >> (ehci->has_hostpc ? 25 : 26)) & 3) {
159 +#ifdef CONFIG_ARCH_GEMINI
160 + portsc = readl(ehci_to_hcd(ehci)->regs + 0x80);
161 + switch ((portsc>>22)&3) {
163 + switch ((portsc>>26)&3) {
168 --- a/drivers/usb/host/ehci-hub.c
169 +++ b/drivers/usb/host/ehci-hub.c
170 @@ -1075,6 +1075,11 @@ int ehci_hub_control(
171 /* see what we found out */
172 temp = check_reset_complete (ehci, wIndex, status_reg,
173 ehci_readl(ehci, status_reg));
174 +#ifdef CONFIG_ARCH_GEMINI
175 + /* restart schedule */
176 + ehci->command |= CMD_RUN;
177 + ehci_writel(ehci, ehci->command, &ehci->regs->command);
181 /* transfer dedicated ports to the companion hc */
182 --- a/include/linux/usb/ehci_def.h
183 +++ b/include/linux/usb/ehci_def.h
184 @@ -112,8 +112,13 @@ struct ehci_regs {
185 u32 frame_list; /* points to periodic list */
186 /* ASYNCLISTADDR: offset 0x18 */
187 u32 async_next; /* address of next async queue head */
189 +#ifndef CONFIG_ARCH_GEMINI
193 + /* PORTSC: offset 0x20 for Faraday OTG */
194 + u32 port_status[1];
197 /* TXFILLTUNING: offset 0x24 */
198 u32 txfill_tuning; /* TX FIFO Tuning register */
199 @@ -125,8 +130,11 @@ struct ehci_regs {
201 #define FLAG_CF (1<<0) /* true: we'll support "high speed" */
203 +#ifndef CONFIG_ARCH_GEMINI
204 /* PORTSC: offset 0x44 */
205 u32 port_status[0]; /* up to N_PORTS */
208 /* EHCI 1.1 addendum */
209 #define PORTSC_SUSPEND_STS_ACK 0
210 #define PORTSC_SUSPEND_STS_NYET 1