Re: driver model advice

From: Geert Uytterhoeven
Date: Mon Jun 08 2009 - 02:36:49 EST


On Mon, Jun 8, 2009 at 00:45, Alexander Clouter<alex@xxxxxxxxxxxxx> wrote:
> For a while I have been maintaining the TS-7800 mainline support[1] and
> decided to attempt to properly address support for the FPGA on the
> board.
>
> Currently the solution I'm using[2] is not very flexible and scalable as
> for every device that is added the platform code grows with it. ÂI also
> think it's just not very pretty.
>
> I have been reading various sources of documentation regarding the
> driver model and relevant sections in the LDD tomb and felt that making
> the FPGA behave as a bus seemed a neat way to do things.
>
> A quick overview of the approach I'm using is that the bus code adds and
> removes the devices depending on the bus's state ('online' or
> 'offline'). ÂWhen going online (or as new drivers are insmod'ed) the bus
> decides if the 'discover' function should be executed depending on the
> FPGA bitstream magic number and then if the driver's discover() function
> decides the device is present it is added to the bus.

You can make it a separate bus...

> The code for my amendments can be found (it's 30kB hence why it's not
> inline), it's been written against 2.6.30-rc7:
>
> http://stuff.digriz.org.uk/ts78xx-fpga/fpga-device-work.diff
>
> and the my .config file is:
>
> http://stuff.digriz.org.uk/ts78xx-fpga/ts78xx.config
>
> One thing that might make people 'queasy' is that there is some wrapper
> code for platform drivers. ÂAlthough all the examples I have coded up
> use platform drivers and create platform devices, there are some drivers
> that are non-platform based in the works (GPIO, AVR, ISA bus, etc). ÂI
> felt the appropriate approach was (bearing in mind that different FPGA
> bitstreams implement possibly overlapping/partial duplicate
> functionality) to use a platform wrapper, the platform device being a
> child of my ts78xx-fgpa device.

... or you can make the ts78xx-fpga device a multi-function device
(drivers/mfd).

(In case the mfd-ers read this: recently I've been looking at using the mfd code
for Amiga Zorro expansion boards. As most Zorro boards are made from discrete
components, several of them are actually multi-function devices,
which prohibits
me from just using zorro_driver).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
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/