Merge tag 'for-5.3-rc4-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
[sfrench/cifs-2.6.git] / Documentation / PCI / endpoint / pci-endpoint-cfs.rst
1 .. SPDX-License-Identifier: GPL-2.0
2
3 =======================================
4 Configuring PCI Endpoint Using CONFIGFS
5 =======================================
6
7 :Author: Kishon Vijay Abraham I <kishon@ti.com>
8
9 The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the
10 PCI endpoint function and to bind the endpoint function
11 with the endpoint controller. (For introducing other mechanisms to
12 configure the PCI Endpoint Function refer to [1]).
13
14 Mounting configfs
15 =================
16
17 The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs
18 directory. configfs can be mounted using the following command::
19
20         mount -t configfs none /sys/kernel/config
21
22 Directory Structure
23 ===================
24
25 The pci_ep configfs has two directories at its root: controllers and
26 functions. Every EPC device present in the system will have an entry in
27 the *controllers* directory and and every EPF driver present in the system
28 will have an entry in the *functions* directory.
29 ::
30
31         /sys/kernel/config/pci_ep/
32                 .. controllers/
33                 .. functions/
34
35 Creating EPF Device
36 ===================
37
38 Every registered EPF driver will be listed in controllers directory. The
39 entries corresponding to EPF driver will be created by the EPF core.
40 ::
41
42         /sys/kernel/config/pci_ep/functions/
43                 .. <EPF Driver1>/
44                         ... <EPF Device 11>/
45                         ... <EPF Device 21>/
46                 .. <EPF Driver2>/
47                         ... <EPF Device 12>/
48                         ... <EPF Device 22>/
49
50 In order to create a <EPF device> of the type probed by <EPF Driver>, the
51 user has to create a directory inside <EPF DriverN>.
52
53 Every <EPF device> directory consists of the following entries that can be
54 used to configure the standard configuration header of the endpoint function.
55 (These entries are created by the framework when any new <EPF Device> is
56 created)
57 ::
58
59                 .. <EPF Driver1>/
60                         ... <EPF Device 11>/
61                                 ... vendorid
62                                 ... deviceid
63                                 ... revid
64                                 ... progif_code
65                                 ... subclass_code
66                                 ... baseclass_code
67                                 ... cache_line_size
68                                 ... subsys_vendor_id
69                                 ... subsys_id
70                                 ... interrupt_pin
71
72 EPC Device
73 ==========
74
75 Every registered EPC device will be listed in controllers directory. The
76 entries corresponding to EPC device will be created by the EPC core.
77 ::
78
79         /sys/kernel/config/pci_ep/controllers/
80                 .. <EPC Device1>/
81                         ... <Symlink EPF Device11>/
82                         ... <Symlink EPF Device12>/
83                         ... start
84                 .. <EPC Device2>/
85                         ... <Symlink EPF Device21>/
86                         ... <Symlink EPF Device22>/
87                         ... start
88
89 The <EPC Device> directory will have a list of symbolic links to
90 <EPF Device>. These symbolic links should be created by the user to
91 represent the functions present in the endpoint device.
92
93 The <EPC Device> directory will also have a *start* field. Once
94 "1" is written to this field, the endpoint device will be ready to
95 establish the link with the host. This is usually done after
96 all the EPF devices are created and linked with the EPC device.
97 ::
98
99                          | controllers/
100                                 | <Directory: EPC name>/
101                                         | <Symbolic Link: Function>
102                                         | start
103                          | functions/
104                                 | <Directory: EPF driver>/
105                                         | <Directory: EPF device>/
106                                                 | vendorid
107                                                 | deviceid
108                                                 | revid
109                                                 | progif_code
110                                                 | subclass_code
111                                                 | baseclass_code
112                                                 | cache_line_size
113                                                 | subsys_vendor_id
114                                                 | subsys_id
115                                                 | interrupt_pin
116                                                 | function
117
118 [1] :doc:`pci-endpoint`