Skip to contentSkip to conversation

Make ohci-platform usable for omap3/4/5

PATCH In review Tony Lindgren 3 participants 6 messages May 25, 2017 – May 26, 2017 2 messages not in the archive

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Make ohci-platform usable for omap3/4/5

Hi,

Here's v3 of this series.

Regards,

Tony

Changes since v2:

- Ignore pm_runtime_get_sync for remove(), not much we can do there as noted by Alan Stern

- Add acks

Changes since v1: - Update runtime PM support for ohci based on Alan's comments and
more testing - Just remove ohci-omap3 as it needs LS/FS USB PHY not available
on most hardware

Tony Lindgren (3):
usb: host: ohci-platform: Add basic runtime PM support
usb: host: ohci-platform: Add support for omap3 and later
usb: host: ohci-omap3: Remove driver in favor of ohci-platform

 Documentation/devicetree/bindings/usb/usb-ohci.txt |   1 +
 drivers/usb/host/Kconfig                           |   6 +-
 drivers/usb/host/Makefile                          |   1 -
 drivers/usb/host/ohci-omap3.c                      | 211 ---------------------
 drivers/usb/host/ohci-platform.c                   |  13 ++
 5 files changed, 19 insertions(+), 213 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-omap3.c
Signature · 5 lines
2.13.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH v3 1/3 usb: host: ohci-platform: Add basic runtime PM support

In reply to a message not in the archive

This is needed in preparation of adding support for omap3 and later OHCI. The runtime PM will only do something on platforms that implement it.

Cc Hans de Goede <[email protected]>
Cc Rob Herring <[email protected]>
Cc Roger Quadros <[email protected]>
Cc Sebastian Reichel <sebastian.reichel-ZGY8ohtN/[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
---
 drivers/usb/host/ohci-platform.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-platform.c +8 -0
@@ -24,6 +24,7 @@
 #include <linux/err.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
@@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev)
 	}
 #endif
 
+	pm_runtime_set_active(&dev->dev);
+	pm_runtime_enable(&dev->dev);
 	if (pdata->power_on) {
 		err = pdata->power_on(dev);
 		if (err < 0)
@@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev)
 	if (pdata->power_off)
 		pdata->power_off(dev);
 err_reset:
+	pm_runtime_disable(&dev->dev);
 	while (--rst >= 0)
 		reset_control_assert(priv->resets[rst]);
 err_put_clks:
@@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev)
 	struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
 	int clk, rst;
 
+	pm_runtime_get_sync(&dev->dev);
 	usb_remove_hcd(hcd);
 
 	if (pdata->power_off)
@@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev)
 
 	usb_put_hcd(hcd);
 
+	pm_runtime_put_sync(&dev->dev);
+	pm_runtime_disable(&dev->dev);
+
 	if (pdata == &ohci_platform_defaults)
 		dev->dev.platform_data = NULL;
 
Signature · 5 lines
2.13.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#6 lore raw

PATCH v3 2/3 usb: host: ohci-platform: Add support for omap3 and later

In reply to a message not in the archive

With the runtime PM implemented for ohci-platform driver, we can now support omap3 and later OHCI by adding one device tree property.

