serial_ns16550 driver question

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Wed Jul 20 23:12:24 EDT 2011


On 22:31 Wed 20 Jul     , Sascha Hauer wrote:
> On Wed, Jul 20, 2011 at 11:51:04PM +0400, Antony Pavlov wrote:
> > Hi!
> > 
> > In include/ns16550.h we have:
> > 
> > struct NS16550_plat {
> >         unsigned int clock;
> >         unsigned char f_caps;
> >         /**
> >          * register read access capability
> >          */
> >         unsigned int (*reg_read) (unsigned long base, unsigned char reg_offset);
> >         /**
> >          * register write access capability
> >          */
> >         void (*reg_write) (unsigned int val, unsigned long base,
> >                                     unsigned char reg_offset);
> > };
> > 
> > Why reg_read and reg_write's argument base has type unsigned long?
> > IMHO pointer type (void * or char *)  is more natural.
> 
> You're right, I also wondered about this recently when looking at a
> patch on the list. I would also rather see void __iomem *. The problem
> is that this driver is also used on X86 which uses inb/outb which take
> an integer argument.
> The Linux driver works around this by having a membase and a iobase
> field along with different register accessors. While being cleaner
> I'm unsure if we want to go this way.

we can do it via resoure and the flasgs IORESOURCE_MEM_8BIT,
IORESOURCE_MEM_168BITi etc..

Best Regards,
J.



More information about the barebox mailing list