ohci-pxa27x.c (1139b4516f3927ae835ed3b0a9c69a0dfaf4cdd4) | ohci-pxa27x.c (293b2da1b61136813fc2764f43304c66ff8040e9) |
---|---|
1/* 2 * OHCI HCD (Host Controller Driver) for USB. 3 * 4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> 5 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> 6 * (C) Copyright 2002 Hewlett-Packard Company 7 * 8 * Bus Glue for pxa27x --- 9 unchanged lines hidden (view full) --- 18 * 19 * This file is licenced under the GPL. 20 */ 21 22#include <linux/device.h> 23#include <linux/signal.h> 24#include <linux/platform_device.h> 25#include <linux/clk.h> | 1/* 2 * OHCI HCD (Host Controller Driver) for USB. 3 * 4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> 5 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> 6 * (C) Copyright 2002 Hewlett-Packard Company 7 * 8 * Bus Glue for pxa27x --- 9 unchanged lines hidden (view full) --- 18 * 19 * This file is licenced under the GPL. 20 */ 21 22#include <linux/device.h> 23#include <linux/signal.h> 24#include <linux/platform_device.h> 25#include <linux/clk.h> |
26#include <linux/of_platform.h> 27#include <linux/of_gpio.h> | |
28#include <mach/hardware.h> | 26#include <mach/hardware.h> |
29#include <mach/ohci.h> 30#include <mach/pxa3xx-u2d.h> | 27#include <linux/platform_data/usb-ohci-pxa27x.h> 28#include <linux/platform_data/usb-pxa3xx-ulpi.h> |
31 32/* 33 * UHC: USB Host Controller (OHCI-like) register definitions 34 */ 35#define UHCREV (0x0000) /* UHC HCI Spec Revision */ 36#define UHCHCON (0x0004) /* UHC Host Control Register */ 37#define UHCCOMS (0x0008) /* UHC Command Status Register */ 38#define UHCINTS (0x000C) /* UHC Interrupt Status Register */ --- 230 unchanged lines hidden (view full) --- 269 /* Host Controller Reset */ 270 uhccoms = __raw_readl(ohci->mmio_base + UHCCOMS) | 0x01; 271 __raw_writel(uhccoms, ohci->mmio_base + UHCCOMS); 272 udelay(10); 273 274 clk_disable_unprepare(ohci->clk); 275} 276 | 29 30/* 31 * UHC: USB Host Controller (OHCI-like) register definitions 32 */ 33#define UHCREV (0x0000) /* UHC HCI Spec Revision */ 34#define UHCHCON (0x0004) /* UHC Host Control Register */ 35#define UHCCOMS (0x0008) /* UHC Command Status Register */ 36#define UHCINTS (0x000C) /* UHC Interrupt Status Register */ --- 230 unchanged lines hidden (view full) --- 267 /* Host Controller Reset */ 268 uhccoms = __raw_readl(ohci->mmio_base + UHCCOMS) | 0x01; 269 __raw_writel(uhccoms, ohci->mmio_base + UHCCOMS); 270 udelay(10); 271 272 clk_disable_unprepare(ohci->clk); 273} 274 |
277#ifdef CONFIG_OF 278static const struct of_device_id pxa_ohci_dt_ids[] = { 279 { .compatible = "marvell,pxa-ohci" }, 280 { } 281}; | |
282 | 275 |
283MODULE_DEVICE_TABLE(of, pxa_ohci_dt_ids); 284 285static u64 pxa_ohci_dma_mask = DMA_BIT_MASK(32); 286 287static int __devinit ohci_pxa_of_init(struct platform_device *pdev) 288{ 289 struct device_node *np = pdev->dev.of_node; 290 struct pxaohci_platform_data *pdata; 291 u32 tmp; 292 293 if (!np) 294 return 0; 295 296 /* Right now device-tree probed devices don't get dma_mask set. 297 * Since shared usb code relies on it, set it here for now. 298 * Once we have dma capability bindings this can go away. 299 */ 300 if (!pdev->dev.dma_mask) 301 pdev->dev.dma_mask = &pxa_ohci_dma_mask; 302 303 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 304 if (!pdata) 305 return -ENOMEM; 306 307 if (of_get_property(np, "marvell,enable-port1", NULL)) 308 pdata->flags |= ENABLE_PORT1; 309 if (of_get_property(np, "marvell,enable-port2", NULL)) 310 pdata->flags |= ENABLE_PORT2; 311 if (of_get_property(np, "marvell,enable-port3", NULL)) 312 pdata->flags |= ENABLE_PORT3; 313 if (of_get_property(np, "marvell,port-sense-low", NULL)) 314 pdata->flags |= POWER_SENSE_LOW; 315 if (of_get_property(np, "marvell,power-control-low", NULL)) 316 pdata->flags |= POWER_CONTROL_LOW; 317 if (of_get_property(np, "marvell,no-oc-protection", NULL)) 318 pdata->flags |= NO_OC_PROTECTION; 319 if (of_get_property(np, "marvell,oc-mode-perport", NULL)) 320 pdata->flags |= OC_MODE_PERPORT; 321 if (!of_property_read_u32(np, "marvell,power-on-delay", &tmp)) 322 pdata->power_on_delay = tmp; 323 if (!of_property_read_u32(np, "marvell,port-mode", &tmp)) 324 pdata->port_mode = tmp; 325 if (!of_property_read_u32(np, "marvell,power-budget", &tmp)) 326 pdata->power_budget = tmp; 327 328 pdev->dev.platform_data = pdata; 329 330 return 0; 331} 332#else 333static int __devinit ohci_pxa_of_init(struct platform_device *pdev) 334{ 335 return 0; 336} 337#endif 338 | |
339/*-------------------------------------------------------------------------*/ 340 341/* configure so an HC device and id are always provided */ 342/* always called with process context; sleeping is OK */ 343 344 345/** 346 * usb_hcd_pxa27x_probe - initialize pxa27x-based HCDs --- 8 unchanged lines hidden (view full) --- 355{ 356 int retval, irq; 357 struct usb_hcd *hcd; 358 struct pxaohci_platform_data *inf; 359 struct pxa27x_ohci *ohci; 360 struct resource *r; 361 struct clk *usb_clk; 362 | 276/*-------------------------------------------------------------------------*/ 277 278/* configure so an HC device and id are always provided */ 279/* always called with process context; sleeping is OK */ 280 281 282/** 283 * usb_hcd_pxa27x_probe - initialize pxa27x-based HCDs --- 8 unchanged lines hidden (view full) --- 292{ 293 int retval, irq; 294 struct usb_hcd *hcd; 295 struct pxaohci_platform_data *inf; 296 struct pxa27x_ohci *ohci; 297 struct resource *r; 298 struct clk *usb_clk; 299 |
363 retval = ohci_pxa_of_init(pdev); 364 if (retval) 365 return retval; 366 | |
367 inf = pdev->dev.platform_data; 368 369 if (!inf) 370 return -ENODEV; 371 372 irq = platform_get_irq(pdev, 0); 373 if (irq < 0) { 374 pr_err("no resource of IORESOURCE_IRQ"); --- 231 unchanged lines hidden (view full) --- 606 607static struct platform_driver ohci_hcd_pxa27x_driver = { 608 .probe = ohci_hcd_pxa27x_drv_probe, 609 .remove = ohci_hcd_pxa27x_drv_remove, 610 .shutdown = usb_hcd_platform_shutdown, 611 .driver = { 612 .name = "pxa27x-ohci", 613 .owner = THIS_MODULE, | 300 inf = pdev->dev.platform_data; 301 302 if (!inf) 303 return -ENODEV; 304 305 irq = platform_get_irq(pdev, 0); 306 if (irq < 0) { 307 pr_err("no resource of IORESOURCE_IRQ"); --- 231 unchanged lines hidden (view full) --- 539 540static struct platform_driver ohci_hcd_pxa27x_driver = { 541 .probe = ohci_hcd_pxa27x_drv_probe, 542 .remove = ohci_hcd_pxa27x_drv_remove, 543 .shutdown = usb_hcd_platform_shutdown, 544 .driver = { 545 .name = "pxa27x-ohci", 546 .owner = THIS_MODULE, |
614 .of_match_table = of_match_ptr(pxa_ohci_dt_ids), | |
615#ifdef CONFIG_PM 616 .pm = &ohci_hcd_pxa27x_pm_ops, 617#endif 618 }, 619}; 620 | 547#ifdef CONFIG_PM 548 .pm = &ohci_hcd_pxa27x_pm_ops, 549#endif 550 }, 551}; 552 |