All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
       [not found] <20110505135029.0c068b8e@wker>
@ 2011-05-06  9:00 ` Uwe Kleine-König
  2011-05-06  9:04   ` Russell King - ARM Linux
  2011-05-11  6:39   ` Uwe Kleine-König
  0 siblings, 2 replies; 11+ messages in thread
From: Uwe Kleine-König @ 2011-05-06  9:00 UTC (permalink / raw)
  To: linux-arm-kernel

Commit

	09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)

introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
To make the driver compile again this use has to be protected by
an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
is #ifdefed out, too.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
Hello,

I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
a flush ARM probably does, too, no?
If so, what it the right thing to do? Implement flush_dcache_range for
ARM (just wrapping flush_dcache_page?)?

Best regards
Uwe

 drivers/usb/gadget/fsl_udc_core.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index 999eafe..47152e0 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1333,8 +1333,10 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
 	/* Fill in the reqest structure */
 	*((u16 *) req->req.buf) = cpu_to_le16(tmp);
 
+#ifdef CONFIG_PPC32
 	/* flush cache for the req buffer */
 	flush_dcache_range((u32)req->req.buf, (u32)req->req.buf + 8);
+#endif
 
 	req->ep = ep;
 	req->req.length = 2;
@@ -2455,6 +2457,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 	}
 
 	/* Set accessors only after pdata->init() ! */
+#ifdef CONFIG_PPC32
 	if (pdata->big_endian_mmio) {
 		_fsl_readl = _fsl_readl_be;
 		_fsl_writel = _fsl_writel_be;
@@ -2462,6 +2465,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 		_fsl_readl = _fsl_readl_le;
 		_fsl_writel = _fsl_writel_le;
 	}
+#endif
 
 #ifndef CONFIG_ARCH_MXC
 	if (pdata->have_sysif_regs)
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-06  9:00 ` [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM Uwe Kleine-König
@ 2011-05-06  9:04   ` Russell King - ARM Linux
  2011-05-06 10:03     ` Uwe Kleine-König
  2011-05-11  6:39   ` Uwe Kleine-König
  1 sibling, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2011-05-06  9:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> a flush ARM probably does, too, no?
> If so, what it the right thing to do? Implement flush_dcache_range for
> ARM (just wrapping flush_dcache_page?)?

On ARM, we assume all new pages have dirty dcache, which allows us to
neatly end the ever-increasing quantity of drivers which need to be
patched to work on ARM.  PowerPC doesn't do this.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-06  9:04   ` Russell King - ARM Linux
@ 2011-05-06 10:03     ` Uwe Kleine-König
  2011-05-06 18:47       ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2011-05-06 10:03 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

On Fri, May 06, 2011 at 10:04:49AM +0100, Russell King - ARM Linux wrote:
> On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> > a flush ARM probably does, too, no?
> > If so, what it the right thing to do? Implement flush_dcache_range for
> > ARM (just wrapping flush_dcache_page?)?
> 
> On ARM, we assume all new pages have dirty dcache, which allows us to
> neatly end the ever-increasing quantity of drivers which need to be
> patched to work on ARM.  PowerPC doesn't do this.
Unless I'm missing something the cache flushed here isn't necessarily
for a new page. (And even if the flush isn't needed here for ARM, not
having flush_dcache_range results in #ifdefs for each user of it. So a
definition would be nice, wouldn't it?)

Best regards
Uwe

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-06 10:03     ` Uwe Kleine-König
@ 2011-05-06 18:47       ` Russell King - ARM Linux
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2011-05-06 18:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, May 06, 2011 at 12:03:10PM +0200, Uwe Kleine-K?nig wrote:
> Hi Russell,
> 
> On Fri, May 06, 2011 at 10:04:49AM +0100, Russell King - ARM Linux wrote:
> > On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> > > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> > > a flush ARM probably does, too, no?
> > > If so, what it the right thing to do? Implement flush_dcache_range for
> > > ARM (just wrapping flush_dcache_page?)?
> > 
> > On ARM, we assume all new pages have dirty dcache, which allows us to
> > neatly end the ever-increasing quantity of drivers which need to be
> > patched to work on ARM.  PowerPC doesn't do this.
> Unless I'm missing something the cache flushed here isn't necessarily
> for a new page. (And even if the flush isn't needed here for ARM, not
> having flush_dcache_range results in #ifdefs for each user of it. So a
> definition would be nice, wouldn't it?)

Well, the folk introducing it should have added it to cachetlb.txt so
that other folk know what the intentions of it are.  At the moment it
seems to be an unofficial extension with unknown semantics.  Maybe the
PPC folk can clear it up and fix other arches if they wish to make it
an official arch cachetlb extension.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-06  9:00 ` [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM Uwe Kleine-König
  2011-05-06  9:04   ` Russell King - ARM Linux
@ 2011-05-11  6:39   ` Uwe Kleine-König
  2011-05-11 15:54     ` Greg KH
  1 sibling, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2011-05-11  6:39 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Greg,

On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> Commit
> 
> 	09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)
> 
> introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
> CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
> To make the driver compile again this use has to be protected by
> an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
> is #ifdefed out, too.
> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> Hello,
> 
> I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> a flush ARM probably does, too, no?
> If so, what it the right thing to do? Implement flush_dcache_range for
> ARM (just wrapping flush_dcache_page?)?
As Russell seem to be OK with the #ifdef, can you please take this
patch?
 
Thanks
Uwe

>  drivers/usb/gadget/fsl_udc_core.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
> index 999eafe..47152e0 100644
> --- a/drivers/usb/gadget/fsl_udc_core.c
> +++ b/drivers/usb/gadget/fsl_udc_core.c
> @@ -1333,8 +1333,10 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
>  	/* Fill in the reqest structure */
>  	*((u16 *) req->req.buf) = cpu_to_le16(tmp);
>  
> +#ifdef CONFIG_PPC32
>  	/* flush cache for the req buffer */
>  	flush_dcache_range((u32)req->req.buf, (u32)req->req.buf + 8);
> +#endif
>  
>  	req->ep = ep;
>  	req->req.length = 2;
> @@ -2455,6 +2457,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
>  	}
>  
>  	/* Set accessors only after pdata->init() ! */
> +#ifdef CONFIG_PPC32
>  	if (pdata->big_endian_mmio) {
>  		_fsl_readl = _fsl_readl_be;
>  		_fsl_writel = _fsl_writel_be;
> @@ -2462,6 +2465,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
>  		_fsl_readl = _fsl_readl_le;
>  		_fsl_writel = _fsl_writel_le;
>  	}
> +#endif
>  
>  #ifndef CONFIG_ARCH_MXC
>  	if (pdata->have_sysif_regs)

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-11  6:39   ` Uwe Kleine-König
@ 2011-05-11 15:54     ` Greg KH
  2011-05-11 16:29       ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Greg KH @ 2011-05-11 15:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 11, 2011 at 08:39:54AM +0200, Uwe Kleine-K?nig wrote:
> Hello Greg,
> 
> On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> > Commit
> > 
> > 	09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)
> > 
> > introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
> > CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
> > To make the driver compile again this use has to be protected by
> > an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
> > is #ifdefed out, too.
> > 
> > Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> > ---
> > Hello,
> > 
> > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> > a flush ARM probably does, too, no?
> > If so, what it the right thing to do? Implement flush_dcache_range for
> > ARM (just wrapping flush_dcache_page?)?
> As Russell seem to be OK with the #ifdef, can you please take this
> patch?

Ick, no.

> >  drivers/usb/gadget/fsl_udc_core.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
> > index 999eafe..47152e0 100644
> > --- a/drivers/usb/gadget/fsl_udc_core.c
> > +++ b/drivers/usb/gadget/fsl_udc_core.c
> > @@ -1333,8 +1333,10 @@ static void ch9getstatus(struct fsl_udc *udc, u8 request_type, u16 value,
> >  	/* Fill in the reqest structure */
> >  	*((u16 *) req->req.buf) = cpu_to_le16(tmp);
> >  
> > +#ifdef CONFIG_PPC32
> >  	/* flush cache for the req buffer */
> >  	flush_dcache_range((u32)req->req.buf, (u32)req->req.buf + 8);
> > +#endif

Come on, we don't have ifdefs in .c files for a reason, surely there is
a better fix for this some other way?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-11 15:54     ` Greg KH
@ 2011-05-11 16:29       ` Russell King - ARM Linux
  2011-05-22  7:20         ` Uwe Kleine-König
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2011-05-11 16:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 11, 2011 at 08:54:46AM -0700, Greg KH wrote:
> On Wed, May 11, 2011 at 08:39:54AM +0200, Uwe Kleine-K?nig wrote:
> > Hello Greg,
> > 
> > On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> > > Commit
> > > 
> > > 	09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)
> > > 
> > > introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
> > > CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
> > > To make the driver compile again this use has to be protected by
> > > an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
> > > is #ifdefed out, too.
> > > 
> > > Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> > > ---
> > > Hello,
> > > 
> > > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> > > a flush ARM probably does, too, no?
> > > If so, what it the right thing to do? Implement flush_dcache_range for
> > > ARM (just wrapping flush_dcache_page?)?
> > As Russell seem to be OK with the #ifdef, can you please take this
> > patch?
> 
> Ick, no.

I never said I was OK with the #ifdef...

> Come on, we don't have ifdefs in .c files for a reason, surely there is
> a better fix for this some other way?

I suggested ways to fix it, which apparantly got ignored.  To repeat myself,
what I said was:

"Well, the folk introducing it should have added it to cachetlb.txt so
that other folk know what the intentions of it are.  At the moment it
seems to be an unofficial extension with unknown semantics.  Maybe the
PPC folk can clear it up and fix other arches if they wish to make it
an official arch cachetlb extension."

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-11 16:29       ` Russell King - ARM Linux
@ 2011-05-22  7:20         ` Uwe Kleine-König
  2011-06-21  9:32           ` Eric Miao
  0 siblings, 1 reply; 11+ messages in thread
From: Uwe Kleine-König @ 2011-05-22  7:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, May 11, 2011 at 05:29:02PM +0100, Russell King - ARM Linux wrote:
> On Wed, May 11, 2011 at 08:54:46AM -0700, Greg KH wrote:
> > On Wed, May 11, 2011 at 08:39:54AM +0200, Uwe Kleine-K?nig wrote:
> > > Hello Greg,
> > > 
> > > On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> > > > Commit
> > > > 
> > > > 	09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)
> > > > 
> > > > introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
> > > > CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
> > > > To make the driver compile again this use has to be protected by
> > > > an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
> > > > is #ifdefed out, too.
> > > > 
> > > > Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> > > > ---
> > > > Hello,
> > > > 
> > > > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> > > > a flush ARM probably does, too, no?
> > > > If so, what it the right thing to do? Implement flush_dcache_range for
> > > > ARM (just wrapping flush_dcache_page?)?
> > > As Russell seem to be OK with the #ifdef, can you please take this
> > > patch?
> > 
> > Ick, no.
> 
> I never said I was OK with the #ifdef...
Ah, right, sorry.

> > Come on, we don't have ifdefs in .c files for a reason, surely there is
> > a better fix for this some other way?
> 
> I suggested ways to fix it, which apparantly got ignored.  To repeat myself,
> what I said was:
> 
> "Well, the folk introducing it should have added it to cachetlb.txt so
> that other folk know what the intentions of it are.  At the moment it
> seems to be an unofficial extension with unknown semantics.  Maybe the
> PPC folk can clear it up and fix other arches if they wish to make it
> an official arch cachetlb extension."
So what should we do? The fsl_udc_core driver currently fails to build
because it uses flush_dcache_range unconditionally. So the obvious ways
to fix it are:

 1) define flush_dcache_range
   a) in arch/arm
   b) in the driver
 2) make the driver not use flush_dcache_range
   a) #ifdef 
   b) revert 09ba0de (and probably some commits that depend on it)
   c) use a different function to flush the cache


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-05-22  7:20         ` Uwe Kleine-König
@ 2011-06-21  9:32           ` Eric Miao
  2011-06-21  9:48             ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Eric Miao @ 2011-06-21  9:32 UTC (permalink / raw)
  To: linux-arm-kernel

2011/5/22 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> On Wed, May 11, 2011 at 05:29:02PM +0100, Russell King - ARM Linux wrote:
>> On Wed, May 11, 2011 at 08:54:46AM -0700, Greg KH wrote:
>> > On Wed, May 11, 2011 at 08:39:54AM +0200, Uwe Kleine-K?nig wrote:
>> > > Hello Greg,
>> > >
>> > > On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
>> > > > Commit
>> > > >
>> > > > ? ? ? ? 09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)
>> > > >
>> > > > introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
>> > > > CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
>> > > > To make the driver compile again this use has to be protected by
>> > > > an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
>> > > > is #ifdefed out, too.
>> > > >
>> > > > Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
>> > > > ---
>> > > > Hello,
>> > > >
>> > > > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
>> > > > a flush ARM probably does, too, no?
>> > > > If so, what it the right thing to do? Implement flush_dcache_range for
>> > > > ARM (just wrapping flush_dcache_page?)?
>> > > As Russell seem to be OK with the #ifdef, can you please take this
>> > > patch?
>> >
>> > Ick, no.
>>
>> I never said I was OK with the #ifdef...
> Ah, right, sorry.
>
>> > Come on, we don't have ifdefs in .c files for a reason, surely there is
>> > a better fix for this some other way?
>>
>> I suggested ways to fix it, which apparantly got ignored. ?To repeat myself,
>> what I said was:
>>
>> "Well, the folk introducing it should have added it to cachetlb.txt so
>> that other folk know what the intentions of it are. ?At the moment it
>> seems to be an unofficial extension with unknown semantics. ?Maybe the
>> PPC folk can clear it up and fix other arches if they wish to make it
>> an official arch cachetlb extension."
> So what should we do? The fsl_udc_core driver currently fails to build
> because it uses flush_dcache_range unconditionally. So the obvious ways
> to fix it are:
>
> ?1) define flush_dcache_range
> ? a) in arch/arm
> ? b) in the driver
> ?2) make the driver not use flush_dcache_range
> ? a) #ifdef
> ? b) revert 09ba0de (and probably some commits that depend on it)
> ? c) use a different function to flush the cache

I see no reason why a dma_map_*() function couldn't be used here?

This is preventing the driver from being built. And the _fsl_readl stuffs,
which was really introduced by PPC guys, yet it can be made generic
enough I believe. The real requirement is really for a single kernel binary
to run on different LE/BE configurations, which will hurt performance
a bit and is normally not true on the i.MX SoCs, so that can be made as
a config option in my POV, but not necessary #ifdef CONFIG_PPC32,
maybe some better name

PS: why PPC32 is using io_*() API instead of readl/writel(), ISTR PPC32
doesn't have a separate IO space.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-06-21  9:32           ` Eric Miao
@ 2011-06-21  9:48             ` Russell King - ARM Linux
  2011-06-21  9:53               ` Russell King - ARM Linux
  0 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2011-06-21  9:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 21, 2011 at 05:32:32PM +0800, Eric Miao wrote:
> 2011/5/22 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> > On Wed, May 11, 2011 at 05:29:02PM +0100, Russell King - ARM Linux wrote:
> >> On Wed, May 11, 2011 at 08:54:46AM -0700, Greg KH wrote:
> >> > On Wed, May 11, 2011 at 08:39:54AM +0200, Uwe Kleine-K?nig wrote:
> >> > > Hello Greg,
> >> > >
> >> > > On Fri, May 06, 2011 at 11:00:05AM +0200, Uwe Kleine-K?nig wrote:
> >> > > > Commit
> >> > > >
> >> > > > ? ? ? ? 09ba0de (USB: fsl_udc_core: prepare for SoCs with BE registers and descriptors)
> >> > > >
> >> > > > introduced two function pointers _fsl_readl and _fsl_writel in an #ifdef
> >> > > > CONFIG_PPC32 block and used then unconditionally in fsl_udc_probe.
> >> > > > To make the driver compile again this use has to be protected by
> >> > > > an #ifdef, too. Moreover ARM doesn't have flush_dcache_range so this
> >> > > > is #ifdefed out, too.
> >> > > >
> >> > > > Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> >> > > > ---
> >> > > > Hello,
> >> > > >
> >> > > > I'm unsure about getting rid of the flush_dcache_range. If powerpc needs
> >> > > > a flush ARM probably does, too, no?
> >> > > > If so, what it the right thing to do? Implement flush_dcache_range for
> >> > > > ARM (just wrapping flush_dcache_page?)?
> >> > > As Russell seem to be OK with the #ifdef, can you please take this
> >> > > patch?
> >> >
> >> > Ick, no.
> >>
> >> I never said I was OK with the #ifdef...
> > Ah, right, sorry.
> >
> >> > Come on, we don't have ifdefs in .c files for a reason, surely there is
> >> > a better fix for this some other way?
> >>
> >> I suggested ways to fix it, which apparantly got ignored. ?To repeat myself,
> >> what I said was:
> >>
> >> "Well, the folk introducing it should have added it to cachetlb.txt so
> >> that other folk know what the intentions of it are. ?At the moment it
> >> seems to be an unofficial extension with unknown semantics. ?Maybe the
> >> PPC folk can clear it up and fix other arches if they wish to make it
> >> an official arch cachetlb extension."
> > So what should we do? The fsl_udc_core driver currently fails to build
> > because it uses flush_dcache_range unconditionally. So the obvious ways
> > to fix it are:
> >
> > ?1) define flush_dcache_range
> > ? a) in arch/arm
> > ? b) in the driver
> > ?2) make the driver not use flush_dcache_range
> > ? a) #ifdef
> > ? b) revert 09ba0de (and probably some commits that depend on it)
> > ? c) use a different function to flush the cache
> 
> I see no reason why a dma_map_*() function couldn't be used here?
> 
> This is preventing the driver from being built. And the _fsl_readl stuffs,
> which was really introduced by PPC guys, yet it can be made generic
> enough I believe. The real requirement is really for a single kernel binary
> to run on different LE/BE configurations, which will hurt performance
> a bit and is normally not true on the i.MX SoCs, so that can be made as
> a config option in my POV, but not necessary #ifdef CONFIG_PPC32,
> maybe some better name

