mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq@ti.com>
To: <tony@atomide.com>
Cc: <linux@arm.linux.org.uk>, <sameo@linux.intel.com>, <balbi@ti.com>,
	<stern@rowland.harvard.edu>, <gregkh@linuxfoundation.org>,
	<eballetbo@gmail.com>, <javier@dowhile0.org>,
	<sshtylyov@mvista.com>, <linux-usb@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>
Subject: [PATCH 01/30] USB: EHCI: split ehci-omap out to a separate driver
Date: Mon, 28 Jan 2013 13:30:02 +0200	[thread overview]
Message-ID: <1359372631-8180-2-git-send-email-rogerq@ti.com> (raw)
In-Reply-To: <1359372631-8180-1-git-send-email-rogerq@ti.com>

From: Alan Stern <stern@rowland.harvard.edu>

This patch (as1645) converts ehci-omap over to the new "ehci-hcd is a
library" approach, so that it can coexist peacefully with other EHCI
platform drivers and can make use of the private area allocated at
the end of struct ehci_hcd.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
---
 drivers/usb/host/Kconfig     |    2 +-
 drivers/usb/host/Makefile    |    1 +
 drivers/usb/host/ehci-hcd.c  |    6 +---
 drivers/usb/host/ehci-omap.c |   76 +++++++++++++++++++-----------------------
 4 files changed, 37 insertions(+), 48 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..56de410 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -27,6 +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
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 09537b2..5a35246 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -1251,11 +1251,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
@@ -1345,6 +1340,7 @@ MODULE_LICENSE ("GPL");
 	!IS_ENABLED(CONFIG_USB_EHCI_HCD_PLATFORM) && \
 	!IS_ENABLED(CONFIG_USB_CHIPIDEA_HOST) && \
 	!IS_ENABLED(CONFIG_USB_EHCI_MXC) && \
+	!IS_ENABLED(CONFIG_USB_EHCI_HCD_OMAP) && \
 	!defined(PLATFORM_DRIVER) && \
 	!defined(PS3_SYSTEM_BUS_DRIVER) && \
 	!defined(OF_PLATFORM_DRIVER) && \
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index b96a4bf..30fc482 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -36,6 +36,9 @@
  *	- convert to use hwmod and runtime PM
  */
 
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/slab.h>
 #include <linux/usb/ulpi.h>
@@ -43,6 +46,10 @@
 #include <linux/pm_runtime.h>
 #include <linux/gpio.h>
 #include <linux/clk.h>
+#include <linux/usb.h>
+#include <linux/usb/hcd.h>
+
+#include "ehci.h"
 
 #include <linux/platform_data/usb-omap.h>
 
@@ -57,9 +64,11 @@
 #define	EHCI_INSNREG05_ULPI_EXTREGADD_SHIFT		8
 #define	EHCI_INSNREG05_ULPI_WRDATA_SHIFT		0
 
-/*-------------------------------------------------------------------------*/
+#define DRIVER_DESC "OMAP-EHCI Host Controller driver"
 
-static const struct hc_driver ehci_omap_hc_driver;
+static const char hcd_name[] = "ehci-omap";
+
+/*-------------------------------------------------------------------------*/
 
 
 static inline void ehci_write(void __iomem *base, u32 reg, u32 val)
