[PATCH V3 2/4] drivers/i2c/busses/i2c-at91.c: add new driver
Voss, Nikolaus
N.Voss at weinmann.de
Tue Nov 8 10:49:07 EST 2011
> > > > +#include <mach/at91_twi.h>
> > > > +#include <mach/board.h>
> > > > +#include <mach/cpu.h>
> > >
> > > avoid including <mach/*> on drivers.
> >
> > Should I move at91_twi.h to include/linux (omap does it like this,
> > other use the mach-include)?
>
> maybe, is at91_twi.h some sort of platform_data ? there's
> <linux/platform_data/...> for that.
It contains hardware register definitions, not really platform data.
So linux/i2c-at91.h (like linux/i2c-{omap,pxe,...}) would be the right place?
>
> > > > + if (irqstatus & AT91_TWI_TXCOMP) {
> > > > + at91_disable_twi_interrupts(dev);
> > > > + dev->transfer_status = status;
> > > > + complete(&dev->cmd_complete);
> > > > + }
> > > > + else if (irqstatus & AT91_TWI_RXRDY) {
> > > > + at91_twi_read_next_byte(dev);
> > > > + }
> > > > + else if (irqstatus & AT91_TWI_TXRDY) {
> > > > + at91_twi_write_next_byte(dev);
> > > > + }
> > > > + else {
> > > > + return IRQ_NONE;
> > >
> > > coding style is wrong. Also, are those IRQ events really mutually
> exclusive ??
> >
> > These are indeed mutually exclusive (semantically).
>
> so you couldn't have AT91_TWI_TXCOMP and AT91_TWI_RXRDY set when you read
> irqstatus ?
Yes, I do have this, but in this constellation only TXCOMP is relevant and
all other flags can be ignored (because the transfer is finished).
Niko
More information about the linux-arm-kernel
mailing list