4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
10 #include <linux/kernel.h>
11 #include <linux/module.h>
13 #include <linux/usb/of.h>
14 #include <linux/usb/otg.h>
16 static const char *const usbphy_modes
[] = {
17 [USBPHY_INTERFACE_MODE_UNKNOWN
] = "",
18 [USBPHY_INTERFACE_MODE_UTMI
] = "utmi",
19 [USBPHY_INTERFACE_MODE_UTMIW
] = "utmi_wide",
20 [USBPHY_INTERFACE_MODE_ULPI
] = "ulpi",
21 [USBPHY_INTERFACE_MODE_SERIAL
] = "serial",
22 [USBPHY_INTERFACE_MODE_HSIC
] = "hsic",
26 * of_usb_get_phy_mode - Get phy mode for given device_node
27 * @np: Pointer to the given device_node
29 * The function gets phy interface string from property 'phy_type',
30 * and returns the correspondig enum usb_phy_interface
32 enum usb_phy_interface
of_usb_get_phy_mode(struct device_node
*np
)
37 err
= of_property_read_string(np
, "phy_type", &phy_type
);
39 return USBPHY_INTERFACE_MODE_UNKNOWN
;
41 for (i
= 0; i
< ARRAY_SIZE(usbphy_modes
); i
++)
42 if (!strcmp(phy_type
, usbphy_modes
[i
]))
45 return USBPHY_INTERFACE_MODE_UNKNOWN
;
47 EXPORT_SYMBOL_GPL(of_usb_get_phy_mode
);