Skip to contentSkip to conversation

ARM: shmobile: lager: USBHS callback elimination

PATCH New Ulrich Hecht 5 participants 10 messages Jul 10, 2014 – Jul 12, 2014

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

v2 cover ARM: shmobile: lager: USBHS callback elimination

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h
Signature · 1 line
1.8.4.5
#1 lore raw

PATCH v2 1/2 usb: renesas_usbhs: add R-Car Gen. 2 init and power control

In preparation for DT conversion to reduce reliance on platform device callbacks.

---
 drivers/usb/renesas_usbhs/Makefile |  2 +-
 drivers/usb/renesas_usbhs/common.c | 66 ++++++++++++++++++++++++++++++---
 drivers/usb/renesas_usbhs/common.h |  2 +
 drivers/usb/renesas_usbhs/rcar2.c  | 76 ++++++++++++++++++++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h  |  4 ++
 include/linux/usb/renesas_usbhs.h  |  6 +++
 6 files changed, 150 insertions(+), 6 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h
drivers/usb/renesas_usbhs/Makefile +1 -1
index bc8aef4..9e47f47 100644
@@ -4,7 +4,7 @@
 
 obj-$(CONFIG_USB_RENESAS_USBHS)	+= renesas_usbhs.o
 
-renesas_usbhs-y			:= common.o mod.o pipe.o fifo.o
+renesas_usbhs-y			:= common.o mod.o pipe.o fifo.o rcar2.o
 
 ifneq ($(CONFIG_USB_RENESAS_USBHS_HCD),)
 	renesas_usbhs-y		+= mod_host.o
drivers/usb/renesas_usbhs/common.c +61 -5

112 lines not on this page · raw message

drivers/usb/renesas_usbhs/common.h +2 -0
index c69dd2f..a7996da 100644
@@ -268,6 +268,8 @@ struct usbhs_priv {
 	 * fifo control
 	 */
 	struct usbhs_fifo_info fifo_info;
+
+	struct usb_phy *phy;
 };
 
 /*
drivers/usb/renesas_usbhs/rcar2.c new file +76 -0

76 lines not on this page · raw message

drivers/usb/renesas_usbhs/rcar2.h new file +4 -0
new file mode 100644
index 0000000..f07f10d
@@ -0,0 +1,4 @@
+#include "common.h"
+
+extern const struct renesas_usbhs_platform_callback
+	usbhs_rcar2_ops;
include/linux/usb/renesas_usbhs.h +6 -0
index e452ba6..d5952bb 100644
@@ -153,6 +153,9 @@ struct renesas_usbhs_driver_param {
 	 */
 	int pio_dma_border; /* default is 64byte */
 
+	u32 type;
+	u32 enable_gpio;
+
 	/*
 	 * option:
 	 */
@@ -160,6 +163,9 @@ struct renesas_usbhs_driver_param {
 	u32 has_sudmac:1; /* for SUDMAC */
 };
 
