Re: [patch 2.6.18-git] SPI -- Freescale iMX SPI controller driver

From: David Brownell
Date: Sat Oct 07 2006 - 20:06:14 EST


On Saturday 07 October 2006 4:01 am, you wrote:
> > > > ...
> > > > ug. Why not simply open-code
> > > >
> > > > readl(addr + DATA);
> > ...
>
> What you're saying is clear.
> But I'm a little bit confused...what about the lot of definitions
> that use __REG or __REG2 macros to define registers address
> (inside imx-regs.h, pxa-regs.h and so on) ?

There are two conventions; accessing chip registers like globals
(matching chip documentation) is a second convention. The __REG32
style accessors can generate better code in many cases, too.

Thing is, you shouldn't create a third convention.


> > > > The use of loops_per_jiffy seems inappropriate. That's an IO-space read in
> > > > there, which is slow. This timeout will be very long indeed.
> > >
> > > Please suggest me what it's more appropriate.
> >
> > Pick a constant, use it.
>
> How should I choose the value of that costant ?

You could pick the value of loops_per_jiffy at HZ=1000,
for one example. You're using that limit to avoid
spinning too long with IRQs blocked, so you basically
just need a loop count which, if it's exceeded, will
pretty clearly indicate a hardware bug.

- Dave

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/