8287361abc
This is a collection of header file cleanups, mostly for OMAP and AT91, that keeps moving the platforms in the direction of multiplatform by removing the need for mach-dependent header files used in drivers and other places. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJQx2reAAoJEIwa5zzehBx3Z/oQAIHp8aXbUD0GvbBPQ2vIydZ8 Qfdh2ypbyFB9GSLmPP6BhurEFUcwmW3MH2r9Kq68omPt4XxrFEt1SdEn3TgZlhTY YYzEv2DLbWfmKCDBFAEFullsfVkrpggyou5ty30YVp/u2lVLvChpkciE5/9HADy5 uoh/W2KZcLE51tvnbRy/1DBaOtxEdCjJ9hTaef7FCB9ugOG+yMDYwIPRW/b4fNA6 o/1NuZTWp0H4ePRG2oqLxYnjSiF63DVTJZjSJ+c5gW34bWgh8+/xzaLFA9U++/ig meGUD1Oe65+ctr+Wk2mV29eb02jauUe6qvkwt+iFIDDopgc2mn5BcW+ENpgpjhe3 6l3ClRd94qh4cMWzqDa5PZCdetshiKqSH2IGpKS/dHNB1h5sBP7CCbvbalwzWd5n qjfkPC7kSFyU3XV+9SEAXE6HLKsiMQy9kRcKOMdTE5BA4FEAZk0wfiG9WcVCvS2D 9tDC3X0aScyXx4Mkd4wIAZVhY68QuI17fPft9zZSj691YiUW5cR2yF1qbCka0yd5 pHu/QSZg1+dUitMUvMPQmWJ15jnAtEYUtV/8zQFFVchgkxlrW+UtvW3zxghB6D+J ZwcjAMfQQz9fLoMQXlVovjQIhYsjw3SlV62ReBH7eyPs3+KfPIBn7Ks6mVQs3dS5 AMUWORsB5u92XHl9EL9C =aggA -----END PGP SIGNATURE----- Merge tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC Header cleanups from Olof Johansson: "This is a collection of header file cleanups, mostly for OMAP and AT91, that keeps moving the platforms in the direction of multiplatform by removing the need for mach-dependent header files used in drivers and other places." Fix up mostly trivial conflicts as per Olof. * tag 'headers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (106 commits) ARM: OMAP2+: Move iommu/iovmm headers to platform_data ARM: OMAP2+: Make some definitions local ARM: OMAP2+: Move iommu2 to drivers/iommu/omap-iommu2.c ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h ARM: OMAP2+: Move iopgtable header to drivers/iommu/ ARM: OMAP: Merge iommu2.h into iommu.h atmel: move ATMEL_MAX_UART to platform_data/atmel.h ARM: OMAP: Remove omap_init_consistent_dma_size() arm: at91: move at91rm9200 rtc header in drivers/rtc arm: at91: move reset controller header to arm/arm/mach-at91 arm: at91: move pit define to the driver arm: at91: move at91_shdwc.h to arch/arm/mach-at91 arm: at91: move board header to arch/arm/mach-at91 arn: at91: move at91_tc.h to arch/arm/mach-at91 arm: at91 move at91_aic.h to arch/arm/mach-at91 arm: at91 move board.h to arch/arm/mach-at91 arm: at91: move platfarm_data to include/linux/platform_data/atmel.h arm: at91: drop machine defconfig ARM: OMAP: Remove NEED_MACH_GPIO_H ARM: OMAP: Remove unnecessary mach and plat includes ...
242 lines
5.8 KiB
C
242 lines
5.8 KiB
C
/*
|
|
* ohci-omap3.c - driver for OHCI on OMAP3 and later processors
|
|
*
|
|
* Bus Glue for OMAP3 USBHOST 3 port OHCI controller
|
|
* This controller is also used in later OMAPs and AM35x chips
|
|
*
|
|
* Copyright (C) 2007-2010 Texas Instruments, Inc.
|
|
* Author: Vikram Pandita <vikram.pandita@ti.com>
|
|
* Author: Anand Gadiyar <gadiyar@ti.com>
|
|
* Author: Keshava Munegowda <keshava_mgowda@ti.com>
|
|
*
|
|
* Based on ehci-omap.c and some other ohci glue layers
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
*
|
|
* TODO (last updated Feb 27, 2011):
|
|
* - add kernel-doc
|
|
*/
|
|
|
|
#include <linux/platform_device.h>
|
|
#include <linux/pm_runtime.h>
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
static int ohci_omap3_init(struct usb_hcd *hcd)
|
|
{
|
|
dev_dbg(hcd->self.controller, "starting OHCI controller\n");
|
|
|
|
return ohci_init(hcd_to_ohci(hcd));
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
static int ohci_omap3_start(struct usb_hcd *hcd)
|
|
{
|
|
struct ohci_hcd *ohci = hcd_to_ohci(hcd);
|
|
int ret;
|
|
|
|
/*
|
|
* RemoteWakeupConnected has to be set explicitly before
|
|
* calling ohci_run. The reset value of RWC is 0.
|
|
*/
|
|
ohci->hc_control = OHCI_CTRL_RWC;
|
|
writel(OHCI_CTRL_RWC, &ohci->regs->control);
|
|
|
|
ret = ohci_run(ohci);
|
|
|
|
if (ret < 0) {
|
|
dev_err(hcd->self.controller, "can't start\n");
|
|
ohci_stop(hcd);
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
static const struct hc_driver ohci_omap3_hc_driver = {
|
|
.description = hcd_name,
|
|
.product_desc = "OMAP3 OHCI Host Controller",
|
|
.hcd_priv_size = sizeof(struct ohci_hcd),
|
|
|
|
/*
|
|
* generic hardware linkage
|
|
*/
|
|
.irq = ohci_irq,
|
|
.flags = HCD_USB11 | HCD_MEMORY,
|
|
|
|
/*
|
|
* basic lifecycle operations
|
|
*/
|
|
.reset = ohci_omap3_init,
|
|
.start = ohci_omap3_start,
|
|
.stop = ohci_stop,
|
|
.shutdown = ohci_shutdown,
|
|
|
|
/*
|
|
* managing i/o requests and associated device resources
|
|
*/
|
|
.urb_enqueue = ohci_urb_enqueue,
|
|
.urb_dequeue = ohci_urb_dequeue,
|
|
.endpoint_disable = ohci_endpoint_disable,
|
|
|
|
/*
|
|
* scheduling support
|
|
*/
|
|
.get_frame_number = ohci_get_frame,
|
|
|
|
/*
|
|
* root hub support
|
|
*/
|
|
.hub_status_data = ohci_hub_status_data,
|
|
.hub_control = ohci_hub_control,
|
|
#ifdef CONFIG_PM
|
|
.bus_suspend = ohci_bus_suspend,
|
|
.bus_resume = ohci_bus_resume,
|
|
#endif
|
|
.start_port_reset = ohci_start_port_reset,
|
|
};
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
/*
|
|
* configure so an HC device and id are always provided
|
|
* always called with process context; sleeping is OK
|
|
*/
|
|
|
|
/**
|
|
* ohci_hcd_omap3_probe - initialize OMAP-based HCDs
|
|
*
|
|
* Allocates basic resources for this USB host controller, and
|
|
* then invokes the start() method for the HCD associated with it
|
|
* through the hotplug entry's driver_data.
|
|
*/
|
|
static int ohci_hcd_omap3_probe(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
struct usb_hcd *hcd = NULL;
|
|
void __iomem *regs = NULL;
|
|
struct resource *res;
|
|
int ret = -ENODEV;
|
|
int irq;
|
|
|
|
if (usb_disabled())
|
|
return -ENODEV;
|
|
|
|
if (!dev->parent) {
|
|
dev_err(dev, "Missing parent device\n");
|
|
return -ENODEV;
|
|
}
|
|
|
|
irq = platform_get_irq_byname(pdev, "ohci-irq");
|
|
if (irq < 0) {
|
|
dev_err(dev, "OHCI irq failed\n");
|
|
return -ENODEV;
|
|
}
|
|
|
|
res = platform_get_resource_byname(pdev,
|
|
IORESOURCE_MEM, "ohci");
|
|
if (!res) {
|
|
dev_err(dev, "UHH OHCI get resource failed\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
regs = ioremap(res->start, resource_size(res));
|
|
if (!regs) {
|
|
dev_err(dev, "UHH OHCI ioremap failed\n");
|
|
return -ENOMEM;
|
|
}
|
|
|
|
|
|
hcd = usb_create_hcd(&ohci_omap3_hc_driver, dev,
|
|
dev_name(dev));
|
|
if (!hcd) {
|
|
dev_err(dev, "usb_create_hcd failed\n");
|
|
goto err_io;
|
|
}
|
|
|
|
hcd->rsrc_start = res->start;
|
|
hcd->rsrc_len = resource_size(res);
|
|
hcd->regs = regs;
|
|
|
|
pm_runtime_enable(dev);
|
|
pm_runtime_get_sync(dev);
|
|
|
|
ohci_hcd_init(hcd_to_ohci(hcd));
|
|
|
|
ret = usb_add_hcd(hcd, irq, 0);
|
|
if (ret) {
|
|
dev_dbg(dev, "failed to add hcd with err %d\n", ret);
|
|
goto err_add_hcd;
|
|
}
|
|
|
|
return 0;
|
|
|
|
err_add_hcd:
|
|
pm_runtime_put_sync(dev);
|
|
usb_put_hcd(hcd);
|
|
|
|
err_io:
|
|
iounmap(regs);
|
|
|
|
return ret;
|
|
}
|
|
|
|
/*
|
|
* may be called without controller electrically present
|
|
* may be called with controller, bus, and devices active
|
|
*/
|
|
|
|
/**
|
|
* ohci_hcd_omap3_remove - shutdown processing for OHCI HCDs
|
|
* @pdev: USB Host Controller being removed
|
|
*
|
|
* Reverses the effect of ohci_hcd_omap3_probe(), first invoking
|
|
* the HCD's stop() method. It is always called from a thread
|
|
* context, normally "rmmod", "apmd", or something similar.
|
|
*/
|
|
static int ohci_hcd_omap3_remove(struct platform_device *pdev)
|
|
{
|
|
struct device *dev = &pdev->dev;
|
|
struct usb_hcd *hcd = dev_get_drvdata(dev);
|
|
|
|
iounmap(hcd->regs);
|
|
usb_remove_hcd(hcd);
|
|
pm_runtime_put_sync(dev);
|
|
pm_runtime_disable(dev);
|
|
usb_put_hcd(hcd);
|
|
return 0;
|
|
}
|
|
|
|
static void ohci_hcd_omap3_shutdown(struct platform_device *pdev)
|
|
{
|
|
struct usb_hcd *hcd = dev_get_drvdata(&pdev->dev);
|
|
|
|
if (hcd->driver->shutdown)
|
|
hcd->driver->shutdown(hcd);
|
|
}
|
|
|
|
static struct platform_driver ohci_hcd_omap3_driver = {
|
|
.probe = ohci_hcd_omap3_probe,
|
|
.remove = ohci_hcd_omap3_remove,
|
|
.shutdown = ohci_hcd_omap3_shutdown,
|
|
.driver = {
|
|
.name = "ohci-omap3",
|
|
},
|
|
};
|
|
|
|
MODULE_ALIAS("platform:ohci-omap3");
|
|
MODULE_AUTHOR("Anand Gadiyar <gadiyar@ti.com>");
|