men-chameleon-bus.txt: standardize document format
Each text file under Documentation follows a different format. Some doesn't even have titles! Change its representation to follow the adopted standard, using ReST markups for it to be parseable by Sphinx: - Adjust identations; - Remove title numbering; - mark literal blocks; - comment its TOC. Acked-by: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
This commit is contained in:
parent
c18c1cce0c
commit
78b11f40d4
@ -1,7 +1,8 @@
|
|||||||
|
=================
|
||||||
MEN Chameleon Bus
|
MEN Chameleon Bus
|
||||||
=================
|
=================
|
||||||
|
|
||||||
Table of Contents
|
.. Table of Contents
|
||||||
=================
|
=================
|
||||||
1 Introduction
|
1 Introduction
|
||||||
1.1 Scope of this Document
|
1.1 Scope of this Document
|
||||||
@ -19,37 +20,44 @@ Table of Contents
|
|||||||
4.3 Initializing the driver
|
4.3 Initializing the driver
|
||||||
|
|
||||||
|
|
||||||
1 Introduction
|
Introduction
|
||||||
===============
|
============
|
||||||
|
|
||||||
This document describes the architecture and implementation of the MEN
|
This document describes the architecture and implementation of the MEN
|
||||||
Chameleon Bus (called MCB throughout this document).
|
Chameleon Bus (called MCB throughout this document).
|
||||||
|
|
||||||
1.1 Scope of this Document
|
Scope of this Document
|
||||||
---------------------------
|
----------------------
|
||||||
|
|
||||||
This document is intended to be a short overview of the current
|
This document is intended to be a short overview of the current
|
||||||
implementation and does by no means describe the complete possibilities of MCB
|
implementation and does by no means describe the complete possibilities of MCB
|
||||||
based devices.
|
based devices.
|
||||||
|
|
||||||
1.2 Limitations of the current implementation
|
Limitations of the current implementation
|
||||||
----------------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
The current implementation is limited to PCI and PCIe based carrier devices
|
The current implementation is limited to PCI and PCIe based carrier devices
|
||||||
that only use a single memory resource and share the PCI legacy IRQ. Not
|
that only use a single memory resource and share the PCI legacy IRQ. Not
|
||||||
implemented are:
|
implemented are:
|
||||||
|
|
||||||
- Multi-resource MCB devices like the VME Controller or M-Module carrier.
|
- Multi-resource MCB devices like the VME Controller or M-Module carrier.
|
||||||
- MCB devices that need another MCB device, like SRAM for a DMA Controller's
|
- MCB devices that need another MCB device, like SRAM for a DMA Controller's
|
||||||
buffer descriptors or a video controller's video memory.
|
buffer descriptors or a video controller's video memory.
|
||||||
- A per-carrier IRQ domain for carrier devices that have one (or more) IRQs
|
- A per-carrier IRQ domain for carrier devices that have one (or more) IRQs
|
||||||
per MCB device like PCIe based carriers with MSI or MSI-X support.
|
per MCB device like PCIe based carriers with MSI or MSI-X support.
|
||||||
|
|
||||||
2 Architecture
|
Architecture
|
||||||
===============
|
============
|
||||||
|
|
||||||
MCB is divided into 3 functional blocks:
|
MCB is divided into 3 functional blocks:
|
||||||
|
|
||||||
- The MEN Chameleon Bus itself,
|
- The MEN Chameleon Bus itself,
|
||||||
- drivers for MCB Carrier Devices and
|
- drivers for MCB Carrier Devices and
|
||||||
- the parser for the Chameleon table.
|
- the parser for the Chameleon table.
|
||||||
|
|
||||||
2.1 MEN Chameleon Bus
|
MEN Chameleon Bus
|
||||||
----------------------
|
-----------------
|
||||||
|
|
||||||
The MEN Chameleon Bus is an artificial bus system that attaches to a so
|
The MEN Chameleon Bus is an artificial bus system that attaches to a so
|
||||||
called Chameleon FPGA device found on some hardware produced my MEN Mikro
|
called Chameleon FPGA device found on some hardware produced my MEN Mikro
|
||||||
Elektronik GmbH. These devices are multi-function devices implemented in a
|
Elektronik GmbH. These devices are multi-function devices implemented in a
|
||||||
@ -59,8 +67,9 @@ Table of Contents
|
|||||||
BAR, size in the FPGA, interrupt number and some other properties currently
|
BAR, size in the FPGA, interrupt number and some other properties currently
|
||||||
not handled by the MCB implementation.
|
not handled by the MCB implementation.
|
||||||
|
|
||||||
2.2 Carrier Devices
|
Carrier Devices
|
||||||
--------------------
|
---------------
|
||||||
|
|
||||||
A carrier device is just an abstraction for the real world physical bus the
|
A carrier device is just an abstraction for the real world physical bus the
|
||||||
Chameleon FPGA is attached to. Some IP Core drivers may need to interact with
|
Chameleon FPGA is attached to. Some IP Core drivers may need to interact with
|
||||||
properties of the carrier device (like querying the IRQ number of a PCI
|
properties of the carrier device (like querying the IRQ number of a PCI
|
||||||
@ -70,8 +79,9 @@ Table of Contents
|
|||||||
implement the get_irq() method which can be translated into a hardware bus
|
implement the get_irq() method which can be translated into a hardware bus
|
||||||
query for the IRQ number the device should use.
|
query for the IRQ number the device should use.
|
||||||
|
|
||||||
2.3 Parser
|
Parser
|
||||||
-----------
|
------
|
||||||
|
|
||||||
The parser reads the first 512 bytes of a Chameleon device and parses the
|
The parser reads the first 512 bytes of a Chameleon device and parses the
|
||||||
Chameleon table. Currently the parser only supports the Chameleon v2 variant
|
Chameleon table. Currently the parser only supports the Chameleon v2 variant
|
||||||
of the Chameleon table but can easily be adopted to support an older or
|
of the Chameleon table but can easily be adopted to support an older or
|
||||||
@ -81,36 +91,39 @@ Table of Contents
|
|||||||
MCB devices are registered at the MCB and thus at the driver core of the
|
MCB devices are registered at the MCB and thus at the driver core of the
|
||||||
Linux kernel.
|
Linux kernel.
|
||||||
|
|
||||||
3 Resource handling
|
Resource handling
|
||||||
====================
|
=================
|
||||||
|
|
||||||
The current implementation assigns exactly one memory and one IRQ resource
|
The current implementation assigns exactly one memory and one IRQ resource
|
||||||
per MCB device. But this is likely going to change in the future.
|
per MCB device. But this is likely going to change in the future.
|
||||||
|
|
||||||
3.1 Memory Resources
|
Memory Resources
|
||||||
---------------------
|
----------------
|
||||||
|
|
||||||
Each MCB device has exactly one memory resource, which can be requested from
|
Each MCB device has exactly one memory resource, which can be requested from
|
||||||
the MCB bus. This memory resource is the physical address of the MCB device
|
the MCB bus. This memory resource is the physical address of the MCB device
|
||||||
inside the carrier and is intended to be passed to ioremap() and friends. It
|
inside the carrier and is intended to be passed to ioremap() and friends. It
|
||||||
is already requested from the kernel by calling request_mem_region().
|
is already requested from the kernel by calling request_mem_region().
|
||||||
|
|
||||||
3.2 IRQs
|
IRQs
|
||||||
---------
|
----
|
||||||
|
|
||||||
Each MCB device has exactly one IRQ resource, which can be requested from the
|
Each MCB device has exactly one IRQ resource, which can be requested from the
|
||||||
MCB bus. If a carrier device driver implements the ->get_irq() callback
|
MCB bus. If a carrier device driver implements the ->get_irq() callback
|
||||||
method, the IRQ number assigned by the carrier device will be returned,
|
method, the IRQ number assigned by the carrier device will be returned,
|
||||||
otherwise the IRQ number inside the Chameleon table will be returned. This
|
otherwise the IRQ number inside the Chameleon table will be returned. This
|
||||||
number is suitable to be passed to request_irq().
|
number is suitable to be passed to request_irq().
|
||||||
|
|
||||||
4 Writing an MCB driver
|
Writing an MCB driver
|
||||||
=======================
|
=====================
|
||||||
|
|
||||||
|
The driver structure
|
||||||
|
--------------------
|
||||||
|
|
||||||
4.1 The driver structure
|
|
||||||
-------------------------
|
|
||||||
Each MCB driver has a structure to identify the device driver as well as
|
Each MCB driver has a structure to identify the device driver as well as
|
||||||
device ids which identify the IP Core inside the FPGA. The driver structure
|
device ids which identify the IP Core inside the FPGA. The driver structure
|
||||||
also contains callback methods which get executed on driver probe and
|
also contains callback methods which get executed on driver probe and
|
||||||
removal from the system.
|
removal from the system::
|
||||||
|
|
||||||
|
|
||||||
static const struct mcb_device_id foo_ids[] = {
|
static const struct mcb_device_id foo_ids[] = {
|
||||||
{ .device = 0x123 },
|
{ .device = 0x123 },
|
||||||
@ -128,22 +141,22 @@ Table of Contents
|
|||||||
.id_table = foo_ids,
|
.id_table = foo_ids,
|
||||||
};
|
};
|
||||||
|
|
||||||
4.2 Probing and attaching
|
Probing and attaching
|
||||||
--------------------------
|
---------------------
|
||||||
|
|
||||||
When a driver is loaded and the MCB devices it services are found, the MCB
|
When a driver is loaded and the MCB devices it services are found, the MCB
|
||||||
core will call the driver's probe callback method. When the driver is removed
|
core will call the driver's probe callback method. When the driver is removed
|
||||||
from the system, the MCB core will call the driver's remove callback method.
|
from the system, the MCB core will call the driver's remove callback method::
|
||||||
|
|
||||||
|
|
||||||
static init foo_probe(struct mcb_device *mdev, const struct mcb_device_id *id);
|
static init foo_probe(struct mcb_device *mdev, const struct mcb_device_id *id);
|
||||||
static void foo_remove(struct mcb_device *mdev);
|
static void foo_remove(struct mcb_device *mdev);
|
||||||
|
|
||||||
4.3 Initializing the driver
|
Initializing the driver
|
||||||
----------------------------
|
-----------------------
|
||||||
|
|
||||||
When the kernel is booted or your foo driver module is inserted, you have to
|
When the kernel is booted or your foo driver module is inserted, you have to
|
||||||
perform driver initialization. Usually it is enough to register your driver
|
perform driver initialization. Usually it is enough to register your driver
|
||||||
module at the MCB core.
|
module at the MCB core::
|
||||||
|
|
||||||
|
|
||||||
static int __init foo_init(void)
|
static int __init foo_init(void)
|
||||||
{
|
{
|
||||||
@ -157,7 +170,6 @@ Table of Contents
|
|||||||
}
|
}
|
||||||
module_exit(foo_exit);
|
module_exit(foo_exit);
|
||||||
|
|
||||||
The module_mcb_driver() macro can be used to reduce the above code.
|
The module_mcb_driver() macro can be used to reduce the above code::
|
||||||
|
|
||||||
|
|
||||||
module_mcb_driver(foo_driver);
|
module_mcb_driver(foo_driver);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user