spi device from handle

Martyn Welch martyn.welch at ge.com
Fri Jan 13 20:32:09 EST 2012


On 12/01/12 16:02, Michael Remski wrote:
> kernel 2.6.33
> 
> relevant section of dts has:
> spi at 7000 {
>     fpga0: fpga at 0 {
>         #address-cells = <1>;
>         #size-cells = <0>;
>         compatible = "fsl, espi-fpga";
>         reg = <0>;
>         linux,modalias = "spidev";
>         spi-max-frequency = <1572864>;
>     };
> }
> 
> 
> I have another device driver that needs to talk to this fpga device, but for
> the life of me I can't figure out the appropriate hooks to get there. The
> device can be talked to from userland via /dev/spixyx.k, but how do I get to
> the device from another driver?
> 
> Any little hints would be appreciated.  Upgrading kernel is not an option
> (sorry).
> 

We have a FPGA that provides a number of different functions. Each function is
provided in a distinct register set. We have multiple entries in the DTS, one
for each piece of functionality. The drivers are then able to bind separately
against the required registers. So in the case of
"arch/powerpc/boot/dts/gef_ppc9a.dts", "fpga at 4,0", "wdt at 4,2000", "wdt at 4,2010",
"pic at 4,4000" and "gpio at 7,14000" are all provided by the same FPGA and each has
it's own driver. However, I've just realised our FPGA is memory mapped and
looking at your DTS snippet yours isn't.

The only clean way I can think about doing it via spi would be to have a
driver that provides an in-kernel interface to access the functionality in the
FPGA (which binds to this entry in the DTS), then modify the driver providing
the user space access to use that and also use that interface for other
drivers needing access to the FPGA. Depending on the level of extrapolation
provided by the existing user space driver, this may be possible without
breaking anything in user space.

Martyn

-- 
Martyn Welch (Lead Software Engineer)  | Registered in England and Wales
GE Intelligent Platforms               | (3828642) at 100 Barbirolli Square
T +44(0)1327322748                     | Manchester, M2 3AB
E martyn.welch at ge.com                  | VAT:GB 927559189


More information about the Linuxppc-dev mailing list