From: Tim T. <tim...@ho...> - 2006-12-06 14:07:21
|
I'm try write a diver to control a device with a 16 bit data bus. After reading most of the chapter form "Linux Device Drivers, 3rd edition" and I searched the internet I found same examples but they are all for 8 bits. I'm not sure what I need to change so I can write and read 16 bits to my device. I already tried readw/writew inw/outw but it doesn't seem to work. Is there a sample driver or any document I can read. Any help is welcomed. Tim Timotheou _________________________________________________________________ WIN up to $10,000 in cash or prizes enter the Microsoft Office Live Sweepstakes http://clk..atdmt.com/MRT/go/aub0050001581mrt/direct/01/ |
From: Craig H. <cr...@gu...> - 2006-12-06 21:56:02
|
On Dec 6, 2006, at 6:07 AM, Tim Timotheou wrote: > I'm try write a diver to control a device with a 16 bit data bus. > After reading most of the chapter form "Linux Device Drivers, 3rd > edition" and > I searched the internet I found same examples but they are all for > 8 bits. > I'm not sure what I need to change so I can write and read 16 bits > to my device. > I already tried readw/writew inw/outw but it doesn't seem to work. > Is there a sample driver or any document I can read. Any help is > welcomed. The smc91x driver for the gumstix ethernet cards uses a 16-bit bus. The driver is in drivers/net/*smc91x* in the linux directory in the buildroot. The resource allocation stuff is in gumstix-smc91x.c and the rest of the driver in smc91x.{c|h} C |
From: Dave H. <dhy...@gm...> - 2006-12-06 19:57:46
|
Hi Tim, On 12/6/06, Tim Timotheou <tim...@ho...> wrote: > I'm try write a diver to control a device with a 16 bit data bus. > After reading most of the chapter form "Linux Device Drivers, 3rd edition" > and > I searched the internet I found same examples but they are all for 8 bits. > I'm not sure what I need to change so I can write and read 16 bits to my > device. > I already tried readw/writew inw/outw but it doesn't seem to work. > Is there a sample driver or any document I can read. Any help is welcomed. The bus on the gumstix connex connector is 32-bits wide. Peripherals on this bus are memory mapped, so it's really just a case of setting up the appropriate memory map entries at kernel initialization and then doing 16 bit memory accesses. If you take a look at the SMC driver (linux-2.6.18gum/drivers/net/gumstix-smc91x.c) you can see how it allocates memory resources starting at PXA_CS1_PHYS and PXA_CS2_PHYS. The smc driver itself uses macros like SMC_inw which are defined to be readw in the smc91x.h file. But readw will only work if the memory maps have been setup. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/ |