Skip to contentSkip to conversation

USB: host: Remove non-DT support for Exynos EHCI and OHCI

PATCH Superseded Jingoo Han 3 participants 8 messages Oct 10, 2013 2 messages not in the archive

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jingoo Han

author
#0 lore raw

cover USB: host: Remove non-DT support for Exynos EHCI and OHCI

This patchset removes non-DT support for Exynos EHCI and OHCI from arch and driver directories, because the non-DT for EXYNOS SoCs is not supported from v3.11.

In order to keep the consistency, ehci-s5p.c is changed to ehci-exynos.c. So, the name of Exynos EHCI and OHCI driver is as below:
- ehci-exynos.c
- ohci-exynos.c

Also, missing usb_put_hcd() is added to prevent memory leak.

In order to prevent build error issues or merge conflict,
this patchset includes the following patches that were
previously submitted.
- [PATCH] ARM: SAMSUNG: Remove unused s5p_device_ehci
(http://www.spinics.net/lists/linux-samsung-soc/msg23397.html)
- [PATCH] USB: ohci-exynos: Add missing usb_put_hcd() to prevent memory leak
(http://www.spinics.net/lists/linux-usb/msg95282.html)

These patches were tested on Exynos5250.

---
 arch/arm/plat-samsung/Kconfig                  |    5 -
 arch/arm/plat-samsung/devs.c                   |   34 -----
 arch/arm/plat-samsung/include/plat/devs.h      |    1 -
 drivers/usb/host/Kconfig                       |    5 +-
 drivers/usb/host/Makefile                      |    2 +-
 drivers/usb/host/{ehci-s5p.c => ehci-exynos.c} |  165 ++++++++++--------------
 drivers/usb/host/ohci-exynos.c                 |   17 +--
 include/linux/platform_data/usb-ehci-s5p.h     |   21 ---
 include/linux/platform_data/usb-ohci-exynos.h  |   21 ---
 9 files changed, 76 insertions(+), 195 deletions(-)
 rename drivers/usb/host/{ehci-s5p.c => ehci-exynos.c} (55%)
 delete mode 100644 include/linux/platform_data/usb-ehci-s5p.h
 delete mode 100644 include/linux/platform_data/usb-ohci-exynos.h
author
#1 lore raw

PATCH 1/5 ARM: SAMSUNG: Remove unused s5p_device_ehci

Since commit ca91435 "ARM: EXYNOS: Remove unused board files", s5p_device_ehci is not used anymore. Thus, s5p_device_ehci can be removed. Also, unnecessary S5P_DEV_USB_EHCI option is removed.

---
 arch/arm/plat-samsung/Kconfig             |    5 -----
 arch/arm/plat-samsung/devs.c              |   34 -----------------------------
 arch/arm/plat-samsung/include/plat/devs.h |    1 -
 3 files changed, 40 deletions(-)
arch/arm/plat-samsung/Kconfig +0 -5
index 7dfba93..99bfbb3 100644
@@ -382,11 +382,6 @@ config S5P_DEV_TV
 	help
 	  Compile in platform device definition for TV interface
 
-config S5P_DEV_USB_EHCI
-	bool
-	help
-	  Compile in platform device definition for USB EHCI
-
 config S3C24XX_PWM
 	bool "PWM device support"
 	select PWM
arch/arm/plat-samsung/devs.c +0 -34
index 8ce0ac0..25f40c9 100644
@@ -49,7 +49,6 @@
 #include <plat/devs.h>
 #include <plat/adc.h>
 #include <linux/platform_data/ata-samsung_cf.h>
-#include <linux/platform_data/usb-ehci-s5p.h>
 #include <plat/fb.h>
 #include <plat/fb-s3c2410.h>
 #include <plat/hdmi.h>
@@ -1359,39 +1358,6 @@ void __init s3c24xx_udc_set_platdata(struct s3c2410_udc_mach_info *pd)
 }
 #endif /* CONFIG_PLAT_S3C24XX */
 
-/* USB EHCI Host Controller */
-
-#ifdef CONFIG_S5P_DEV_USB_EHCI
-static struct resource s5p_ehci_resource[] = {
-	[0] = DEFINE_RES_MEM(S5P_PA_EHCI, SZ_256),
-	[1] = DEFINE_RES_IRQ(IRQ_USB_HOST),
-};
-
-struct platform_device s5p_device_ehci = {
-	.name		= "s5p-ehci",
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(s5p_ehci_resource),
-	.resource	= s5p_ehci_resource,
-	.dev		= {
-		.dma_mask		= &samsung_device_dma_mask,
-		.coherent_dma_mask	= DMA_BIT_MASK(32),
-	}
-};
-
-void __init s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd)
-{
-	struct s5p_ehci_platdata *npd;
-
-	npd = s3c_set_platdata(pd, sizeof(struct s5p_ehci_platdata),
-			&s5p_device_ehci);
-
-	if (!npd->phy_init)
-		npd->phy_init = s5p_usb_phy_init;
-	if (!npd->phy_exit)
-		npd->phy_exit = s5p_usb_phy_exit;
-}
-#endif /* CONFIG_S5P_DEV_USB_EHCI */
-
 /* USB HSOTG */
 
 #ifdef CONFIG_S3C_DEV_USB_HSOTG
