Skip to contentSkip to conversation

FMC: resending unapplied patches

PATCH New Alessandro Rubini 1 participant 7 messages Jun 18, 2013 Documentation

lore
Share & tools
lore
#0 lore raw

v3 cover FMC: resending unapplied patches

Six patches from the series I initially sent on Jun 12.

Changes in V3: all 6 yet unapplied by greg are resent, in correct order.

Changes in V2: turned a generic "public domain" note for code to be reused into a proper BSD-like license, but I only resent affected patches, in error.

Alessandro Rubini (6):
FMC: add core bus driver
FMC: add documentation for the core
FMC: add a software carrier driver
FMC: add a software mezzanine driver
FMC: add a driver to write mezzanine EEPROM
FMC: add a char-device mezzanine driver

 Documentation/00-INDEX                 |    2 +
 Documentation/fmc/00-INDEX             |   38 ++++
 Documentation/fmc/API.txt              |   47 +++++
 Documentation/fmc/FMC-and-SDB.txt      |   88 ++++++++
 Documentation/fmc/carrier.txt          |  311 ++++++++++++++++++++++++++++
 Documentation/fmc/fmc-chardev.txt      |   64 ++++++
 Documentation/fmc/fmc-fakedev.txt      |   36 ++++
 Documentation/fmc/fmc-trivial.txt      |   17 ++
 Documentation/fmc/fmc-write-eeprom.txt |  125 +++++++++++
 Documentation/fmc/identifiers.txt      |  168 +++++++++++++++
 Documentation/fmc/mezzanine.txt        |  123 +++++++++++
 Documentation/fmc/parameters.txt       |   56 +++++
 drivers/fmc/Kconfig                    |   34 +++
 drivers/fmc/Makefile                   |    9 +
 drivers/fmc/fmc-chardev.c              |  197 ++++++++++++++++++
 drivers/fmc/fmc-core.c                 |  274 ++++++++++++++++++++++++-
 drivers/fmc/fmc-dump.c                 |  100 +++++++++
 drivers/fmc/fmc-fakedev.c              |  355 ++++++++++++++++++++++++++++++++
 drivers/fmc/fmc-match.c                |  114 ++++++++++
 drivers/fmc/fmc-sdb.c                  |  265 ++++++++++++++++++++++++
 drivers/fmc/fmc-trivial.c              |  107 ++++++++++
 drivers/fmc/fmc-write-eeprom.c         |  176 ++++++++++++++++
 drivers/fmc/fru-parse.c                |   82 ++++++++
 23 files changed, 2787 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/fmc/00-INDEX
 create mode 100644 Documentation/fmc/API.txt
 create mode 100644 Documentation/fmc/FMC-and-SDB.txt
 create mode 100644 Documentation/fmc/carrier.txt
 create mode 100644 Documentation/fmc/fmc-chardev.txt
 create mode 100644 Documentation/fmc/fmc-fakedev.txt
 create mode 100644 Documentation/fmc/fmc-trivial.txt
 create mode 100644 Documentation/fmc/fmc-write-eeprom.txt
 create mode 100644 Documentation/fmc/identifiers.txt
 create mode 100644 Documentation/fmc/mezzanine.txt
 create mode 100644 Documentation/fmc/parameters.txt
 create mode 100644 drivers/fmc/fmc-chardev.c
 create mode 100644 drivers/fmc/fmc-dump.c
 create mode 100644 drivers/fmc/fmc-fakedev.c
 create mode 100644 drivers/fmc/fmc-match.c
 create mode 100644 drivers/fmc/fmc-sdb.c
 create mode 100644 drivers/fmc/fmc-trivial.c
 create mode 100644 drivers/fmc/fmc-write-eeprom.c
 create mode 100644 drivers/fmc/fru-parse.c
Signature · 1 line
1.7.7.2
#1 lore raw

PATCH v3 1/6 FMC: add core bus driver

This module offers registration services for both carriers (i.e. devices) and mezzanines (i.e. drivers). The matching for devices and drivers is performed according to the IPMI standard for FRU devices (Field Replaceable Units).

The code includes support for parsing an SDB tree if present in the FPGA, and dumping it for diagnostics. SDB is not mandatory.

Files in this commit correspond to commit ab23167f in the master branch of the project hosted on ohwr.org.

---
 drivers/fmc/Makefile    |    4 +
 drivers/fmc/fmc-core.c  |  274 ++++++++++++++++++++++++++++++++++++++++++++++-
 drivers/fmc/fmc-dump.c  |  100 +++++++++++++++++
 drivers/fmc/fmc-match.c |  114 ++++++++++++++++++++
 drivers/fmc/fmc-sdb.c   |  265 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/fmc/fru-parse.c |   82 ++++++++++++++
 6 files changed, 838 insertions(+), 1 deletions(-)
 create mode 100644 drivers/fmc/fmc-dump.c
 create mode 100644 drivers/fmc/fmc-match.c
 create mode 100644 drivers/fmc/fmc-sdb.c
 create mode 100644 drivers/fmc/fru-parse.c