Cc Hans de Goede <[email protected]>
Cc Rob Herring <[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
Cc Sebastian Reichel <sebastian.reichel-ZGY8ohtN/[email protected]>
---
 Documentation/devicetree/bindings/usb/usb-ohci.txt | 1 +
 drivers/usb/host/ohci-platform.c                   | 5 +++++
 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/usb/usb-ohci.txt +1 -0
@@ -10,6 +10,7 @@ Optional properties:
 - big-endian-desc : boolean, set this for hcds with big-endian descriptors
 - big-endian : boolean, for hcds with big-endian-regs + big-endian-desc
 - no-big-frame-no : boolean, set if frame_no lives in bits [15:0] of HCCA
+- remote-wakeup-connected: remote wakeup is wired on the platform
 - num-ports : u32, to override the detected port count
 - clocks : a list of phandle + clock specifier pairs
 - phys : phandle + phy specifier pair
drivers/usb/host/ohci-platform.c +5 -0
@@ -164,6 +164,10 @@ static int ohci_platform_probe(struct platform_device *dev)
 		if (of_property_read_bool(dev->dev.of_node, "no-big-frame-no"))
 			ohci->flags |= OHCI_QUIRK_FRAME_NO;
 
+		if (of_property_read_bool(dev->dev.of_node,
+					  "remote-wakeup-connected"))
+			ohci->hc_control = OHCI_CTRL_RWC;
+
 		of_property_read_u32(dev->dev.of_node, "num-ports",
 				     &ohci->num_ports);
 
@@ -358,6 +362,7 @@ static int ohci_platform_resume(struct device *dev)
 static const struct of_device_id ohci_platform_ids[] = {
 	{ .compatible = "generic-ohci", },
 	{ .compatible = "cavium,octeon-6335-ohci", },
+	{ .compatible = "ti,ohci-omap3", },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, ohci_platform_ids);
Signature · 5 lines
2.13.0
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#7 lore raw

PATCH v3 3/3 usb: host: ohci-omap3: Remove driver in favor of ohci-platform

In reply to a message not in the archive

This driver is no longer needed and can be removed. The reason why it's safe to remove this driver is that most omap devices don't have a USB low-speed or full-speed compatible PHY installed and configured with drivers/mfd/omap-usb-host.c. This means that devices like beagleboard and pandaboard need to use a high-speed USB hub in order to use devices like keyboard and mice.

Currently the only known configured for a full-speed PHY is the mdm6600 modem on droid 4 and I've verified it works just fine with ohci-platform.

---
 drivers/usb/host/Kconfig      |   6 +-
 drivers/usb/host/Makefile     |   1 -
 drivers/usb/host/ohci-omap3.c | 211 ------------------------------------------
 3 files changed, 5 insertions(+), 213 deletions(-)
 delete mode 100644 drivers/usb/host/ohci-omap3.c
drivers/usb/host/Kconfig +5 -1
@@ -473,8 +473,12 @@ config USB_OHCI_HCD_AT91
 config USB_OHCI_HCD_OMAP3
 	tristate "OHCI support for OMAP3 and later chips"
 	depends on (ARCH_OMAP3 || ARCH_OMAP4 || SOC_OMAP5)
+	select USB_OHCI_HCD_PLATFORM
 	default y
-	---help---
+	help
+	  This option is deprecated now and the driver was removed, use
+	  USB_OHCI_HCD_PLATFORM instead.
+
 	  Enables support for the on-chip OHCI controller on
 	  OMAP3 and later chips.
 
drivers/usb/host/Makefile +0 -1
@@ -52,7 +52,6 @@ obj-$(CONFIG_USB_OHCI_HCD_PCI)	+= ohci-pci.o
 obj-$(CONFIG_USB_OHCI_HCD_PLATFORM)	+= ohci-platform.o
 obj-$(CONFIG_USB_OHCI_EXYNOS)	+= ohci-exynos.o
 obj-$(CONFIG_USB_OHCI_HCD_OMAP1)	+= ohci-omap.o
-obj-$(CONFIG_USB_OHCI_HCD_OMAP3)	+= ohci-omap3.o
 obj-$(CONFIG_USB_OHCI_HCD_SPEAR)	+= ohci-spear.o
 obj-$(CONFIG_USB_OHCI_HCD_STI)	+= ohci-st.o
 obj-$(CONFIG_USB_OHCI_HCD_AT91)	+= ohci-at91.o
drivers/usb/host/ohci-omap3.c deleted +0 -206

206 lines not on this page · raw message

Acked-by
#4 lore raw

Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support

In reply to a message not in the archive
Quoted 52 lines · Tony Lindgren

This is needed in preparation of adding support for omap3 and later OHCI. The runtime PM will only do something on platforms that implement it.

Cc Hans de Goede <[email protected]>
Cc Rob Herring <[email protected]>
Cc Roger Quadros <[email protected]>
Cc Sebastian Reichel <sebastian.reichel-ZGY8ohtN/[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
---
 drivers/usb/host/ohci-platform.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-platform.c +5 -0
@@ -24,6 +24,7 @@
 #include <linux/err.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
@@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev)
 	}
 #endif
 
