Skip to contentSkip to conversation

usb: added palmas-usb driver and a few misc fixes

PATCH Superseded Kishon Vijay Abraham I 3 participants 14 messages Mar 5, 2013

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover usb: added palmas-usb driver and a few misc fixes

Added palmas-usb driver which is mainly used as comparator driver to detect vbus/id events when a USB cable is connected and passes on the event information to omap glue (dwc3-omap.c)

The other fixes include setting dma_mask for dwc3 device since device tree doesn't fill dma_mask, returning EPROBE_DEFER if probe has not yet called and replace *_* with *-* in property names in musb glue since that is the usual convention followed.

Graeme Gregory (1):
USB: Palmas OTG Transceiver Driver

Kishon Vijay Abraham I (3):
usb: dwc3: dwc3-omap: set dma_mask for dwc3 inorder for host mode to
work
usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet
executed
usb: musb: omap2430: replace *_* with *-* in property names

 Documentation/devicetree/bindings/usb/omap-usb.txt |   12 +-
 .../devicetree/bindings/usb/twlxxxx-usb.txt        |   15 +
 drivers/usb/dwc3/dwc3-omap.c                       |   17 +-
 drivers/usb/musb/omap2430.c                        |    6 +-
 drivers/usb/otg/Kconfig                            |    6 +
 drivers/usb/otg/Makefile                           |    1 +
 drivers/usb/otg/palmas-usb.c                       |  399 ++++++++++++++++++++
 include/linux/mfd/palmas.h                         |    7 +-
 include/linux/usb/dwc3-omap.h                      |    6 +-
 9 files changed, 454 insertions(+), 15 deletions(-)
 create mode 100644 drivers/usb/otg/palmas-usb.c
Signature · 1 line
1.7.10.4
#1 lore raw

PATCH 1/4 usb: dwc3: dwc3-omap: set dma_mask for dwc3 inorder for host mode to work

While creating the child devices, *of_platform_populate* sets only coherent_dma_mask but USBHCD sets *uses_dma* (determines whether the controller is DMA'able) based on dma_mask. So If we haven't explicitly set dma_mask, the HCD thinks the controller is not DMA'able and the controller will fail. So explicity set dma_mask for dwc3 after *of_platform_populate*.

---
 drivers/usb/dwc3/dwc3-omap.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/usb/dwc3/dwc3-omap.c +10 -0
index 35b9673..19c6e72 100644
@@ -277,6 +277,14 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, 0x00);
 }
 
+static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
+
+static int dwc3_omap_set_dmamask(struct device *dev, void *c)
+{
+	dev->dma_mask = &dwc3_omap_dma_mask;
+	return 0;
+}
+
 static int dwc3_omap_probe(struct platform_device *pdev)
 {
 	struct device_node	*node = pdev->dev.of_node;
@@ -381,6 +389,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	device_for_each_child(&pdev->dev, NULL, dwc3_omap_set_dmamask);
+
 	return 0;
 }
 
Signature · 1 line
1.7.10.4
#2 lore raw

Re: [PATCH 1/4] usb: dwc3: dwc3-omap: set dma_mask for dwc3 inorder for host mode to work

Quoted 32 lines · Kishon Vijay Abraham I

While creating the child devices, *of_platform_populate* sets only coherent_dma_mask but USBHCD sets *uses_dma* (determines whether the controller is DMA'able) based on dma_mask. So If we haven't explicitly set dma_mask, the HCD thinks the controller is not DMA'able and the controller will fail. So explicity set dma_mask for dwc3 after *of_platform_populate*.

---
 drivers/usb/dwc3/dwc3-omap.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/usb/dwc3/dwc3-omap.c +8 -0
index 35b9673..19c6e72 100644
@@ -277,6 +277,14 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, 0x00);
 }
 