Hang on, let me get this straight.

This is an iMX driver, which was written avoiding the DMA API despite
it clearly doing DMA related stuff.  Allocating memory from kmalloc,
translating it to physical addresses using virt_to_phys, etc.

The PPC people decided to reuse it, and ended up introducing some custom
cache flushing APIs to get around the lack of dma_map_* usage.

Given that, I'm not surprised that this has ended up being broken.  Had
it been written _properly_ from the start (iow, using the DMA API) then
maybe the driver wouldn't be broken now.

I think the iMX people have got their just deserts for this.  There's a
lesson to be learnt there - always use the correct APIs from day one.

So, I have no sympathy for this self-inflicted breakage.  The solution:
fix the driver to use the proper APIs.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM
  2011-06-21  9:48             ` Russell King - ARM Linux
@ 2011-06-21  9:53               ` Russell King - ARM Linux
  0 siblings, 0 replies; 11+ messages in thread
From: Russell King - ARM Linux @ 2011-06-21  9:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jun 21, 2011 at 10:48:34AM +0100, Russell King - ARM Linux wrote:
> This is an iMX driver, which was written avoiding the DMA API despite
> it clearly doing DMA related stuff.  Allocating memory from kmalloc,
> translating it to physical addresses using virt_to_phys, etc.
> 
> The PPC people decided to reuse it, and ended up introducing some custom
> cache flushing APIs to get around the lack of dma_map_* usage.

Oops, no it wasn't - it was a freescale driver.  git log didn't go back
past the rename the imx people did.

But still, it needs converting to the DMA API rather than these private
arch bodges being introduced.

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2011-06-21  9:53 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20110505135029.0c068b8e@wker>
2011-05-06  9:00 ` [PATCH] [RFC] USB: fsl_udc_core: fix build-failure for ARM Uwe Kleine-König
2011-05-06  9:04   ` Russell King - ARM Linux
2011-05-06 10:03     ` Uwe Kleine-König
2011-05-06 18:47       ` Russell King - ARM Linux
2011-05-11  6:39   ` Uwe Kleine-König
2011-05-11 15:54     ` Greg KH
2011-05-11 16:29       ` Russell King - ARM Linux
2011-05-22  7:20         ` Uwe Kleine-König
2011-06-21  9:32           ` Eric Miao
2011-06-21  9:48             ` Russell King - ARM Linux
2011-06-21  9:53               ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.