From patchwork Sat Aug 10 07:41:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Manjunath Goudar X-Patchwork-Id: 2842382 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B121F9F271 for ; Sat, 10 Aug 2013 07:42:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AE4F6201E8 for ; Sat, 10 Aug 2013 07:42:55 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A45A201E5 for ; Sat, 10 Aug 2013 07:42:54 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V83oy-0005LP-LP; Sat, 10 Aug 2013 07:42:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V83os-00018C-6p; Sat, 10 Aug 2013 07:42:38 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V83ob-00014L-KB for linux-arm-kernel@lists.infradead.org; Sat, 10 Aug 2013 07:42:25 +0000 Received: by mail-pa0-f46.google.com with SMTP id fa1so3811660pad.5 for ; Sat, 10 Aug 2013 00:42:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yO82TCtC80Jk3QR6XlEbVhwckfDOtzfIZz3rGgLAAgU=; b=ny2lPn1w3z23w/N9oGsLWaGolsNTrW3ZPi17m34qStRg31aoYudcgaTTwzYQIesErE 1HkVN2EX083/xtJ6U0oU0+O/yT96mWGHpE2t9pzbDtOyK7ypiLQ3WkrClvQolC6/oRPz 5jn2SmQSMoBQgVe8Y7Dn3cGl2+Azn3e87gkMNi9gjOK0Z9yqHMfjntwnQ3VtJirfvg1m oUYRqbKOduNuWYBu2wkRyVtJbZF7eEtIwOdLNidFyp7+2YQUoVtUjLh51dXI3DJiZlrT cIY0RXz3k3mzZSNwCOoftrRhIjUz6uP9xQ3BhDqOxw47KgxJGIzx3YrXVThNoV3CZ/Pq A5zA== X-Gm-Message-State: ALoCoQkW776LtToIgM8f+Ybfi1kWRbP3zCoGzxmQK6LI3My7GIJE+ekLACZS6VAZmrmWMDdykgkJ X-Received: by 10.66.144.161 with SMTP id sn1mr15177274pab.30.1376120520233; Sat, 10 Aug 2013 00:42:00 -0700 (PDT) Received: from localhost.localdomain ([223.239.128.199]) by mx.google.com with ESMTPSA id sz6sm26927438pab.5.2013.08.10.00.41.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 10 Aug 2013 00:41:59 -0700 (PDT) From: Manjunath Goudar To: linux-arm-kernel@lists.infradead.org Subject: [PATCH V3 1/2] USB: OHCI: make ohci-ep93xx a separate driver Date: Sat, 10 Aug 2013 13:11:39 +0530 Message-Id: <1376120501-21368-2-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1376120501-21368-1-git-send-email-manjunath.goudar@linaro.org> References: <1372958187-4039-1-git-send-email-manjunath.goudar@linaro.org> <1376120501-21368-1-git-send-email-manjunath.goudar@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130810_034221_892967_9390CDB4 X-CRM114-Status: GOOD ( 18.73 ) X-Spam-Score: -2.6 (--) Cc: linaro-kernel@lists.linaro.org, Arnd Bergmann , patches@linaro.org, Greg KH , manjunath.goudar@linaro.org, linux-usb@vger.kernel.org, dsaxena@linaro.org, arnd@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Signed-off-by: Deepak Saxena Acked-by: Alan Stern Cc: Arnd Bergmann 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(). V3: -Unused *ohci variable has been removed. --- drivers/usb/host/Kconfig | 8 ++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ohci-ep93xx.c | 80 +++++++++++++++++----------------------- drivers/usb/host/ohci-hcd.c | 18 --------- 4 files changed, 43 insertions(+), 64 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..7b0e3ae 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; @@ -79,8 +92,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 +118,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 +175,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 +189,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 6ae5520..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,19 +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: @@ -1334,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