arch/arm/plat-samsung/include/plat/devs.h +0 -1
index 0dc4ac4..eece188 100644
@@ -75,7 +75,6 @@ extern struct platform_device s3c_device_usb_hsotg;
 extern struct platform_device s3c_device_usb_hsudc;
 extern struct platform_device s3c_device_wdt;
 
-extern struct platform_device s5p_device_ehci;
 extern struct platform_device s5p_device_fimc0;
 extern struct platform_device s5p_device_fimc1;
 extern struct platform_device s5p_device_fimc2;
Signature · 1 line
1.7.10.4
author
#2 lore raw

PATCH 2/5 USB: host: Rename ehci-s5p to ehci-exynos

In reply to Jingoo Han

Currently, Samsung is using 'EXYNOS' as the name of Samsung SoCs. Thus, ehci-exynos is preferred than ehci-s5p.

---
 drivers/usb/host/Kconfig                           |    5 +-
 drivers/usb/host/Makefile                          |    2 +-
 drivers/usb/host/{ehci-s5p.c => ehci-exynos.c}     |  164 ++++++++++----------
 .../{usb-ehci-s5p.h => usb-ehci-exynos.h}          |   10 +-
 4 files changed, 90 insertions(+), 91 deletions(-)
 rename drivers/usb/host/{ehci-s5p.c => ehci-exynos.c} (57%)
 rename include/linux/platform_data/{usb-ehci-s5p.h => usb-ehci-exynos.h} (71%)
drivers/usb/host/Kconfig +2 -3
index 70cb1a9..80e72fb 100644
@@ -203,12 +203,11 @@ config USB_EHCI_SH
 	  Enables support for the on-chip EHCI controller on the SuperH.
 	  If you use the PCI EHCI controller, this option is not necessary.
 
-config USB_EHCI_S5P
+config USB_EHCI_EXYNOS
        tristate "EHCI support for Samsung S5P/EXYNOS SoC Series"
        depends on PLAT_S5P || ARCH_EXYNOS
        help
-	Enable support for the Samsung S5Pxxxx and Exynos3/4/5 SOC's
-	on-chip EHCI controller.
+	Enable support for the Samsung Exynos SOC's on-chip EHCI controller.
 
 config USB_EHCI_MV
 	bool "EHCI support for Marvell PXA/MMP USB controller"
drivers/usb/host/Makefile +1 -1
index 0b9fdee..9dc11c2 100644
@@ -34,7 +34,7 @@ obj-$(CONFIG_USB_EHCI_MXC)	+= ehci-mxc.o
 obj-$(CONFIG_USB_EHCI_HCD_OMAP)	+= ehci-omap.o
 obj-$(CONFIG_USB_EHCI_HCD_ORION)	+= ehci-orion.o
 obj-$(CONFIG_USB_EHCI_HCD_SPEAR)	+= ehci-spear.o
-obj-$(CONFIG_USB_EHCI_S5P)	+= ehci-s5p.o
+obj-$(CONFIG_USB_EHCI_EXYNOS)	+= ehci-exynos.o
 obj-$(CONFIG_USB_EHCI_HCD_AT91) += ehci-atmel.o
 obj-$(CONFIG_USB_EHCI_MSM)	+= ehci-msm.o
 obj-$(CONFIG_USB_EHCI_TEGRA)	+= ehci-tegra.o
drivers/usb/host/ehci-exynos.c renamed from drivers/usb/host/ehci-s5p.c +82 -82

318 lines not on this page · raw message

include/linux/platform_data/usb-ehci-exynos.h renamed from include/linux/platform_data/usb-ehci-s5p.h +5 -5
similarity index 71%
rename from include/linux/platform_data/usb-ehci-s5p.h
rename to include/linux/platform_data/usb-ehci-exynos.h
index 5f28cae..5413745 100644
@@ -8,14 +8,14 @@
  * option) any later version.
  */
 