+#define USBHS_TYPE_R8A7790 1
+#define USBHS_TYPE_R8A7791 2
+
 /*
  * option:
  *
Signature · 1 line
1.8.4.5
#2 lore raw

PATCH v2 2/2 ARM: shmobile: lager: remove USBHS callbacks

In reply to Ulrich Hecht

Let the driver handle initialization and power control.

---
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 1 file changed, 13 insertions(+), 113 deletions(-)
arch/arm/mach-shmobile/board-lager.c +13 -113
index b8b2b44..c2a14c7 100644
@@ -420,117 +420,17 @@ static const struct resource usbhs_resources[] __initconst = {
 	DEFINE_RES_IRQ(gic_spi(107)),
 };
 
-struct usbhs_private {
-	struct renesas_usbhs_platform_info info;
-	struct usb_phy *phy;
-};
-
-#define usbhs_get_priv(pdev) \
-	container_of(renesas_usbhs_get_info(pdev), struct usbhs_private, info)
-
-static int usbhs_power_ctrl(struct platform_device *pdev,
-				void __iomem *base, int enable)
-{
-	struct usbhs_private *priv = usbhs_get_priv(pdev);
-
-	if (!priv->phy)
-		return -ENODEV;
-
-	if (enable) {
-		int retval = usb_phy_init(priv->phy);
-
-		if (!retval)
-			retval = usb_phy_set_suspend(priv->phy, 0);
-		return retval;
-	}
-
-	usb_phy_set_suspend(priv->phy, 1);
-	usb_phy_shutdown(priv->phy);
-	return 0;
-}
-
-static int usbhs_hardware_init(struct platform_device *pdev)
-{
-	struct usbhs_private *priv = usbhs_get_priv(pdev);
-	struct usb_phy *phy;
-	int ret;
-
-	/* USB0 Function - use PWEN as GPIO input to detect DIP Switch SW5
-	 * setting to avoid VBUS short circuit due to wrong cable.
-	 * PWEN should be pulled up high if USB Function is selected by SW5
-	 */
-	gpio_request_one(RCAR_GP_PIN(5, 18), GPIOF_IN, NULL); /* USB0_PWEN */
-	if (!gpio_get_value(RCAR_GP_PIN(5, 18))) {
-		pr_warn("Error: USB Function not selected - check SW5 + SW6\n");
-		ret = -ENOTSUPP;
-		goto error;
-	}
-
-	phy = usb_get_phy_dev(&pdev->dev, 0);
-	if (IS_ERR(phy)) {
-		ret = PTR_ERR(phy);
-		goto error;
-	}
-
-	priv->phy = phy;
-	return 0;
- error:
-	gpio_free(RCAR_GP_PIN(5, 18));
-	return ret;
-}
-
-static int usbhs_hardware_exit(struct platform_device *pdev)
-{
-	struct usbhs_private *priv = usbhs_get_priv(pdev);
-
-	if (!priv->phy)
-		return 0;
-
-	usb_put_phy(priv->phy);
-	priv->phy = NULL;
-
-	gpio_free(RCAR_GP_PIN(5, 18));
-	return 0;
-}
-
-static int usbhs_get_id(struct platform_device *pdev)
-{
-	return USBHS_GADGET;
-}
-
-static u32 lager_usbhs_pipe_type[] = {
-	USB_ENDPOINT_XFER_CONTROL,
-	USB_ENDPOINT_XFER_ISOC,
-	USB_ENDPOINT_XFER_ISOC,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_INT,
-	USB_ENDPOINT_XFER_INT,
-	USB_ENDPOINT_XFER_INT,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-	USB_ENDPOINT_XFER_BULK,
-};
-
-static struct usbhs_private usbhs_priv __initdata = {
-	.info = {
-		.platform_callback = {
-			.power_ctrl	= usbhs_power_ctrl,
-			.hardware_init	= usbhs_hardware_init,
-			.hardware_exit	= usbhs_hardware_exit,
-			.get_id		= usbhs_get_id,
-		},
-		.driver_param = {
-			.buswait_bwait	= 4,
-			.pipe_type = lager_usbhs_pipe_type,
-			.pipe_size = ARRAY_SIZE(lager_usbhs_pipe_type),
-		},
-	}
+static struct renesas_usbhs_platform_info usbhs_info __initdata = {
+	.driver_param = {
+		.buswait_bwait	= 4,
+		.type = USBHS_TYPE_R8A7790,
+		/* USB0 Function - use PWEN as GPIO input to detect DIP
+		 * Switch SW5 setting to avoid VBUS short circuit due to
+		 * wrong cable.  PWEN should be pulled up high if USB
+		 * Function is selected by SW5.
+		 */
+		.enable_gpio = RCAR_GP_PIN(5, 18),
+	},
 };
 
 static void __init lager_register_usbhs(void)
@@ -540,8 +440,8 @@ static void __init lager_register_usbhs(void)
 					  "renesas_usbhs", -1,
 					  usbhs_resources,
 					  ARRAY_SIZE(usbhs_resources),
-					  &usbhs_priv.info,
-					  sizeof(usbhs_priv.info));
+					  &usbhs_info,
+					  sizeof(usbhs_info));
 }
 
 /* USBHS PHY */
Signature · 1 line
1.8.4.5
#3 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

In reply to Ulrich Hecht

Hi

Quoted 9 lines

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 10 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

#4 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

In reply to Ulrich Hecht

Hi Ulrich,

Quoted 9 lines · Ulrich Hecht

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 11 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

I tested these patches on Lager legacy, and these patches worked correctly.

Best regards,
Yoshihiro Shimoda

#5 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

[Cc Felipe Balbi]

Quoted 26 lines · Kuninori Morimoto

Hi

Quoted 9 lines

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 10 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

[snip]

Quoted 3 lines

I tested these patches on Lager legacy, and these patches worked correctly.