+static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
+
+static int dwc3_omap_set_dmamask(struct device *dev, void *c)
+{
+	dev->dma_mask = &dwc3_omap_dma_mask;
+	return 0;
+}
+
 static int dwc3_omap_probe(struct platform_device *pdev)
 {
 	struct device_node	*node = pdev->dev.of_node;

drivers/usb/dwc3/dwc3-omap.c static int dwc3_omap_probe(struct platform_device *pdev) · line 392

Quoted 4 lines
drivers/usb/dwc3/dwc3-omap.c +1 -0
@@ -381,6 +389,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	device_for_each_child(&pdev->dev, NULL, dwc3_omap_set_dmamask);

I don't think this is correct. Child should be setting its own by copying from parent. In summary I think we should add this to dwc3 core:

dma_set_coherent_mask(&pdev->dev, pdev->dev.parent->coherent_dma_mask); pdev->dev.dma_mask = pdev->dev.parent->dma_mask; pdev->dev.dma_parms = pdev->dev.parent->dma_parms;

And add the same thing to xhci-plat.c btw.

Signature · 1 line
balbi

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

author
#3 lore raw

Re: [PATCH 1/4] usb: dwc3: dwc3-omap: set dma_mask for dwc3 inorder for host mode to work

Hi,

Quoted 41 lines · Felipe Balbi
Quoted 32 lines · Kishon Vijay Abraham I

While creating the child devices, *of_platform_populate* sets only coherent_dma_mask but USBHCD sets *uses_dma* (determines whether the controller is DMA'able) based on dma_mask. So If we haven't explicitly set dma_mask, the HCD thinks the controller is not DMA'able and the controller will fail. So explicity set dma_mask for dwc3 after *of_platform_populate*.

---
  drivers/usb/dwc3/dwc3-omap.c |   10 ++++++++++
  1 file changed, 10 insertions(+)
drivers/usb/dwc3/dwc3-omap.c +8 -0
index 35b9673..19c6e72 100644
@@ -277,6 +277,14 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
  	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, 0x00);
  }
 
+static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
+
+static int dwc3_omap_set_dmamask(struct device *dev, void *c)
+{
+	dev->dma_mask = &dwc3_omap_dma_mask;
+	return 0;
+}
+
  static int dwc3_omap_probe(struct platform_device *pdev)
  {
  	struct device_node	*node = pdev->dev.of_node;

drivers/usb/dwc3/dwc3-omap.c static int dwc3_omap_probe(struct platform_device *pdev) · line 392

Quoted 4 lines
drivers/usb/dwc3/dwc3-omap.c +1 -0
@@ -381,6 +389,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
  		return ret;
  	}
 
+	device_for_each_child(&pdev->dev, NULL, dwc3_omap_set_dmamask);

I don't think this is correct. Child should be setting its own by copying from parent. In summary I think we should add this to dwc3 core:

Quoted 5 lines

dma_set_coherent_mask(&pdev->dev, pdev->dev.parent->coherent_dma_mask); pdev->dev.dma_mask = pdev->dev.parent->dma_mask; pdev->dev.dma_parms = pdev->dev.parent->dma_parms;

And add the same thing to xhci-plat.c btw.

hmm.. ok.

Thanks
Kishon

#4 lore raw

Re: [PATCH 1/4] usb: dwc3: dwc3-omap: set dma_mask for dwc3 inorder for host mode to work

Quoted 44 lines · kishon

Hi,

Quoted 41 lines · Felipe Balbi
Quoted 32 lines · Kishon Vijay Abraham I

While creating the child devices, *of_platform_populate* sets only coherent_dma_mask but USBHCD sets *uses_dma* (determines whether the controller is DMA'able) based on dma_mask. So If we haven't explicitly set dma_mask, the HCD thinks the controller is not DMA'able and the controller will fail. So explicity set dma_mask for dwc3 after *of_platform_populate*.

---
 drivers/usb/dwc3/dwc3-omap.c |   10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/usb/dwc3/dwc3-omap.c +8 -0
index 35b9673..19c6e72 100644
@@ -277,6 +277,14 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 	dwc3_omap_writel(omap->base, USBOTGSS_IRQENABLE_SET_0, 0x00);
 }
 
