drivers:usb:fsl:Make fsl ehci drv an independent driver module
Make Freescale EHCI driver an independent entity from ehci-hcd.c. This involves - using module_init/module_exit functions - using overrides structure - some necessary code cleanup Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Родитель
909eacd748
Коммит
ca07e1c1e4
|
@ -137,7 +137,7 @@ config XPS_USB_HCD_XILINX
|
||||||
devices only.
|
devices only.
|
||||||
|
|
||||||
config USB_EHCI_FSL
|
config USB_EHCI_FSL
|
||||||
bool "Support for Freescale PPC on-chip EHCI USB controller"
|
tristate "Support for Freescale PPC on-chip EHCI USB controller"
|
||||||
depends on FSL_SOC
|
depends on FSL_SOC
|
||||||
select USB_EHCI_ROOT_HUB_TT
|
select USB_EHCI_ROOT_HUB_TT
|
||||||
select USB_FSL_MPH_DR_OF if OF
|
select USB_FSL_MPH_DR_OF if OF
|
||||||
|
|
|
@ -72,6 +72,7 @@ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o
|
||||||
obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o
|
obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o
|
||||||
obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o
|
obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.o
|
||||||
obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o
|
obj-$(CONFIG_USB_FSL_MPH_DR_OF) += fsl-mph-dr-of.o
|
||||||
|
obj-$(CONFIG_USB_EHCI_FSL) += ehci-fsl.o
|
||||||
obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o
|
obj-$(CONFIG_USB_HCD_BCMA) += bcma-hcd.o
|
||||||
obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o
|
obj-$(CONFIG_USB_HCD_SSB) += ssb-hcd.o
|
||||||
obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o
|
obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2005-2009 MontaVista Software, Inc.
|
* Copyright 2005-2009 MontaVista Software, Inc.
|
||||||
* Copyright 2008,2012 Freescale Semiconductor, Inc.
|
* Copyright 2008,2012,2015 Freescale Semiconductor, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
@ -24,29 +24,38 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/module.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
|
#include <linux/usb.h>
|
||||||
|
#include <linux/usb/ehci_def.h>
|
||||||
|
#include <linux/usb/hcd.h>
|
||||||
|
#include <linux/usb/otg.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/fsl_devices.h>
|
#include <linux/fsl_devices.h>
|
||||||
|
|
||||||
|
#include "ehci.h"
|
||||||
#include "ehci-fsl.h"
|
#include "ehci-fsl.h"
|
||||||
|
|
||||||
|
#define DRIVER_DESC "Freescale EHCI Host controller driver"
|
||||||
|
#define DRV_NAME "ehci-fsl"
|
||||||
|
|
||||||
|
static struct hc_driver __read_mostly fsl_ehci_hc_driver;
|
||||||
|
|
||||||
/* configure so an HC device and id are always provided */
|
/* configure so an HC device and id are always provided */
|
||||||
/* always called with process context; sleeping is OK */
|
/* always called with process context; sleeping is OK */
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* usb_hcd_fsl_probe - initialize FSL-based HCDs
|
* fsl_ehci_drv_probe - initialize FSL-based HCDs
|
||||||
* @drvier: Driver to be used for this HCD
|
|
||||||
* @pdev: USB Host Controller being probed
|
* @pdev: USB Host Controller being probed
|
||||||
* Context: !in_interrupt()
|
* Context: !in_interrupt()
|
||||||
*
|
*
|
||||||
* Allocates basic resources for this USB host controller.
|
* Allocates basic resources for this USB host controller.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
static int fsl_ehci_drv_probe(struct platform_device *pdev)
|
||||||
struct platform_device *pdev)
|
|
||||||
{
|
{
|
||||||
struct fsl_usb2_platform_data *pdata;
|
struct fsl_usb2_platform_data *pdata;
|
||||||
struct usb_hcd *hcd;
|
struct usb_hcd *hcd;
|
||||||
|
@ -86,7 +95,8 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
||||||
}
|
}
|
||||||
irq = res->start;
|
irq = res->start;
|
||||||
|
|
||||||
hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
|
hcd = usb_create_hcd(&fsl_ehci_hc_driver, &pdev->dev,
|
||||||
|
dev_name(&pdev->dev));
|
||||||
if (!hcd) {
|
if (!hcd) {
|
||||||
retval = -ENOMEM;
|
retval = -ENOMEM;
|
||||||
goto err1;
|
goto err1;
|
||||||
|
@ -159,38 +169,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* may be called without controller electrically present */
|
|
||||||
/* may be called with controller, bus, and devices active */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* usb_hcd_fsl_remove - shutdown processing for FSL-based HCDs
|
|
||||||
* @dev: USB Host Controller being removed
|
|
||||||
* Context: !in_interrupt()
|
|
||||||
*
|
|
||||||
* Reverses the effect of usb_hcd_fsl_probe().
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void usb_hcd_fsl_remove(struct usb_hcd *hcd,
|
|
||||||
struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
|
||||||
|
|
||||||
if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
|
|
||||||
otg_set_host(hcd->usb_phy->otg, NULL);
|
|
||||||
usb_put_phy(hcd->usb_phy);
|
|
||||||
}
|
|
||||||
|
|
||||||
usb_remove_hcd(hcd);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* do platform specific un-initialization:
|
|
||||||
* release iomux pins, disable clock, etc.
|
|
||||||
*/
|
|
||||||
if (pdata->exit)
|
|
||||||
pdata->exit(pdev);
|
|
||||||
usb_put_hcd(hcd);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
|
static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
|
||||||
enum fsl_usb2_phy_modes phy_mode,
|
enum fsl_usb2_phy_modes phy_mode,
|
||||||
unsigned int port_offset)
|
unsigned int port_offset)
|
||||||
|
@ -636,79 +614,77 @@ static int ehci_start_port_reset(struct usb_hcd *hcd, unsigned port)
|
||||||
#define ehci_start_port_reset NULL
|
#define ehci_start_port_reset NULL
|
||||||
#endif /* CONFIG_USB_OTG */
|
#endif /* CONFIG_USB_OTG */
|
||||||
|
|
||||||
|
static struct ehci_driver_overrides ehci_fsl_overrides __initdata = {
|
||||||
static const struct hc_driver ehci_fsl_hc_driver = {
|
.extra_priv_size = sizeof(struct ehci_fsl),
|
||||||
.description = hcd_name,
|
|
||||||
.product_desc = "Freescale On-Chip EHCI Host Controller",
|
|
||||||
.hcd_priv_size = sizeof(struct ehci_fsl),
|
|
||||||
|
|
||||||
/*
|
|
||||||
* generic hardware linkage
|
|
||||||
*/
|
|
||||||
.irq = ehci_irq,
|
|
||||||
.flags = HCD_USB2 | HCD_MEMORY | HCD_BH,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* basic lifecycle operations
|
|
||||||
*/
|
|
||||||
.reset = ehci_fsl_setup,
|
.reset = ehci_fsl_setup,
|
||||||
.start = ehci_run,
|
|
||||||
.stop = ehci_stop,
|
|
||||||
.shutdown = ehci_shutdown,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* managing i/o requests and associated device resources
|
|
||||||
*/
|
|
||||||
.urb_enqueue = ehci_urb_enqueue,
|
|
||||||
.urb_dequeue = ehci_urb_dequeue,
|
|
||||||
.endpoint_disable = ehci_endpoint_disable,
|
|
||||||
.endpoint_reset = ehci_endpoint_reset,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* scheduling support
|
|
||||||
*/
|
|
||||||
.get_frame_number = ehci_get_frame,
|
|
||||||
|
|
||||||
/*
|
|
||||||
* root hub support
|
|
||||||
*/
|
|
||||||
.hub_status_data = ehci_hub_status_data,
|
|
||||||
.hub_control = ehci_hub_control,
|
|
||||||
.bus_suspend = ehci_bus_suspend,
|
|
||||||
.bus_resume = ehci_bus_resume,
|
|
||||||
.start_port_reset = ehci_start_port_reset,
|
|
||||||
.relinquish_port = ehci_relinquish_port,
|
|
||||||
.port_handed_over = ehci_port_handed_over,
|
|
||||||
|
|
||||||
.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static int ehci_fsl_drv_probe(struct platform_device *pdev)
|
/**
|
||||||
{
|
* fsl_ehci_drv_remove - shutdown processing for FSL-based HCDs
|
||||||
if (usb_disabled())
|
* @dev: USB Host Controller being removed
|
||||||
return -ENODEV;
|
* Context: !in_interrupt()
|
||||||
|
*
|
||||||
|
* Reverses the effect of usb_hcd_fsl_probe().
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/* FIXME we only want one one probe() not two */
|
static int fsl_ehci_drv_remove(struct platform_device *pdev)
|
||||||
return usb_hcd_fsl_probe(&ehci_fsl_hc_driver, pdev);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int ehci_fsl_drv_remove(struct platform_device *pdev)
|
|
||||||
{
|
{
|
||||||
|
struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev);
|
||||||
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
struct usb_hcd *hcd = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
/* FIXME we only want one one remove() not two */
|
if (!IS_ERR_OR_NULL(hcd->usb_phy)) {
|
||||||
usb_hcd_fsl_remove(hcd, pdev);
|
otg_set_host(hcd->usb_phy->otg, NULL);
|
||||||
|
usb_put_phy(hcd->usb_phy);
|
||||||
|
}
|
||||||
|
|
||||||
|
usb_remove_hcd(hcd);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* do platform specific un-initialization:
|
||||||
|
* release iomux pins, disable clock, etc.
|
||||||
|
*/
|
||||||
|
if (pdata->exit)
|
||||||
|
pdata->exit(pdev);
|
||||||
|
usb_put_hcd(hcd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_ALIAS("platform:fsl-ehci");
|
|
||||||
|
|
||||||
static struct platform_driver ehci_fsl_driver = {
|
static struct platform_driver ehci_fsl_driver = {
|
||||||
.probe = ehci_fsl_drv_probe,
|
.probe = fsl_ehci_drv_probe,
|
||||||
.remove = ehci_fsl_drv_remove,
|
.remove = fsl_ehci_drv_remove,
|
||||||
.shutdown = usb_hcd_platform_shutdown,
|
.shutdown = usb_hcd_platform_shutdown,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "fsl-ehci",
|
.name = "fsl-ehci",
|
||||||
.pm = EHCI_FSL_PM_OPS,
|
.pm = EHCI_FSL_PM_OPS,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int __init ehci_fsl_init(void)
|
||||||
|
{
|
||||||
|
if (usb_disabled())
|
||||||
|
return -ENODEV;
|
||||||
|
|
||||||
|
pr_info(DRV_NAME ": " DRIVER_DESC "\n");
|
||||||
|
|
||||||
|
ehci_init_driver(&fsl_ehci_hc_driver, &ehci_fsl_overrides);
|
||||||
|
|
||||||
|
fsl_ehci_hc_driver.product_desc =
|
||||||
|
"Freescale On-Chip EHCI Host Controller";
|
||||||
|
fsl_ehci_hc_driver.start_port_reset = ehci_start_port_reset;
|
||||||
|
|
||||||
|
|
||||||
|
return platform_driver_register(&ehci_fsl_driver);
|
||||||
|
}
|
||||||
|
module_init(ehci_fsl_init);
|
||||||
|
|
||||||
|
static void __exit ehci_fsl_cleanup(void)
|
||||||
|
{
|
||||||
|
platform_driver_unregister(&ehci_fsl_driver);
|
||||||
|
}
|
||||||
|
module_exit(ehci_fsl_cleanup);
|
||||||
|
|
||||||
|
MODULE_DESCRIPTION(DRIVER_DESC);
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_ALIAS("platform:" DRV_NAME);
|
||||||
|
|
|
@ -1250,11 +1250,6 @@ MODULE_DESCRIPTION(DRIVER_DESC);
|
||||||
MODULE_AUTHOR (DRIVER_AUTHOR);
|
MODULE_AUTHOR (DRIVER_AUTHOR);
|
||||||
MODULE_LICENSE ("GPL");
|
MODULE_LICENSE ("GPL");
|
||||||
|
|
||||||
#ifdef CONFIG_USB_EHCI_FSL
|
|
||||||
#include "ehci-fsl.c"
|
|
||||||
#define PLATFORM_DRIVER ehci_fsl_driver
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CONFIG_USB_EHCI_SH
|
#ifdef CONFIG_USB_EHCI_SH
|
||||||
#include "ehci-sh.c"
|
#include "ehci-sh.c"
|
||||||
#define PLATFORM_DRIVER ehci_hcd_sh_driver
|
#define PLATFORM_DRIVER ehci_hcd_sh_driver
|
||||||
|
|
Загрузка…
Ссылка в новой задаче