Thread (1 message) 1 message, 1 author, 2013-01-29

[PATCH,RFC] usb: add devicetree helpers for determining dr_mode and phy_type

From: Stephen Warren <hidden>
Date: 2013-01-29 17:10:37
Also in: linux-devicetree

On 01/29/2013 06:44 AM, kishon wrote:
Hi,

On Tuesday 29 January 2013 04:52 PM, Sascha Hauer wrote:
quoted
From: Michael Grzeschik <redacted>

This adds two little devicetree helper functions for determining the
dr_mode (host, peripheral, otg) and phy_type (utmi, ulpi,...) from
the devicetree.
quoted
+/**
+ * of_get_usbphy_mode - Get phy mode for given device_node
+ * @np:    Pointer to the given device_node
+ *
+ * The function gets phy interface string from property 'phy_type',
+ * and returns the correspondig enum usb_phy_interface
+ */
+enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
+{
+    const char *phy_type;
+    int err, i;
+
+    err = of_property_read_string(np, "phy_type", &phy_type);
+    if (err < 0)
+        return USBPHY_INTERFACE_MODE_NA;
Why don't we use a u32 property type for the *phy-type*? IMHO we should
use string property only when the property should be absolutely
unambiguous (e.g., compatible property should be string).
Well, this DT property is already defined an in-use, so while a
different decision might (or might not) be made today about the property
name/content, it's already defined and widely in use, so can't really be
changed.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help