Hi,

it seems that the 2nd patch should go through my renesas tree but it depends on the first patch which should be taken by Felipe Balbi (Cced).

Felipe, is there any chance that you could take this for v3.16? I am quite happy to make a branch for you to pull for renesas_usbhs if this would make your life easier.

#6 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

Quoted 38 lines · Simon Horman

[Cc Felipe Balbi]

Quoted 26 lines · Kuninori Morimoto

Hi

Quoted 9 lines

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 10 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

[snip]

Quoted 3 lines

I tested these patches on Lager legacy, and these patches worked correctly.

Hi,

Quoted 7 lines

it seems that the 2nd patch should go through my renesas tree but it depends on the first patch which should be taken by Felipe Balbi (Cced).

Felipe, is there any chance that you could take this for v3.16? I am quite happy to make a branch for you to pull for renesas_usbhs if this would make your life easier.

you need to take both patches or just patch 1 ?

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140711/77a83077/attachment.sig>
#7 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Simon Horman

[Cc Felipe Balbi]

Quoted 26 lines · Kuninori Morimoto

Hi

Quoted 9 lines

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 10 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

[snip]

Quoted 3 lines

I tested these patches on Lager legacy, and these patches worked correctly.

Hi,

it seems that the 2nd patch should go through my renesas tree but it depends on the first patch which should be taken by Felipe Balbi (Cced).

Quoted 5 lines
Quoted 3 lines

Felipe, is there any chance that you could take this for v3.16? I am quite happy to make a branch for you to pull for renesas_usbhs if this would make your life easier.

you need to take both patches or just patch 1 ?

Please just take patch 1.
Thanks

#8 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

Quoted 44 lines · Simon Horman
Quoted 43 lines · Felipe Balbi
Quoted 42 lines · Simon Horman

[Cc Felipe Balbi]

Quoted 26 lines · Kuninori Morimoto

Hi

Quoted 9 lines

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 10 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

[snip]

Quoted 3 lines

I tested these patches on Lager legacy, and these patches worked correctly.

Hi,

it seems that the 2nd patch should go through my renesas tree but it depends on the first patch which should be taken by Felipe Balbi (Cced).

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Felipe, is there any chance that you could take this for v3.16? I am quite happy to make a branch for you to pull for renesas_usbhs if this would make your life easier.

you need to take both patches or just patch 1 ?

Please just take patch 1.

will do.

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140711/d012ef40/attachment.sig>
#9 lore raw

v2 cover ARM: shmobile: lager: USBHS callback elimination

Quoted 49 lines · Felipe Balbi
Quoted 48 lines · Simon Horman
Quoted 47 lines · Felipe Balbi
Quoted 45 lines · Simon Horman

[Cc Felipe Balbi]

Quoted 26 lines · Kuninori Morimoto

Hi

Quoted 9 lines

Changes in v2:
- move phy handle to struct usbhs_priv
- add new default pipe type to driver
- remove pipe type from Lager board code

Ulrich Hecht (2):
usb: renesas_usbhs: add R-Car Gen. 2 init and power control
ARM: shmobile: lager: remove USBHS callbacks

Quoted 10 lines
 arch/arm/mach-shmobile/board-lager.c | 126 ++++-------------------------------
 drivers/usb/renesas_usbhs/Makefile   |   2 +-
 drivers/usb/renesas_usbhs/common.c   |  66 ++++++++++++++++--
 drivers/usb/renesas_usbhs/common.h   |   2 +
 drivers/usb/renesas_usbhs/rcar2.c    |  76 +++++++++++++++++++++
 drivers/usb/renesas_usbhs/rcar2.h    |   4 ++
 include/linux/usb/renesas_usbhs.h    |   6 ++
 7 files changed, 163 insertions(+), 119 deletions(-)
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.c
 create mode 100644 drivers/usb/renesas_usbhs/rcar2.h

For all patches

[snip]

Quoted 3 lines

I tested these patches on Lager legacy, and these patches worked correctly.

Hi,

it seems that the 2nd patch should go through my renesas tree but it depends on the first patch which should be taken by Felipe Balbi (Cced).

Felipe, is there any chance that you could take this for v3.16? I am quite happy to make a branch for you to pull for renesas_usbhs if this would make your life easier.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

you need to take both patches or just patch 1 ?

Please just take patch 1.

will do.

Thanks.

Ulrich, please repost patch #2 once patch #1 hits an rc release.