linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] usb: dwc3: core: allow vendor drivers to check probe status
@ 2014-07-17 17:13 Lee Jones
  2014-07-17 17:20 ` Felipe Balbi
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Jones @ 2014-07-17 17:13 UTC (permalink / raw)
  To: linux-arm-kernel

This patch provides mechanism for subordinate devices to check
whether the DWC3 core probed successfully or otherwise.  Useful
if PHYs are required to configure controllers, but aren't yet
available.  The DWC3 core driver will defer probe if PHYs are
unavailable, however subordinate DWC3 drivers currently do not
have any visibility or means to check status - until now.

Another way to do this would be to *_phy_get*(), but if every
driver did this it would create a high level of code
duplication.

Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
 drivers/usb/dwc3/core.c | 12 ++++++++++++
 drivers/usb/dwc3/core.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index eb69eb9..171ca52 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -47,6 +47,14 @@
 
 /* -------------------------------------------------------------------------- */
 
+static bool is_enabled = false;
+
+int dwc3_is_enabled(void)
+{
+	return is_enabled;
+}
+EXPORT_SYMBOL(dwc3_is_enabled);
+
 void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
 {
 	u32 reg;
@@ -757,6 +765,8 @@ static int dwc3_probe(struct platform_device *pdev)
 
 	pm_runtime_allow(dev);
 
+	is_enabled = true;
+
 	return 0;
 
 err3:
@@ -786,6 +796,8 @@ static int dwc3_remove(struct platform_device *pdev)
 {
 	struct dwc3	*dwc = platform_get_drvdata(pdev);
 
+	is_enabled = false;
+
 	usb_phy_set_suspend(dwc->usb2_phy, 1);
 	usb_phy_set_suspend(dwc->usb3_phy, 1);
 	phy_power_off(dwc->usb2_generic_phy);
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 57332e3..94dee86 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -906,6 +906,7 @@ struct dwc3_gadget_ep_cmd_params {
 /* prototypes */
 void dwc3_set_mode(struct dwc3 *dwc, u32 mode);
 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc);
+int dwc3_is_enabled(void);
 
 #if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
 int dwc3_host_init(struct dwc3 *dwc);
-- 
1.8.3.2

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-07-22 15:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-17 17:13 [RFC PATCH] usb: dwc3: core: allow vendor drivers to check probe status Lee Jones
2014-07-17 17:20 ` Felipe Balbi
2014-07-18  7:11   ` Lee Jones
2014-07-18 14:40     ` Felipe Balbi
2014-07-22 13:55       ` Peter Griffin
2014-07-22 15:04         ` Felipe Balbi

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).