Skip to content

Commit

Permalink
FMC: add a software carrier driver
Browse files Browse the repository at this point in the history
This fake carrier is designed to help FMC users understand how a
carrier driver works, and to experiment the behaviour with EEPROM
reprogramming (with a mezzanine driver commited later). This carrier
can register up to 4 (fake) mezzanines.

We have real carriers (both on PCI-E and VME), but they are bigger
things and are not part of this submission.

Signed-off-by: Alessandro Rubini <[email protected]>
Acked-by: Juan David Gonzalez Cobas <[email protected]>
Acked-by: Emilio G. Cota <[email protected]>
Acked-by: Samuel Iglesias Gonsalvez <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
rubini authored and gregkh committed Jun 18, 2013
1 parent 022c674 commit 6c62a89
Show file tree
Hide file tree
Showing 5 changed files with 407 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Documentation/fmc/00-INDEX
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ mezzanine.txt

identifiers.txt
- how identification and matching works

fmc-fakedev.txt
- about drivers/fmc/fmc-fakedev.ko
36 changes: 36 additions & 0 deletions Documentation/fmc/fmc-fakedev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
fmc-fakedev
===========

This package includes a software-only device, called fmc-fakedev, which
is able to register up to 4 mezzanines (by default it registers one).
Unlike the SPEC driver, which creates an FMC device for each PCI cards
it manages, this module creates a single instance of its set of
mezzanines.

It is meant as the simplest possible example of how a driver should be
written, and it includes a fake EEPROM image (built using the tools
described in *note FMC Identification::),, which by default is
replicated for each fake mezzanine.

You can also use this device to verify the match algorithms, by asking
it to test your own EEPROM image. You can provide the image by means of
the eeprom= module parameter: the new EEPROM image is loaded, as usual,
by means of the firmware loader. This example shows the defaults and a
custom EEPROM image:

spusa.root# insmod fmc-fakedev.ko
[ 99.971247] fake-fmc-carrier: mezzanine 0
[ 99.975393] Manufacturer: fake-vendor
[ 99.979624] Product name: fake-design-for-testing
spusa.root# rmmod fmc-fakedev
spusa.root# insmod fmc-fakedev.ko eeprom=fdelay-eeprom.bin
[ 121.447464] fake-fmc-carrier: Mezzanine 0: eeprom "fdelay-eeprom.bin"
[ 121.462725] fake-fmc-carrier: mezzanine 0
[ 121.466858] Manufacturer: CERN
[ 121.470477] Product name: FmcDelay1ns4cha
spusa.root# rmmod fmc-fakedev

After loading the device, you can use the write_ee method do modify its
own internal fake EEPROM: whenever the image is overwritten starting at
offset 0, the module will unregister and register again the FMC device.
This is shown in fmc-write-eeprom.txt
11 changes: 11 additions & 0 deletions drivers/fmc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ menuconfig FMC
The framework was born outside of the kernel and at this time
the off-tree code base is more complete. Code and documentation
is at git://ohwr.org/fmc-projects/fmc-bus.git .

if FMC

config FMC_FAKEDEV
tristate "FMC fake device (software testing)"
help
This is a fake carrier, bringing a default EEPROM content
that can be rewritten at run time and usef for matching
mezzanines.

endif # FMC
2 changes: 2 additions & 0 deletions drivers/fmc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ fmc-y += fmc-match.o
fmc-y += fmc-sdb.o
fmc-y += fru-parse.o
fmc-y += fmc-dump.o

obj-$(CONFIG_FMC_FAKEDEV) += fmc-fakedev.o
Loading

0 comments on commit 6c62a89

Please sign in to comment.