From: Chris Ruehl <chris.ruehl@gtsys.com.hk>
To: Mark Rutland <mark.rutland@arm.com>
Cc: "balbi@ti.com" <balbi@ti.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/3] usb: phy-generic: Add ULPI VBUS support
Date: Tue, 03 Dec 2013 13:24:52 +0800 [thread overview]
Message-ID: <529D6B24.7020502@gtsys.com.hk> (raw)
In-Reply-To: <20131202182204.GQ12952@e106331-lin.cambridge.arm.com>
On Tuesday, December 03, 2013 02:22 AM, Mark Rutland wrote:
> On Mon, Dec 02, 2013 at 07:05:19AM +0000, Chris Ruehl wrote:
>> usb: phy-generic: Add ULPI VBUS support
>>
>> Some platforms need to set the VBUS parameters of the ULPI
>> like ISP1504 which interact with overcurrent protection and
>> power switch MIC2575. Therefore it requires to set
>> * DRVVBUS
>> * DRVVBUS_EXT
>> * EXTVBUSIND
>> * CHRGVBUS
>> of the ULPI.
>> This patch add support for it.
>
> Could you elaborate on when we need to do this and why?
>
>>
>> Devicetree configuration example:
>>
>> usbphy0: usbphy@0x10024170 {
>> compatible = "usb-nop-xceiv";
>> reg =<0x10024170 0x4>; /* ULPI Viewport OTG */
>> clocks =<&clks 75>;
>> clock-names = "main_clk";
>> };
>>
>> &usbphy0 {
>> reset-gpios =<&gpio1 31 1>;
>> pinctrl-names = "default";
>> pinctrl-0 =<&pinctrl_usbphy0&pinctrl_usbotg1>;
>> ulpi_set_vbus =<0x0f>;
>> };
>>
>> Please refer to the phy-bindings.txt for the value of ulpi_set_vbus commit
>> with this patch.
>>
>> Signed-off-by: Chris Ruehl<chris.ruehl@gtsys.com.hk>
>> ---
>> .../devicetree/bindings/phy/phy-bindings.txt | 15 ++++++
>> drivers/usb/phy/phy-generic.c | 50 +++++++++++++++++++-
>> drivers/usb/phy/phy-generic.h | 3 ++
>> 3 files changed, 67 insertions(+), 1 deletion(-)
>>
>> diff --git a/Documentation/devicetree/bindings/phy/phy-bindings.txt b/Documentation/devicetree/bindings/phy/phy-bindings.txt
>> index 8ae844f..b109b2f 100644
>> --- a/Documentation/devicetree/bindings/phy/phy-bindings.txt
>> +++ b/Documentation/devicetree/bindings/phy/phy-bindings.txt
>> @@ -34,6 +34,18 @@ phys : the phandle for the PHY device (used by the PHY subsystem)
>> phy-names : the names of the PHY corresponding to the PHYs present in the
>> *phys* phandle
>>
>> +Optional Properties:
>> +reset-gpios : GPIO used to reset ULPI like ISP1504 with
>> + 0 = reset active high ; 1 = reset active low.
>
> The format of the gpio-specifier doesn't matter here.
>
> Why do you need to mention the ISP1504? Either this is generic, or it
> doesn't belong here.
>
> Perhaps we need a ulpi-phy binding document. This and the rest of the
> patch is strongly tied to ULPI.
>
>> +cs-gpios : GPIO used to activate a ULPI like ISP1504 with
>> + 0 = reset acitive high; 1 = reset active low.
>
> Again, the format of the gpio-specifier is not a concern here. I'm also
> a little confused as to the name "cs-gpios" for something that activates
> the ULPI.
>
>> +ulpi_set_vbus : ULPI configuation parameter to program the VBUS signaling of
>> + ISP1504 or similar chipsets.
>
> Could you elaborate on this? Is this applicable to any ULPI PHY? The
> description implies that it's somewhat tied to ISP1504 (if it's not,
> drop the mention of ISP1504).
>
> Why exactly do we need this, and why should it live in the DT?
>
> Why can se not figure this out automatically, or have defaults that work
> in more places?
>
> Also, s/_/-/ on property names please.
>
>> + Set the parameter:
>> + DRVVBUS = (1) DRVVBUS_EXT = (1<<1) EXTVBUSIND = (1<<2) CHRGVBUS = (1<<3)
>> + eg: DRVVBUS | DRVVBUS_EXT = 0x03
>> + ulpi_set_vbus =<0x03>
>
> I don't like putting arbitrary bitfields like this in DT. They're
> illegible and easy to abuse.
>
> Boolean properties are nicer for flags.
>
> What exactly do these flags mean?
>
> [...]
>
>> @@ -253,14 +284,15 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev)
>>
>> if (dev->of_node) {
>> struct device_node *node = dev->of_node;
>> + struct resource *res;
>> enum of_gpio_flags flags;
>> enum of_gpio_flags csflags;
>> + u32 ulpi_vbus;
>>
>> if (of_property_read_u32(node, "clock-frequency",&clk_rate))
>> clk_rate = 0;
>>
>> needs_vcc = of_property_read_bool(node, "vcc-supply");
>> -
>> nop->gpio_reset = of_get_named_gpio_flags(node, "reset-gpios",
>> 0,&flags);
>
> Why the random line deletion?
>
>>
>> @@ -274,6 +306,22 @@ static int usb_phy_gen_xceiv_probe(struct platform_device *pdev)
>> if (gpio_is_valid(nop->gpio_chipselect))
>> nop->cs_active_low = csflags& OF_GPIO_ACTIVE_LOW;
>>
>> + err = of_property_read_u32(node, "ulpi_set_vbus",&ulpi_vbus);
>> + if (err) {
>> + nop->ulpi_vbus = -1;
>> + nop->viewport = NULL;
>> + ulpi_vbus = 0;
>> + } else {
>> + dev_dbg(dev,"ULPI ulpi_set_vbus 0x%02x",ulpi_vbus);
>> + nop->ulpi_vbus = ulpi_vbus;
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>
> This wasn't described in the binding document, and it's ULPI specific. I
> think we need a separate ulpi-phy binding that builds upon the generic
> one.
>
Mark, before commit an other patch, is it this what you looking for?
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/phy-ulpi.txt
@@ -0,0 +1,36 @@
+This document explains only the device tree data binding for phy-ulpi nodes.
For general
+information about PHY subsystem refer to Documentation/phy.txt
+
+PHY device node
+===============
+
+Required Properties:
+reg: ULPI Viewport
+reset-gpios : GPIO used to reset ULPI chipset
+
+Optional Properties:
+cs-gpios : GPIO used to activate a ULPI chipset
+ulpi-set-vbus : ULPI configuation parameter to program the VBUS logic
+ Set the parameter:
+ DRVVBUS = (1<<0) Enable VBUS logic
+ DRVVBUS_EXT = (1<<1) Enable External VBUS logic
+ EXTVBUSIND = (1<<2) Enable Ext. VBUS indication and
fault handler
+ CHRGVBUS = (1<<3) Enable VBUS charge pump logic
+ eg: DRVVBUS | DRVVBUS_EXT = 0x03
+ ulpi_set_vbus = <0x03>
+
+For example:
+
+phys: phy@p {
+ compatible = "xxx";
+ reg = <p>;
+ .
+ .
+ #phy-cells = <1>;
+ .
+ .
+ reset-gpios = <&gpioX nn n>
+ cs-gpios = <&gpioX nn n>
+ ulpi-set-vbus = <0xXX>;
+};
+
Thanks
Chris
> Thanks,
> Mark.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
GTSYS Limited RFID Technology
A01 24/F Gold King Industrial Bld
35-41 Tai Lin Pai Road, Kwai Chung, Hong Kong
Fax (852) 8167 4060 - Tel (852) 3598 9488
Disclaimer: http://www.gtsys.com.hk/email/classified.html
next prev parent reply other threads:[~2013-12-03 5:24 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-02 7:05 [PATCH] usb: phy-generic, phy-ulpi patch set Chris Ruehl
[not found] ` <1385967919-13258-1-git-send-email-chris.ruehl-CR359r9tUDPXPF5Rlphj1Q@public.gmane.org>
2013-12-02 7:05 ` [PATCH 1/3] usb: phy-generic: Add GPIO based ChipSelect Chris Ruehl
[not found] ` <1385967919-13258-2-git-send-email-chris.ruehl-CR359r9tUDPXPF5Rlphj1Q@public.gmane.org>
2013-12-06 20:24 ` Felipe Balbi
[not found] ` <20131206202453.GF21086-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2013-12-09 1:45 ` Chris Ruehl
2013-12-09 4:07 ` Felipe Balbi
[not found] ` <20131209040705.GB20608-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2013-12-09 4:11 ` Chris Ruehl
2013-12-02 7:05 ` [PATCH 2/3] usb: phy-ulpi: Add EXTVBUSIND,CHRGVBUS flag support Chris Ruehl
2013-12-02 18:59 ` Sergei Shtylyov
2013-12-02 7:05 ` [PATCH 3/3] usb: phy-generic: Add ULPI VBUS support Chris Ruehl
[not found] ` <1385967919-13258-4-git-send-email-chris.ruehl-CR359r9tUDPXPF5Rlphj1Q@public.gmane.org>
2013-12-02 18:22 ` Mark Rutland
[not found] ` <20131202182204.GQ12952-NuALmloUBlrZROr8t4l/smS4ubULX0JqMm0uRHvK7Nw@public.gmane.org>
2013-12-03 2:46 ` Chris Ruehl
2013-12-03 5:24 ` Chris Ruehl [this message]
2013-12-03 8:15 ` Heikki Krogerus
2013-12-04 7:16 ` Chris Ruehl
[not found] ` <529ED6C5.3000608-CR359r9tUDPXPF5Rlphj1Q@public.gmane.org>
2013-12-04 9:49 ` Heikki Krogerus
2013-12-05 4:15 ` Chris Ruehl
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=529D6B24.7020502@gtsys.com.hk \
--to=chris.ruehl@gtsys.com.hk \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mark.rutland@arm.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;
as well as URLs for NNTP newsgroup(s).