drivers/fmc/Makefile +4 -0
index a2784d8..df98939 100644
@@ -2,3 +2,7 @@
 obj-$(CONFIG_FMC) += fmc.o
 
 fmc-y = fmc-core.o
+fmc-y += fmc-match.o
+fmc-y += fmc-sdb.o
+fmc-y += fru-parse.o
+fmc-y += fmc-dump.o
drivers/fmc/fmc-core.c +273 -1

286 lines not on this page · raw message

drivers/fmc/fmc-dump.c new file +100 -0

100 lines not on this page · raw message

drivers/fmc/fmc-match.c new file +114 -0

114 lines not on this page · raw message

drivers/fmc/fmc-sdb.c new file +265 -0

265 lines not on this page · raw message

drivers/fmc/fru-parse.c new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#2 lore raw

PATCH v3 2/6 FMC: add documentation for the core

In reply to Alessandro Rubini

This is selected sections of the current manual for fmc-bus, as developed outside of the kernel before submission.

Like the other patches in this set, it corresponds to commit ab23167f of the repository at ohwr.org

---
 Documentation/00-INDEX            |    2 +
 Documentation/fmc/00-INDEX        |   26 +++
 Documentation/fmc/API.txt         |   47 ++++++
 Documentation/fmc/FMC-and-SDB.txt |   88 +++++++++++
 Documentation/fmc/carrier.txt     |  311 +++++++++++++++++++++++++++++++++++++
 Documentation/fmc/identifiers.txt |  168 ++++++++++++++++++++
 Documentation/fmc/mezzanine.txt   |  123 +++++++++++++++
 Documentation/fmc/parameters.txt  |   56 +++++++
 8 files changed, 821 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/fmc/00-INDEX
 create mode 100644 Documentation/fmc/API.txt
 create mode 100644 Documentation/fmc/FMC-and-SDB.txt
 create mode 100644 Documentation/fmc/carrier.txt
 create mode 100644 Documentation/fmc/identifiers.txt
 create mode 100644 Documentation/fmc/mezzanine.txt
 create mode 100644 Documentation/fmc/parameters.txt
Documentation/00-INDEX +2 -0
index 45b3df9..0c4cc68 100644
@@ -187,6 +187,8 @@ firmware_class/
 	- request_firmware() hotplug interface info.
 flexible-arrays.txt
 	- how to make use of flexible sized arrays in linux
+fmc/
+	- information about the FMC bus abstraction
 frv/
 	- Fujitsu FR-V Linux documentation.
 futex-requeue-pi.txt
Documentation/fmc/00-INDEX new file +26 -0
new file mode 100644
index 0000000..71304b7
@@ -0,0 +1,26 @@
+
+Documentation in this directory comes from sections of the manual we
+wrote for the externally-developed fmc-bus package. The complete
+manual as of today (2013-02) is available in PDF format at
+http://www.ohwr.org/projects/fmc-bus/files
+
+00-INDEX
+	- this file.
+
+FMC-and-SDB.txt
+	- What are FMC and SDB, basic concepts for this framework
+
+API.txt
+	- The functions that are exported by the bus driver
+
+parameters.txt
+	- The module parameters
+
+carrier.txt
+	- writing a carrier (a device)
+
+mezzanine.txt
+	- writing code for your mezzanine (a driver)
+
+identifiers.txt
+	- how identification and matching works
Documentation/fmc/API.txt new file +47 -0

47 lines not on this page · raw message

Documentation/fmc/FMC-and-SDB.txt new file +88 -0

88 lines not on this page · raw message

Documentation/fmc/carrier.txt new file +311 -0

311 lines not on this page · raw message

Documentation/fmc/identifiers.txt new file +168 -0

168 lines not on this page · raw message

Documentation/fmc/mezzanine.txt new file +123 -0

123 lines not on this page · raw message

Documentation/fmc/parameters.txt new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#3 lore raw

PATCH v3 3/6 FMC: add a software carrier driver

In reply to Alessandro Rubini

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
#4 lore raw

PATCH v3 4/6 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
#5 lore raw

PATCH v3 5/6 FMC: add a driver to write mezzanine EEPROM

In reply to Alessandro Rubini

This driver allows to reprogram the EEPROM in a mezzanine, to store its own identifiers during manufacturing or to save other useful data.