-#ifndef __PLAT_SAMSUNG_EHCI_H
-#define __PLAT_SAMSUNG_EHCI_H __FILE__
+#ifndef __USB_EHCI_EXYNOS_H
+#define __USB_EHCI_EXYNOS_H __FILE__
 
-struct s5p_ehci_platdata {
+struct exynos_ehci_platdata {
 	int (*phy_init)(struct platform_device *pdev, int type);
 	int (*phy_exit)(struct platform_device *pdev, int type);
 };
 
-extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd);
+extern void exynos_ehci_set_platdata(struct exynos_ehci_platdata *pd);
 
-#endif /* __PLAT_SAMSUNG_EHCI_H */
+#endif /* __USB_EHCI_EXYNOS_H */
Signature · 1 line
1.7.10.4
author
#3 lore raw

PATCH 3/5 USB: ehci-exynos: Remove non-DT support

In reply to Jingoo Han

The non-DT for EXYNOS SoCs is not supported from v3.11. Thus, there is no need to support non-DT for Exynos EHCI driver.

The 'include/linux/platform_data/usb-ehci-exynos.h' file has been used for non-DT support. Thus, the 'usb-ehci-exynos.h' file can be removed.

---
 drivers/usb/host/ehci-exynos.c                |   33 +++----------------------
 include/linux/platform_data/usb-ehci-exynos.h |   21 ----------------
 2 files changed, 4 insertions(+), 50 deletions(-)
 delete mode 100644 include/linux/platform_data/usb-ehci-exynos.h
drivers/usb/host/ehci-exynos.c +4 -29
index 42b5fb8..80c6a91 100644
@@ -20,7 +20,6 @@
 #include <linux/of.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
-#include <linux/platform_data/usb-ehci-exynos.h>
 #include <linux/usb/phy.h>
 #include <linux/usb/samsung_usb_phy.h>
 #include <linux/usb.h>
@@ -47,11 +46,8 @@ struct exynos_ehci_hcd {
 	struct clk *clk;
 	struct usb_phy *phy;
 	struct usb_otg *otg;
-	struct exynos_ehci_platdata *pdata;
 };
 
-static struct exynos_ehci_platdata empty_platdata;
-
 #define to_exynos_ehci(hcd) (struct exynos_ehci_hcd *)(hcd_to_ehci(hcd)->priv)
 
 static void exynos_setup_vbus_gpio(struct platform_device *pdev)
@@ -75,7 +71,6 @@ static void exynos_setup_vbus_gpio(struct platform_device *pdev)
 
 static int exynos_ehci_probe(struct platform_device *pdev)
 {
-	struct exynos_ehci_platdata *pdata = dev_get_platdata(&pdev->dev);
 	struct exynos_ehci_hcd *exynos_ehci;
 	struct usb_hcd *hcd;
 	struct ehci_hcd *ehci;
@@ -105,21 +100,14 @@ static int exynos_ehci_probe(struct platform_device *pdev)
 	exynos_ehci = to_exynos_ehci(hcd);
 
 	if (of_device_is_compatible(pdev->dev.of_node,
-					"samsung,exynos5440-ehci")) {
-		exynos_ehci->pdata = &empty_platdata;
+					"samsung,exynos5440-ehci"))
 		goto skip_phy;
