blob: dba55ccb9b531b717597f5e8f7fc2016144c5b99 [file] [log] [blame]
Greg Kroah-Hartman5fd54ac2017-11-03 11:28:30 +01001// SPDX-License-Identifier: GPL-2.0
Michael Grzeschik1c9af652013-06-13 17:59:55 +03002/*
3 * OF helpers for usb devices.
4 *
5 * This file is released under the GPLv2
6 */
7
8#ifndef __LINUX_USB_OF_H
9#define __LINUX_USB_OF_H
10
Felipe Balbi1494a1f2013-06-30 13:56:45 +030011#include <linux/usb/ch9.h>
Michael Grzeschik1c9af652013-06-13 17:59:55 +030012#include <linux/usb/otg.h>
13#include <linux/usb/phy.h>
14
Johan Hovold1a7e3942017-11-09 18:07:21 +010015struct usb_device;
16
Peter Chen848d5b92013-06-24 09:25:59 +080017#if IS_ENABLED(CONFIG_OF)
Hans de Goedece15ed42016-06-10 11:46:25 +020018enum usb_dr_mode of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0);
Peter Chen05f8b352014-08-19 09:51:55 +080019bool of_usb_host_tpl_support(struct device_node *np);
Li Jun929412d2015-07-09 15:18:44 +080020int of_usb_update_otg_caps(struct device_node *np,
21 struct usb_otg_caps *otg_caps);
Johan Hovold77393762017-11-09 18:07:23 +010022struct device_node *usb_of_get_device_node(struct usb_device *hub, int port1);
Johan Hovold1a7e3942017-11-09 18:07:21 +010023bool usb_of_has_combined_node(struct usb_device *udev);
24struct device_node *usb_of_get_interface_node(struct usb_device *udev,
25 u8 config, u8 ifnum);
Yoshihiro Shimoda5095cb82017-02-21 19:59:47 +090026struct device *usb_of_get_companion_dev(struct device *dev);
Michael Grzeschik1c9af652013-06-13 17:59:55 +030027#else
Felipe Balbibe99c842015-12-17 09:55:41 -060028static inline enum usb_dr_mode
Hans de Goedece15ed42016-06-10 11:46:25 +020029of_usb_get_dr_mode_by_phy(struct device_node *np, int arg0)
Bin Liu98bfb392015-11-03 11:51:15 -060030{
31 return USB_DR_MODE_UNKNOWN;
32}
Peter Chen05f8b352014-08-19 09:51:55 +080033static inline bool of_usb_host_tpl_support(struct device_node *np)
34{
35 return false;
36}
Li Jun929412d2015-07-09 15:18:44 +080037static inline int of_usb_update_otg_caps(struct device_node *np,
38 struct usb_otg_caps *otg_caps)
39{
40 return 0;
41}
Johan Hovold77393762017-11-09 18:07:23 +010042static inline struct device_node *
43usb_of_get_device_node(struct usb_device *hub, int port1)
Peter Chen69bec722016-02-19 17:26:15 +080044{
45 return NULL;
46}
Johan Hovold1a7e3942017-11-09 18:07:21 +010047static inline bool usb_of_has_combined_node(struct usb_device *udev)
48{
49 return false;
50}
51static inline struct device_node *
52usb_of_get_interface_node(struct usb_device *udev, u8 config, u8 ifnum)
53{
54 return NULL;
55}
Yoshihiro Shimoda5095cb82017-02-21 19:59:47 +090056static inline struct device *usb_of_get_companion_dev(struct device *dev)
57{
58 return NULL;
59}
Peter Chen848d5b92013-06-24 09:25:59 +080060#endif
61
Felipe Balbi9cf7b242013-07-30 09:09:15 +030062#if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT)
Peter Chen848d5b92013-06-24 09:25:59 +080063enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np);
64#else
Michael Grzeschik1c9af652013-06-13 17:59:55 +030065static inline enum usb_phy_interface of_usb_get_phy_mode(struct device_node *np)
66{
67 return USBPHY_INTERFACE_MODE_UNKNOWN;
68}
69
Michael Grzeschik1c9af652013-06-13 17:59:55 +030070#endif
71
72#endif /* __LINUX_USB_OF_H */