From 05f8b35a62efb8e70ebcd78e9c957324e9caddad Mon Sep 17 00:00:00 2001 From: Peter Chen Date: Tue, 19 Aug 2014 09:51:55 +0800 Subject: [PATCH] usb: common: add API to get if the platform supports TPL The TPL (Targeted Peripheral List) is used for targeted hosts (non-PC hosts), and it can be used at USB OTG & EH certification and some specific products which need white list. Signed-off-by: Peter Chen Signed-off-by: Greg Kroah-Hartman --- drivers/usb/common/usb-common.c | 15 +++++++++++++++ include/linux/usb/of.h | 5 +++++ 2 files changed, 20 insertions(+) diff --git a/drivers/usb/common/usb-common.c b/drivers/usb/common/usb-common.c index 6dfd30a863c..b530fd403ff 100644 --- a/drivers/usb/common/usb-common.c +++ b/drivers/usb/common/usb-common.c @@ -139,6 +139,21 @@ enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np) } EXPORT_SYMBOL_GPL(of_usb_get_maximum_speed); +/** + * of_usb_host_tpl_support - to get if Targeted Peripheral List is supported + * for given targeted hosts (non-PC hosts) + * @np: Pointer to the given device_node + * + * The function gets if the targeted hosts support TPL or not + */ +bool of_usb_host_tpl_support(struct device_node *np) +{ + if (of_find_property(np, "tpl-support", NULL)) + return true; + + return false; +} +EXPORT_SYMBOL_GPL(of_usb_host_tpl_support); #endif MODULE_LICENSE("GPL"); diff --git a/include/linux/usb/of.h b/include/linux/usb/of.h index 8c38aa26b3b..cfe0528cdbb 100644 --- a/include/linux/usb/of.h +++ b/include/linux/usb/of.h @@ -14,6 +14,7 @@ #if IS_ENABLED(CONFIG_OF) enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np); enum usb_device_speed of_usb_get_maximum_speed(struct device_node *np); +bool of_usb_host_tpl_support(struct device_node *np); #else static inline enum usb_dr_mode of_usb_get_dr_mode(struct device_node *np) { @@ -25,6 +26,10 @@ of_usb_get_maximum_speed(struct device_node *np) { return USB_SPEED_UNKNOWN; } +static inline bool of_usb_host_tpl_support(struct device_node *np) +{ + return false; +} #endif #if IS_ENABLED(CONFIG_OF) && IS_ENABLED(CONFIG_USB_SUPPORT) -- 2.46.0