xref: /OK3568_Linux_fs/kernel/Documentation/driver-api/rapidio/mport_cdev.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun==================================================================
2*4882a593SmuzhiyunRapidIO subsystem mport character device driver (rio_mport_cdev.c)
3*4882a593Smuzhiyun==================================================================
4*4882a593Smuzhiyun
5*4882a593Smuzhiyun1. Overview
6*4882a593Smuzhiyun===========
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunThis device driver is the result of collaboration within the RapidIO.org
9*4882a593SmuzhiyunSoftware Task Group (STG) between Texas Instruments, Freescale,
10*4882a593SmuzhiyunProdrive Technologies, Nokia Networks, BAE and IDT.  Additional input was
11*4882a593Smuzhiyunreceived from other members of RapidIO.org. The objective was to create a
12*4882a593Smuzhiyuncharacter mode driver interface which exposes the capabilities of RapidIO
13*4882a593Smuzhiyundevices directly to applications, in a manner that allows the numerous and
14*4882a593Smuzhiyunvaried RapidIO implementations to interoperate.
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThis driver (MPORT_CDEV) provides access to basic RapidIO subsystem operations
17*4882a593Smuzhiyunfor user-space applications. Most of RapidIO operations are supported through
18*4882a593Smuzhiyun'ioctl' system calls.
19*4882a593Smuzhiyun
20*4882a593SmuzhiyunWhen loaded this device driver creates filesystem nodes named rio_mportX in /dev
21*4882a593Smuzhiyundirectory for each registered RapidIO mport device. 'X' in the node name matches
22*4882a593Smuzhiyunto unique port ID assigned to each local mport device.
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunUsing available set of ioctl commands user-space applications can perform
25*4882a593Smuzhiyunfollowing RapidIO bus and subsystem operations:
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun- Reads and writes from/to configuration registers of mport devices
28*4882a593Smuzhiyun  (RIO_MPORT_MAINT_READ_LOCAL/RIO_MPORT_MAINT_WRITE_LOCAL)
29*4882a593Smuzhiyun- Reads and writes from/to configuration registers of remote RapidIO devices.
30*4882a593Smuzhiyun  This operations are defined as RapidIO Maintenance reads/writes in RIO spec.
31*4882a593Smuzhiyun  (RIO_MPORT_MAINT_READ_REMOTE/RIO_MPORT_MAINT_WRITE_REMOTE)
32*4882a593Smuzhiyun- Set RapidIO Destination ID for mport devices (RIO_MPORT_MAINT_HDID_SET)
33*4882a593Smuzhiyun- Set RapidIO Component Tag for mport devices (RIO_MPORT_MAINT_COMPTAG_SET)
34*4882a593Smuzhiyun- Query logical index of mport devices (RIO_MPORT_MAINT_PORT_IDX_GET)
35*4882a593Smuzhiyun- Query capabilities and RapidIO link configuration of mport devices
36*4882a593Smuzhiyun  (RIO_MPORT_GET_PROPERTIES)
37*4882a593Smuzhiyun- Enable/Disable reporting of RapidIO doorbell events to user-space applications
38*4882a593Smuzhiyun  (RIO_ENABLE_DOORBELL_RANGE/RIO_DISABLE_DOORBELL_RANGE)
39*4882a593Smuzhiyun- Enable/Disable reporting of RIO port-write events to user-space applications
40*4882a593Smuzhiyun  (RIO_ENABLE_PORTWRITE_RANGE/RIO_DISABLE_PORTWRITE_RANGE)
41*4882a593Smuzhiyun- Query/Control type of events reported through this driver: doorbells,
42*4882a593Smuzhiyun  port-writes or both (RIO_SET_EVENT_MASK/RIO_GET_EVENT_MASK)
43*4882a593Smuzhiyun- Configure/Map mport's outbound requests window(s) for specific size,
44*4882a593Smuzhiyun  RapidIO destination ID, hopcount and request type
45*4882a593Smuzhiyun  (RIO_MAP_OUTBOUND/RIO_UNMAP_OUTBOUND)
46*4882a593Smuzhiyun- Configure/Map mport's inbound requests window(s) for specific size,
47*4882a593Smuzhiyun  RapidIO base address and local memory base address
48*4882a593Smuzhiyun  (RIO_MAP_INBOUND/RIO_UNMAP_INBOUND)
49*4882a593Smuzhiyun- Allocate/Free contiguous DMA coherent memory buffer for DMA data transfers
50*4882a593Smuzhiyun  to/from remote RapidIO devices (RIO_ALLOC_DMA/RIO_FREE_DMA)
51*4882a593Smuzhiyun- Initiate DMA data transfers to/from remote RapidIO devices (RIO_TRANSFER).
52*4882a593Smuzhiyun  Supports blocking, asynchronous and posted (a.k.a 'fire-and-forget') data
53*4882a593Smuzhiyun  transfer modes.
54*4882a593Smuzhiyun- Check/Wait for completion of asynchronous DMA data transfer
55*4882a593Smuzhiyun  (RIO_WAIT_FOR_ASYNC)
56*4882a593Smuzhiyun- Manage device objects supported by RapidIO subsystem (RIO_DEV_ADD/RIO_DEV_DEL).
57*4882a593Smuzhiyun  This allows implementation of various RapidIO fabric enumeration algorithms
58*4882a593Smuzhiyun  as user-space applications while using remaining functionality provided by
59*4882a593Smuzhiyun  kernel RapidIO subsystem.
60*4882a593Smuzhiyun
61*4882a593Smuzhiyun2. Hardware Compatibility
62*4882a593Smuzhiyun=========================
63*4882a593Smuzhiyun
64*4882a593SmuzhiyunThis device driver uses standard interfaces defined by kernel RapidIO subsystem
65*4882a593Smuzhiyunand therefore it can be used with any mport device driver registered by RapidIO
66*4882a593Smuzhiyunsubsystem with limitations set by available mport implementation.
67*4882a593Smuzhiyun
68*4882a593SmuzhiyunAt this moment the most common limitation is availability of RapidIO-specific
69*4882a593SmuzhiyunDMA engine framework for specific mport device. Users should verify available
70*4882a593Smuzhiyunfunctionality of their platform when planning to use this driver:
71*4882a593Smuzhiyun
72*4882a593Smuzhiyun- IDT Tsi721 PCIe-to-RapidIO bridge device and its mport device driver are fully
73*4882a593Smuzhiyun  compatible with this driver.
74*4882a593Smuzhiyun- Freescale SoCs 'fsl_rio' mport driver does not have implementation for RapidIO
75*4882a593Smuzhiyun  specific DMA engine support and therefore DMA data transfers mport_cdev driver
76*4882a593Smuzhiyun  are not available.
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun3. Module parameters
79*4882a593Smuzhiyun====================
80*4882a593Smuzhiyun
81*4882a593Smuzhiyun- 'dma_timeout'
82*4882a593Smuzhiyun      - DMA transfer completion timeout (in msec, default value 3000).
83*4882a593Smuzhiyun        This parameter set a maximum completion wait time for SYNC mode DMA
84*4882a593Smuzhiyun        transfer requests and for RIO_WAIT_FOR_ASYNC ioctl requests.
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun- 'dbg_level'
87*4882a593Smuzhiyun      - This parameter allows to control amount of debug information
88*4882a593Smuzhiyun        generated by this device driver. This parameter is formed by set of
89*4882a593Smuzhiyun        bit masks that correspond to the specific functional blocks.
90*4882a593Smuzhiyun        For mask definitions see 'drivers/rapidio/devices/rio_mport_cdev.c'
91*4882a593Smuzhiyun        This parameter can be changed dynamically.
92*4882a593Smuzhiyun        Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level.
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun4. Known problems
95*4882a593Smuzhiyun=================
96*4882a593Smuzhiyun
97*4882a593Smuzhiyun  None.
98*4882a593Smuzhiyun
99*4882a593Smuzhiyun5. User-space Applications and API
100*4882a593Smuzhiyun==================================
101*4882a593Smuzhiyun
102*4882a593SmuzhiyunAPI library and applications that use this device driver are available from
103*4882a593SmuzhiyunRapidIO.org.
104*4882a593Smuzhiyun
105*4882a593Smuzhiyun6. TODO List
106*4882a593Smuzhiyun============
107*4882a593Smuzhiyun
108*4882a593Smuzhiyun- Add support for sending/receiving "raw" RapidIO messaging packets.
109*4882a593Smuzhiyun- Add memory mapped DMA data transfers as an option when RapidIO-specific DMA
110*4882a593Smuzhiyun  is not available.
111