aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorVictor Rodriguez <vm.rod25@gmail.com>2010-12-27 17:43:13 -0500
committerKevin Hilman <khilman@ti.com>2011-02-28 17:53:28 -0500
commitf5714abba6668d2790fd2ac708aabd9506d3baf4 (patch)
treebcb2fe8107788c9d0d39861dce182c2ae6827d56 /arch/arm/mach-davinci
parent5efe330ac19ff63c257db1ab120234cca01a8079 (diff)
davinci: USB1.1 support for Omapl138-Hawkboard
This patch adds USB1.1 support for the Hawkboard-L138 system Signed-off-by: Victor Rodriguez <vm.rod25@gmail.com> Tested-by: Rene Gonzalez <renegs.2378@gmail.com> Acked-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/board-omapl138-hawk.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c
index eeb1cad02503..67c38d0ecd10 100644
--- a/arch/arm/mach-davinci/board-omapl138-hawk.c
+++ b/arch/arm/mach-davinci/board-omapl138-hawk.c
@@ -25,6 +25,9 @@
25#define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12) 25#define DA850_HAWK_MMCSD_CD_PIN GPIO_TO_PIN(3, 12)
26#define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13) 26#define DA850_HAWK_MMCSD_WP_PIN GPIO_TO_PIN(3, 13)
27 27
28#define DA850_USB1_VBUS_PIN GPIO_TO_PIN(2, 4)
29#define DA850_USB1_OC_PIN GPIO_TO_PIN(6, 13)
30
28static short omapl138_hawk_mii_pins[] __initdata = { 31static short omapl138_hawk_mii_pins[] __initdata = {
29 DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3, 32 DA850_MII_TXEN, DA850_MII_TXCLK, DA850_MII_COL, DA850_MII_TXD_3,
30 DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER, 33 DA850_MII_TXD_2, DA850_MII_TXD_1, DA850_MII_TXD_0, DA850_MII_RXER,
@@ -180,6 +183,116 @@ mmc_setup_wp_fail:
180 gpio_free(DA850_HAWK_MMCSD_CD_PIN); 183 gpio_free(DA850_HAWK_MMCSD_CD_PIN);
181} 184}
182 185
186static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id);
187static da8xx_ocic_handler_t hawk_usb_ocic_handler;
188
189static const short da850_hawk_usb11_pins[] = {
190 DA850_GPIO2_4, DA850_GPIO6_13,
191 -1
192};
193
194static int hawk_usb_set_power(unsigned port, int on)
195{
196 gpio_set_value(DA850_USB1_VBUS_PIN, on);
197 return 0;
198}
199
200static int hawk_usb_get_power(unsigned port)
201{
202 return gpio_get_value(DA850_USB1_VBUS_PIN);
203}
204
205static int hawk_usb_get_oci(unsigned port)
206{
207 return !gpio_get_value(DA850_USB1_OC_PIN);
208}
209
210static int hawk_usb_ocic_notify(da8xx_ocic_handler_t handler)
211{
212 int irq = gpio_to_irq(DA850_USB1_OC_PIN);
213 int error = 0;
214
215 if (handler != NULL) {
216 hawk_usb_ocic_handler = handler;
217
218 error = request_irq(irq, omapl138_hawk_usb_ocic_irq,
219 IRQF_DISABLED | IRQF_TRIGGER_RISING |
220 IRQF_TRIGGER_FALLING,
221 "OHCI over-current indicator", NULL);
222 if (error)
223 pr_err("%s: could not request IRQ to watch "
224 "over-current indicator changes\n", __func__);
225 } else {
226 free_irq(irq, NULL);
227 }
228 return error;
229}
230
231static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = {
232 .set_power = hawk_usb_set_power,
233 .get_power = hawk_usb_get_power,
234 .get_oci = hawk_usb_get_oci,
235 .ocic_notify = hawk_usb_ocic_notify,
236 /* TPS2087 switch @ 5V */
237 .potpgt = (3 + 1) / 2, /* 3 ms max */
238};
239
240static irqreturn_t omapl138_hawk_usb_ocic_irq(int irq, void *dev_id)
241{
242 hawk_usb_ocic_handler(&omapl138_hawk_usb11_pdata, 1);
243 return IRQ_HANDLED;
244}
245
246static __init void omapl138_hawk_usb_init(void)
247{
248 int ret;
249 u32 cfgchip2;
250
251 ret = davinci_cfg_reg_list(da850_hawk_usb11_pins);
252 if (ret) {
253 pr_warning("%s: USB 1.1 PinMux setup failed: %d\n",
254 __func__, ret);
255 return;
256 }
257
258 /* Setup the Ref. clock frequency for the HAWK at 24 MHz. */
259
260 cfgchip2 = __raw_readl(DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
261 cfgchip2 &= ~CFGCHIP2_REFFREQ;
262 cfgchip2 |= CFGCHIP2_REFFREQ_24MHZ;
263 __raw_writel(cfgchip2, DA8XX_SYSCFG0_VIRT(DA8XX_CFGCHIP2_REG));
264
265 ret = gpio_request_one(DA850_USB1_VBUS_PIN,
266 GPIOF_DIR_OUT, "USB1 VBUS");
267 if (ret < 0) {
268 pr_err("%s: failed to request GPIO for USB 1.1 port "
269 "power control: %d\n", __func__, ret);
270 return;
271 }
272
273 ret = gpio_request_one(DA850_USB1_OC_PIN,
274 GPIOF_DIR_IN, "USB1 OC");
275 if (ret < 0) {
276 pr_err("%s: failed to request GPIO for USB 1.1 port "
277 "over-current indicator: %d\n", __func__, ret);
278 goto usb11_setup_oc_fail;
279 }
280
281 ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata);
282 if (ret) {
283 pr_warning("%s: USB 1.1 registration failed: %d\n",
284 __func__, ret);
285 goto usb11_setup_fail;
286 }
287
288 return;
289
290usb11_setup_fail:
291 gpio_free(DA850_USB1_OC_PIN);
292usb11_setup_oc_fail:
293 gpio_free(DA850_USB1_VBUS_PIN);
294}
295
183static struct davinci_uart_config omapl138_hawk_uart_config __initdata = { 296static struct davinci_uart_config omapl138_hawk_uart_config __initdata = {
184 .enabled_uarts = 0x7, 297 .enabled_uarts = 0x7,
185}; 298};
@@ -199,6 +312,8 @@ static __init void omapl138_hawk_init(void)
199 312
200 omapl138_hawk_mmc_init(); 313 omapl138_hawk_mmc_init();
201 314
315 omapl138_hawk_usb_init();
316
202 ret = da8xx_register_watchdog(); 317 ret = da8xx_register_watchdog();
203 if (ret) 318 if (ret)
204 pr_warning("omapl138_hawk_init: " 319 pr_warning("omapl138_hawk_init: "