+static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
+
+static int dwc3_omap_set_dmamask(struct device *dev, void *c)
+{
+	dev->dma_mask = &dwc3_omap_dma_mask;
+	return 0;
+}
+
 static int dwc3_omap_probe(struct platform_device *pdev)
 {
 	struct device_node	*node = pdev->dev.of_node;

drivers/usb/dwc3/dwc3-omap.c static int dwc3_omap_probe(struct platform_device *pdev) · line 392

Quoted 4 lines
drivers/usb/dwc3/dwc3-omap.c +1 -0
@@ -381,6 +389,8 @@ static int dwc3_omap_probe(struct platform_device *pdev)
 		return ret;
 	}
 
+	device_for_each_child(&pdev->dev, NULL, dwc3_omap_set_dmamask);

I don't think this is correct. Child should be setting its own by copying from parent. In summary I think we should add this to dwc3 core:

Quoted 7 lines
Quoted 5 lines

dma_set_coherent_mask(&pdev->dev, pdev->dev.parent->coherent_dma_mask); pdev->dev.dma_mask = pdev->dev.parent->dma_mask; pdev->dev.dma_parms = pdev->dev.parent->dma_parms;

And add the same thing to xhci-plat.c btw.

hmm.. ok.

another thing, this means that we can remove similar code from dwc3-pci.c and dwc3-exynos.c ;-)

Signature · 1 line
balbi
#5 lore raw

PATCH 2/4 usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executed

In reply to Kishon Vijay Abraham I

return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed.

---
 drivers/usb/dwc3/dwc3-omap.c  |    7 +++++--
 include/linux/usb/dwc3-omap.h |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-omap.c +5 -2
index 19c6e72..9428f4e 100644
@@ -138,11 +138,14 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
 	writel(value, base + offset);
 }
 
-void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 {
 	u32			val;
 	struct dwc3_omap	*omap = _omap;
 
+	if (!omap)
+		return -EPROBE_DEFER;
+
 	switch (status) {
 	case OMAP_DWC3_ID_GROUND:
 		dev_dbg(omap->dev, "ID GND\n");
@@ -185,7 +188,7 @@ void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 		dev_dbg(omap->dev, "ID float\n");
 	}
 
-	return;
+	return IRQ_HANDLED;
 }
 EXPORT_SYMBOL_GPL(dwc3_omap_mailbox);
 
include/linux/usb/dwc3-omap.h +3 -3
index 51eae14..5615f4d 100644
@@ -19,11 +19,11 @@ enum omap_dwc3_vbus_id_status {
 };
 
 #if (defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_DWC3_MODULE))
-extern void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
+extern int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status);
 #else
-static inline void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+static inline int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 {
-	return;
+	return -ENODEV;
 }
 #endif
 
Signature · 1 line
1.7.10.4
#6 lore raw

Re: [PATCH 2/4] usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executed

Quoted 30 lines · Kishon Vijay Abraham I

return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed.

---
 drivers/usb/dwc3/dwc3-omap.c  |    7 +++++--
 include/linux/usb/dwc3-omap.h |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-omap.c +4 -1
index 19c6e72..9428f4e 100644
@@ -138,11 +138,14 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
 	writel(value, base + offset);
 }
 
-void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 {
 	u32			val;
 	struct dwc3_omap	*omap = _omap;
 
+	if (!omap)
+		return -EPROBE_DEFER;
+
 	switch (status) {
 	case OMAP_DWC3_ID_GROUND:
 		dev_dbg(omap->dev, "ID GND\n");

drivers/usb/dwc3/dwc3-omap.c void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) · line 191

Quoted 5 lines
drivers/usb/dwc3/dwc3-omap.c +1 -1
@@ -185,7 +188,7 @@ void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 		dev_dbg(omap->dev, "ID float\n");
 	}
 