-	}
 
 	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 	if (IS_ERR(phy)) {
-		/* Fallback to pdata */
-		if (!pdata) {
-			usb_put_hcd(hcd);
-			dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
-			return -EPROBE_DEFER;
-		} else {
-			exynos_ehci->pdata = pdata;
-		}
+		usb_put_hcd(hcd);
+		dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
+		return -EPROBE_DEFER;
 	} else {
 		exynos_ehci->phy = phy;
 		exynos_ehci->otg = phy->otg;
@@ -167,8 +155,6 @@ skip_phy:
 
 	if (exynos_ehci->phy)
 		usb_phy_init(exynos_ehci->phy);
-	else if (exynos_ehci->pdata->phy_init)
-		exynos_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
 
 	ehci = hcd_to_ehci(hcd);
 	ehci->caps = hcd->regs;
@@ -189,8 +175,6 @@ skip_phy:
 fail_add_hcd:
 	if (exynos_ehci->phy)
 		usb_phy_shutdown(exynos_ehci->phy);
-	else if (exynos_ehci->pdata->phy_exit)
-		exynos_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 fail_io:
 	clk_disable_unprepare(exynos_ehci->clk);
 fail_clk:
@@ -210,8 +194,6 @@ static int exynos_ehci_remove(struct platform_device *pdev)
 
 	if (exynos_ehci->phy)
 		usb_phy_shutdown(exynos_ehci->phy);
-	else if (exynos_ehci->pdata->phy_exit)
-		exynos_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 
 	clk_disable_unprepare(exynos_ehci->clk);
 
@@ -225,8 +207,6 @@ static int exynos_ehci_suspend(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd);
-	struct platform_device *pdev = to_platform_device(dev);
-
 	bool do_wakeup = device_may_wakeup(dev);
 	int rc;
 
@@ -237,8 +217,6 @@ static int exynos_ehci_suspend(struct device *dev)
 
 	if (exynos_ehci->phy)
 		usb_phy_shutdown(exynos_ehci->phy);
-	else if (exynos_ehci->pdata->phy_exit)
-		exynos_ehci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 
 	clk_disable_unprepare(exynos_ehci->clk);
 
@@ -249,7 +227,6 @@ static int exynos_ehci_resume(struct device *dev)
 {
 	struct usb_hcd *hcd = dev_get_drvdata(dev);
 	struct exynos_ehci_hcd *exynos_ehci = to_exynos_ehci(hcd);
-	struct platform_device *pdev = to_platform_device(dev);
 
 	clk_prepare_enable(exynos_ehci->clk);
 
@@ -258,8 +235,6 @@ static int exynos_ehci_resume(struct device *dev)
 
 	if (exynos_ehci->phy)
 		usb_phy_init(exynos_ehci->phy);
-	else if (exynos_ehci->pdata->phy_init)
-		exynos_ehci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
 
 	/* DMA burst Enable */
 	writel(EHCI_INSNREG00_ENABLE_DMA_BURST, EHCI_INSNREG00(hcd->regs));
include/linux/platform_data/usb-ehci-exynos.h deleted +0 -21
deleted file mode 100644
index 5413745..0000000
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2011 Samsung Electronics Co.Ltd
- * Author: Joonyoung Shim <[email protected]>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#ifndef __USB_EHCI_EXYNOS_H
-#define __USB_EHCI_EXYNOS_H __FILE__
-
-struct exynos_ehci_platdata {
-	int (*phy_init)(struct platform_device *pdev, int type);
-	int (*phy_exit)(struct platform_device *pdev, int type);
-};
-
-extern void exynos_ehci_set_platdata(struct exynos_ehci_platdata *pd);
-
-#endif /* __USB_EHCI_EXYNOS_H */
Signature · 1 line
1.7.10.4

A message that is not in the archive (sent off-list or not yet received): 000901cec582$6ba1f6c0$42e5e440$%[email protected]

#5 lore raw

Re: [PATCH 3/5] USB: ehci-exynos: Remove non-DT support

Hi Jingoo,

Quoted 6 lines · Jingoo Han

The non-DT for EXYNOS SoCs is not supported from v3.11. Thus, there is no need to support non-DT for Exynos EHCI driver.

The 'include/linux/platform_data/usb-ehci-exynos.h' file has been used for non-DT support. Thus, the 'usb-ehci-exynos.h' file can be removed.

Wouldn't it be better to do the non-DT cleanup first and then the renaming. This would avoid unnecessary code churn. For e.g., since the header file is deleted in this patch, it doesn't make sense to rename the file and other variable/function
names in the previous patch.

Signature · 6 lines
With warm regards,
Sachin
--
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
author
#6 lore raw

Re: [PATCH 3/5] USB: ehci-exynos: Remove non-DT support

Quoted 8 lines · Sachin Kamat
Quoted 6 lines · Jingoo Han

The non-DT for EXYNOS SoCs is not supported from v3.11. Thus, there is no need to support non-DT for Exynos EHCI driver.

The 'include/linux/platform_data/usb-ehci-exynos.h' file has been used for non-DT support. Thus, the 'usb-ehci-exynos.h' file can be removed.

Quoted 5 lines

Wouldn't it be better to do the non-DT cleanup first and then the renaming. This would avoid unnecessary code churn. For e.g., since the header file is deleted in this patch, it doesn't make sense to rename the file and other variable/function
names in the previous patch.

Hi Sachin Kamat,

OK, I see.
I will do the non-DT cleanup first and then the renaming, as you mentioned.
Then, the v2 patches will be as below:

[PATCH 1/5] ARM: SAMSUNG: Remove unused s5p_device_ehci [PATCH 2/5] USB: ehci-s5p: Remove non-DT support [PATCH 3/5] USB: ohci-exynos: Remove non-DT support [PATCH 4/5] USB: host: Rename ehci-s5p to ehci-exynos [PATCH 5/5] USB: ohci-exynos: Add missing usb_put_hcd()

Best regards,
Jingoo Han

A message that is not in the archive (sent off-list or not yet received): 000001cec582$02a6cfb0$07f46f10$%[email protected]

#8 lore raw

PATCH 4/5 USB: ohci-exynos: Remove non-DT support

The non-DT for EXYNOS SoCs is not supported from v3.11. Thus, there is no need to support non-DT for Exynos OHCI driver.

The 'include/linux/platform_data/usb-ohci-exynos.h' file has been used for non-DT support. Thus, the 'usb-ohci-exynos.h' file can be removed.

---
 drivers/usb/host/ohci-exynos.c                |   16 ++--------------
 include/linux/platform_data/usb-ohci-exynos.h |   21 ---------------------
 2 files changed, 2 insertions(+), 35 deletions(-)
 delete mode 100644 include/linux/platform_data/usb-ohci-exynos.h
drivers/usb/host/ohci-exynos.c +2 -14
index f5f372e..5c877bf 100644
@@ -18,7 +18,6 @@
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
-#include <linux/platform_data/usb-ohci-exynos.h>
 #include <linux/usb/phy.h>
 #include <linux/usb/samsung_usb_phy.h>
 #include <linux/usb.h>
@@ -38,7 +37,6 @@ struct exynos_ohci_hcd {
 	struct clk *clk;
 	struct usb_phy *phy;
 	struct usb_otg *otg;
-	struct exynos4_ohci_platdata *pdata;
 };
 
 static void exynos_ohci_phy_enable(struct platform_device *pdev)
@@ -48,8 +46,6 @@ static void exynos_ohci_phy_enable(struct platform_device *pdev)
 
 	if (exynos_ohci->phy)
 		usb_phy_init(exynos_ohci->phy);
-	else if (exynos_ohci->pdata && exynos_ohci->pdata->phy_init)
-		exynos_ohci->pdata->phy_init(pdev, USB_PHY_TYPE_HOST);
 }
 
 static void exynos_ohci_phy_disable(struct platform_device *pdev)
@@ -59,13 +55,10 @@ static void exynos_ohci_phy_disable(struct platform_device *pdev)
 
 	if (exynos_ohci->phy)
 		usb_phy_shutdown(exynos_ohci->phy);
-	else if (exynos_ohci->pdata && exynos_ohci->pdata->phy_exit)
-		exynos_ohci->pdata->phy_exit(pdev, USB_PHY_TYPE_HOST);
 }
 
 static int exynos_ohci_probe(struct platform_device *pdev)
 {
-	struct exynos4_ohci_platdata *pdata = dev_get_platdata(&pdev->dev);
 	struct exynos_ohci_hcd *exynos_ohci;
 	struct usb_hcd *hcd;
 	struct resource *res;
@@ -98,13 +91,8 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 
 	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 	if (IS_ERR(phy)) {
-		/* Fallback to pdata */
-		if (!pdata) {
-			dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
-			return -EPROBE_DEFER;
-		} else {
-			exynos_ohci->pdata = pdata;
-		}
+		dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
+		return -EPROBE_DEFER;
 	} else {
 		exynos_ohci->phy = phy;
 		exynos_ohci->otg = phy->otg;
include/linux/platform_data/usb-ohci-exynos.h deleted +0 -19
deleted file mode 100644
index c256c59..0000000
@@ -1,21 +0,0 @@
-/*
- * Copyright (C) 2011 Samsung Electronics Co.Ltd
- *		http://www.samsung.com/
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-#ifndef __MACH_EXYNOS_OHCI_H
-#define __MACH_EXYNOS_OHCI_H
-
-struct exynos4_ohci_platdata {
-	int (*phy_init)(struct platform_device *pdev, int type);
-	int (*phy_exit)(struct platform_device *pdev, int type);
-};
-
-extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
author
#9 lore raw

PATCH 5/5 USB: ohci-exynos: Add missing usb_put_hcd() to prevent memory leak

In reply to Jingoo Han

When devm_usb_get_phy() fails, usb_put_hcd() should be called to prevent memory leak.

---
 drivers/usb/host/ohci-exynos.c |    1 +
 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-exynos.c +1 -0
index 5c877bf..aa50e18 100644
@@ -91,6 +91,7 @@ static int exynos_ohci_probe(struct platform_device *pdev)
 
 	phy = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
 	if (IS_ERR(phy)) {
+		usb_put_hcd(hcd);
 		dev_warn(&pdev->dev, "no platform data or transceiver defined\n");
 		return -EPROBE_DEFER;
 	} else {
Signature · 1 line
1.7.10.4