Skip to contentSkip to conversation

FMC: resend sample drivers

PATCH In review Alessandro Rubini 2 participants 5 messages Jun 18, 2013 Documentation

lore
Share & tools
lore
#0 lore raw

v2 cover FMC: resend sample drivers

As suggested by Greg-KH [1] I'm resending the two example submodules (one carrier driver and one mezzanine driver) with a proper licence text for BSD. Among the various wordings, I chose the shortest one, as used by a number of drivers/net/wireless/ files. Thank you David for checking the distribution policies.

I rebased to next-20130617 and rebuilt, with no conflicts. In any of the patches of the original series.

[1] https://lkml.org/lkml/2013/6/17/772:
"Just redo those two patches and send them as 'v2'")

Alessandro Rubini (2):
FMC: add a software carrier driver
FMC: add a software mezzanine driver

 Documentation/fmc/00-INDEX        |    6 +
 Documentation/fmc/fmc-fakedev.txt |   36 ++++
 Documentation/fmc/fmc-trivial.txt |   17 ++
 drivers/fmc/Kconfig               |   18 ++
 drivers/fmc/Makefile              |    3 +
 drivers/fmc/fmc-fakedev.c         |  355 +++++++++++++++++++++++++++++++++++++
 drivers/fmc/fmc-trivial.c         |  107 +++++++++++
 7 files changed, 542 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/fmc/fmc-fakedev.txt
 create mode 100644 Documentation/fmc/fmc-trivial.txt
 create mode 100644 drivers/fmc/fmc-fakedev.c
 create mode 100644 drivers/fmc/fmc-trivial.c
Signature · 1 line
1.7.7.2
#1 lore raw

PATCH v2 1/2 FMC: add a software carrier driver

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.

---
 Documentation/fmc/00-INDEX        |    3 +
 Documentation/fmc/fmc-fakedev.txt |   36 ++++
 drivers/fmc/Kconfig               |   11 ++
 drivers/fmc/Makefile              |    2 +
 drivers/fmc/fmc-fakedev.c         |  355 +++++++++++++++++++++++++++++++++++++
 5 files changed, 407 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/fmc/fmc-fakedev.txt
 create mode 100644 drivers/fmc/fmc-fakedev.c
Documentation/fmc/00-INDEX +3 -0
index 71304b7..34df5cf 100644
@@ -24,3 +24,6 @@ mezzanine.txt
 
 identifiers.txt
 	- how identification and matching works
+
+fmc-fakedev.txt
+	- about drivers/fmc/fmc-fakedev.ko
Documentation/fmc/fmc-fakedev.txt new file +36 -0
new file mode 100644
index 0000000..e85b74a
@@ -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
drivers/fmc/Kconfig +11 -0
index e287902..505e96b 100644
@@ -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
drivers/fmc/Makefile +2 -0
index df98939..9832b79 100644
@@ -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
drivers/fmc/fmc-fakedev.c new file +355 -0

355 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#2 lore raw

PATCH v2 2/2 FMC: add a software mezzanine driver

In reply to Alessandro Rubini

This simple do-nothing mezzanine driver shows how to write a mezzanine driver, that can also handle interrupts reported by the carrier.

---
 Documentation/fmc/00-INDEX        |    3 +
 Documentation/fmc/fmc-trivial.txt |   17 ++++++
 drivers/fmc/Kconfig               |    7 +++
 drivers/fmc/Makefile              |    1 +
 drivers/fmc/fmc-trivial.c         |  107 +++++++++++++++++++++++++++++++++++++
 5 files changed, 135 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/fmc/fmc-trivial.txt
 create mode 100644 drivers/fmc/fmc-trivial.c
Documentation/fmc/00-INDEX +3 -0
index 34df5cf..c22d687 100644
@@ -27,3 +27,6 @@ identifiers.txt
 
 fmc-fakedev.txt
 	- about drivers/fmc/fmc-fakedev.ko
+
+fmc-trivial.txt
+	- about drivers/fmc/fmc-trivial.ko
Documentation/fmc/fmc-trivial.txt new file +17 -0
new file mode 100644
index 0000000..d1910bc
@@ -0,0 +1,17 @@
+fmc-trivial
+===========
+
+The simple module fmc-trivial is just a simple client that registers an
+interrupt handler. I used it to verify the basic mechanism of the FMC
+bus and how interrupts worked.
+
+The module implements the generic FMC parameters, so it can program a
+different gateware file in each card. The whole list of parameters it
+accepts are:
+
+`busid='
+`gateware='
+     Generic parameters. See mezzanine.txt
+
+
+This driver is worth reading, in my opinion.
drivers/fmc/Kconfig +7 -0
index 505e96b..7eacef9 100644
@@ -25,4 +25,11 @@ config FMC_FAKEDEV
 	  that can be rewritten at run time and usef for matching
 	  mezzanines.
 
+config FMC_TRIVIAL
+	tristate "FMC trivial mezzanine driver (software testing)"
+	help
+	  This is a fake mezzanine driver, to show how FMC works and test it.
+	  The driver also handles interrupts (we used it with a real carrier
+	  before the mezzanines were produced)
+
 endif # FMC
drivers/fmc/Makefile +1 -0
index 9832b79..52624e6 100644
@@ -8,3 +8,4 @@ fmc-y += fru-parse.o
 fmc-y += fmc-dump.o
 
 obj-$(CONFIG_FMC_FAKEDEV) += fmc-fakedev.o
+obj-$(CONFIG_FMC_TRIVIAL) += fmc-trivial.o
drivers/fmc/fmc-trivial.c new file +107 -0

107 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#3 lore raw
In reply to Alessandro Rubini
Quoted 9 lines · Alessandro Rubini

As suggested by Greg-KH [1] I'm resending the two example submodules (one carrier driver and one mezzanine driver) with a proper licence text for BSD. Among the various wordings, I chose the shortest one, as used by a number of drivers/net/wireless/ files. Thank you David for checking the distribution policies.

I rebased to next-20130617 and rebuilt, with no conflicts. In any of the patches of the original series.

Quoted 6 lines

[1] https://lkml.org/lkml/2013/6/17/772:
"Just redo those two patches and send them as 'v2'")

Alessandro Rubini (2):
FMC: add a software carrier driver
FMC: add a software mezzanine driver

Did I only not apply 2 patches? I thought there should be some more that I'm missing here. Can you resend _everything_ that I need to apply that I haven't already?

thanks,

greg k-h

#4 lore raw
Quoted 3 lines

Did I only not apply 2 patches? I thought there should be some more that I'm missing here. Can you resend _everything_ that I need to apply that I haven't already?

Ok. I wondered which magic tools of yours would use "v2" to rebuild the series in the same order. Sneding the whole 6-lot in a few minutes.

/alessandro