public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time
Date: Wed, 19 Jan 2011 19:54:44 +0100	[thread overview]
Message-ID: <20110119185444.GA7228@pengutronix.de> (raw)
In-Reply-To: <4D371ABB.7000608@freescale.com>

On Wed, Jan 19, 2011 at 03:09:15PM -0200, Fabio Estevam wrote:
> On 1/19/2011 1:36 PM, Eric B?nard wrote:
> > Hi Fabio,
> > 
> > On 19/01/2011 16:32, Fabio Estevam wrote:
> >> Instead of checking the CPU type in build-time, do it in run-time.
> >>
> >> Signed-off-by: Fabio Estevam<fabio.estevam@freescale.com>
> >> ---
> >>   drivers/usb/gadget/fsl_mxc_udc.c |   23 ++++++++++++-----------
> >>   1 files changed, 12 insertions(+), 11 deletions(-)
> >>
> >> diff --git a/drivers/usb/gadget/fsl_mxc_udc.c b/drivers/usb/gadget/fsl_mxc_udc.c
> >> index 77b1eb5..167abe0 100644
> >> --- a/drivers/usb/gadget/fsl_mxc_udc.c
> >> +++ b/drivers/usb/gadget/fsl_mxc_udc.c
> >> @@ -88,17 +88,18 @@ eenahb:
> >>   void fsl_udc_clk_finalize(struct platform_device *pdev)
> >>   {
> >>       struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
> >> -#if defined(CONFIG_ARCH_MX35)
> >> -    unsigned int v;
> >> -
> >> -    /* workaround ENGcm09152 for i.MX35 */
> >> -    if (pdata->workaround&  FLS_USB2_WORKAROUND_ENGCM09152) {
> >> -        v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
> >> -                USBPHYCTRL_OTGBASE_OFFSET));
> >> -        writel(v | USBPHYCTRL_EVDO, MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
> >> -                USBPHYCTRL_OTGBASE_OFFSET));
> >> -    }
> >> -#endif
> >> +    if (cpu_is_mx35()) {
> >> +        unsigned int v;
> >> +
> >> +        /* workaround ENGcm09152 for i.MX35 */
> >> +        if (pdata->workaround&  FLS_USB2_WORKAROUND_ENGCM09152) {
can you please fix up the position of the '&'?

> >> +            v = readl(MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
> >> +                    USBPHYCTRL_OTGBASE_OFFSET));
> >> +            writel(v | USBPHYCTRL_EVDO,
> >> +                MX35_IO_ADDRESS(MX35_USB_BASE_ADDR +
> >> +                    USBPHYCTRL_OTGBASE_OFFSET));
I wonder if the address isn't mapped via ioremap in the driver and the
cookie saved somewhere?  (And no, I don't ask you to change that in this
patch.)  (If so, it this already problematic aliasing?)

> >> +        }
> >> +    }
> >>
> > are you sure this compiles when MX35 is not selected ?
> 
> Including #include <mach/mx35.h> fixes the build for a non- mx35 kernel.
> 
> Would this be acceptable? If so, I can send v2.
If you keep the #if defined(CONFIG_ARCH_MX35) and only add the if
(cpu_is_mx35()) it should work without a new #include.
Doing that seems a tad cleaner to me.

Best regards
Uwe 

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  reply	other threads:[~2011-01-19 18:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-19 15:32 [PATCH] usb: gadget/fsl_mxc_udc: Detect the CPU type in run-time Fabio Estevam
2011-01-19 15:36 ` Eric Bénard
2011-01-19 16:08   ` Fabio Estevam
2011-01-19 17:09   ` Fabio Estevam
2011-01-19 18:54     ` Uwe Kleine-König [this message]
2011-01-19 20:07       ` Fabio Estevam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110119185444.GA7228@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox