blob: b6d39cdec56ef79781244ef71005e116e6a85eb9 [file] [log] [blame]
Changbin Dud4518e42019-05-14 22:47:32 +08001.. SPDX-License-Identifier: GPL-2.0
2
3=======================================
4Configuring PCI Endpoint Using CONFIGFS
5=======================================
6
7:Author: Kishon Vijay Abraham I <kishon@ti.com>
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +05308
9The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the
10PCI endpoint function and to bind the endpoint function
11with the endpoint controller. (For introducing other mechanisms to
12configure the PCI Endpoint Function refer to [1]).
13
Changbin Dud4518e42019-05-14 22:47:32 +080014Mounting configfs
15=================
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053016
17The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs
Changbin Dud4518e42019-05-14 22:47:32 +080018directory. configfs can be mounted using the following command::
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053019
20 mount -t configfs none /sys/kernel/config
21
Changbin Dud4518e42019-05-14 22:47:32 +080022Directory Structure
23===================
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053024
25The pci_ep configfs has two directories at its root: controllers and
26functions. Every EPC device present in the system will have an entry in
27the *controllers* directory and and every EPF driver present in the system
28will have an entry in the *functions* directory.
Changbin Dud4518e42019-05-14 22:47:32 +080029::
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053030
Changbin Dud4518e42019-05-14 22:47:32 +080031 /sys/kernel/config/pci_ep/
32 .. controllers/
33 .. functions/
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053034
Changbin Dud4518e42019-05-14 22:47:32 +080035Creating EPF Device
36===================
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053037
38Every registered EPF driver will be listed in controllers directory. The
39entries corresponding to EPF driver will be created by the EPF core.
Changbin Dud4518e42019-05-14 22:47:32 +080040::
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053041
Changbin Dud4518e42019-05-14 22:47:32 +080042 /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>/
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053049
50In order to create a <EPF device> of the type probed by <EPF Driver>, the
51user has to create a directory inside <EPF DriverN>.
52
53Every <EPF device> directory consists of the following entries that can be
54used to configure the standard configuration header of the endpoint function.
55(These entries are created by the framework when any new <EPF Device> is
56created)
Changbin Dud4518e42019-05-14 22:47:32 +080057::
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053058
Changbin Dud4518e42019-05-14 22:47:32 +080059 .. <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
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053071
Changbin Dud4518e42019-05-14 22:47:32 +080072EPC Device
73==========
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053074
75Every registered EPC device will be listed in controllers directory. The
76entries corresponding to EPC device will be created by the EPC core.
Changbin Dud4518e42019-05-14 22:47:32 +080077::
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053078
Changbin Dud4518e42019-05-14 22:47:32 +080079 /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
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053088
89The <EPC Device> directory will have a list of symbolic links to
90<EPF Device>. These symbolic links should be created by the user to
91represent the functions present in the endpoint device.
92
93The <EPC Device> directory will also have a *start* field. Once
94"1" is written to this field, the endpoint device will be ready to
95establish the link with the host. This is usually done after
96all the EPF devices are created and linked with the EPC device.
Changbin Dud4518e42019-05-14 22:47:32 +080097::
Kishon Vijay Abraham Ibea37d32017-03-27 15:15:00 +053098
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
Changbin Dud4518e42019-05-14 22:47:32 +0800118[1] :doc:`pci-endpoint`