Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1419251
| From | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources |
| Date | 2016-06-10 12:40 +0200 |
| Message-ID | <rIs14-3pw-17@gated-at.bofh.it> (permalink) |
| References | <rxDsS-1yk-7@gated-at.bofh.it> <rxDsT-1yk-31@gated-at.bofh.it> <rF94C-5yl-21@gated-at.bofh.it> <rIrol-2W0-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hello.
On 6/10/2016 12:56 PM, Roger Quadros wrote:
> Implementations might use different IRQs for
> host, gadget so use named interrupt resources
> to allow device tree to specify the interrupts.
>
> Following are the interrupt names
>
> Peripheral Interrupt - peripheral
> HOST Interrupt - host
>
> Maintain backward compatibility for a single named
> interrupt ("dwc3_usb3") for all interrupts as well as
> unnamed interrupt at index 0 for all interrupts.
>
> As platform_get_irq_() variants are used, tackle
platform_get_irq().
> the -EPROBE_DEFER case as well.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> v10:
> - don't mention otg irq since we are not using it yet
> - use platform_get_irq() and friends and check -EPROBE_DEFER case.
>
> drivers/usb/dwc3/core.c | 22 ++++++++--------------
> drivers/usb/dwc3/gadget.c | 29 ++++++++++++++++++++++++++---
> drivers/usb/dwc3/host.c | 41 ++++++++++++++++++++++++++++++++++++++++-
> 3 files changed, 74 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index 8fceeb1..131e7eb 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
[...]
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 0f6fb8e..774a0d8 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
[...]
> @@ -2866,7 +2865,31 @@ static irqreturn_t dwc3_interrupt(int irq, void *_evt)
> */
> int dwc3_gadget_init(struct dwc3 *dwc)
> {
> - int ret;
> + int ret, irq;
> + struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
> +
> + irq = platform_get_irq_byname(dwc3_pdev, "peripheral");
> + if (irq == -EPROBE_DEFER)
> + return irq;
> +
> + if (irq <= 0) {
> + irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3");
> + if (irq == -EPROBE_DEFER)
> + return irq;
> +
> + if (irq <= 0) {
> + irq = platform_get_irq(dwc3_pdev, 0);
> + if (irq <= 0) {
> + if (irq != -EPROBE_DEFER) {
> + dev_err(dwc->dev,
> + "missing peripheral IRQ\n");
> + }
> + return irq;
Iff irq == 0, you'll return success despite IRQ was "invalid". Was that
intended?
> + }
> + }
> + }
> +
> + dwc->irq_gadget = irq;
>
> dwc->ctrl_req = dma_alloc_coherent(dwc->dev, sizeof(*dwc->ctrl_req),
> &dwc->ctrl_req_addr, GFP_KERNEL);
> diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c
> index c679f63..eb5e8f9 100644
> --- a/drivers/usb/dwc3/host.c
> +++ b/drivers/usb/dwc3/host.c
> @@ -24,7 +24,46 @@ int dwc3_host_init(struct dwc3 *dwc)
> {
> struct platform_device *xhci;
> struct usb_xhci_pdata pdata;
> - int ret;
> + int ret, irq;
> + struct resource *res;
> + struct platform_device *dwc3_pdev = to_platform_device(dwc->dev);
> +
> + irq = platform_get_irq_byname(dwc3_pdev, "host");
> + if (irq == -EPROBE_DEFER)
> + return irq;
> +
> + if (irq <= 0) {
> + irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3");
> + if (irq == -EPROBE_DEFER)
> + return irq;
> +
> + if (irq <= 0) {
> + irq = platform_get_irq(dwc3_pdev, 0);
> + if (irq <= 0) {
> + if (irq != -EPROBE_DEFER) {
> + dev_err(dwc->dev,
> + "missing host IRQ\n");
> + }
> + return irq;
Iff irq == 0, you'll return success despite IRQ was "invalid". Was that
intended?
> + } else {
> + res = platform_get_resource(dwc3_pdev,
> + IORESOURCE_IRQ, 0);
> + }
> + } else {
> + res = platform_get_resource_byname(dwc3_pdev,
> + IORESOURCE_IRQ,
> + "dwc_usb3");
> + }
> +
> + } else {
> + res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ,
> + "host");
> + }
> +
> + dwc->xhci_resources[1].start = irq;
> + dwc->xhci_resources[1].end = irq;
> + dwc->xhci_resources[1].flags = res->flags;
> + dwc->xhci_resources[1].name = res->name;
>
> xhci = platform_device_alloc("xhci-hcd", PLATFORM_DEVID_AUTO);
> if (!xhci) {
MBR, Sergei
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-01 09:50 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Felipe Balbi <balbi@kernel.org> - 2016-06-01 10:10 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-07 11:40 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Grygorii Strashko <grygorii.strashko@ti.com> - 2016-06-02 14:00 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-07 11:40 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Grygorii Strashko <grygorii.strashko@ti.com> - 2016-06-07 14:00 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-07 14:50 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Felipe Balbi <balbi@kernel.org> - 2016-06-07 15:10 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-07 16:10 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 10:00 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 10:10 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 10:10 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Felipe Balbi <balbi@kernel.org> - 2016-06-10 10:20 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 10:40 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Felipe Balbi <balbi@kernel.org> - 2016-06-10 11:20 +0200
Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources Felipe Balbi <balbi@kernel.org> - 2016-06-10 10:20 +0200
[PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 12:00 +0200
Re: [PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-06-10 12:40 +0200
Re: [PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 13:40 +0200
Re: [PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 13:50 +0200
Re: [PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-06-10 14:30 +0200
Re: [PATCH v10 5/5] usb: dwc3: core: cleanup IRQ resources Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2016-06-10 13:50 +0200
[PATCH v11 5/5] usb: dwc3: core: cleanup IRQ resources Roger Quadros <rogerq@ti.com> - 2016-06-10 13:50 +0200
csiph-web