+	pm_runtime_set_active(&dev->dev);
+	pm_runtime_enable(&dev->dev);
 	if (pdata->power_on) {
 		err = pdata->power_on(dev);
 		if (err < 0)
@@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev)
 	if (pdata->power_off)
 		pdata->power_off(dev);
 err_reset:
+	pm_runtime_disable(&dev->dev);
 	while (--rst >= 0)
 		reset_control_assert(priv->resets[rst]);
 err_put_clks:
@@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev)
 	struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
 	int clk, rst;
 
+	pm_runtime_get_sync(&dev->dev);
 	usb_remove_hcd(hcd);
 
 	if (pdata->power_off)

drivers/usb/host/ohci-platform.c static int ohci_platform_remove(struct platform_device *dev) · line 317

Quoted 8 lines
drivers/usb/host/ohci-platform.c +3 -0
@@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev)
 
 	usb_put_hcd(hcd);
 
+	pm_runtime_put_sync(&dev->dev);
+	pm_runtime_disable(&dev->dev);
+
 	if (pdata == &ohci_platform_defaults)
 		dev->dev.platform_data = NULL;

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by
#5 lore raw

Re: [PATCH 1/3] usb: host: ohci-platform: Add basic runtime PM support

In reply to a message not in the archive
Quoted 11 lines · Tony Lindgren

This is needed in preparation of adding support for omap3 and later OHCI. The runtime PM will only do something on platforms that implement it.

Cc Hans de Goede <[email protected]>
Cc Rob Herring <[email protected]>
Cc Roger Quadros <[email protected]>
Cc Sebastian Reichel <sebastian.reichel-ZGY8ohtN/[email protected]>
Cc Yoshihiro Shimoda <[email protected]>
Quoted 51 lines
---
 drivers/usb/host/ohci-platform.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/usb/host/ohci-platform.c +8 -0
@@ -24,6 +24,7 @@
 #include <linux/err.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
 #include <linux/reset.h>
 #include <linux/usb/ohci_pdriver.h>
 #include <linux/usb.h>
@@ -242,6 +243,8 @@ static int ohci_platform_probe(struct platform_device *dev)
 	}
 #endif
 
+	pm_runtime_set_active(&dev->dev);
+	pm_runtime_enable(&dev->dev);
 	if (pdata->power_on) {
 		err = pdata->power_on(dev);
 		if (err < 0)
@@ -271,6 +274,7 @@ static int ohci_platform_probe(struct platform_device *dev)
 	if (pdata->power_off)
 		pdata->power_off(dev);
 err_reset:
+	pm_runtime_disable(&dev->dev);
 	while (--rst >= 0)
 		reset_control_assert(priv->resets[rst]);
 err_put_clks:
@@ -292,6 +296,7 @@ static int ohci_platform_remove(struct platform_device *dev)
 	struct ohci_platform_priv *priv = hcd_to_ohci_priv(hcd);
 	int clk, rst;
 
+	pm_runtime_get_sync(&dev->dev);
 	usb_remove_hcd(hcd);
 
 	if (pdata->power_off)
@@ -305,6 +310,9 @@ static int ohci_platform_remove(struct platform_device *dev)
 
 	usb_put_hcd(hcd);
 
+	pm_runtime_put_sync(&dev->dev);
+	pm_runtime_disable(&dev->dev);
+
 	if (pdata == &ohci_platform_defaults)
 		dev->dev.platform_data = NULL;
 
Signature · 6 lines
cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html