-	return;
+	return IRQ_HANDLED;

IRQ_HANDLED ????

Signature · 1 line
balbi
author
#7 lore raw

Re: [PATCH 2/4] usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executed

Hi,

Quoted 34 lines · Felipe Balbi
Quoted 33 lines · Kishon Vijay Abraham I

return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed.

---
  drivers/usb/dwc3/dwc3-omap.c  |    7 +++++--
  include/linux/usb/dwc3-omap.h |    6 +++---
  2 files changed, 8 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-omap.c +4 -1
index 19c6e72..9428f4e 100644
@@ -138,11 +138,14 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
  	writel(value, base + offset);
  }
 
-void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
  {
  	u32			val;
  	struct dwc3_omap	*omap = _omap;
 
+	if (!omap)
+		return -EPROBE_DEFER;
+
  	switch (status) {
  	case OMAP_DWC3_ID_GROUND:
  		dev_dbg(omap->dev, "ID GND\n");
@@ -185,7 +188,7 @@ void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
  		dev_dbg(omap->dev, "ID float\n");
  	}
 
Quoted 4 lines

drivers/usb/dwc3/dwc3-omap.c void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) · line 191

Quoted 2 lines
drivers/usb/dwc3/dwc3-omap.c +1 -1
-	return;
+	return IRQ_HANDLED;

IRQ_HANDLED ????

Actually I did it that way since palmas_vbus_wakeup_irq can directly return the return value from dwc3_omap_mailbox. If this seems hacky to you, I'll change it.

Thanks
Kishon

#8 lore raw

Re: [PATCH 2/4] usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executed

Quoted 37 lines · kishon

Hi,

Quoted 34 lines · Felipe Balbi
Quoted 33 lines · Kishon Vijay Abraham I

return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed.

---
 drivers/usb/dwc3/dwc3-omap.c  |    7 +++++--
 include/linux/usb/dwc3-omap.h |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-omap.c +4 -1
index 19c6e72..9428f4e 100644
@@ -138,11 +138,14 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
 	writel(value, base + offset);
 }
 
-void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 {
 	u32			val;
 	struct dwc3_omap	*omap = _omap;
 
+	if (!omap)
+		return -EPROBE_DEFER;
+
 	switch (status) {
 	case OMAP_DWC3_ID_GROUND:
 		dev_dbg(omap->dev, "ID GND\n");
@@ -185,7 +188,7 @@ void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 		dev_dbg(omap->dev, "ID float\n");
 	}
 
Quoted 8 lines
Quoted 4 lines

drivers/usb/dwc3/dwc3-omap.c void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) · line 191

Quoted 2 lines
drivers/usb/dwc3/dwc3-omap.c +1 -1
-	return;
+	return IRQ_HANDLED;

IRQ_HANDLED ????

Actually I did it that way since palmas_vbus_wakeup_irq can directly return the return value from dwc3_omap_mailbox. If this seems hacky to you, I'll change it.

it does seem hacky :-) Try something like:

ret = dwc3_omap_mailbox();
if (ret)

	print_error();

return IRQ_HANDLED;

Signature · 1 line
balbi

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

author
#9 lore raw

Re: [PATCH 2/4] usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executed

Hi,

Quoted 47 lines · Felipe Balbi
Quoted 37 lines · kishon

Hi,

Quoted 34 lines · Felipe Balbi
Quoted 33 lines · Kishon Vijay Abraham I

return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed.

---
  drivers/usb/dwc3/dwc3-omap.c  |    7 +++++--
  include/linux/usb/dwc3-omap.h |    6 +++---
  2 files changed, 8 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-omap.c +4 -1
index 19c6e72..9428f4e 100644
@@ -138,11 +138,14 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
  	writel(value, base + offset);
  }
 
