From patchwork Thu Feb 7 17:33:59 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: manjunath.goudar@linaro.org X-Patchwork-Id: 14680 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id ECF5324262 for ; Thu, 7 Feb 2013 17:35:27 +0000 (UTC) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by fiordland.canonical.com (Postfix) with ESMTP id 78D0BA18DFA for ; Thu, 7 Feb 2013 17:35:26 +0000 (UTC) Received: by mail-vc0-f171.google.com with SMTP id p1so1788988vcq.2 for ; Thu, 07 Feb 2013 09:35:26 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=mxqrmk3KiJf9ZWDou+AQsiH0AgDt6koiyA02s6nAqRU=; b=Gpk7HJFSG7iQlbGZHOYb6ATT2e6hWd/yeCOEwY8tcZFAtzieDFjryLQBlXYMvWkw1S +1aVaaZLpAuCW1VBq/+M3CZVgq59T9halbXz+g4SxYffkZGpVng2GZds1bO5kPQkEDTS eWSwv21eYL8ikw+EIOzVgYzCBd5ng9l6g1bhHMjf9XPz54eJAf9mw1gYIaHnk5KRXhfp +x+9cqfA5piweE6tDXIrIlPiHpRoyn0UHmrGYE2AbEJXq5U0u7QHG8+r5AhYTZJ1R1pk xg5S+YEcZyrxy6tTvViEv6Ql38G4Irvm3hsa19rMJ/72LY/ZaYN7Z6g+edUYedC6C7Di nt5A== X-Received: by 10.58.8.82 with SMTP id p18mr2709870vea.54.1360258525965; Thu, 07 Feb 2013 09:35:25 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp102875vec; Thu, 7 Feb 2013 09:35:25 -0800 (PST) X-Received: by 10.42.94.8 with SMTP id z8mr3817350icm.36.1360258524976; Thu, 07 Feb 2013 09:35:24 -0800 (PST) Received: from mail-da0-f43.google.com (mail-da0-f43.google.com [209.85.210.43]) by mx.google.com with ESMTPS id b9si35696343pax.136.2013.02.07.09.35.24 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Feb 2013 09:35:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.43 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.210.43; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.43 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) smtp.mail=manjunath.goudar@linaro.org Received: by mail-da0-f43.google.com with SMTP id u36so1340876dak.30 for ; Thu, 07 Feb 2013 09:35:24 -0800 (PST) X-Received: by 10.66.81.231 with SMTP id d7mr7861066pay.27.1360258524380; Thu, 07 Feb 2013 09:35:24 -0800 (PST) Received: from localhost.localdomain ([223.239.143.60]) by mx.google.com with ESMTPS id d8sm47524026pax.23.2013.02.07.09.35.19 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 07 Feb 2013 09:35:23 -0800 (PST) From: manjunath.goudar@linaro.org To: linux-usb@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, patches@linaro.org, stern@rowland.harvard.edu, arnd@linaro.org, gregkh@linuxfoundation.org, Manjunath Goudar , Felipe Balbi , Greg KH , Tony Lindgren Subject: [PATCH 02/10] USB: EHCI: make ehci-omap a separate driver Date: Thu, 7 Feb 2013 23:03:59 +0530 Message-Id: <5113e5db.c84e420a.08c3.ffffbe6b@mx.google.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1360258447-27247-1-git-send-email-yes> References: <1360258447-27247-1-git-send-email-yes> X-Gm-Message-State: ALoCoQkIDRLJHQRVqj3j5C5tlAMwmDcsCQPhBE+zhZ9BM1gCFVAGBIPS7O1a5u3Shvpnpp63kZ9w From: Manjunath Goudar Separate the OMAP host controller driver from ehci-hcd host code into its own driver module. Signed-off-by: Manjunath Goudar Signed-off-by: Arnd Bergmann Cc: Felipe Balbi Cc: Greg KH Cc: Alan Stern Cc: linux-usb@vger.kernel.org Cc: Tony Lindgren --- drivers/usb/host/Kconfig | 2 +- drivers/usb/host/Makefile | 2 +- drivers/usb/host/ehci-hcd.c | 6 +--- drivers/usb/host/ehci-omap.c | 69 ++++++++++++++++++------------------------ 4 files changed, 32 insertions(+), 47 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 3a21c5d..11e102e 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -155,7 +155,7 @@ config USB_EHCI_MXC Variation of ARC USB block used in some Freescale chips. config USB_EHCI_HCD_OMAP - bool "EHCI support for OMAP3 and later chips" + tristate "EHCI support for OMAP3 and later chips" depends on USB_EHCI_HCD && ARCH_OMAP default y ---help--- diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 001fbff..b54a597 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -27,7 +27,7 @@ obj-$(CONFIG_USB_EHCI_HCD) += ehci-hcd.o obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o obj-$(CONFIG_USB_EHCI_HCD_PLATFORM) += ehci-platform.o obj-$(CONFIG_USB_EHCI_MXC) += ehci-mxc.o - +obj-$(CONFIG_USB_EHCI_HCD_OMAP) += ehci-omap.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o obj-$(CONFIG_USB_ISP1362_HCD) += isp1362-hcd.o diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index b416a3f..aaf93ca 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1252,11 +1252,6 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ehci_hcd_sh_driver #endif -#ifdef CONFIG_USB_EHCI_HCD_OMAP -#include "ehci-omap.c" -#define PLATFORM_DRIVER ehci_hcd_omap_driver -#endif - #ifdef CONFIG_PPC_PS3 #include "ehci-ps3.c" #define PS3_SYSTEM_BUS_DRIVER ps3_ehci_driver @@ -1347,6 +1342,7 @@ MODULE_LICENSE ("GPL"); !IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \ !IS_ENABLED(CONFIG_USB_EHCI_MXC) && \ !defined(PLATFORM_DRIVER) && \ + !IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \ !defined(PS3_SYSTEM_BUS_DRIVER) && \ !defined(OF_PLATFORM_DRIVER) && \ !defined(XILINX_OF_PLATFORM_DRIVER) diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c index ac17a7c..9c10fc3 100644 --- a/drivers/usb/host/ehci-omap.c +++ b/drivers/usb/host/ehci-omap.c @@ -43,6 +43,11 @@ #include #include #include +#include +#include +#include +#include +#include #include @@ -58,9 +63,12 @@ #define EHCI_INSNREG05_ULPI_WRDATA_SHIFT 0 /*-------------------------------------------------------------------------*/ +#include "ehci.h" -static const struct hc_driver ehci_omap_hc_driver; +#define DRIVER_DESC "EHCI OMAP driver" +static const char hcd_name[] = "ehci-omap"; +static struct hc_driver __read_mostly ehci_omap_hc_driver; static inline void ehci_write(void __iomem *base, u32 reg, u32 val) { @@ -323,56 +331,37 @@ static struct platform_driver ehci_hcd_omap_driver = { /*.suspend = ehci_hcd_omap_suspend, */ /*.resume = ehci_hcd_omap_resume, */ .driver = { - .name = "ehci-omap", + .name = hcd_name, } }; -/*-------------------------------------------------------------------------*/ - -static const struct hc_driver ehci_omap_hc_driver = { - .description = hcd_name, - .product_desc = "OMAP-EHCI Host Controller", - .hcd_priv_size = sizeof(struct ehci_hcd), - /* - * generic hardware linkage - */ - .irq = ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, +static const struct ehci_driver_overrides omap_overrides __initdata = { + .reset = omap_ehci_init, +}; - /* - * basic lifecycle operations - */ - .reset = omap_ehci_init, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, +static int __init ehci_omap_init(void) +{ + if (usb_disabled()) + return -ENODEV; - /* - * 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, + pr_info("%s: " DRIVER_DESC "\n", hcd_name); - /* - * scheduling support - */ - .get_frame_number = ehci_get_frame, + ehci_init_driver(&ehci_omap_hc_driver, &omap_overrides); + return platform_driver_register(&ehci_hcd_omap_driver); +} +module_init(ehci_omap_init); - /* - * 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, +static void __exit ehci_omap_cleanup(void) +{ + platform_driver_unregister(&ehci_hcd_omap_driver); +} +module_exit(ehci_omap_cleanup); - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; +MODULE_DESCRIPTION(DRIVER_DESC); MODULE_ALIAS("platform:omap-ehci"); MODULE_AUTHOR("Texas Instruments, Inc."); MODULE_AUTHOR("Felipe Balbi "); +MODULE_LICENSE("GPL");