From patchwork Sun Mar 17 18:31:41 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: 15395 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 2B02B23E2C for ; Sun, 17 Mar 2013 18:32:15 +0000 (UTC) Received: from mail-ve0-f174.google.com (mail-ve0-f174.google.com [209.85.128.174]) by fiordland.canonical.com (Postfix) with ESMTP id C403CA18892 for ; Sun, 17 Mar 2013 18:32:14 +0000 (UTC) Received: by mail-ve0-f174.google.com with SMTP id pb11so3780358veb.19 for ; Sun, 17 Mar 2013 11:32:14 -0700 (PDT) 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=L2jPn3CUhxIS/16yaqZeOGqXrqUS4oJ0n1n3TqJyIsw=; b=W0CFZCkX5aDWYgmL8RddwKaDw65tmq3zspYPX//D0wK2/voHLNQ1b/ybiYwL/+loaj yvdG27vIGFCi1x7j6QP+afTbzMPol5Bk5hmzNCqLkGvwYtbidZ6NbVqw/RFd7S8x+tiX AMNoHvbgVhTSQagk21e5Zrg3LmRigYtbULP511apGWKl8RzwOOFrJ4una8bdjQUafg/u EaX2vKhuW3UEnzl+CLRhHtslOTjZcj39XQ+uGzZWbugkdjGdbyZwbC1qIhL0b0OCskmg A+HUcdSLm4HsyXRacK15Lvqw1nmQXW+RYMHzy0DRzievl8KwcOEVwUI9VnUzqFf9Lgja GndA== X-Received: by 10.52.109.5 with SMTP id ho5mr3611611vdb.75.1363545134241; Sun, 17 Mar 2013 11:32:14 -0700 (PDT) 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.127.98 with SMTP id nf2csp208094veb; Sun, 17 Mar 2013 11:32:13 -0700 (PDT) X-Received: by 10.66.190.104 with SMTP id gp8mr6568192pac.84.1363545133045; Sun, 17 Mar 2013 11:32:13 -0700 (PDT) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by mx.google.com with ESMTPS id lm9si3981453pab.173.2013.03.17.11.32.12 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Mar 2013 11:32:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.44 is neither permitted nor denied by best guess record for domain of manjunath.goudar@linaro.org) client-ip=209.85.160.44; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.44 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-pb0-f44.google.com with SMTP id wz12so5808437pbc.17 for ; Sun, 17 Mar 2013 11:32:12 -0700 (PDT) X-Received: by 10.66.248.227 with SMTP id yp3mr6382024pac.158.1363545132287; Sun, 17 Mar 2013 11:32:12 -0700 (PDT) Received: from localhost.localdomain ([223.239.138.120]) by mx.google.com with ESMTPS id i9sm5187683paa.7.2013.03.17.11.32.09 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 17 Mar 2013 11:32:11 -0700 (PDT) From: Manjunath Goudar To: manjunath.goudar@linaro.org Cc: arnd@linaro.org, patches@linaro.org Subject: [V3 5/8] USB: EHCI: make ehci-vt8500 a separate driver Date: Mon, 18 Mar 2013 00:01:41 +0530 Message-Id: <1363545104-1677-6-git-send-email-manjunath.goudar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363545104-1677-1-git-send-email-manjunath.goudar@linaro.org> References: <1363545104-1677-1-git-send-email-manjunath.goudar@linaro.org> X-Gm-Message-State: ALoCoQkp+A/bxjL3GfvjOAm2EgyhRuaant0K3wzV68rRRLkSyls6dj3LWOxa/Tc7p5M2Wv/rX/jw Separate the vt8500 host controller driver from ehci-hcd host code into its own driver module because of following reason. With the multiplatform changes in arm-soc tree, it becomes possible to enable the vt8500 platform at the same time as other platforms that require a conflicting EHCI bus glue. At the moment, this results in a warning like drivers/usb/host/ehci-hcd.c:1277:0: warning: "PLATFORM_DRIVER" redefined [enabled by default] drivers/usb/host/ehci-hcd.c:1257:0: note: this is the location of the previous definition drivers/usb/host/ehci-omap.c:319:31: warning: 'ehci_hcd_omap_driver' defined but not used [-Wunused-variable] and an ehci driver that only works on one of them. With the infrastructure added by Alan Stern in patch 3e0232039 "USB: EHCI: prepare to make ehci-hcd a library module", we can avoid this problem by turning a bus glue into a separate module, as we do here for the vt8500 bus glue. In V3: 1.Submitted patch is reverts (commit d57ada0c37ecf836259c205442c15c7679a6dc3e) due to drive.name initialized hcd_name[] = "ehci-vt8500" in platform_driver structure initialization instead of "vt8500-ehci",that is reason it was breaking in EHCI USB testing. 2.Detail commit message added here,why this patch is required. 2.Removed ehci_vt8500_overrides structure because ehci_setup is the default value anyway.This structure can be omitted. 3.MODULE_LICENSE is GPL v2. 4.Arranged #include's in alphabetical order. 5.In ehci_init_driver calling second argument passed as NULL instead of ehci_vt8500_overrides because ehci_vt8500_overrides is removed. In V2: Change the GPL to GPL v2 MODULE_LICENSE. Signed-off-by: Manjunath Goudar Signed-off-by: Arnd Bergmann Acked-by: Tony Prisk Cc: Greg KH Cc: Alan Stern Cc: Alexey Charkov Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- drivers/usb/host/Kconfig | 8 +++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ehci-hcd.c | 6 +--- drivers/usb/host/ehci-vt8500.c | 71 +++++++++++++++++----------------------- 4 files changed, 40 insertions(+), 46 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 26754d6..efc6564 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -162,6 +162,14 @@ config USB_EHCI_HCD_OMAP Enables support for the on-chip EHCI controller on OMAP3 and later chips. +config USB_EHCI_HCD_VT8500 + tristate "Support for VIA/Wondermedia on-chip EHCI USB controller" + depends on USB_EHCI_HCD && ARCH_VT8500 + default y + ---help--- + Enables support for the on-chip EHCI controller on VIA VT8500 and + Wondermedia WM8x50 chips. + config USB_EHCI_HCD_SPEAR tristate "Support for ST SPEAr on-chip EHCI USB controller" depends on USB_EHCI_HCD && PLAT_SPEAR diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index e5f380a..0f1214e 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_USB_EHCI_HCD_SPEAR) += ehci-spear.o obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o obj-$(CONFIG_USB_EHCI_S5P) += ehci-s5p.o obj-$(CONFIG_USB_EHCI_MV) += ehci-mv.o +obj-$(CONFIG_USB_EHCI_HCD_VT8500) += ehci-vt8500.o obj-$(CONFIG_USB_OXU210HP_HCD) += oxu210hp-hcd.o obj-$(CONFIG_USB_ISP116X_HCD) += isp116x-hcd.o diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 1672235..33e4ea2 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -1288,11 +1288,6 @@ MODULE_LICENSE ("GPL"); #define PLATFORM_DRIVER ehci_octeon_driver #endif -#ifdef CONFIG_ARCH_VT8500 -#include "ehci-vt8500.c" -#define PLATFORM_DRIVER vt8500_ehci_driver -#endif - #ifdef CONFIG_USB_EHCI_MSM #include "ehci-msm.c" #define PLATFORM_DRIVER ehci_msm_driver @@ -1331,6 +1326,7 @@ MODULE_LICENSE ("GPL"); !IS_ENABLED(CONFIG_ARCH_AT91) && \ !IS_ENABLED(CONFIG_USB_EHCI_S5P) && \ !IS_ENABLED(CONFIG_USB_EHCI_MV) && \ + !IS_ENABLED(CONFIG_ARCH_VT8500) && \ !defined(PLATFORM_DRIVER) && \ !defined(PS3_SYSTEM_BUS_DRIVER) && \ !defined(OF_PLATFORM_DRIVER) && \ diff --git a/drivers/usb/host/ehci-vt8500.c b/drivers/usb/host/ehci-vt8500.c index 7ecf709..d5d9ef4 100644 --- a/drivers/usb/host/ehci-vt8500.c +++ b/drivers/usb/host/ehci-vt8500.c @@ -17,53 +17,22 @@ */ #include +#include +#include +#include +#include #include #include +#include +#include -static const struct hc_driver vt8500_ehci_hc_driver = { - .description = hcd_name, - .product_desc = "VT8500 EHCI", - .hcd_priv_size = sizeof(struct ehci_hcd), +#include "ehci.h" - /* - * generic hardware linkage - */ - .irq = ehci_irq, - .flags = HCD_MEMORY | HCD_USB2, +#define DRIVER_DESC "vt8500 On-Chip EHCI Host driver" - /* - * basic lifecycle operations - */ - .reset = ehci_setup, - .start = ehci_run, - .stop = ehci_stop, - .shutdown = ehci_shutdown, +static const char hcd_name[] = "ehci-vt8500"; - /* - * 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, - .relinquish_port = ehci_relinquish_port, - .port_handed_over = ehci_port_handed_over, - - .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, -}; +static struct hc_driver __read_mostly vt8500_ehci_hc_driver; static u64 vt8500_ehci_dma_mask = DMA_BIT_MASK(32); @@ -146,5 +115,25 @@ static struct platform_driver vt8500_ehci_driver = { } }; +static int __init ehci_vt8500_init(void) +{ + if (usb_disabled()) + return -ENODEV; + + pr_info("%s: " DRIVER_DESC "\n", hcd_name); + ehci_init_driver(&vt8500_ehci_hc_driver, NULL); + return platform_driver_register(&vt8500_ehci_driver); +} +module_init(ehci_vt8500_init); + +static void __exit ehci_vt8500_cleanup(void) +{ + platform_driver_unregister(&vt8500_ehci_driver); +} +module_exit(ehci_vt8500_cleanup); + +MODULE_DESCRIPTION(DRIVER_DESC); +MODULE_AUTHOR("Alexey Charkov"); +MODULE_LICENSE("GPL v2"); MODULE_ALIAS("platform:vt8500-ehci"); MODULE_DEVICE_TABLE(of, vt8500_ehci_ids);