-void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
  {
  	u32			val;
  	struct dwc3_omap	*omap = _omap;
 
+	if (!omap)
+		return -EPROBE_DEFER;
+
  	switch (status) {
  	case OMAP_DWC3_ID_GROUND:
  		dev_dbg(omap->dev, "ID GND\n");
@@ -185,7 +188,7 @@ void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
  		dev_dbg(omap->dev, "ID float\n");
  	}
 
Quoted 8 lines
Quoted 4 lines

drivers/usb/dwc3/dwc3-omap.c void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) · line 191

Quoted 2 lines
drivers/usb/dwc3/dwc3-omap.c +1 -1
-	return;
+	return IRQ_HANDLED;

IRQ_HANDLED ????

Actually I did it that way since palmas_vbus_wakeup_irq can directly return the return value from dwc3_omap_mailbox. If this seems hacky to you, I'll change it.

Quoted 7 lines

it does seem hacky :-) Try something like:

ret = dwc3_omap_mailbox();
if (ret)

	print_error();

return IRQ_HANDLED;

hmm.. But there is one case where palmas_vbus_wakeup_irq should return EPROBE_DEFER. In the cold plug case, if palmas gets loaded before dwc3-omap, omap in dwc3_omap_mailbox will be NULL. So ideally palmas should be probed after dwc3-omap for this case. Returning IRQ_HANDLED or IRQ_NONE wont help here.

Thanks
Kishon

Quoted 1 line
#10 lore raw

Re: [PATCH 2/4] usb: dwc3: dwc3-omap: return -EPROBE_DEFER if probe has not yet executed

Quoted 56 lines · kishon

Hi,

Quoted 53 lines · Felipe Balbi
Quoted 37 lines · kishon

Hi,

Quoted 34 lines · Felipe Balbi
Quoted 33 lines · Kishon Vijay Abraham I

return -EPROBE_DEFER from dwc3_omap_mailbox in dwc3-omap.c, if the probe of dwc3-omap has not yet been executed or failed.

---
 drivers/usb/dwc3/dwc3-omap.c  |    7 +++++--
 include/linux/usb/dwc3-omap.h |    6 +++---
 2 files changed, 8 insertions(+), 5 deletions(-)
drivers/usb/dwc3/dwc3-omap.c +4 -1
index 19c6e72..9428f4e 100644
@@ -138,11 +138,14 @@ static inline void dwc3_omap_writel(void __iomem *base, u32 offset, u32 value)
 	writel(value, base + offset);
 }
 
-void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
+int dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 {
 	u32			val;
 	struct dwc3_omap	*omap = _omap;
 
+	if (!omap)
+		return -EPROBE_DEFER;
+
 	switch (status) {
 	case OMAP_DWC3_ID_GROUND:
 		dev_dbg(omap->dev, "ID GND\n");
@@ -185,7 +188,7 @@ void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status)
 		dev_dbg(omap->dev, "ID float\n");
 	}
 
Quoted 8 lines
Quoted 4 lines

drivers/usb/dwc3/dwc3-omap.c void dwc3_omap_mailbox(enum omap_dwc3_vbus_id_status status) · line 191

Quoted 2 lines
drivers/usb/dwc3/dwc3-omap.c +1 -1
-	return;
+	return IRQ_HANDLED;

IRQ_HANDLED ????

Actually I did it that way since palmas_vbus_wakeup_irq can directly return the return value from dwc3_omap_mailbox. If this seems hacky to you, I'll change it.

it does seem hacky :-) Try something like:

ret = dwc3_omap_mailbox();
if (ret)

	print_error();
Quoted 7 lines
Quoted 1 line

return IRQ_HANDLED;

hmm.. But there is one case where palmas_vbus_wakeup_irq should return EPROBE_DEFER. In the cold plug case, if palmas gets loaded before dwc3-omap, omap in dwc3_omap_mailbox will be NULL. So ideally palmas should be probed after dwc3-omap for this case. Returning IRQ_HANDLED or IRQ_NONE wont help here.

