Thread (2 messages) 2 messages, 2 authors, 2014-09-30

Re: [PATCH v3 2/2] usb: renesas_usbhs: Add device tree support for R-Car H2 and M2

From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Date: 2014-09-30 09:51:37
Also in: linux-sh

Possibly related (same subject, not in this thread)

Hello.

(2014/09/30 1:35), Sergei Shtylyov wrote:
Hello.

On 09/03/2014 09:25 AM, Yoshihiro Shimoda wrote:
quoted
This driver supports other SoCs, but they need boards/Soc depend code.
So, this patch adds device tree support for R-Car H2 and M2 initially.
quoted
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
  drivers/usb/renesas_usbhs/common.c |   44 ++++++++++++++++++++++++++++++++++++
  1 file changed, 44 insertions(+)
quoted
diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index 1b9bf8d..b3b6813 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -18,6 +18,8 @@
  #include <linux/gpio.h>
  #include <linux/io.h>
  #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
  #include <linux/pm_runtime.h>
  #include <linux/slab.h>
  #include <linux/sysfs.h>
@@ -438,6 +440,43 @@ static int usbhsc_drvcllbck_notify_hotplug(struct platform_device *pdev)
[...]
quoted
+static struct renesas_usbhs_platform_info *usbhs_parse_dt(struct device *dev)
+{
+	struct renesas_usbhs_platform_info *info;
+	struct renesas_usbhs_driver_param *dparam;
+	const struct of_device_id *of_id = of_match_device(usbhs_of_match, dev);
+	u32 tmp;
+	int gpio;
+
+	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
+	if (!info)
+		return NULL;
+
+	dparam = &info->driver_param;
+	dparam->type = of_id ? (u32)of_id->data : 0;
+	if (!of_property_read_u32(dev->of_node, "renesas,buswait", &tmp))
+		dparam->buswait_bwait = tmp;
+	gpio = of_get_named_gpio_flags(dev->of_node, "renesas,enable-gpio", 0,
+				       NULL);
+	if (gpio > 0)
+		dparam->enable_gpio = gpio;
+
+	return info;
    I don't see where you parse the optional "phy" property. It should exist 
for the Lager and Koelsch boards you target.
Since I wrote 'phy-names: must be "usb"' in the document,
I intend to use a fixed property for "phy" driver like the following:

	phy = phy_get(&pdev->dev, "usb");

Is this a bad code?

About using the phy driver in renesas_usbhs driver, I intend to modify
the drivers/usb/renesas_usbhs/rcar.c.

Best regards,
Yoshihiro Shimoda
WBR, Sergei
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help