162306a36Sopenharmony_ci==================================================================
262306a36Sopenharmony_ciRapidIO subsystem mport character device driver (rio_mport_cdev.c)
362306a36Sopenharmony_ci==================================================================
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci1. Overview
662306a36Sopenharmony_ci===========
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciThis device driver is the result of collaboration within the RapidIO.org
962306a36Sopenharmony_ciSoftware Task Group (STG) between Texas Instruments, Freescale,
1062306a36Sopenharmony_ciProdrive Technologies, Nokia Networks, BAE and IDT.  Additional input was
1162306a36Sopenharmony_cireceived from other members of RapidIO.org. The objective was to create a
1262306a36Sopenharmony_cicharacter mode driver interface which exposes the capabilities of RapidIO
1362306a36Sopenharmony_cidevices directly to applications, in a manner that allows the numerous and
1462306a36Sopenharmony_civaried RapidIO implementations to interoperate.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciThis driver (MPORT_CDEV) provides access to basic RapidIO subsystem operations
1762306a36Sopenharmony_cifor user-space applications. Most of RapidIO operations are supported through
1862306a36Sopenharmony_ci'ioctl' system calls.
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ciWhen loaded this device driver creates filesystem nodes named rio_mportX in /dev
2162306a36Sopenharmony_cidirectory for each registered RapidIO mport device. 'X' in the node name matches
2262306a36Sopenharmony_cito unique port ID assigned to each local mport device.
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ciUsing available set of ioctl commands user-space applications can perform
2562306a36Sopenharmony_cifollowing RapidIO bus and subsystem operations:
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci- Reads and writes from/to configuration registers of mport devices
2862306a36Sopenharmony_ci  (RIO_MPORT_MAINT_READ_LOCAL/RIO_MPORT_MAINT_WRITE_LOCAL)
2962306a36Sopenharmony_ci- Reads and writes from/to configuration registers of remote RapidIO devices.
3062306a36Sopenharmony_ci  This operations are defined as RapidIO Maintenance reads/writes in RIO spec.
3162306a36Sopenharmony_ci  (RIO_MPORT_MAINT_READ_REMOTE/RIO_MPORT_MAINT_WRITE_REMOTE)
3262306a36Sopenharmony_ci- Set RapidIO Destination ID for mport devices (RIO_MPORT_MAINT_HDID_SET)
3362306a36Sopenharmony_ci- Set RapidIO Component Tag for mport devices (RIO_MPORT_MAINT_COMPTAG_SET)
3462306a36Sopenharmony_ci- Query logical index of mport devices (RIO_MPORT_MAINT_PORT_IDX_GET)
3562306a36Sopenharmony_ci- Query capabilities and RapidIO link configuration of mport devices
3662306a36Sopenharmony_ci  (RIO_MPORT_GET_PROPERTIES)
3762306a36Sopenharmony_ci- Enable/Disable reporting of RapidIO doorbell events to user-space applications
3862306a36Sopenharmony_ci  (RIO_ENABLE_DOORBELL_RANGE/RIO_DISABLE_DOORBELL_RANGE)
3962306a36Sopenharmony_ci- Enable/Disable reporting of RIO port-write events to user-space applications
4062306a36Sopenharmony_ci  (RIO_ENABLE_PORTWRITE_RANGE/RIO_DISABLE_PORTWRITE_RANGE)
4162306a36Sopenharmony_ci- Query/Control type of events reported through this driver: doorbells,
4262306a36Sopenharmony_ci  port-writes or both (RIO_SET_EVENT_MASK/RIO_GET_EVENT_MASK)
4362306a36Sopenharmony_ci- Configure/Map mport's outbound requests window(s) for specific size,
4462306a36Sopenharmony_ci  RapidIO destination ID, hopcount and request type
4562306a36Sopenharmony_ci  (RIO_MAP_OUTBOUND/RIO_UNMAP_OUTBOUND)
4662306a36Sopenharmony_ci- Configure/Map mport's inbound requests window(s) for specific size,
4762306a36Sopenharmony_ci  RapidIO base address and local memory base address
4862306a36Sopenharmony_ci  (RIO_MAP_INBOUND/RIO_UNMAP_INBOUND)
4962306a36Sopenharmony_ci- Allocate/Free contiguous DMA coherent memory buffer for DMA data transfers
5062306a36Sopenharmony_ci  to/from remote RapidIO devices (RIO_ALLOC_DMA/RIO_FREE_DMA)
5162306a36Sopenharmony_ci- Initiate DMA data transfers to/from remote RapidIO devices (RIO_TRANSFER).
5262306a36Sopenharmony_ci  Supports blocking, asynchronous and posted (a.k.a 'fire-and-forget') data
5362306a36Sopenharmony_ci  transfer modes.
5462306a36Sopenharmony_ci- Check/Wait for completion of asynchronous DMA data transfer
5562306a36Sopenharmony_ci  (RIO_WAIT_FOR_ASYNC)
5662306a36Sopenharmony_ci- Manage device objects supported by RapidIO subsystem (RIO_DEV_ADD/RIO_DEV_DEL).
5762306a36Sopenharmony_ci  This allows implementation of various RapidIO fabric enumeration algorithms
5862306a36Sopenharmony_ci  as user-space applications while using remaining functionality provided by
5962306a36Sopenharmony_ci  kernel RapidIO subsystem.
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci2. Hardware Compatibility
6262306a36Sopenharmony_ci=========================
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ciThis device driver uses standard interfaces defined by kernel RapidIO subsystem
6562306a36Sopenharmony_ciand therefore it can be used with any mport device driver registered by RapidIO
6662306a36Sopenharmony_cisubsystem with limitations set by available mport implementation.
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciAt this moment the most common limitation is availability of RapidIO-specific
6962306a36Sopenharmony_ciDMA engine framework for specific mport device. Users should verify available
7062306a36Sopenharmony_cifunctionality of their platform when planning to use this driver:
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci- IDT Tsi721 PCIe-to-RapidIO bridge device and its mport device driver are fully
7362306a36Sopenharmony_ci  compatible with this driver.
7462306a36Sopenharmony_ci- Freescale SoCs 'fsl_rio' mport driver does not have implementation for RapidIO
7562306a36Sopenharmony_ci  specific DMA engine support and therefore DMA data transfers mport_cdev driver
7662306a36Sopenharmony_ci  are not available.
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci3. Module parameters
7962306a36Sopenharmony_ci====================
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci- 'dma_timeout'
8262306a36Sopenharmony_ci      - DMA transfer completion timeout (in msec, default value 3000).
8362306a36Sopenharmony_ci        This parameter set a maximum completion wait time for SYNC mode DMA
8462306a36Sopenharmony_ci        transfer requests and for RIO_WAIT_FOR_ASYNC ioctl requests.
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci- 'dbg_level'
8762306a36Sopenharmony_ci      - This parameter allows to control amount of debug information
8862306a36Sopenharmony_ci        generated by this device driver. This parameter is formed by set of
8962306a36Sopenharmony_ci        bit masks that correspond to the specific functional blocks.
9062306a36Sopenharmony_ci        For mask definitions see 'drivers/rapidio/devices/rio_mport_cdev.c'
9162306a36Sopenharmony_ci        This parameter can be changed dynamically.
9262306a36Sopenharmony_ci        Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level.
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci4. Known problems
9562306a36Sopenharmony_ci=================
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci  None.
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci5. User-space Applications and API
10062306a36Sopenharmony_ci==================================
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ciAPI library and applications that use this device driver are available from
10362306a36Sopenharmony_ciRapidIO.org.
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci6. TODO List
10662306a36Sopenharmony_ci============
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci- Add support for sending/receiving "raw" RapidIO messaging packets.
10962306a36Sopenharmony_ci- Add memory mapped DMA data transfers as an option when RapidIO-specific DMA
11062306a36Sopenharmony_ci  is not available.
111