you can return IRQ_HANDLED but don't clear the IRQ status bits, which will make the IRQ retrigger, right ?

If you return -EPROBE_DEFER from within the IRQ handler, what will happen ? IRQ subsystem only understands IRQ_NONE, IRQ_WAKE_THREAD, and IRQ_HANDLED. How do you suppose it will treat -EPROBE_DEFER ?

Signature · 1 line
balbi

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss

#11 lore raw

PATCH 3/4 USB: Palmas OTG Transceiver Driver

In reply to Kishon Vijay Abraham I

From: Graeme Gregory <gg-kDsPt+C1G03kYMGBc/[email protected]>

This is the driver for the OTG transceiver built into the Palmas chip. It handles the various USB OTG events that can be generated by cable insertion/removal.

---
This driver is contributed by a lot of people fixing various issues that came along. All the fixes has been squashed into this single patch. I've included their *Signed-off-by*.

 .../devicetree/bindings/usb/twlxxxx-usb.txt        |   15 +
 drivers/usb/otg/Kconfig                            |    6 +
 drivers/usb/otg/Makefile                           |    1 +
 drivers/usb/otg/palmas-usb.c                       |  399 ++++++++++++++++++++
 include/linux/mfd/palmas.h                         |    7 +-
 5 files changed, 427 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/otg/palmas-usb.c
Documentation/devicetree/bindings/usb/twlxxxx-usb.txt +15 -0
index 36b9aed..6d941ef 100644
@@ -38,3 +38,18 @@ twl4030-usb {
 	usb3v1-supply = <&vusb3v1>;
 	usb_mode = <1>;
 };
+
+PALMAS USB COMPARATOR
+Required Properties:
+ - compatible : Should be "ti,palmas-usb"
+ - vbus-supply : phandle to the regulator device tree node.
+
+Optional Properties:
+ - ti,wakeup : To enable the wakeup comparator in probe
+ - ti,no_control_vbus: if the platform wishes its own vbus control
+
+palmas-usb {
+	compatible = "ti,palmas-usb";
+	vbus-supply = <&smps10_reg>;
+	ti,wakeup;
+};
drivers/usb/otg/Kconfig +6 -0
index 37962c9..5b40e04 100644
@@ -138,4 +138,10 @@ config USB_MV_OTG
 
 	  To compile this driver as a module, choose M here.
 
+config PALMAS_USB
+	tristate "Palmas USB Transceiver Driver"
+	depends on MFD_PALMAS
+	help
+	  Enable this to support the Palmas OTG transceiver
+
 endif # USB || OTG
drivers/usb/otg/Makefile +1 -0
index a844b8d..7ae90ba 100644
@@ -22,3 +22,4 @@ fsl_usb2_otg-objs		:= fsl_otg.o otg_fsm.o
 obj-$(CONFIG_FSL_USB2_OTG)	+= fsl_usb2_otg.o
 obj-$(CONFIG_USB_MXS_PHY)	+= mxs-phy.o
 obj-$(CONFIG_USB_MV_OTG)	+= mv_otg.o
+obj-$(CONFIG_PALMAS_USB)	+= palmas-usb.o
drivers/usb/otg/palmas-usb.c new file +399 -0

399 lines not on this page · raw message

include/linux/mfd/palmas.h +6 -1
index a4d13d7..f1c936c 100644
@@ -19,6 +19,9 @@
 #include <linux/leds.h>
 #include <linux/regmap.h>
 #include <linux/regulator/driver.h>
+#include <linux/usb/phy_companion.h>
+#include <linux/usb/dwc3-omap.h>
+#include <linux/platform_data/dwc3-omap.h>
 
 #define PALMAS_NUM_CLIENTS		3
 
