Re: [PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts

2015-07-08 Thread Roger Quadros
Hi,

On 08/07/15 16:06, Sergei Shtylyov wrote:
> Hello.
> 
> On 7/8/2015 1:36 PM, Roger Quadros wrote:
> 
>> From: Felipe Balbi 
> 
>> Add support to use interrupt names,
> 
>> Following are the interrupt names
> 
>> Peripheral Interrupt - peripheral
>> HOST Interrupt - host
>> OTG Interrupt - otg
> 
>> [Roger Q]
>> - If any of these are missing we use the
>> first available IRQ resource so that we don't
>> break with older DTBs.
> 
>> - Use gadget_irq in gadget driver.
> 
>> Signed-off-by: Felipe Balbi 
>> Signed-off-by: Roger Quadros 
>> ---
>>   drivers/usb/dwc3/core.c   | 12 
>>   drivers/usb/dwc3/core.h   |  7 +++
>>   drivers/usb/dwc3/gadget.c |  2 +-
>>   3 files changed, 20 insertions(+), 1 deletion(-)
> 
>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>> index a7498e0..7b33d7b 100644
>> --- a/drivers/usb/dwc3/core.c
>> +++ b/drivers/usb/dwc3/core.c
>> @@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev)
>>   dwc->xhci_resources[1].flags = res->flags;
>>   dwc->xhci_resources[1].name = res->name;
>>
>> +dwc->otg_irq = platform_get_irq_byname(pdev, "otg");
>> +if (!dwc->otg_irq)
> 
>The usual mistake repeated again: that function reutrns error # on 
> failure, not 0.
> 
>> +dwc->otg_irq = res->start;
>> +
>> +dwc->gadget_irq = platform_get_irq_byname(pdev, "peripheral");
>> +if (!dwc->gadget_irq)
>> +dwc->gadget_irq = res->start;
> 
>Likewise.
> 
>> +
>> +dwc->xhci_irq = platform_get_irq_byname(pdev, "host");
>> +if (!dwc->xhci_irq)
> 
>Likewise.

Right. I'll fix it up. Thanks.

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts

2015-07-08 Thread Sergei Shtylyov

Hello.

On 7/8/2015 1:36 PM, Roger Quadros wrote:


From: Felipe Balbi 



Add support to use interrupt names,



Following are the interrupt names



Peripheral Interrupt - peripheral
HOST Interrupt - host
OTG Interrupt - otg



[Roger Q]
- If any of these are missing we use the
first available IRQ resource so that we don't
break with older DTBs.



- Use gadget_irq in gadget driver.



Signed-off-by: Felipe Balbi 
Signed-off-by: Roger Quadros 
---
  drivers/usb/dwc3/core.c   | 12 
  drivers/usb/dwc3/core.h   |  7 +++
  drivers/usb/dwc3/gadget.c |  2 +-
  3 files changed, 20 insertions(+), 1 deletion(-)



diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index a7498e0..7b33d7b 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev)
dwc->xhci_resources[1].flags = res->flags;
dwc->xhci_resources[1].name = res->name;

+   dwc->otg_irq = platform_get_irq_byname(pdev, "otg");
+   if (!dwc->otg_irq)


   The usual mistake repeated again: that function reutrns error # on 
failure, not 0.



+   dwc->otg_irq = res->start;
+
+   dwc->gadget_irq = platform_get_irq_byname(pdev, "peripheral");
+   if (!dwc->gadget_irq)
+   dwc->gadget_irq = res->start;


   Likewise.


+
+   dwc->xhci_irq = platform_get_irq_byname(pdev, "host");
+   if (!dwc->xhci_irq)


   Likewise.

[...]

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 4/9] usb: dwc3: core: Adapt to named interrupts

2015-07-08 Thread Roger Quadros
From: Felipe Balbi 

Add support to use interrupt names,

Following are the interrupt names

Peripheral Interrupt - peripheral
HOST Interrupt - host
OTG Interrupt - otg

[Roger Q]
- If any of these are missing we use the
first available IRQ resource so that we don't
break with older DTBs.

- Use gadget_irq in gadget driver.

Signed-off-by: Felipe Balbi 
Signed-off-by: Roger Quadros 
---
 drivers/usb/dwc3/core.c   | 12 
 drivers/usb/dwc3/core.h   |  7 +++
 drivers/usb/dwc3/gadget.c |  2 +-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index a7498e0..7b33d7b 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -941,6 +941,18 @@ static int dwc3_probe(struct platform_device *pdev)
dwc->xhci_resources[1].flags = res->flags;
dwc->xhci_resources[1].name = res->name;
 
+   dwc->otg_irq = platform_get_irq_byname(pdev, "otg");
+   if (!dwc->otg_irq)
+   dwc->otg_irq = res->start;
+
+   dwc->gadget_irq = platform_get_irq_byname(pdev, "peripheral");
+   if (!dwc->gadget_irq)
+   dwc->gadget_irq = res->start;
+
+   dwc->xhci_irq = platform_get_irq_byname(pdev, "host");
+   if (!dwc->xhci_irq)
+   dwc->xhci_irq = res->start;
+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "missing memory resource\n");
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 9c1c094..c3431b2 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -742,6 +742,9 @@ struct dwc3_scratchpad_array {
  * @maximum_speed: maximum speed requested (mainly for testing purposes)
  * @revision: revision register contents
  * @dr_mode: requested mode of operation
+ * @xhci_irq: IRQ number for XHCI IRQs
+ * @gadget_irq: IRQ number for Peripheral IRQs
+ * @otg_irq: IRQ number for OTG IRQs
  * @usb2_phy: pointer to USB2 PHY
  * @usb3_phy: pointer to USB3 PHY
  * @usb2_generic_phy: pointer to USB2 PHY
@@ -846,6 +849,10 @@ struct dwc3 {
 
enum usb_dr_modedr_mode;
 
+   int gadget_irq;
+   int xhci_irq;
+   int otg_irq;
+
/* used for suspend/resume */
u32 dcfg;
u32 gctl;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 333a7c0..cf6b945 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1531,7 +1531,7 @@ static int dwc3_gadget_start(struct usb_gadget *g,
int irq;
u32 reg;
 
-   irq = platform_get_irq(to_platform_device(dwc->dev), 0);
+   irq = dwc->gadget_irq;
ret = request_threaded_irq(irq, dwc3_interrupt, dwc3_thread_interrupt,
IRQF_SHARED, "dwc3", dwc);
if (ret) {
-- 
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/