---
 Documentation/fmc/00-INDEX             |    3 +
 Documentation/fmc/fmc-write-eeprom.txt |  125 ++++++++++++++++++++++
 drivers/fmc/Kconfig                    |    8 ++
 drivers/fmc/Makefile                   |    1 +
 drivers/fmc/fmc-write-eeprom.c         |  176 ++++++++++++++++++++++++++++++++
 5 files changed, 313 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/fmc/fmc-write-eeprom.txt
 create mode 100644 drivers/fmc/fmc-write-eeprom.c
Documentation/fmc/00-INDEX +3 -0
index c22d687..177c3e4 100644
@@ -30,3 +30,6 @@ fmc-fakedev.txt
 
 fmc-trivial.txt
 	- about drivers/fmc/fmc-trivial.ko
+
+fmc-write-eeprom.txt
+        - about drivers/fmc/fmc-write-eeprom.ko
Documentation/fmc/fmc-write-eeprom.txt new file +125 -0

125 lines not on this page · raw message

drivers/fmc/Kconfig +8 -0
index 7eacef9..2bb1953 100644
@@ -32,4 +32,12 @@ config FMC_TRIVIAL
 	  The driver also handles interrupts (we used it with a real carrier
 	  before the mezzanines were produced)
 
+config FMC_WRITE_EEPROM
+	tristate "FMC mezzanine driver to write I2C EEPROM"
+	help
+	  This driver matches every mezzanine device and can write the
+	  internal EEPROM of the PCB, using the firmware loader to get
+	  its binary and the function carrier->reprogram to actually do it.
+	  It is useful when the mezzanines are produced.
+
 endif # FMC
drivers/fmc/Makefile +1 -0
index 52624e6..13701fa 100644
@@ -9,3 +9,4 @@ fmc-y += fmc-dump.o
 
 obj-$(CONFIG_FMC_FAKEDEV) += fmc-fakedev.o
 obj-$(CONFIG_FMC_TRIVIAL) += fmc-trivial.o
+obj-$(CONFIG_FMC_WRITE_EEPROM) += fmc-write-eeprom.o
drivers/fmc/fmc-write-eeprom.c new file +176 -0

176 lines not on this page · raw message

Signature · 1 line
1.7.7.2
#6 lore raw

PATCH v3 6/6 FMC: add a char-device mezzanine driver

In reply to Alessandro Rubini

This driver exports the memory area associated with the mezzanine card as a misc device, so users can access registers.

---
 Documentation/fmc/00-INDEX        |    5 +-
 Documentation/fmc/fmc-chardev.txt |   64 ++++++++++++
 drivers/fmc/Kconfig               |    8 ++
 drivers/fmc/Makefile              |    1 +
 drivers/fmc/fmc-chardev.c         |  197 +++++++++++++++++++++++++++++++++++++
 5 files changed, 274 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/fmc/fmc-chardev.txt
 create mode 100644 drivers/fmc/fmc-chardev.c
Documentation/fmc/00-INDEX +4 -1
index 177c3e4..431c695 100644
@@ -32,4 +32,7 @@ fmc-trivial.txt
 	- about drivers/fmc/fmc-trivial.ko
 
 fmc-write-eeprom.txt
-        - about drivers/fmc/fmc-write-eeprom.ko
+	- about drivers/fmc/fmc-write-eeprom.ko
+
+fmc-chardev.txt
+	- about drivers/fmc/fmc-chardev.ko
Documentation/fmc/fmc-chardev.txt new file +64 -0

64 lines not on this page · raw message

drivers/fmc/Kconfig +8 -0
index 2bb1953..c01cf45 100644
@@ -40,4 +40,12 @@ config FMC_WRITE_EEPROM
 	  its binary and the function carrier->reprogram to actually do it.
 	  It is useful when the mezzanines are produced.
 
+config FMC_CHARDEV
+	tristate "FMC mezzanine driver that registers a char device"
+	help
+	  This driver matches every mezzanine device and allows user
+	  space to read and write registers using a char device. It
+	  can be used to write user-space drivers, or just get
+	  aquainted with a mezzanine before writing its specific driver.
+
 endif # FMC
drivers/fmc/Makefile +1 -0
index 13701fa..b945291 100644
@@ -10,3 +10,4 @@ fmc-y += fmc-dump.o
 obj-$(CONFIG_FMC_FAKEDEV) += fmc-fakedev.o
 obj-$(CONFIG_FMC_TRIVIAL) += fmc-trivial.o
 obj-$(CONFIG_FMC_WRITE_EEPROM) += fmc-write-eeprom.o
+obj-$(CONFIG_FMC_CHARDEV) += fmc-chardev.o
drivers/fmc/fmc-chardev.c new file +197 -0

197 lines not on this page · raw message

Signature · 1 line
1.7.7.2