drivers/fmc: bus support for ANSI-VITA 57.1
Subsystems (2)
cover drivers/fmc: bus support for ANSI-VITA 57.1
This is an RFC for upstreaming the Linux bus abstraction for FMC. The following text is a slightly modified extract from the documentation, which is included in the fmc-bus package. The code I'm submitting is currently maintained outside of the kernel proper. See
http://www.ohwr.org/projects/fmc-bus/ . The public repository is atgit://ohwr.org/fmc-projects/fmc-bus.git and the current manual is at
http://www.ohwr.org/attachments/download/1845/fmc-bus-2013-01-release.pdf
The whole patch-set is sent to lkml, Greg K H (for drivers/), Rob Landley and the linux-doc list (both for Documentation/).
FMC is a standard developed by the VME consortium called VITA (VMEbus International Trade Association) and ratified by ANSI, the American National Standard Institute. The official documentation is called "ANSI-VITA 57.1". The wikipedia article is
http://en.wikipedia.org/wiki/FMC_%E2%80%93_FPGA_Mezzanine_Card
FMC (FPGA Mezzanine Card) is what we use for our I/O devices, in the context of White Rabbit and related hardware. White Rabbit is a multi-lab synchronization project; bot software and hardware for WR is hosted at www.ohwr.org .
In our I/O environments we need to write drivers for each mezzanine card, and such drivers must work regardless of the carrier being used. To achieve this, we abstract the FMC interface.
The FMC card is an almost square PCB, around 70x75 millimeters, that is called mezzanine in code and documentation under drivers/fmc. It usually lives plugged into another PCB for power supply and control; such bigger circuit board is called carrier from now on, and a single carrier may host more than one mezzanine.
We have a carrier for PCI-E called SPEC and one for VME called SVEC,
(http://www.ohwr.org/projects/spec/wiki and
http://www.ohwr.org/projects/svec/wiki) but more are planned. Also, we support stand-alone devices (usually plugged on a SPEC card), controlled through Etherbone, which in turn is developed by GSI.de . This submission does not include drivers for specific cards like the SPEC or SVEC, but has software-only carriers and drivers. Nothing in the submission in specific to CERN: the code is designed to match FMC features, not our own specific needs.
In the typical application the mezzanine is mostly analog while the carrier is mostly digital, and hosts an FPGA that must be configured to match the specific mezzanine and the desired application. Thus, you may need to load different FPGA images to drive different instances of the same mezzanine.
FMC, as such, is not a bus in the usual meaning of the term, because most carriers have only one connector, and carriers with several connectors have completely separate electrical connections to them. This package, however, implements a bus as a software abstraction.
SDB (Self Describing Bus) is a set of data structures that we use for enumerating the internal structure of an FPGA image. We also use it as a filesystem inside the FMC EEPROM, but this submission only uses it to enumerate cores inside and FPGA design.
SDB is not mandatory for use of this FMC kernel bus, but if you have SDB this package can make good use of it. SDB itself is developed in the fpga-config-space OHWR project. The link to the repository is `git://ohwr.org/hdl-core-lib/fpga-config-space.git' and what is used in this project lives in the sdbfs subdirectory in there.
Alessandro Rubini (8):
FMC: create drivers/fmc and toplevel Kconfig question
FMC: add needed headers
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 | 44 +++++ Documentation/fmc/FMC-and-SDB.txt | 89 +++++++++ Documentation/fmc/carrier.txt | 311 ++++++++++++++++++++++++++++++++ Documentation/fmc/fmc-chardev.txt | 64 +++++++ Documentation/fmc/fmc-fakedev.txt | 30 +++ Documentation/fmc/fmc-trivial.txt | 17 ++ Documentation/fmc/fmc-write-eeprom.txt | 112 ++++++++++++ Documentation/fmc/identifiers.txt | 169 +++++++++++++++++ Documentation/fmc/mezzanine.txt | 123 +++++++++++++ Documentation/fmc/parameters.txt | 56 ++++++ MAINTAINERS | 9 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/fmc/Kconfig | 51 ++++++ drivers/fmc/Makefile | 13 ++ drivers/fmc/fmc-chardev.c | 197 ++++++++++++++++++++ drivers/fmc/fmc-core.c | 255 ++++++++++++++++++++++++++ drivers/fmc/fmc-dump.c | 100 ++++++++++ drivers/fmc/fmc-fakedev.c | 308 +++++++++++++++++++++++++++++++ drivers/fmc/fmc-match.c | 108 +++++++++++ drivers/fmc/fmc-sdb.c | 258 ++++++++++++++++++++++++++ drivers/fmc/fmc-trivial.c | 101 +++++++++++ drivers/fmc/fmc-write-eeprom.c | 170 +++++++++++++++++ drivers/fmc/fru-parse.c | 82 +++++++++ include/linux/fmc-sdb.h | 36 ++++ include/linux/fmc.h | 237 ++++++++++++++++++++++++ include/linux/ipmi-fru.h | 135 ++++++++++++++ include/linux/sdb.h | 130 +++++++++++++ 30 files changed, 3248 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/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/Kconfig create mode 100644 drivers/fmc/Makefile create mode 100644 drivers/fmc/fmc-chardev.c create mode 100644 drivers/fmc/fmc-core.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 create mode 100644 include/linux/fmc-sdb.h create mode 100644 include/linux/fmc.h create mode 100644 include/linux/ipmi-fru.h create mode 100644 include/linux/sdb.h
Signature · 1 line
1.7.7.2
PATCH 1/8 FMC: create drivers/fmc and toplevel Kconfig question
This commit creates the drivers/fmc directory and puts the necessary hooks for kbuild and kconfig. The code is currently a placeholder that only registers an empty bus.
--- MAINTAINERS | 9 +++++++++ drivers/Kconfig | 2 ++ drivers/Makefile | 1 + drivers/fmc/Kconfig | 17 +++++++++++++++++ drivers/fmc/Makefile | 4 ++++ drivers/fmc/fmc-core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 0 deletions(-) create mode 100644 drivers/fmc/Kconfig create mode 100644 drivers/fmc/Makefile create mode 100644 drivers/fmc/fmc-core.c
MAINTAINERS +9 -0
@@ -3253,6 +3253,15 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/floppy.git S: Odd fixes F: drivers/block/floppy.c +FMC SUBSYSTEM +M: Alessandro Rubini <[email protected]> +W: http://www.ohwr.org/projects/fmc-bus +S: Supported +F: drivers/fmc/ +F: include/linux/fmc*.h +F: include/linux/ipmi-fru.h +K: fmc_d.*register + FPU EMULATOR M: Bill Metzenthen <[email protected]> W: http://floatingpoint.sourceforge.net/emulator/index.html
drivers/Kconfig +2 -0
@@ -162,4 +162,6 @@ source "drivers/irqchip/Kconfig" source "drivers/ipack/Kconfig" +source "drivers/fmc/Kconfig" + endmenu
drivers/Makefile +1 -0
@@ -150,3 +150,4 @@ obj-$(CONFIG_IIO) += iio/ obj-$(CONFIG_VME_BUS) += vme/ obj-$(CONFIG_IPACK_BUS) += ipack/ obj-$(CONFIG_NTB) += ntb/ +obj-$(CONFIG_FMC) += fmc/
drivers/fmc/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# +# FMC (ANSI-VITA 57.1) bus support +# + +menuconfig FMC + tristate "FMC support" + help + + FMC (FPGA Mezzanine Carrier) is a mechanical and electrical + standard for mezzanine cards that plug into a carrier board. + This kernel subsystem supports the matching between carrier + and mezzanine based on identifiers stored in the internal I2C + EEPROM, as well as having carrier-independent drivers. + + 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 .
drivers/fmc/Makefile new file +4 -0
@@ -0,0 +1,4 @@ + +obj-$(CONFIG_FMC) += fmc.o + +fmc-y = fmc-core.o
drivers/fmc/fmc-core.c new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
1.7.7.2
PATCH 2/8 FMC: add needed headers
In reply to Alessandro RubiniThis set of headers comes from commit 55812ecd (current master of the project on ohwr.org). They define the basic data structures for FMC and its SDB support.
--- include/linux/fmc-sdb.h | 36 +++++++ include/linux/fmc.h | 237 ++++++++++++++++++++++++++++++++++++++++++++++ include/linux/ipmi-fru.h | 135 ++++++++++++++++++++++++++ include/linux/sdb.h | 130 +++++++++++++++++++++++++ 4 files changed, 538 insertions(+), 0 deletions(-) create mode 100644 include/linux/fmc-sdb.h create mode 100644 include/linux/fmc.h create mode 100644 include/linux/ipmi-fru.h create mode 100644 include/linux/sdb.h
include/linux/fmc-sdb.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* This file is separate from sdb.h, because I want that one to remain +* unchanged (as far as possible) from the official sdb distribution +* +* This file and associated functionality are a playground for me to +* understand stuff which will later be implemented in more generic places. +*/ +#include <linux/sdb.h> + +/* This is the union of all currently defined types */ +union sdb_record { +struct sdb_interconnect ic; +struct sdb_device dev; +struct sdb_bridge bridge; +struct sdb_integration integr; +struct sdb_empty empty; +}; + +struct fmc_device ; + +/* Every sdb table is turned into this structure */ +struct sdb_array { +int len; +int level; +unsigned long baseaddr; +struct fmc_device *fmc;/* the device that hosts it */ +struct sdb_array *parent;/* NULL at root */ +union sdb_record *record;/* copies of the struct */ +struct sdb_array **subtree;/* only valid for bridge items */ +}; + +extern int fmc_scan_sdb_tree (struct fmc_device *fmc,unsigned long address); +extern void fmc_show_sdb_tree (const struct fmc_device *fmc); +extern signed long fmc_find_sdb_device (struct sdb_array *tree,uint64_t vendor, +uint32_t device,unsigned long *sz); +extern int fmc_free_sdb_tree (struct fmc_device *fmc);
include/linux/fmc.h new file +237 -0
237 lines not on this page · raw message
include/linux/ipmi-fru.h new file +135 -0
135 lines not on this page · raw message
include/linux/sdb.h new file +130 -0
130 lines not on this page · raw message
Signature · 1 line
1.7.7.2
PATCH 3/8 FMC: add core bus driver
In reply to Alessandro RubiniThis 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 55812ecd in the master branch of the project hosted on ohwr.org.
--- drivers/fmc/Makefile | 4 + drivers/fmc/fmc-core.c | 219 +++++++++++++++++++++++++++++++++++++++- drivers/fmc/fmc-dump.c | 100 ++++++++++++++++++ drivers/fmc/fmc-match.c | 108 ++++++++++++++++++++ drivers/fmc/fmc-sdb.c | 258 +++++++++++++++++++++++++++++++++++++++++++++++ drivers/fmc/fru-parse.c | 82 +++++++++++++++ 6 files changed, 768 insertions(+), 3 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
@@ -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 +216 -3
243 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 +108 -0
108 lines not on this page · raw message
drivers/fmc/fmc-sdb.c new file +258 -0
258 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
Re: [PATCH 3/8] FMC: add core bus driver
drivers/fmc/fmc-core.c line 71
Quoted 3 lines · Alessandro Rubini
drivers/fmc/fmc-core.c +1
-1-/* Every device must have a release method: provide a default */ +/* We really have nothing to release in here */ static void __fmc_release (struct device *dev) { }
Then your implementation is wrong, and as per the documentation in the kernel Documentation directory (kobject.txt), I get to make fun of you in public for trying to do this :)
Please fix this up, this isn't ok.
greg k-h
PATCH 4/8 FMC: add documentation for the core
In reply to Alessandro RubiniThis is selected sections of the current manual for fmc-bus, as developed outside of the kernel before submission.
--- Documentation/00-INDEX | 2 + Documentation/fmc/00-INDEX | 26 +++ Documentation/fmc/API.txt | 44 +++++ Documentation/fmc/FMC-and-SDB.txt | 89 +++++++++++ Documentation/fmc/carrier.txt | 311 +++++++++++++++++++++++++++++++++++++ Documentation/fmc/identifiers.txt | 169 ++++++++++++++++++++ Documentation/fmc/mezzanine.txt | 123 +++++++++++++++ Documentation/fmc/parameters.txt | 56 +++++++ 8 files changed, 820 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
@@ -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
@@ -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 +44 -0
44 lines not on this page · raw message
Documentation/fmc/FMC-and-SDB.txt new file +89 -0
89 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 +169 -0
169 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
Re: [PATCH 4/8] FMC: add documentation for the core
Quoted 7 lines · Alessandro Rubini
This is selected sections of the current manual for fmc-bus, as developed outside of the kernel before submission.
Signed-off-by Alessandro Rubini <[email protected]>Acked-by Emilio G. Cota <[email protected]>
On the basis it's all nicely in its own subdirectory not bothering anyone else.
Documentation/fmc/API.txt line 25
Quoted 3 lines · That
Documentation/fmc/API.txt new file +3
-0+The data structure that describe a device is detailed in *note FMC +Device::, the one that describes a driver is detailed in *note FMC +Driver::.
What is this *note thingy:: syntax? It recurs a lot. Some sort of reference into the PDF you started out with a link to, maybe?
From your 00-INDEX additions:
Quoted 16 lines
Documentation/fmc/FMC-and-SDB.txt new file +7
-0+FMC-and-SDB.txt + - What are FMC and SDB, basic concepts for this framework +What is FMC +*********** + +FMC, as said, stands for "FPGA Mezzanine Card". It is a standard +developed by the VME consortium called VITA (VMEbus InternationalTrade
Documentation/fmc/FMC-and-SDB.txt new file +4
-0+Association and ratified by ANSI, the American National Standard +Institute. The official documentation is called "ANSI-VITA 57.1". + +The FMC card is an almost square PCB, around 70x75 millimeters, thatis
(quoted diff) +2
-0+called mezzanine in this document. It usually lives plugged into +another PCB for power supply and control; such bigger circuit board
Quoted 4 lines
is
+called carrier from now on, and a single carrier may host more than one
+mezzanine.
A basic concept of this framework is that you have a 70x75 PCB? Is this part of that ANSI-VITA standard?
Quoted 8 lines
(quoted diff) +2
-0+In the typical application the mezzanine is mostly analog while the +carrier is mostly digital, and hosts an FPGA that must be configuredto
+match the specific mezzanine and the desired application. Thus, you may
+need to load different FPGA images to drive different instances of the
+same mezzanine.
From the top level 00-INDEX:
Documentation/00-INDEX firmware_class/ · line 191
Quoted 2 lines
Documentation/00-INDEX +2
-0+fmc/ + - information about the FMC bus abstraction
And then...
Documentation/fmc/FMC-and-SDB.txt line 52
Quoted 4 lines
Documentation/fmc/FMC-and-SDB.txt new file +4
-0+FMC, as such, is not a bus in the usual meaning of the term, because +most carriers have only one connector, and carriers with several +connectors have completely separate electrical connections to them. +This package, however, implements a bus as a software abstraction.
USB is point to point connections with switches in between. It's still got B in the acronym. I'm not sure what you're saying here.
Quoted 8 lines
Documentation/fmc/FMC-and-SDB.txt new file +6
-0+ +What is SDB +*********** + +SDB (Self Describing Bus) is a set of data structures that we use for +enumerating the internal structure of an FPGA image. We also use itas
+a filesystem inside the FMC EEPROM.
Are you trying to document infrastructure to implement a standard, or a bespoke driver for a specific piece of hardware? How much of this is generic? Are there other vendors who might someday want to use this code?
Anyway, no serious objection, but I note that reading to this point I didn't feel I had enough information to wrap my head around what it's for. It's documentation by people who already know this stuff, for people who already know this stuff. (There's a long tradition of that. Oh well.)
Rob
Re: [PATCH 4/8] FMC: add documentation for the core
Quoted 1 line
Acked-by Rob Landley <[email protected]>
Thanks.
Quoted 2 lines
What is this *note thingy:: syntax? It recurs a lot. Some sort of reference into the PDF you started out with a link to, maybe?
My documentation is texinfo and this is the ASCII output, manually split into different files. I fixed some of the internal references when I noted them. But since it's manual work, I didn't do it carefully. I suspect I'll need to V2 for some reason anyways.
Quoted 2 lines
A basic concept of this framework is that you have a 70x75 PCB? Is this part of that ANSI-VITA standard?
Yes. the form-factor is fixed, like PC104 in the PC world. Here's the jpg of a carrier: http://www.ohwr.org/attachments/download/552 (from
http://www.ohwr.org/projects/spec/wiki). And here's the jpg of a mezzanine:
http://www.ohwr.org/attachments/download/833/FmcAdc100M14b4cha_top_small.JPG
You find more on the net, also from commercial vendors.
Quoted 7 lines
Documentation/fmc/FMC-and-SDB.txt line 52
Quoted 4 lines
Documentation/fmc/FMC-and-SDB.txt new file +4
-0+FMC, as such, is not a bus in the usual meaning of the term, because +most carriers have only one connector, and carriers with several +connectors have completely separate electrical connections to them. +This package, however, implements a bus as a software abstraction.USB is point to point connections with switches in between. It's still got B in the acronym. I'm not sure what you're saying here.
FMC has no switches, no hotplug, not even shared wires like ISA. I took a while to explain some hardware guys that it ought to be a "bus" in software. That's why I have the paragraph.
Quoted 4 lines
Quoted 4 lines
Documentation/fmc/FMC-and-SDB.txt new file +4
-0+What is SDB +*********** + +SDB (Self Describing Bus) is a set of data structures that we use for
Quoted 8 lines
Quoted 3 lines
+enumerating the internal structure of an FPGA image. We also use it as
+a filesystem inside the FMC EEPROM.Are you trying to document infrastructure to implement a standard, or a bespoke driver for a specific piece of hardware? How much of this is generic? Are there other vendors who might someday want to use this code?
SDB is already implemented and is generic. We enumerate the devices inside the FPGA already, and it only costs a few lines of VHDL (using the support files by Wesley Terpstra) to describe your own FPGA design. Wesley even discovers and enumerates devices over the Ethernet, by means of Ethernet-driven device access and SDB-aware host code -- all code is published.
The SDB specification is discussed in a mailing list and is public
(http://www.ohwr.org/attachments/download/1486/sdb-1.0.pdf). By having 64-bit vendor identifiers we encourage anyone who finds SDB useful to become a vendor. There are a few vendors already, although I admit the early adopters are involved in the same set of projects.
Quoted 5 lines
Anyway, no serious objection, but I note that reading to this point I didn't feel I had enough information to wrap my head around what it's for. It's documentation by people who already know this stuff, for people who already know this stuff. (There's a long tradition of that. Oh well.)
I'm aware of this. But it's the same if you read USB documentation without ever seeing one such device (I remember the feeling :). FMC is not common on the shelf, but it is already renown in high-profile I/O environments.
Thanks
/alessandro
PATCH 5/8 FMC: add a software carrier driver
In reply to Alessandro RubiniThis fake carrier is designed to understand how a carrier driver works, and to experiment the behaviour with EEPROM reprogramming (with a mezzanine driver commited later).
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 | 30 ++++ drivers/fmc/Kconfig | 11 ++ drivers/fmc/Makefile | 2 + drivers/fmc/fmc-fakedev.c | 308 +++++++++++++++++++++++++++++++++++++ 5 files changed, 354 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
@@ -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 +30 -0
@@ -0,0 +1,30 @@ +fmc-fakedev +=========== + +This package includes a software-only device, called fmc-fakedev. +Unlike the SPEC driver, which creates an FMC device for each PCI cards +it manages, this module creates a single instance of its device. + +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::). + +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 + [ 158.355436] fake-fmc: Manufacturer: fake-vendor + [ 158.360106] fake-fmc: Product name: fake-design-for-testing + spusa.root# rmmod fmc-fakedev + spusa.root# insmod fmc-fakedev.ko eeprom=fdelay-eeprom.bin + [ 197.182682] fake-fmc: Manufacturer: CERN + [ 197.186764] fake-fmc: 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
@@ -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
@@ -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 +308 -0
308 lines not on this page · raw message
Signature · 1 line
1.7.7.2
PATCH 6/8 FMC: add a software mezzanine driver
In reply to Alessandro RubiniThis 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 | 101 +++++++++++++++++++++++++++++++++++++ 5 files changed, 129 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
@@ -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
@@ -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
@@ -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
@@ -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 +101 -0
101 lines not on this page · raw message
Signature · 1 line
1.7.7.2
PATCH 7/8 FMC: add a driver to write mezzanine EEPROM
In reply to Alessandro RubiniThis 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 | 112 +++++++++++++++++++++ drivers/fmc/Kconfig | 8 ++ drivers/fmc/Makefile | 1 + drivers/fmc/fmc-write-eeprom.c | 170 ++++++++++++++++++++++++++++++++ 5 files changed, 294 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
@@ -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 +112 -0
112 lines not on this page · raw message
drivers/fmc/Kconfig +8 -0
@@ -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
@@ -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 +170 -0
170 lines not on this page · raw message
Signature · 1 line
1.7.7.2
PATCH 8/8 FMC: add a char-device mezzanine driver
In reply to Alessandro RubiniThis 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
@@ -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
@@ -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
@@ -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