Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932529AbbELMNG (ORCPT ); Tue, 12 May 2015 08:13:06 -0400 Received: from mail-bn1bn0102.outbound.protection.outlook.com ([157.56.110.102]:27342 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932444AbbELMNA (ORCPT ); Tue, 12 May 2015 08:13:00 -0400 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: Ramneek Mehresh To: CC: , , , Ramneek Mehresh Subject: [PATCH 1/2] drivers:usb:fsl:Make fsl ehci drv an independent module Date: Tue, 12 May 2015 17:53:51 +0530 Message-ID: <1431433432-17409-2-git-send-email-ramneek.mehresh@freescale.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1431433432-17409-1-git-send-email-ramneek.mehresh@freescale.com> References: <1431433432-17409-1-git-send-email-ramneek.mehresh@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD046;1:Jq54G1SttTrxfox1xZ3AvcJMGrnsMormIlqEchvuh01YB5kGHTl+NOKOnpigPfhmtAUv/sp7M/85DmQlIKIt/ACdID83CCc/rCZWbIz9XnIXOtADJk0r3pmAiDicG8lPKGjuvRzes8hRGw1/DYYdzApUyk/w/C/xce3SWxU6sM316+tScX8MUxDLlsIY4vOQxZ7yx4kH9bsFRD4njf2ZDqJL3WtwCm8smZHv8SdIEAbmBdKtcCZL6lHjZznsYoBJ8D8krpXeu28FiuWo5ORdW9xmPASnlhRJPVuCx/6/ksnzVR1+ZRpp/mfsS66M4Xe6WnHAsLlUJafG9ALeplxcSg== X-Forefront-Antispam-Report: CIP:192.88.158.2;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(199003)(189002)(76506005)(6806004)(50226001)(48376002)(50466002)(19580405001)(2351001)(106466001)(50986999)(19580395003)(189998001)(85426001)(107886002)(5001960100002)(76176999)(86362001)(33646002)(87936001)(104016003)(229853001)(92566002)(46102003)(110136002)(47776003)(105606002)(62966003)(36756003)(77096005)(2950100001)(77156002)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0301MB1570;H:az84smr01.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1570; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(3002001);SRVR:BLUPR0301MB1570;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB1570; X-Forefront-PRVS: 0574D4712B X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 May 2015 12:12:58.5411 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.158.2];Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB1570 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7176 Lines: 244 Make fsl ehci driver an independent entity from ehci-hcd driver Signed-off-by: Ramneek Mehresh --- drivers/usb/host/Kconfig | 2 +- drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-fsl.c | 116 ++++++++++++++++++++++++-------------------- drivers/usb/host/ehci-hcd.c | 5 -- 4 files changed, 65 insertions(+), 59 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 197a6a3..547cee8 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -137,7 +137,7 @@ config XPS_USB_HCD_XILINX devices only. 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 select USB_EHCI_ROOT_HUB_TT select USB_FSL_MPH_DR_OF if OF diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 972a74a..754efaa 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -72,6 +72,7 @@ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o obj-$(CONFIG_USB_HWA_HCD) += hwa-hc.o obj-$(CONFIG_USB_IMX21_HCD) += imx21-hcd.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_SSB) += ssb-hcd.o obj-$(CONFIG_USB_FUSBH200_HCD) += fusbh200-hcd.o diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index ab4eee3..42628e5 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c @@ -24,20 +24,29 @@ */ #include +#include #include #include #include #include +#include +#include +#include +#include #include #include +#include "ehci.h" #include "ehci-fsl.h" +#define DRIVER_DESC "Fsl EHCI driver" +#define DRV_NAME "ehci-fsl" + /* configure so an HC device and id are always provided */ /* 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 * Context: !in_interrupt() @@ -45,8 +54,7 @@ * Allocates basic resources for this USB host controller. * */ -static int usb_hcd_fsl_probe(const struct hc_driver *driver, - struct platform_device *pdev) +static int fsl_ehci_drv_probe(struct platform_device *pdev) { struct fsl_usb2_platform_data *pdata; struct usb_hcd *hcd; @@ -86,7 +94,8 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, } 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) { retval = -ENOMEM; goto err1; @@ -159,38 +168,6 @@ static int usb_hcd_fsl_probe(const struct hc_driver *driver, 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, enum fsl_usb2_phy_modes phy_mode, unsigned int port_offset) @@ -637,7 +614,7 @@ static int ehci_start_port_reset(struct usb_hcd *hcd, unsigned port) #endif /* CONFIG_USB_OTG */ -static const struct hc_driver ehci_fsl_hc_driver = { +static const struct hc_driver fsl_ehci_hc_driver = { .description = hcd_name, .product_desc = "Freescale On-Chip EHCI Host Controller", .hcd_priv_size = sizeof(struct ehci_fsl), @@ -683,32 +660,65 @@ static const struct hc_driver ehci_fsl_hc_driver = { .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, }; -static int ehci_fsl_drv_probe(struct platform_device *pdev) +/* + * 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 int fsl_ehci_drv_remove(struct platform_device *pdev) { - if (usb_disabled()) - return -ENODEV; + struct fsl_usb2_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct usb_hcd *hcd = platform_get_drvdata(pdev); - /* FIXME we only want one one probe() not two */ - return usb_hcd_fsl_probe(&ehci_fsl_hc_driver, pdev); -} + if (!IS_ERR_OR_NULL(hcd->usb_phy)) { + otg_set_host(hcd->usb_phy->otg, NULL); + usb_put_phy(hcd->usb_phy); + } -static int ehci_fsl_drv_remove(struct platform_device *pdev) -{ - struct usb_hcd *hcd = platform_get_drvdata(pdev); + 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); - /* FIXME we only want one one remove() not two */ - usb_hcd_fsl_remove(hcd, pdev); return 0; } -MODULE_ALIAS("platform:fsl-ehci"); - static struct platform_driver ehci_fsl_driver = { - .probe = ehci_fsl_drv_probe, - .remove = ehci_fsl_drv_remove, + .probe = fsl_ehci_drv_probe, + .remove = fsl_ehci_drv_remove, .shutdown = usb_hcd_platform_shutdown, .driver = { .name = "fsl-ehci", .pm = EHCI_FSL_PM_OPS, }, }; + +static int __init ehci_fsl_init(void) +{ + if (usb_disabled()) + return -ENODEV; + + pr_info(DRV_NAME ": " DRIVER_DESC "\n"); + + 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); diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index f4d88df..9dd161c 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1250,11 +1250,6 @@ MODULE_DESCRIPTION(DRIVER_DESC); MODULE_AUTHOR (DRIVER_AUTHOR); MODULE_LICENSE ("GPL"); -#ifdef CONFIG_USB_EHCI_FSL -#include "ehci-fsl.c" -#define PLATFORM_DRIVER ehci_fsl_driver -#endif - #ifdef CONFIG_USB_EHCI_SH #include "ehci-sh.c" #define PLATFORM_DRIVER ehci_hcd_sh_driver -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/