@@ -341,6 +344,8 @@ struct palmas_usb {
 	struct palmas *palmas;
 	struct device *dev;
 
+	struct phy_companion comparator;
+
 	/* for vbus reporting with irqs disabled */
 	spinlock_t lock;
 
@@ -356,7 +361,7 @@ struct palmas_usb {
 
 	int vbus_enable;
 
-	u8 linkstat;
+	enum omap_dwc3_vbus_id_status linkstat;
 };
 
 #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator)
Signature · 1 line
1.7.10.4
#12 lore raw

Re: [PATCH 3/4] USB: Palmas OTG Transceiver Driver

Documentation/devicetree/bindings/usb/twlxxxx-usb.txt twl4030-usb { · line 52

Quoted 9 lines · Kishon Vijay Abraham I

From: Graeme Gregory <[email protected]>

This is the driver for the OTG transceiver built into the Palmas chip. It handles the various USB OTG events that can be generated by cable

Documentation/devicetree/bindings/usb/twlxxxx-usb.txt +2 -0
 
+palmas-usb {
+	compatible = "ti,palmas-usb";

The example should probably demonstrate best DT practices, and include a specific chip name in the compatible value too. In other words, something like:

compatible = "ti,twl12345-usb", "ti,palmas-usb";

#13 lore raw

PATCH 4/4 usb: musb: omap2430: replace *_* with *-* in property names

In reply to Kishon Vijay Abraham I

No functional change. Replace *_* with *-* in property names of otg to follow the general convention.

---
 Documentation/devicetree/bindings/usb/omap-usb.txt |   12 ++++++------
 drivers/usb/musb/omap2430.c                        |    6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/usb/omap-usb.txt +6 -6
index 1b9f55f..662f0f1 100644
@@ -8,10 +8,10 @@ OMAP MUSB GLUE
    and disconnect.
  - multipoint : Should be "1" indicating the musb controller supports
    multipoint. This is a MUSB configuration-specific setting.
- - num_eps : Specifies the number of endpoints. This is also a
+ - num-eps : Specifies the number of endpoints. This is also a
    MUSB configuration-specific setting. Should be set to "16"
- - ram_bits : Specifies the ram address size. Should be set to "12"
- - interface_type : This is a board specific setting to describe the type of
+ - ram-bits : Specifies the ram address size. Should be set to "12"
+ - interface-type : This is a board specific setting to describe the type of
    interface between the controller and the phy. It should be "0" or "1"
    specifying ULPI and UTMI respectively.
  - mode : Should be "3" to represent OTG. "1" signifies HOST and "2"
@@ -29,14 +29,14 @@ usb_otg_hs: usb_otg_hs@4a0ab000 {
 	ti,hwmods = "usb_otg_hs";
 	ti,has-mailbox;
 	multipoint = <1>;
-	num_eps = <16>;
-	ram_bits = <12>;
+	num-eps = <16>;
+	ram-bits = <12>;
 	ctrl-module = <&omap_control_usb>;
 };
 
 Board specific device node entry
 &usb_otg_hs {
-	interface_type = <1>;
+	interface-type = <1>;
 	mode = <3>;
 	power = <50>;
 };
drivers/usb/musb/omap2430.c +3 -3
index 1762354..dde2802 100644
@@ -522,10 +522,10 @@ static int omap2430_probe(struct platform_device *pdev)
 		}
 
 		of_property_read_u32(np, "mode", (u32 *)&pdata->mode);
-		of_property_read_u32(np, "interface_type",
+		of_property_read_u32(np, "interface-type",
 						(u32 *)&data->interface_type);
-		of_property_read_u32(np, "num_eps", (u32 *)&config->num_eps);
-		of_property_read_u32(np, "ram_bits", (u32 *)&config->ram_bits);
+		of_property_read_u32(np, "num-eps", (u32 *)&config->num_eps);
+		of_property_read_u32(np, "ram-bits", (u32 *)&config->ram_bits);
 		of_property_read_u32(np, "power", (u32 *)&pdata->power);
 		config->multipoint = of_property_read_bool(np, "multipoint");
 		pdata->has_mailbox = of_property_read_bool(np,
Signature · 1 line
1.7.10.4