@@ -166,6 +175,12 @@ static void disable_put_regulator(
 /* configure so an HC device and id are always provided */
 /* always called with process context; sleeping is OK */
 
+static struct hc_driver __read_mostly ehci_omap_hc_driver;
+
+static const struct ehci_driver_overrides ehci_omap_overrides __initdata = {
+	.reset =		omap_ehci_init,
+};
+
 /**
  * ehci_hcd_omap_probe - initialize TI-based HCDs
  *
@@ -315,56 +330,33 @@ 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,
-
-	/*
-	 * basic lifecycle operations
-	 */
-	.reset			= omap_ehci_init,
-	.start			= ehci_run,
-	.stop			= ehci_stop,
-	.shutdown		= ehci_shutdown,
-
-	/*
-	 * 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,
+static int __init ehci_omap_init(void)
+{
+	if (usb_disabled())
+		return -ENODEV;
 
-	/*
-	 * scheduling support
-	 */
-	.get_frame_number	= ehci_get_frame,
+	pr_info("%s: " DRIVER_DESC "\n", hcd_name);
 
-	/*
-	 * 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,
+	ehci_init_driver(&ehci_omap_hc_driver, &ehci_omap_overrides);
+	return platform_driver_register(&ehci_hcd_omap_driver);
+}
+module_init(ehci_omap_init);
 
-	.clear_tt_buffer_complete = ehci_clear_tt_buffer_complete,
-};
+static void __exit ehci_omap_cleanup(void)
+{
+	platform_driver_unregister(&ehci_hcd_omap_driver);
+}
+module_exit(ehci_omap_cleanup);
 
 MODULE_ALIAS("platform:omap-ehci");
 MODULE_AUTHOR("Texas Instruments, Inc.");
 MODULE_AUTHOR("Felipe Balbi <felipe.balbi@nokia.com>");
 
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL");
-- 
1.7.4.1


  reply	other threads:[~2013-01-28 11:41 UTC|newest]

Thread overview: 101+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 11:30 [PATCH v2 00/30] USB: omap-ehci: Move PHY management to PHY driver Roger Quadros
2013-01-28 11:30 ` Roger Quadros [this message]
2013-02-05  9:11   ` [PATCH 01/30] USB: EHCI: split ehci-omap out to a separate driver Felipe Balbi
2013-01-28 11:30 ` [PATCH 02/30] usb: phy: nop: use devm_kzalloc() Roger Quadros
2013-02-05  9:14   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 03/30] usb: phy: nop: Manage PHY clock Roger Quadros
2013-02-05  9:17   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 04/30] usb: phy: nop: Handle power supply regulator for the PHY Roger Quadros
2013-02-05  9:20   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 05/30] usb: phy: nop: Handle RESET " Roger Quadros
2013-02-05  9:22   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 06/30] usb: phy: nop: use new PHY API to register PHY Roger Quadros
2013-02-05  9:23   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 07/30] mfd: omap-usb-host: update nports in platform_data Roger Quadros
2013-02-05  9:24   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 08/30] mfd: omap-usb-host: Remove PHY reset handling code Roger Quadros
2013-02-05  9:25   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 09/30] USB: ehci-omap: Use devm_request_and_ioremap() Roger Quadros
2013-01-28 15:17   ` Alan Stern
2013-01-28 15:20     ` Russell King - ARM Linux
2013-01-29 15:34       ` Alan Stern
2013-01-29 16:01         ` Russell King - ARM Linux
2013-01-29 22:08           ` Greg KH
2013-02-05  9:25   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 10/30] USB: ehci-omap: Use PHY APIs to get the PHY device and put it out of suspend Roger Quadros
2013-01-28 15:40   ` Alan Stern
2013-01-28 15:58     ` Roger Quadros
2013-01-29  9:50   ` [PATCH v3 " Roger Quadros
2013-01-29  9:57     ` Felipe Balbi
2013-01-29 10:08       ` Roger Quadros
2013-01-29 10:12         ` Felipe Balbi
2013-01-29 15:30     ` Alan Stern
2013-01-29 15:33       ` Roger Quadros
2013-02-05  9:13       ` Felipe Balbi
2013-02-05  9:26       ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 11/30] usb: ehci-omap: Remove PHY reset handling code Roger Quadros
2013-01-28 17:34   ` Alan Stern
2013-02-05  9:27     ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 12/30] usb: ehci-omap: Remove PHY regulator " Roger Quadros
2013-01-28 17:35   ` Alan Stern
2013-02-05  9:27     ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 13/30] ARM: OMAP2+: omap4panda: Provide USB Host's PHY platform data Roger Quadros
2013-02-05  9:28   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH v2 14/30] ARM: OMAP2+: omap4panda: Adapt to ehci-omap changes Roger Quadros
2013-02-05  9:31   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 15/30] ARM: OMAP3: Beagle: " Roger Quadros
2013-02-05  9:31   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 16/30] ARM: OMAP3: 3430SDP: " Roger Quadros
2013-02-05  9:31   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 17/30] ARM: OMAP3: 3630SDP: " Roger Quadros
2013-02-05  9:31   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 18/30] ARM: OMAP: AM3517crane: " Roger Quadros
2013-02-05  9:32   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 19/30] ARM: OMAP: AM3517evm: " Roger Quadros
2013-02-05  9:32   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 20/30] ARM: OMAP3: cm-t35: " Roger Quadros
2013-02-05  9:32   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 21/30] ARM: OMAP3: cm-t3517: " Roger Quadros
2013-02-05  9:32   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 22/30] ARM: OMAP: devkit8000: " Roger Quadros
2013-02-05  9:33   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 23/30] ARM: OMAP3: igep0020: " Roger Quadros
2013-02-05  9:33   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 24/30] ARM: OMAP3: omap3evm: " Roger Quadros
2013-02-05  9:33   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 25/30] ARM: OMAP3: omap3pandora: " Roger Quadros
2013-02-05  9:33   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 26/30] ARM: OMAP3: omap3stalker: " Roger Quadros
2013-02-05  9:34   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 27/30] ARM: OMAP3: omap3touchbook: " Roger Quadros
2013-02-05  9:34   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 28/30] ARM: OMAP3: overo: " Roger Quadros
2013-02-05  9:40   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 29/30] ARM: OMAP: zoom: " Roger Quadros
2013-02-05  9:40   ` Felipe Balbi
2013-01-28 11:30 ` [PATCH 30/30] ARM: OMAP: USB: Remove unused fields from struct usbhs_omap_platform_data Roger Quadros
2013-02-05  9:40   ` Felipe Balbi
2013-01-30 12:08 ` [PATCH v2 00/30] USB: omap-ehci: Move PHY management to PHY driver Mohammed, Afzal
2013-01-30 12:48   ` Roger Quadros
2013-01-30 13:12     ` Mohammed, Afzal
2013-01-30 13:15       ` Roger Quadros
2013-01-30 13:15     ` Felipe Balbi
2013-01-30 13:19       ` Mohammed, Afzal
2013-02-01 14:21         ` Mohammed, Afzal
2013-02-01 14:25           ` Roger Quadros
2013-02-01 14:27             ` Mohammed, Afzal
2013-02-01 14:31               ` Roger Quadros
2013-02-01 14:35                 ` Mohammed, Afzal
2013-02-01 14:58                   ` Roger Quadros
2013-02-04 14:35 ` [PATCH v2 09/31] USB: ehci-omap: Use devm_ioremap_resource() Roger Quadros
2013-02-04 21:11   ` Alan Stern
2013-02-04 14:46 ` [PATCH 31/31] USB: ehci-omap: Select NOP USB transceiver driver Roger Quadros
2013-02-04 21:03   ` Alan Stern
2013-02-05  9:41     ` Felipe Balbi
2013-02-05 11:28 ` [PATCH v2 00/30] USB: omap-ehci: Move PHY management to PHY driver Roger Quadros
2013-02-05 16:58   ` Greg KH
2013-02-05 17:17     ` Tony Lindgren
2013-02-06  9:49       ` Roger Quadros
2013-02-06 17:11         ` Tony Lindgren
2013-02-06 17:48           ` Greg KH
2013-02-07 15:28           ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1359372631-8180-2-git-send-email-rogerq@ti.com \
    --to=rogerq@ti.com \
    --cc=balbi@ti.com \
    --cc=eballetbo@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=javier@dowhile0.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=sameo@linux.intel.com \
    --cc=sshtylyov@mvista.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®