* [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc
@ 2016-06-13 8:47 Alexandre Belloni
2016-06-13 8:56 ` Uwe Kleine-König
0 siblings, 1 reply; 3+ messages in thread
From: Alexandre Belloni @ 2016-06-13 8:47 UTC (permalink / raw)
To: Felipe Balbi
Cc: Nicolas Ferre, Uwe Kleine-König, Boris Brezillon,
Greg Kroah-Hartman, linux-arm-kernel, linux-usb, linux-kernel,
Alexandre Belloni
The "atmel,at91sam9g45-udc" compatible UDC is also used on at91sam9x5 so it
is also necessary to try to get the syscon for at91sam9x5-pmc.
Fixes: 4747639f01c9 ("usb: gadget: atmel: access the PMC using regmap")
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
index 18569de06b04..bb1f6c8f0f01 100644
--- a/drivers/usb/gadget/udc/atmel_usba_udc.c
+++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
@@ -1920,6 +1920,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
udc->errata = match->data;
udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc");
+ if (IS_ERR(udc->pmc))
+ udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9x5-pmc");
if (udc->errata && IS_ERR(udc->pmc))
return ERR_CAST(udc->pmc);
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc
2016-06-13 8:47 [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc Alexandre Belloni
@ 2016-06-13 8:56 ` Uwe Kleine-König
2016-06-13 9:26 ` Alexandre Belloni
0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2016-06-13 8:56 UTC (permalink / raw)
To: Alexandre Belloni
Cc: Felipe Balbi, Nicolas Ferre, Boris Brezillon, Greg Kroah-Hartman,
linux-arm-kernel, linux-usb, linux-kernel
Hello,
On Mon, Jun 13, 2016 at 10:47:30AM +0200, Alexandre Belloni wrote:
> The "atmel,at91sam9g45-udc" compatible UDC is also used on at91sam9x5 so it
> is also necessary to try to get the syscon for at91sam9x5-pmc.
>
> Fixes: 4747639f01c9 ("usb: gadget: atmel: access the PMC using regmap")
> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
I played with the AT91 during my non-work time, so please use
uwe@kleine-koenig.org as my email address.
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
> drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> index 18569de06b04..bb1f6c8f0f01 100644
> --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> @@ -1920,6 +1920,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
>
> udc->errata = match->data;
> udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc");
> + if (IS_ERR(udc->pmc))
> + udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9x5-pmc");
> if (udc->errata && IS_ERR(udc->pmc))
> return ERR_CAST(udc->pmc);
I didn't retest but I'm sure this makes usb gadget work on my AT91.
Still I'm unsure if the patch is correct. Can
syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc")
return -EPROBE_DEFER? Are there other error codes that should be fatal
enough to not try to look for a sam9x5-pmc?
Nearly orthogonal to the issue: An error message on failure would be
nice. When I saw usb gadget broken I first had to add messages to this
driver to see where it failed.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc
2016-06-13 8:56 ` Uwe Kleine-König
@ 2016-06-13 9:26 ` Alexandre Belloni
0 siblings, 0 replies; 3+ messages in thread
From: Alexandre Belloni @ 2016-06-13 9:26 UTC (permalink / raw)
To: Uwe Kleine-König
Cc: Felipe Balbi, Nicolas Ferre, Boris Brezillon, Greg Kroah-Hartman,
linux-arm-kernel, linux-usb, linux-kernel
On 13/06/2016 at 10:56:08 +0200, Uwe Kleine-König wrote :
> Hello,
>
> On Mon, Jun 13, 2016 at 10:47:30AM +0200, Alexandre Belloni wrote:
> > The "atmel,at91sam9g45-udc" compatible UDC is also used on at91sam9x5 so it
> > is also necessary to try to get the syscon for at91sam9x5-pmc.
> >
> > Fixes: 4747639f01c9 ("usb: gadget: atmel: access the PMC using regmap")
> > Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
>
> I played with the AT91 during my non-work time, so please use
> uwe@kleine-koenig.org as my email address.
>
> > Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> > ---
> > drivers/usb/gadget/udc/atmel_usba_udc.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c
> > index 18569de06b04..bb1f6c8f0f01 100644
> > --- a/drivers/usb/gadget/udc/atmel_usba_udc.c
> > +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c
> > @@ -1920,6 +1920,8 @@ static struct usba_ep * atmel_udc_of_init(struct platform_device *pdev,
> >
> > udc->errata = match->data;
> > udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc");
> > + if (IS_ERR(udc->pmc))
> > + udc->pmc = syscon_regmap_lookup_by_compatible("atmel,at91sam9x5-pmc");
> > if (udc->errata && IS_ERR(udc->pmc))
> > return ERR_CAST(udc->pmc);
>
> I didn't retest but I'm sure this makes usb gadget work on my AT91.
> Still I'm unsure if the patch is correct. Can
>
> syscon_regmap_lookup_by_compatible("atmel,at91sam9g45-pmc")
>
> return -EPROBE_DEFER? Are there other error codes that should be fatal
> enough to not try to look for a sam9x5-pmc?
>
Well, if finding the PMC fails, you are probably not far enough in the
boot process to care about USB :)
Also, looking up the syscon will never return -EPROBE_DEFER because it
will create the regmap on first lookup, it doesn't matter where it is
coming from.
> Nearly orthogonal to the issue: An error message on failure would be
> nice. When I saw usb gadget broken I first had to add messages to this
> driver to see where it failed.
>
Good point, this can probably go in a separate, less urgent patch.
--
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-13 9:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-13 8:47 [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc Alexandre Belloni
2016-06-13 8:56 ` Uwe Kleine-König
2016-06-13 9:26 ` Alexandre Belloni
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).