From mboxrd@z Thu Jan 1 00:00:00 1970 From: u.kleine-koenig@pengutronix.de (Uwe =?iso-8859-1?Q?Kleine-K=F6nig?=) Date: Mon, 13 Jun 2016 10:56:08 +0200 Subject: [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc In-Reply-To: <1465807650-27316-1-git-send-email-alexandre.belloni@free-electrons.com> References: <1465807650-27316-1-git-send-email-alexandre.belloni@free-electrons.com> Message-ID: <20160613085608.GG26768@pengutronix.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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 I played with the AT91 during my non-work time, so please use uwe at kleine-koenig.org as my email address. > Signed-off-by: Alexandre Belloni > --- > 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/ | From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422847AbcFMI4X (ORCPT ); Mon, 13 Jun 2016 04:56:23 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:45270 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422823AbcFMI4T (ORCPT ); Mon, 13 Jun 2016 04:56:19 -0400 Date: Mon, 13 Jun 2016 10:56:08 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Alexandre Belloni Cc: Felipe Balbi , Nicolas Ferre , Boris Brezillon , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: gadget: udc: atmel: Also get regmap for at91sam9x5-pmc Message-ID: <20160613085608.GG26768@pengutronix.de> References: <1465807650-27316-1-git-send-email-alexandre.belloni@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1465807650-27316-1-git-send-email-alexandre.belloni@free-electrons.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 > --- > 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/ |