From patchwork Tue Jul 23 15:56:26 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: 18540 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2F49825E73 for ; Tue, 23 Jul 2013 15:56:45 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id p12sf9940995vbe.7 for ; Tue, 23 Jul 2013 08:56:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=DZ7iANeqf8Q1RUiCC+qmWGPeX6OVj1ELkOb3iDSmYxg=; b=cebpJhtT2xQBzZPZRj5Uw12xP2SIEPbeRACptp/Tyi6KZGc8G4miXzGV2Qj34Js8JS Djl2SRI3y9fTYVRgQn2G7FFnsxrbY12bwTBlWzx5hG4HSfGhE2pW+hdQTa3ref6CWcCd dKu06d9O5mH2uUgHIzbPL30pV8cBfkCrsoXqyK6racerSO8ums+qh/HowYujY4/IzAts 79XAKaxK4Pgr3HT5POLyM6r8HiiH27GcqdDKtMjlQvlobYb8W5Lr2p8w5tcxxi7cUFeJ Qq9QCdaqv9pMNSAdrQv/cmtRA1sK82bkiVW7PTcMiiZjQq131Ch9D6GSDgpjEKtYHekd qprw== X-Received: by 10.236.124.78 with SMTP id w54mr18261430yhh.44.1374595004674; Tue, 23 Jul 2013 08:56:44 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.52.40 with SMTP id q8ls3356210qeo.1.gmail; Tue, 23 Jul 2013 08:56:44 -0700 (PDT) X-Received: by 10.52.95.113 with SMTP id dj17mr9974877vdb.82.1374595004487; Tue, 23 Jul 2013 08:56:44 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id ia10si8535255vdb.90.2013.07.23.08.56.44 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Jul 2013 08:56:44 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf10so1488282vcb.40 for ; Tue, 23 Jul 2013 08:56:44 -0700 (PDT) X-Received: by 10.52.120.77 with SMTP id la13mr9863741vdb.23.1374595004363; Tue, 23 Jul 2013 08:56:44 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.165.8 with SMTP id yu8csp114223veb; Tue, 23 Jul 2013 08:56:43 -0700 (PDT) X-Received: by 10.68.217.137 with SMTP id oy9mr37321671pbc.130.1374595003216; Tue, 23 Jul 2013 08:56:43 -0700 (PDT) Received: from mail-pb0-f50.google.com (mail-pb0-f50.google.com [209.85.160.50]) by mx.google.com with ESMTPS id qn3si22824171pbc.242.2013.07.23.08.56.42 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Jul 2013 08:56:43 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.50 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.160.50; Received: by mail-pb0-f50.google.com with SMTP id wz7so8488392pbc.23 for ; Tue, 23 Jul 2013 08:56:42 -0700 (PDT) X-Received: by 10.68.143.73 with SMTP id sc9mr37740681pbb.2.1374595002787; Tue, 23 Jul 2013 08:56:42 -0700 (PDT) Received: from localhost.localdomain ([223.238.75.33]) by mx.google.com with ESMTPSA id ys4sm42574198pbb.9.2013.07.23.08.56.38 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 23 Jul 2013 08:56:42 -0700 (PDT) From: Manjunath Goudar To: patches@linaro.org Cc: stern@rowland.harvard.edu, arnd@linaro.org, manjunath.goudar@linaro.org, linaro-kernel@lists.linaro.org, Arnd Bergmann , Greg KH , linux-usb@vger.kernel.org Subject: [PATCH V2 1/2] USB: OHCI: make ohci-ep93xx a separate driver Date: Tue, 23 Jul 2013 21:26:26 +0530 Message-Id: <1374594987-1137-2-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1374594987-1137-1-git-send-email-manjunath.goudar@linaro.org> References: <1372958187-4039-1-git-send-email-manjunath.goudar@linaro.org> <1374594987-1137-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQnDnxgJpGouPOjaV+Lm57RgN9lGvrmxXxhr7WJTo+i1KgwrDNqkgkI+ZMsWVktt4mdqHa0p X-Original-Sender: manjunath.goudar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Separate the OHCI EP93XX host controller driver from ohci-hcd host code so that it can be built as a separate driver module. This work is part of enabling multi-platform kernels on ARM. Signed-off-by: Manjunath Goudar Cc: Arnd Bergmann Cc: Alan Stern Cc: Greg KH Cc: linux-usb@vger.kernel.org V2: -ohci_hcd_init() statements are removed, because by default it is called in ohci_setup(). Acked-by: Alan Stern --- drivers/usb/host/Kconfig | 8 ++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ohci-ep93xx.c | 81 +++++++++++++++++----------------------- drivers/usb/host/ohci-hcd.c | 19 ---------- 4 files changed, 44 insertions(+), 65 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index f7f7823..cdfaa04 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -414,6 +414,14 @@ config USB_OHCI_HCD_DA8XX Enables support for the on-chip OHCI controller on DA8xx/OMAP-L1x chips. +config USB_OHCI_HCD_EP93XX + tristate "Support for EP93XX on-chip OHCI USB controller" + depends on USB_OHCI_HCD && ARCH_EP93XX + default y + ---help--- + Enables support for the on-chip OHCI controller on + EP93XX chips. + config USB_OHCI_HCD_AT91 tristate "Support for Atmel on-chip OHCI USB controller" depends on USB_OHCI_HCD && ARCH_AT91 diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index f8d59371..3fee3ea 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -54,6 +54,7 @@ obj-$(CONFIG_USB_OHCI_HCD_AT91) += ohci-at91.o obj-$(CONFIG_USB_OHCI_HCD_S3CXXXX) += ohci-s3c2410.o obj-$(CONFIG_USB_OHCI_HCD_LPC32XX) += ohci-nxp.o obj-$(CONFIG_USB_OHCI_HCD_DA8XX) += ohci-da8xx.o +obj-$(CONFIG_USB_OHCI_HCD_EP93XX) += ohci-ep93xx.o obj-$(CONFIG_USB_UHCI_HCD) += uhci-hcd.o obj-$(CONFIG_USB_FHCI_HCD) += fhci.o diff --git a/drivers/usb/host/ohci-ep93xx.c b/drivers/usb/host/ohci-ep93xx.c index f0aaa48..30b0ffe 100644 --- a/drivers/usb/host/ohci-ep93xx.c +++ b/drivers/usb/host/ohci-ep93xx.c @@ -25,8 +25,21 @@ #include #include -#include +#include +#include +#include #include +#include +#include +#include + +#include "ohci.h" + +#define DRIVER_DESC "OHCI EP93xx driver" + +static const char hcd_name[] = "ohci-ep93xx"; + +static struct hc_driver __read_mostly ohci_ep93xx_hc_driver; static struct clk *usb_host_clock; @@ -45,6 +58,7 @@ static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, { int retval; struct usb_hcd *hcd; + struct ohci_hcd *ohci; if (pdev->resource[1].flags != IORESOURCE_IRQ) { dev_dbg(&pdev->dev, "resource[1] is not IORESOURCE_IRQ\n"); @@ -79,8 +93,6 @@ static int usb_hcd_ep93xx_probe(const struct hc_driver *driver, ep93xx_start_hc(&pdev->dev); - ohci_hcd_init(hcd_to_ohci(hcd)); - retval = usb_add_hcd(hcd, pdev->resource[1].start, 0); if (retval == 0) return retval; @@ -107,48 +119,6 @@ static void usb_hcd_ep93xx_remove(struct usb_hcd *hcd, usb_put_hcd(hcd); } -static int ohci_ep93xx_start(struct usb_hcd *hcd) -{ - struct ohci_hcd *ohci = hcd_to_ohci(hcd); - int ret; - - if ((ret = ohci_init(ohci)) < 0) - return ret; - - if ((ret = ohci_run(ohci)) < 0) { - dev_err(hcd->self.controller, "can't start %s\n", - hcd->self.bus_name); - ohci_stop(hcd); - return ret; - } - - return 0; -} - -static struct hc_driver ohci_ep93xx_hc_driver = { - .description = hcd_name, - .product_desc = "EP93xx OHCI", - .hcd_priv_size = sizeof(struct ohci_hcd), - .irq = ohci_irq, - .flags = HCD_USB11 | HCD_MEMORY, - .start = ohci_ep93xx_start, - .stop = ohci_stop, - .shutdown = ohci_shutdown, - .urb_enqueue = ohci_urb_enqueue, - .urb_dequeue = ohci_urb_dequeue, - .endpoint_disable = ohci_endpoint_disable, - .get_frame_number = ohci_get_frame, - .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, -}; - -extern int usb_disabled(void); - static int ohci_hcd_ep93xx_drv_probe(struct platform_device *pdev) { int ret; @@ -206,7 +176,6 @@ static int ohci_hcd_ep93xx_drv_resume(struct platform_device *pdev) } #endif - static struct platform_driver ohci_hcd_ep93xx_driver = { .probe = ohci_hcd_ep93xx_drv_probe, .remove = ohci_hcd_ep93xx_drv_remove, @@ -221,4 +190,24 @@ static struct platform_driver ohci_hcd_ep93xx_driver = { }, }; +static int __init ohci_ep93xx_init(void) +{ + if (usb_disabled()) + return -ENODEV; + + pr_info("%s: " DRIVER_DESC "\n", hcd_name); + + ohci_init_driver(&ohci_ep93xx_hc_driver, NULL); + return platform_driver_register(&ohci_hcd_ep93xx_driver); +} +module_init(ohci_ep93xx_init); + +static void __exit ohci_ep93xx_cleanup(void) +{ + platform_driver_unregister(&ohci_hcd_ep93xx_driver); +} +module_exit(ohci_ep93xx_cleanup); + +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:ep93xx-ohci"); diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index d514e11..3f46cff 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1189,11 +1189,6 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ohci_hcd_pxa27x_driver #endif -#ifdef CONFIG_ARCH_EP93XX -#include "ohci-ep93xx.c" -#define EP93XX_PLATFORM_DRIVER ohci_hcd_ep93xx_driver -#endif - #ifdef CONFIG_USB_OHCI_HCD_PPC_OF #include "ohci-ppc-of.c" #define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver @@ -1284,20 +1279,9 @@ static int __init ohci_hcd_mod_init(void) if (retval < 0) goto error_tmio; #endif - -#ifdef EP93XX_PLATFORM_DRIVER - retval = platform_driver_register(&EP93XX_PLATFORM_DRIVER); - if (retval < 0) - goto error_ep93xx; -#endif - return retval; /* Error path */ -#ifdef EP93XX_PLATFORM_DRIVER - platform_driver_unregister(&EP93XX_PLATFORM_DRIVER); - error_ep93xx: -#endif #ifdef TMIO_OHCI_DRIVER platform_driver_unregister(&TMIO_OHCI_DRIVER); error_tmio: @@ -1335,9 +1319,6 @@ module_init(ohci_hcd_mod_init); static void __exit ohci_hcd_mod_exit(void) { -#ifdef EP93XX_PLATFORM_DRIVER - platform_driver_unregister(&EP93XX_PLATFORM_DRIVER); -#endif #ifdef TMIO_OHCI_DRIVER platform_driver_unregister(&TMIO_OHCI_DRIVER); #endif