diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-08 22:03:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-05-08 22:03:25 -0400 |
commit | 857f8640147c9fb43f20e43cbca6452710e1ca5d (patch) | |
tree | 76a92068d703b8001ca790ffa096d435fa24ae81 /Documentation | |
parent | 8f3207c7eab9d885cc64c778416537034a7d9c5b (diff) | |
parent | 3146c8f4de9b0858794a902f273aec13f168596e (diff) |
Merge tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci
Pull PCI updates from Bjorn Helgaas:
- add framework for supporting PCIe devices in Endpoint mode (Kishon
Vijay Abraham I)
- use non-postable PCI config space mappings when possible (Lorenzo
Pieralisi)
- clean up and unify mmap of PCI BARs (David Woodhouse)
- export and unify Function Level Reset support (Christoph Hellwig)
- avoid FLR for Intel 82579 NICs (Sasha Neftin)
- add pci_request_irq() and pci_free_irq() helpers (Christoph Hellwig)
- short-circuit config access failures for disconnected devices (Keith
Busch)
- remove D3 sleep delay when possible (Adrian Hunter)
- freeze PME scan before suspending devices (Lukas Wunner)
- stop disabling MSI/MSI-X in pci_device_shutdown() (Prarit Bhargava)
- disable boot interrupt quirk for ASUS M2N-LR (Stefan Assmann)
- add arch-specific alignment control to improve device passthrough by
avoiding multiple BARs in a page (Yongji Xie)
- add sysfs sriov_drivers_autoprobe to control VF driver binding
(Bodong Wang)
- allow slots below PCI-to-PCIe "reverse bridges" (Bjorn Helgaas)
- fix crashes when unbinding host controllers that don't support
removal (Brian Norris)
- add driver for MicroSemi Switchtec management interface (Logan
Gunthorpe)
- add driver for Faraday Technology FTPCI100 host bridge (Linus
Walleij)
- add i.MX7D support (Andrey Smirnov)
- use generic MSI support for Aardvark (Thomas Petazzoni)
- make Rockchip driver modular (Brian Norris)
- advertise 128-byte Read Completion Boundary support for Rockchip
(Shawn Lin)
- advertise PCI_EXP_LNKSTA_SLC for Rockchip root port (Shawn Lin)
- convert atomic_t to refcount_t in HV driver (Elena Reshetova)
- add CPU IRQ affinity in HV driver (K. Y. Srinivasan)
- fix PCI bus removal in HV driver (Long Li)
- add support for ThunderX2 DMA alias topology (Jayachandran C)
- add ThunderX pass2.x 2nd node MCFG quirk (Tomasz Nowicki)
- add ITE 8893 bridge DMA alias quirk (Jarod Wilson)
- restrict Cavium ACS quirk only to CN81xx/CN83xx/CN88xx devices
(Manish Jaggi)
* tag 'pci-v4.12-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (146 commits)
PCI: Don't allow unbinding host controllers that aren't prepared
ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
MAINTAINERS: Add PCI Endpoint maintainer
Documentation: PCI: Add userguide for PCI endpoint test function
tools: PCI: Add sample test script to invoke pcitest
tools: PCI: Add a userspace tool to test PCI endpoint
Documentation: misc-devices: Add Documentation for pci-endpoint-test driver
misc: Add host side PCI driver for PCI test function device
PCI: Add device IDs for DRA74x and DRA72x
dt-bindings: PCI: dra7xx: Add DT bindings to enable unaligned access
PCI: dwc: dra7xx: Workaround for errata id i870
dt-bindings: PCI: dra7xx: Add DT bindings for PCI dra7xx EP mode
PCI: dwc: dra7xx: Add EP mode support
PCI: dwc: dra7xx: Facilitate wrapper and MSI interrupts to be enabled independently
dt-bindings: PCI: Add DT bindings for PCI designware EP mode
PCI: dwc: designware: Add EP mode support
Documentation: PCI: Add binding documentation for pci-test endpoint function
ixgbe: Use pcie_flr() instead of duplicating it
IB/hfi1: Use pcie_flr() instead of duplicating it
PCI: imx6: Fix spelling mistake: "contol" -> "control"
...
Diffstat (limited to 'Documentation')
18 files changed, 1049 insertions, 21 deletions
diff --git a/Documentation/ABI/testing/sysfs-bus-pci b/Documentation/ABI/testing/sysfs-bus-pci index e4e90104d7c3..44d4b2be92fd 100644 --- a/Documentation/ABI/testing/sysfs-bus-pci +++ b/Documentation/ABI/testing/sysfs-bus-pci | |||
@@ -301,3 +301,25 @@ Contact: Emil Velikov <emil.l.velikov@gmail.com> | |||
301 | Description: | 301 | Description: |
302 | This file contains the revision field of the PCI device. | 302 | This file contains the revision field of the PCI device. |
303 | The value comes from device config space. The file is read only. | 303 | The value comes from device config space. The file is read only. |
304 | |||
305 | What: /sys/bus/pci/devices/.../sriov_drivers_autoprobe | ||
306 | Date: April 2017 | ||
307 | Contact: Bodong Wang<bodong@mellanox.com> | ||
308 | Description: | ||
309 | This file is associated with the PF of a device that | ||
310 | supports SR-IOV. It determines whether newly-enabled VFs | ||
311 | are immediately bound to a driver. It initially contains | ||
312 | 1, which means the kernel automatically binds VFs to a | ||
313 | compatible driver immediately after they are enabled. If | ||
314 | an application writes 0 to the file before enabling VFs, | ||
315 | the kernel will not bind VFs to a driver. | ||
316 | |||
317 | A typical use case is to write 0 to this file, then enable | ||
318 | VFs, then assign the newly-created VFs to virtual machines. | ||
319 | Note that changing this file does not affect already- | ||
320 | enabled VFs. In this scenario, the user must first disable | ||
321 | the VFs, write 0 to sriov_drivers_autoprobe, then re-enable | ||
322 | the VFs. | ||
323 | |||
324 | This is similar to /sys/bus/pci/drivers_autoprobe, but | ||
325 | affects only the VFs associated with a specific PF. | ||
diff --git a/Documentation/ABI/testing/sysfs-class-switchtec b/Documentation/ABI/testing/sysfs-class-switchtec new file mode 100644 index 000000000000..48cb4c15e430 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-switchtec | |||
@@ -0,0 +1,96 @@ | |||
1 | switchtec - Microsemi Switchtec PCI Switch Management Endpoint | ||
2 | |||
3 | For details on this subsystem look at Documentation/switchtec.txt. | ||
4 | |||
5 | What: /sys/class/switchtec | ||
6 | Date: 05-Jan-2017 | ||
7 | KernelVersion: v4.11 | ||
8 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
9 | Description: The switchtec class subsystem folder. | ||
10 | Each registered switchtec driver is represented by a switchtecX | ||
11 | subfolder (X being an integer >= 0). | ||
12 | |||
13 | |||
14 | What: /sys/class/switchtec/switchtec[0-9]+/component_id | ||
15 | Date: 05-Jan-2017 | ||
16 | KernelVersion: v4.11 | ||
17 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
18 | Description: Component identifier as stored in the hardware (eg. PM8543) | ||
19 | (read only) | ||
20 | Values: arbitrary string. | ||
21 | |||
22 | |||
23 | What: /sys/class/switchtec/switchtec[0-9]+/component_revision | ||
24 | Date: 05-Jan-2017 | ||
25 | KernelVersion: v4.11 | ||
26 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
27 | Description: Component revision stored in the hardware (read only) | ||
28 | Values: integer. | ||
29 | |||
30 | |||
31 | What: /sys/class/switchtec/switchtec[0-9]+/component_vendor | ||
32 | Date: 05-Jan-2017 | ||
33 | KernelVersion: v4.11 | ||
34 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
35 | Description: Component vendor as stored in the hardware (eg. MICROSEM) | ||
36 | (read only) | ||
37 | Values: arbitrary string. | ||
38 | |||
39 | |||
40 | What: /sys/class/switchtec/switchtec[0-9]+/device_version | ||
41 | Date: 05-Jan-2017 | ||
42 | KernelVersion: v4.11 | ||
43 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
44 | Description: Device version as stored in the hardware (read only) | ||
45 | Values: integer. | ||
46 | |||
47 | |||
48 | What: /sys/class/switchtec/switchtec[0-9]+/fw_version | ||
49 | Date: 05-Jan-2017 | ||
50 | KernelVersion: v4.11 | ||
51 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
52 | Description: Currently running firmware version (read only) | ||
53 | Values: integer (in hexadecimal). | ||
54 | |||
55 | |||
56 | What: /sys/class/switchtec/switchtec[0-9]+/partition | ||
57 | Date: 05-Jan-2017 | ||
58 | KernelVersion: v4.11 | ||
59 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
60 | Description: Partition number for this device in the switch (read only) | ||
61 | Values: integer. | ||
62 | |||
63 | |||
64 | What: /sys/class/switchtec/switchtec[0-9]+/partition_count | ||
65 | Date: 05-Jan-2017 | ||
66 | KernelVersion: v4.11 | ||
67 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
68 | Description: Total number of partitions in the switch (read only) | ||
69 | Values: integer. | ||
70 | |||
71 | |||
72 | What: /sys/class/switchtec/switchtec[0-9]+/product_id | ||
73 | Date: 05-Jan-2017 | ||
74 | KernelVersion: v4.11 | ||
75 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
76 | Description: Product identifier as stored in the hardware (eg. PSX 48XG3) | ||
77 | (read only) | ||
78 | Values: arbitrary string. | ||
79 | |||
80 | |||
81 | What: /sys/class/switchtec/switchtec[0-9]+/product_revision | ||
82 | Date: 05-Jan-2017 | ||
83 | KernelVersion: v4.11 | ||
84 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
85 | Description: Product revision stored in the hardware (eg. RevB) | ||
86 | (read only) | ||
87 | Values: arbitrary string. | ||
88 | |||
89 | |||
90 | What: /sys/class/switchtec/switchtec[0-9]+/product_vendor | ||
91 | Date: 05-Jan-2017 | ||
92 | KernelVersion: v4.11 | ||
93 | Contact: Logan Gunthorpe <logang@deltatee.com> | ||
94 | Description: Product vendor as stored in the hardware (eg. MICROSEM) | ||
95 | (read only) | ||
96 | Values: arbitrary string. | ||
diff --git a/Documentation/PCI/00-INDEX b/Documentation/PCI/00-INDEX index 147231f1613e..00c9a90b6f38 100644 --- a/Documentation/PCI/00-INDEX +++ b/Documentation/PCI/00-INDEX | |||
@@ -12,3 +12,13 @@ pci.txt | |||
12 | - info on the PCI subsystem for device driver authors | 12 | - info on the PCI subsystem for device driver authors |
13 | pcieaer-howto.txt | 13 | pcieaer-howto.txt |
14 | - the PCI Express Advanced Error Reporting Driver Guide HOWTO | 14 | - the PCI Express Advanced Error Reporting Driver Guide HOWTO |
15 | endpoint/pci-endpoint.txt | ||
16 | - guide to add endpoint controller driver and endpoint function driver. | ||
17 | endpoint/pci-endpoint-cfs.txt | ||
18 | - guide to use configfs to configure the PCI endpoint function. | ||
19 | endpoint/pci-test-function.txt | ||
20 | - specification of *PCI test* function device. | ||
21 | endpoint/pci-test-howto.txt | ||
22 | - userguide for PCI endpoint test function. | ||
23 | endpoint/function/binding/ | ||
24 | - binding documentation for PCI endpoint function | ||
diff --git a/Documentation/PCI/endpoint/function/binding/pci-test.txt b/Documentation/PCI/endpoint/function/binding/pci-test.txt new file mode 100644 index 000000000000..3b68b955fb50 --- /dev/null +++ b/Documentation/PCI/endpoint/function/binding/pci-test.txt | |||
@@ -0,0 +1,17 @@ | |||
1 | PCI TEST ENDPOINT FUNCTION | ||
2 | |||
3 | name: Should be "pci_epf_test" to bind to the pci_epf_test driver. | ||
4 | |||
5 | Configurable Fields: | ||
6 | vendorid : should be 0x104c | ||
7 | deviceid : should be 0xb500 for DRA74x and 0xb501 for DRA72x | ||
8 | revid : don't care | ||
9 | progif_code : don't care | ||
10 | subclass_code : don't care | ||
11 | baseclass_code : should be 0xff | ||
12 | cache_line_size : don't care | ||
13 | subsys_vendor_id : don't care | ||
14 | subsys_id : don't care | ||
15 | interrupt_pin : Should be 1 - INTA, 2 - INTB, 3 - INTC, 4 -INTD | ||
16 | msi_interrupts : Should be 1 to 32 depending on the number of MSI interrupts | ||
17 | to test | ||
diff --git a/Documentation/PCI/endpoint/pci-endpoint-cfs.txt b/Documentation/PCI/endpoint/pci-endpoint-cfs.txt new file mode 100644 index 000000000000..d740f29960a4 --- /dev/null +++ b/Documentation/PCI/endpoint/pci-endpoint-cfs.txt | |||
@@ -0,0 +1,105 @@ | |||
1 | CONFIGURING PCI ENDPOINT USING CONFIGFS | ||
2 | Kishon Vijay Abraham I <kishon@ti.com> | ||
3 | |||
4 | The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the | ||
5 | PCI endpoint function and to bind the endpoint function | ||
6 | with the endpoint controller. (For introducing other mechanisms to | ||
7 | configure the PCI Endpoint Function refer to [1]). | ||
8 | |||
9 | *) Mounting configfs | ||
10 | |||
11 | The PCI Endpoint Core layer creates pci_ep directory in the mounted configfs | ||
12 | directory. configfs can be mounted using the following command. | ||
13 | |||
14 | mount -t configfs none /sys/kernel/config | ||
15 | |||
16 | *) Directory Structure | ||
17 | |||
18 | The pci_ep configfs has two directories at its root: controllers and | ||
19 | functions. Every EPC device present in the system will have an entry in | ||
20 | the *controllers* directory and and every EPF driver present in the system | ||
21 | will have an entry in the *functions* directory. | ||
22 | |||
23 | /sys/kernel/config/pci_ep/ | ||
24 | .. controllers/ | ||
25 | .. functions/ | ||
26 | |||
27 | *) Creating EPF Device | ||
28 | |||
29 | Every registered EPF driver will be listed in controllers directory. The | ||
30 | entries corresponding to EPF driver will be created by the EPF core. | ||
31 | |||
32 | /sys/kernel/config/pci_ep/functions/ | ||
33 | .. <EPF Driver1>/ | ||
34 | ... <EPF Device 11>/ | ||
35 | ... <EPF Device 21>/ | ||
36 | .. <EPF Driver2>/ | ||
37 | ... <EPF Device 12>/ | ||
38 | ... <EPF Device 22>/ | ||
39 | |||
40 | In order to create a <EPF device> of the type probed by <EPF Driver>, the | ||
41 | user has to create a directory inside <EPF DriverN>. | ||
42 | |||
43 | Every <EPF device> directory consists of the following entries that can be | ||
44 | used to configure the standard configuration header of the endpoint function. | ||
45 | (These entries are created by the framework when any new <EPF Device> is | ||
46 | created) | ||
47 | |||
48 | .. <EPF Driver1>/ | ||
49 | ... <EPF Device 11>/ | ||
50 | ... vendorid | ||
51 | ... deviceid | ||
52 | ... revid | ||
53 | ... progif_code | ||
54 | ... subclass_code | ||
55 | ... baseclass_code | ||
56 | ... cache_line_size | ||
57 | ... subsys_vendor_id | ||
58 | ... subsys_id | ||
59 | ... interrupt_pin | ||
60 | |||
61 | *) EPC Device | ||
62 | |||
63 | Every registered EPC device will be listed in controllers directory. The | ||
64 | entries corresponding to EPC device will be created by the EPC core. | ||
65 | |||
66 | /sys/kernel/config/pci_ep/controllers/ | ||
67 | .. <EPC Device1>/ | ||
68 | ... <Symlink EPF Device11>/ | ||
69 | ... <Symlink EPF Device12>/ | ||
70 | ... start | ||
71 | .. <EPC Device2>/ | ||
72 | ... <Symlink EPF Device21>/ | ||
73 | ... <Symlink EPF Device22>/ | ||
74 | ... start | ||
75 | |||
76 | The <EPC Device> directory will have a list of symbolic links to | ||
77 | <EPF Device>. These symbolic links should be created by the user to | ||
78 | represent the functions present in the endpoint device. | ||
79 | |||
80 | The <EPC Device> directory will also have a *start* field. Once | ||
81 | "1" is written to this field, the endpoint device will be ready to | ||
82 | establish the link with the host. This is usually done after | ||
83 | all the EPF devices are created and linked with the EPC device. | ||
84 | |||
85 | |||
86 | | controllers/ | ||
87 | | <Directory: EPC name>/ | ||
88 | | <Symbolic Link: Function> | ||
89 | | start | ||
90 | | functions/ | ||
91 | | <Directory: EPF driver>/ | ||
92 | | <Directory: EPF device>/ | ||
93 | | vendorid | ||
94 | | deviceid | ||
95 | | revid | ||
96 | | progif_code | ||
97 | | subclass_code | ||
98 | | baseclass_code | ||
99 | | cache_line_size | ||
100 | | subsys_vendor_id | ||
101 | | subsys_id | ||
102 | | interrupt_pin | ||
103 | | function | ||
104 | |||
105 | [1] -> Documentation/PCI/endpoint/pci-endpoint.txt | ||
diff --git a/Documentation/PCI/endpoint/pci-endpoint.txt b/Documentation/PCI/endpoint/pci-endpoint.txt new file mode 100644 index 000000000000..9b1d66829290 --- /dev/null +++ b/Documentation/PCI/endpoint/pci-endpoint.txt | |||
@@ -0,0 +1,215 @@ | |||
1 | PCI ENDPOINT FRAMEWORK | ||
2 | Kishon Vijay Abraham I <kishon@ti.com> | ||
3 | |||
4 | This document is a guide to use the PCI Endpoint Framework in order to create | ||
5 | endpoint controller driver, endpoint function driver, and using configfs | ||
6 | interface to bind the function driver to the controller driver. | ||
7 | |||
8 | 1. Introduction | ||
9 | |||
10 | Linux has a comprehensive PCI subsystem to support PCI controllers that | ||
11 | operates in Root Complex mode. The subsystem has capability to scan PCI bus, | ||
12 | assign memory resources and IRQ resources, load PCI driver (based on | ||
13 | vendor ID, device ID), support other services like hot-plug, power management, | ||
14 | advanced error reporting and virtual channels. | ||
15 | |||
16 | However the PCI controller IP integrated in some SoCs is capable of operating | ||
17 | either in Root Complex mode or Endpoint mode. PCI Endpoint Framework will | ||
18 | add endpoint mode support in Linux. This will help to run Linux in an | ||
19 | EP system which can have a wide variety of use cases from testing or | ||
20 | validation, co-processor accelerator, etc. | ||
21 | |||
22 | 2. PCI Endpoint Core | ||
23 | |||
24 | The PCI Endpoint Core layer comprises 3 components: the Endpoint Controller | ||
25 | library, the Endpoint Function library, and the configfs layer to bind the | ||
26 | endpoint function with the endpoint controller. | ||
27 | |||
28 | 2.1 PCI Endpoint Controller(EPC) Library | ||
29 | |||
30 | The EPC library provides APIs to be used by the controller that can operate | ||
31 | in endpoint mode. It also provides APIs to be used by function driver/library | ||
32 | in order to implement a particular endpoint function. | ||
33 | |||
34 | 2.1.1 APIs for the PCI controller Driver | ||
35 | |||
36 | This section lists the APIs that the PCI Endpoint core provides to be used | ||
37 | by the PCI controller driver. | ||
38 | |||
39 | *) devm_pci_epc_create()/pci_epc_create() | ||
40 | |||
41 | The PCI controller driver should implement the following ops: | ||
42 | * write_header: ops to populate configuration space header | ||
43 | * set_bar: ops to configure the BAR | ||
44 | * clear_bar: ops to reset the BAR | ||
45 | * alloc_addr_space: ops to allocate in PCI controller address space | ||
46 | * free_addr_space: ops to free the allocated address space | ||
47 | * raise_irq: ops to raise a legacy or MSI interrupt | ||
48 | * start: ops to start the PCI link | ||
49 | * stop: ops to stop the PCI link | ||
50 | |||
51 | The PCI controller driver can then create a new EPC device by invoking | ||
52 | devm_pci_epc_create()/pci_epc_create(). | ||
53 | |||
54 | *) devm_pci_epc_destroy()/pci_epc_destroy() | ||
55 | |||
56 | The PCI controller driver can destroy the EPC device created by either | ||
57 | devm_pci_epc_create() or pci_epc_create() using devm_pci_epc_destroy() or | ||
58 | pci_epc_destroy(). | ||
59 | |||
60 | *) pci_epc_linkup() | ||
61 | |||
62 | In order to notify all the function devices that the EPC device to which | ||
63 | they are linked has established a link with the host, the PCI controller | ||
64 | driver should invoke pci_epc_linkup(). | ||
65 | |||
66 | *) pci_epc_mem_init() | ||
67 | |||
68 | Initialize the pci_epc_mem structure used for allocating EPC addr space. | ||
69 | |||
70 | *) pci_epc_mem_exit() | ||
71 | |||
72 | Cleanup the pci_epc_mem structure allocated during pci_epc_mem_init(). | ||
73 | |||
74 | 2.1.2 APIs for the PCI Endpoint Function Driver | ||
75 | |||
76 | This section lists the APIs that the PCI Endpoint core provides to be used | ||
77 | by the PCI endpoint function driver. | ||
78 | |||
79 | *) pci_epc_write_header() | ||
80 | |||
81 | The PCI endpoint function driver should use pci_epc_write_header() to | ||
82 | write the standard configuration header to the endpoint controller. | ||
83 | |||
84 | *) pci_epc_set_bar() | ||
85 | |||
86 | The PCI endpoint function driver should use pci_epc_set_bar() to configure | ||
87 | the Base Address Register in order for the host to assign PCI addr space. | ||
88 | Register space of the function driver is usually configured | ||
89 | using this API. | ||
90 | |||
91 | *) pci_epc_clear_bar() | ||
92 | |||
93 | The PCI endpoint function driver should use pci_epc_clear_bar() to reset | ||
94 | the BAR. | ||
95 | |||
96 | *) pci_epc_raise_irq() | ||
97 | |||
98 | The PCI endpoint function driver should use pci_epc_raise_irq() to raise | ||
99 | Legacy Interrupt or MSI Interrupt. | ||
100 | |||
101 | *) pci_epc_mem_alloc_addr() | ||
102 | |||
103 | The PCI endpoint function driver should use pci_epc_mem_alloc_addr(), to | ||
104 | allocate memory address from EPC addr space which is required to access | ||
105 | RC's buffer | ||
106 | |||
107 | *) pci_epc_mem_free_addr() | ||
108 | |||
109 | The PCI endpoint function driver should use pci_epc_mem_free_addr() to | ||
110 | free the memory space allocated using pci_epc_mem_alloc_addr(). | ||
111 | |||
112 | 2.1.3 Other APIs | ||
113 | |||
114 | There are other APIs provided by the EPC library. These are used for binding | ||
115 | the EPF device with EPC device. pci-ep-cfs.c can be used as reference for | ||
116 | using these APIs. | ||
117 | |||
118 | *) pci_epc_get() | ||
119 | |||
120 | Get a reference to the PCI endpoint controller based on the device name of | ||
121 | the controller. | ||
122 | |||
123 | *) pci_epc_put() | ||
124 | |||
125 | Release the reference to the PCI endpoint controller obtained using | ||
126 | pci_epc_get() | ||
127 | |||
128 | *) pci_epc_add_epf() | ||
129 | |||
130 | Add a PCI endpoint function to a PCI endpoint controller. A PCIe device | ||
131 | can have up to 8 functions according to the specification. | ||
132 | |||
133 | *) pci_epc_remove_epf() | ||
134 | |||
135 | Remove the PCI endpoint function from PCI endpoint controller. | ||
136 | |||
137 | *) pci_epc_start() | ||
138 | |||
139 | The PCI endpoint function driver should invoke pci_epc_start() once it | ||
140 | has configured the endpoint function and wants to start the PCI link. | ||
141 | |||
142 | *) pci_epc_stop() | ||
143 | |||
144 | The PCI endpoint function driver should invoke pci_epc_stop() to stop | ||
145 | the PCI LINK. | ||
146 | |||
147 | 2.2 PCI Endpoint Function(EPF) Library | ||
148 | |||
149 | The EPF library provides APIs to be used by the function driver and the EPC | ||
150 | library to provide endpoint mode functionality. | ||
151 | |||
152 | 2.2.1 APIs for the PCI Endpoint Function Driver | ||
153 | |||
154 | This section lists the APIs that the PCI Endpoint core provides to be used | ||
155 | by the PCI endpoint function driver. | ||
156 | |||
157 | *) pci_epf_register_driver() | ||
158 | |||
159 | The PCI Endpoint Function driver should implement the following ops: | ||
160 | * bind: ops to perform when a EPC device has been bound to EPF device | ||
161 | * unbind: ops to perform when a binding has been lost between a EPC | ||
162 | device and EPF device | ||
163 | * linkup: ops to perform when the EPC device has established a | ||
164 | connection with a host system | ||
165 | |||
166 | The PCI Function driver can then register the PCI EPF driver by using | ||
167 | pci_epf_register_driver(). | ||
168 | |||
169 | *) pci_epf_unregister_driver() | ||
170 | |||
171 | The PCI Function driver can unregister the PCI EPF driver by using | ||
172 | pci_epf_unregister_driver(). | ||
173 | |||
174 | *) pci_epf_alloc_space() | ||
175 | |||
176 | The PCI Function driver can allocate space for a particular BAR using | ||
177 | pci_epf_alloc_space(). | ||
178 | |||
179 | *) pci_epf_free_space() | ||
180 | |||
181 | The PCI Function driver can free the allocated space | ||
182 | (using pci_epf_alloc_space) by invoking pci_epf_free_space(). | ||
183 | |||
184 | 2.2.2 APIs for the PCI Endpoint Controller Library | ||
185 | This section lists the APIs that the PCI Endpoint core provides to be used | ||
186 | by the PCI endpoint controller library. | ||
187 | |||
188 | *) pci_epf_linkup() | ||
189 | |||
190 | The PCI endpoint controller library invokes pci_epf_linkup() when the | ||
191 | EPC device has established the connection to the host. | ||
192 | |||
193 | 2.2.2 Other APIs | ||
194 | There are other APIs provided by the EPF library. These are used to notify | ||
195 | the function driver when the EPF device is bound to the EPC device. | ||
196 | pci-ep-cfs.c can be used as reference for using these APIs. | ||
197 | |||
198 | *) pci_epf_create() | ||
199 | |||
200 | Create a new PCI EPF device by passing the name of the PCI EPF device. | ||
201 | This name will be used to bind the the EPF device to a EPF driver. | ||
202 | |||
203 | *) pci_epf_destroy() | ||
204 | |||
205 | Destroy the created PCI EPF device. | ||
206 | |||
207 | *) pci_epf_bind() | ||
208 | |||
209 | pci_epf_bind() should be invoked when the EPF device has been bound to | ||
210 | a EPC device. | ||
211 | |||
212 | *) pci_epf_unbind() | ||
213 | |||
214 | pci_epf_unbind() should be invoked when the binding between EPC device | ||
215 | and EPF device is lost. | ||
diff --git a/Documentation/PCI/endpoint/pci-test-function.txt b/Documentation/PCI/endpoint/pci-test-function.txt new file mode 100644 index 000000000000..0c519c9bf94a --- /dev/null +++ b/Documentation/PCI/endpoint/pci-test-function.txt | |||
@@ -0,0 +1,66 @@ | |||
1 | PCI TEST | ||
2 | Kishon Vijay Abraham I <kishon@ti.com> | ||
3 | |||
4 | Traditionally PCI RC has always been validated by using standard | ||
5 | PCI cards like ethernet PCI cards or USB PCI cards or SATA PCI cards. | ||
6 | However with the addition of EP-core in linux kernel, it is possible | ||
7 | to configure a PCI controller that can operate in EP mode to work as | ||
8 | a test device. | ||
9 | |||
10 | The PCI endpoint test device is a virtual device (defined in software) | ||
11 | used to test the endpoint functionality and serve as a sample driver | ||
12 | for other PCI endpoint devices (to use the EP framework). | ||
13 | |||
14 | The PCI endpoint test device has the following registers: | ||
15 | |||
16 | 1) PCI_ENDPOINT_TEST_MAGIC | ||
17 | 2) PCI_ENDPOINT_TEST_COMMAND | ||
18 | 3) PCI_ENDPOINT_TEST_STATUS | ||
19 | 4) PCI_ENDPOINT_TEST_SRC_ADDR | ||
20 | 5) PCI_ENDPOINT_TEST_DST_ADDR | ||
21 | 6) PCI_ENDPOINT_TEST_SIZE | ||
22 | 7) PCI_ENDPOINT_TEST_CHECKSUM | ||
23 | |||
24 | *) PCI_ENDPOINT_TEST_MAGIC | ||
25 | |||
26 | This register will be used to test BAR0. A known pattern will be written | ||
27 | and read back from MAGIC register to verify BAR0. | ||
28 | |||
29 | *) PCI_ENDPOINT_TEST_COMMAND: | ||
30 | |||
31 | This register will be used by the host driver to indicate the function | ||
32 | that the endpoint device must perform. | ||
33 | |||
34 | Bitfield Description: | ||
35 | Bit 0 : raise legacy IRQ | ||
36 | Bit 1 : raise MSI IRQ | ||
37 | Bit 2 - 7 : MSI interrupt number | ||
38 | Bit 8 : read command (read data from RC buffer) | ||
39 | Bit 9 : write command (write data to RC buffer) | ||
40 | Bit 10 : copy command (copy data from one RC buffer to another | ||
41 | RC buffer) | ||
42 | |||
43 | *) PCI_ENDPOINT_TEST_STATUS | ||
44 | |||
45 | This register reflects the status of the PCI endpoint device. | ||
46 | |||
47 | Bitfield Description: | ||
48 | Bit 0 : read success | ||
49 | Bit 1 : read fail | ||
50 | Bit 2 : write success | ||
51 | Bit 3 : write fail | ||
52 | Bit 4 : copy success | ||
53 | Bit 5 : copy fail | ||
54 | Bit 6 : IRQ raised | ||
55 | Bit 7 : source address is invalid | ||
56 | Bit 8 : destination address is invalid | ||
57 | |||
58 | *) PCI_ENDPOINT_TEST_SRC_ADDR | ||
59 | |||
60 | This register contains the source address (RC buffer address) for the | ||
61 | COPY/READ command. | ||
62 | |||
63 | *) PCI_ENDPOINT_TEST_DST_ADDR | ||
64 | |||
65 | This register contains the destination address (RC buffer address) for | ||
66 | the COPY/WRITE command. | ||
diff --git a/Documentation/PCI/endpoint/pci-test-howto.txt b/Documentation/PCI/endpoint/pci-test-howto.txt new file mode 100644 index 000000000000..75f48c3bb191 --- /dev/null +++ b/Documentation/PCI/endpoint/pci-test-howto.txt | |||
@@ -0,0 +1,179 @@ | |||
1 | PCI TEST USERGUIDE | ||
2 | Kishon Vijay Abraham I <kishon@ti.com> | ||
3 | |||
4 | This document is a guide to help users use pci-epf-test function driver | ||
5 | and pci_endpoint_test host driver for testing PCI. The list of steps to | ||
6 | be followed in the host side and EP side is given below. | ||
7 | |||
8 | 1. Endpoint Device | ||
9 | |||
10 | 1.1 Endpoint Controller Devices | ||
11 | |||
12 | To find the list of endpoint controller devices in the system: | ||
13 | |||
14 | # ls /sys/class/pci_epc/ | ||
15 | 51000000.pcie_ep | ||
16 | |||
17 | If PCI_ENDPOINT_CONFIGFS is enabled | ||
18 | # ls /sys/kernel/config/pci_ep/controllers | ||
19 | 51000000.pcie_ep | ||
20 | |||
21 | 1.2 Endpoint Function Drivers | ||
22 | |||
23 | To find the list of endpoint function drivers in the system: | ||
24 | |||
25 | # ls /sys/bus/pci-epf/drivers | ||
26 | pci_epf_test | ||
27 | |||
28 | If PCI_ENDPOINT_CONFIGFS is enabled | ||
29 | # ls /sys/kernel/config/pci_ep/functions | ||
30 | pci_epf_test | ||
31 | |||
32 | 1.3 Creating pci-epf-test Device | ||
33 | |||
34 | PCI endpoint function device can be created using the configfs. To create | ||
35 | pci-epf-test device, the following commands can be used | ||
36 | |||
37 | # mount -t configfs none /sys/kernel/config | ||
38 | # cd /sys/kernel/config/pci_ep/ | ||
39 | # mkdir functions/pci_epf_test/func1 | ||
40 | |||
41 | The "mkdir func1" above creates the pci-epf-test function device that will | ||
42 | be probed by pci_epf_test driver. | ||
43 | |||
44 | The PCI endpoint framework populates the directory with the following | ||
45 | configurable fields. | ||
46 | |||
47 | # ls functions/pci_epf_test/func1 | ||
48 | baseclass_code interrupt_pin revid subsys_vendor_id | ||
49 | cache_line_size msi_interrupts subclass_code vendorid | ||
50 | deviceid progif_code subsys_id | ||
51 | |||
52 | The PCI endpoint function driver populates these entries with default values | ||
53 | when the device is bound to the driver. The pci-epf-test driver populates | ||
54 | vendorid with 0xffff and interrupt_pin with 0x0001 | ||
55 | |||
56 | # cat functions/pci_epf_test/func1/vendorid | ||
57 | 0xffff | ||
58 | # cat functions/pci_epf_test/func1/interrupt_pin | ||
59 | 0x0001 | ||
60 | |||
61 | 1.4 Configuring pci-epf-test Device | ||
62 | |||
63 | The user can configure the pci-epf-test device using configfs entry. In order | ||
64 | to change the vendorid and the number of MSI interrupts used by the function | ||
65 | device, the following commands can be used. | ||
66 | |||
67 | # echo 0x104c > functions/pci_epf_test/func1/vendorid | ||
68 | # echo 0xb500 > functions/pci_epf_test/func1/deviceid | ||
69 | # echo 16 > functions/pci_epf_test/func1/msi_interrupts | ||
70 | |||
71 | 1.5 Binding pci-epf-test Device to EP Controller | ||
72 | |||
73 | In order for the endpoint function device to be useful, it has to be bound to | ||
74 | a PCI endpoint controller driver. Use the configfs to bind the function | ||
75 | device to one of the controller driver present in the system. | ||
76 | |||
77 | # ln -s functions/pci_epf_test/func1 controllers/51000000.pcie_ep/ | ||
78 | |||
79 | Once the above step is completed, the PCI endpoint is ready to establish a link | ||
80 | with the host. | ||
81 | |||
82 | 1.6 Start the Link | ||
83 | |||
84 | In order for the endpoint device to establish a link with the host, the _start_ | ||
85 | field should be populated with '1'. | ||
86 | |||
87 | # echo 1 > controllers/51000000.pcie_ep/start | ||
88 | |||
89 | 2. RootComplex Device | ||
90 | |||
91 | 2.1 lspci Output | ||
92 | |||
93 | Note that the devices listed here correspond to the value populated in 1.4 above | ||
94 | |||
95 | 00:00.0 PCI bridge: Texas Instruments Device 8888 (rev 01) | ||
96 | 01:00.0 Unassigned class [ff00]: Texas Instruments Device b500 | ||
97 | |||
98 | 2.2 Using Endpoint Test function Device | ||
99 | |||
100 | pcitest.sh added in tools/pci/ can be used to run all the default PCI endpoint | ||
101 | tests. Before pcitest.sh can be used pcitest.c should be compiled using the | ||
102 | following commands. | ||
103 | |||
104 | cd <kernel-dir> | ||
105 | make headers_install ARCH=arm | ||
106 | arm-linux-gnueabihf-gcc -Iusr/include tools/pci/pcitest.c -o pcitest | ||
107 | cp pcitest <rootfs>/usr/sbin/ | ||
108 | cp tools/pci/pcitest.sh <rootfs> | ||
109 | |||
110 | 2.2.1 pcitest.sh Output | ||
111 | # ./pcitest.sh | ||
112 | BAR tests | ||
113 | |||
114 | BAR0: OKAY | ||
115 | BAR1: OKAY | ||
116 | BAR2: OKAY | ||
117 | BAR3: OKAY | ||
118 | BAR4: NOT OKAY | ||
119 | BAR5: NOT OKAY | ||
120 | |||
121 | Interrupt tests | ||
122 | |||
123 | LEGACY IRQ: NOT OKAY | ||
124 | MSI1: OKAY | ||
125 | MSI2: OKAY | ||
126 | MSI3: OKAY | ||
127 | MSI4: OKAY | ||
128 | MSI5: OKAY | ||
129 | MSI6: OKAY | ||
130 | MSI7: OKAY | ||
131 | MSI8: OKAY | ||
132 | MSI9: OKAY | ||
133 | MSI10: OKAY | ||
134 | MSI11: OKAY | ||
135 | MSI12: OKAY | ||
136 | MSI13: OKAY | ||
137 | MSI14: OKAY | ||
138 | MSI15: OKAY | ||
139 | MSI16: OKAY | ||
140 | MSI17: NOT OKAY | ||
141 | MSI18: NOT OKAY | ||
142 | MSI19: NOT OKAY | ||
143 | MSI20: NOT OKAY | ||
144 | MSI21: NOT OKAY | ||
145 | MSI22: NOT OKAY | ||
146 | MSI23: NOT OKAY | ||
147 | MSI24: NOT OKAY | ||
148 | MSI25: NOT OKAY | ||
149 | MSI26: NOT OKAY | ||
150 | MSI27: NOT OKAY | ||
151 | MSI28: NOT OKAY | ||
152 | MSI29: NOT OKAY | ||
153 | MSI30: NOT OKAY | ||
154 | MSI31: NOT OKAY | ||
155 | MSI32: NOT OKAY | ||
156 | |||
157 | Read Tests | ||
158 | |||
159 | READ ( 1 bytes): OKAY | ||
160 | READ ( 1024 bytes): OKAY | ||
161 | READ ( 1025 bytes): OKAY | ||
162 | READ (1024000 bytes): OKAY | ||
163 | READ (1024001 bytes): OKAY | ||
164 | |||
165 | Write Tests | ||
166 | |||
167 | WRITE ( 1 bytes): OKAY | ||
168 | WRITE ( 1024 bytes): OKAY | ||
169 | WRITE ( 1025 bytes): OKAY | ||
170 | WRITE (1024000 bytes): OKAY | ||
171 | WRITE (1024001 bytes): OKAY | ||
172 | |||
173 | Copy Tests | ||
174 | |||
175 | COPY ( 1 bytes): OKAY | ||
176 | COPY ( 1024 bytes): OKAY | ||
177 | COPY ( 1025 bytes): OKAY | ||
178 | COPY (1024000 bytes): OKAY | ||
179 | COPY (1024001 bytes): OKAY | ||
diff --git a/Documentation/PCI/pci-iov-howto.txt b/Documentation/PCI/pci-iov-howto.txt index 2d91ae251982..d2a84151e99c 100644 --- a/Documentation/PCI/pci-iov-howto.txt +++ b/Documentation/PCI/pci-iov-howto.txt | |||
@@ -68,6 +68,18 @@ To disable SR-IOV capability: | |||
68 | echo 0 > \ | 68 | echo 0 > \ |
69 | /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_numvfs | 69 | /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_numvfs |
70 | 70 | ||
71 | To enable auto probing VFs by a compatible driver on the host, run | ||
72 | command below before enabling SR-IOV capabilities. This is the | ||
73 | default behavior. | ||
74 | echo 1 > \ | ||
75 | /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_drivers_autoprobe | ||
76 | |||
77 | To disable auto probing VFs by a compatible driver on the host, run | ||
78 | command below before enabling SR-IOV capabilities. Updating this | ||
79 | entry will not affect VFs which are already probed. | ||
80 | echo 0 > \ | ||
81 | /sys/bus/pci/devices/<DOMAIN:BUS:DEVICE.FUNCTION>/sriov_drivers_autoprobe | ||
82 | |||
71 | 3.2 Usage example | 83 | 3.2 Usage example |
72 | 84 | ||
73 | Following piece of code illustrates the usage of the SR-IOV API. | 85 | Following piece of code illustrates the usage of the SR-IOV API. |
diff --git a/Documentation/devicetree/bindings/pci/designware-pcie.txt b/Documentation/devicetree/bindings/pci/designware-pcie.txt index 1392c705ceca..b2480dd38c11 100644 --- a/Documentation/devicetree/bindings/pci/designware-pcie.txt +++ b/Documentation/devicetree/bindings/pci/designware-pcie.txt | |||
@@ -6,30 +6,40 @@ Required properties: | |||
6 | - reg-names: Must be "config" for the PCIe configuration space. | 6 | - reg-names: Must be "config" for the PCIe configuration space. |
7 | (The old way of getting the configuration address space from "ranges" | 7 | (The old way of getting the configuration address space from "ranges" |
8 | is deprecated and should be avoided.) | 8 | is deprecated and should be avoided.) |
9 | - num-lanes: number of lanes to use | ||
10 | RC mode: | ||
9 | - #address-cells: set to <3> | 11 | - #address-cells: set to <3> |
10 | - #size-cells: set to <2> | 12 | - #size-cells: set to <2> |
11 | - device_type: set to "pci" | 13 | - device_type: set to "pci" |
12 | - ranges: ranges for the PCI memory and I/O regions | 14 | - ranges: ranges for the PCI memory and I/O regions |
13 | - #interrupt-cells: set to <1> | 15 | - #interrupt-cells: set to <1> |
14 | - interrupt-map-mask and interrupt-map: standard PCI properties | 16 | - interrupt-map-mask and interrupt-map: standard PCI |
15 | to define the mapping of the PCIe interface to interrupt | 17 | properties to define the mapping of the PCIe interface to interrupt |
16 | numbers. | 18 | numbers. |
17 | - num-lanes: number of lanes to use | 19 | EP mode: |
20 | - num-ib-windows: number of inbound address translation | ||
21 | windows | ||
22 | - num-ob-windows: number of outbound address translation | ||
23 | windows | ||
18 | 24 | ||
19 | Optional properties: | 25 | Optional properties: |
20 | - num-viewport: number of view ports configured in hardware. If a platform | ||
21 | does not specify it, the driver assumes 2. | ||
22 | - num-lanes: number of lanes to use (this property should be specified unless | 26 | - num-lanes: number of lanes to use (this property should be specified unless |
23 | the link is brought already up in BIOS) | 27 | the link is brought already up in BIOS) |
24 | - reset-gpio: gpio pin number of power good signal | 28 | - reset-gpio: gpio pin number of power good signal |
25 | - bus-range: PCI bus numbers covered (it is recommended for new devicetrees to | ||
26 | specify this property, to keep backwards compatibility a range of 0x00-0xff | ||
27 | is assumed if not present) | ||
28 | - clocks: Must contain an entry for each entry in clock-names. | 29 | - clocks: Must contain an entry for each entry in clock-names. |
29 | See ../clocks/clock-bindings.txt for details. | 30 | See ../clocks/clock-bindings.txt for details. |
30 | - clock-names: Must include the following entries: | 31 | - clock-names: Must include the following entries: |
31 | - "pcie" | 32 | - "pcie" |
32 | - "pcie_bus" | 33 | - "pcie_bus" |
34 | RC mode: | ||
35 | - num-viewport: number of view ports configured in | ||
36 | hardware. If a platform does not specify it, the driver assumes 2. | ||
37 | - bus-range: PCI bus numbers covered (it is recommended | ||
38 | for new devicetrees to specify this property, to keep backwards | ||
39 | compatibility a range of 0x00-0xff is assumed if not present) | ||
40 | EP mode: | ||
41 | - max-functions: maximum number of functions that can be | ||
42 | configured | ||
33 | 43 | ||
34 | Example configuration: | 44 | Example configuration: |
35 | 45 | ||
diff --git a/Documentation/devicetree/bindings/pci/faraday,ftpci100.txt b/Documentation/devicetree/bindings/pci/faraday,ftpci100.txt new file mode 100644 index 000000000000..35d4a979bb7b --- /dev/null +++ b/Documentation/devicetree/bindings/pci/faraday,ftpci100.txt | |||
@@ -0,0 +1,129 @@ | |||
1 | Faraday Technology FTPCI100 PCI Host Bridge | ||
2 | |||
3 | This PCI bridge is found inside that Cortina Systems Gemini SoC platform and | ||
4 | is a generic IP block from Faraday Technology. It exists in two variants: | ||
5 | plain and dual PCI. The plain version embeds a cascading interrupt controller | ||
6 | into the host bridge. The dual version routes the interrupts to the host | ||
7 | chips interrupt controller. | ||
8 | |||
9 | The host controller appear on the PCI bus with vendor ID 0x159b (Faraday | ||
10 | Technology) and product ID 0x4321. | ||
11 | |||
12 | Mandatory properties: | ||
13 | |||
14 | - compatible: ranging from specific to generic, should be one of | ||
15 | "cortina,gemini-pci", "faraday,ftpci100" | ||
16 | "cortina,gemini-pci-dual", "faraday,ftpci100-dual" | ||
17 | "faraday,ftpci100" | ||
18 | "faraday,ftpci100-dual" | ||
19 | - reg: memory base and size for the host bridge | ||
20 | - #address-cells: set to <3> | ||
21 | - #size-cells: set to <2> | ||
22 | - #interrupt-cells: set to <1> | ||
23 | - bus-range: set to <0x00 0xff> | ||
24 | - device_type, set to "pci" | ||
25 | - ranges: see pci.txt | ||
26 | - interrupt-map-mask: see pci.txt | ||
27 | - interrupt-map: see pci.txt | ||
28 | - dma-ranges: three ranges for the inbound memory region. The ranges must | ||
29 | be aligned to a 1MB boundary, and may be 1MB, 2MB, 4MB, 8MB, 16MB, 32MB, 64MB, | ||
30 | 128MB, 256MB, 512MB, 1GB or 2GB in size. The memory should be marked as | ||
31 | pre-fetchable. | ||
32 | |||
33 | Mandatory subnodes: | ||
34 | - For "faraday,ftpci100" a node representing the interrupt-controller inside the | ||
35 | host bridge is mandatory. It has the following mandatory properties: | ||
36 | - interrupt: see interrupt-controller/interrupts.txt | ||
37 | - interrupt-parent: see interrupt-controller/interrupts.txt | ||
38 | - interrupt-controller: see interrupt-controller/interrupts.txt | ||
39 | - #address-cells: set to <0> | ||
40 | - #interrupt-cells: set to <1> | ||
41 | |||
42 | I/O space considerations: | ||
43 | |||
44 | The plain variant has 128MiB of non-prefetchable memory space, whereas the | ||
45 | "dual" variant has 64MiB. Take this into account when describing the ranges. | ||
46 | |||
47 | Interrupt map considerations: | ||
48 | |||
49 | The "dual" variant will get INT A, B, C, D from the system interrupt controller | ||
50 | and should point to respective interrupt in that controller in its | ||
51 | interrupt-map. | ||
52 | |||
53 | The code which is the only documentation of how the Faraday PCI (the non-dual | ||
54 | variant) interrupts assigns the default interrupt mapping/swizzling has | ||
55 | typically been like this, doing the swizzling on the interrupt controller side | ||
56 | rather than in the interconnect: | ||
57 | |||
58 | interrupt-map-mask = <0xf800 0 0 7>; | ||
59 | interrupt-map = | ||
60 | <0x4800 0 0 1 &pci_intc 0>, /* Slot 9 */ | ||
61 | <0x4800 0 0 2 &pci_intc 1>, | ||
62 | <0x4800 0 0 3 &pci_intc 2>, | ||
63 | <0x4800 0 0 4 &pci_intc 3>, | ||
64 | <0x5000 0 0 1 &pci_intc 1>, /* Slot 10 */ | ||
65 | <0x5000 0 0 2 &pci_intc 2>, | ||
66 | <0x5000 0 0 3 &pci_intc 3>, | ||
67 | <0x5000 0 0 4 &pci_intc 0>, | ||
68 | <0x5800 0 0 1 &pci_intc 2>, /* Slot 11 */ | ||
69 | <0x5800 0 0 2 &pci_intc 3>, | ||
70 | <0x5800 0 0 3 &pci_intc 0>, | ||
71 | <0x5800 0 0 4 &pci_intc 1>, | ||
72 | <0x6000 0 0 1 &pci_intc 3>, /* Slot 12 */ | ||
73 | <0x6000 0 0 2 &pci_intc 0>, | ||
74 | <0x6000 0 0 3 &pci_intc 1>, | ||
75 | <0x6000 0 0 4 &pci_intc 2>; | ||
76 | |||
77 | Example: | ||
78 | |||
79 | pci@50000000 { | ||
80 | compatible = "cortina,gemini-pci", "faraday,ftpci100"; | ||
81 | reg = <0x50000000 0x100>; | ||
82 | interrupts = <8 IRQ_TYPE_LEVEL_HIGH>, /* PCI A */ | ||
83 | <26 IRQ_TYPE_LEVEL_HIGH>, /* PCI B */ | ||
84 | <27 IRQ_TYPE_LEVEL_HIGH>, /* PCI C */ | ||
85 | <28 IRQ_TYPE_LEVEL_HIGH>; /* PCI D */ | ||
86 | #address-cells = <3>; | ||
87 | #size-cells = <2>; | ||
88 | #interrupt-cells = <1>; | ||
89 | |||
90 | bus-range = <0x00 0xff>; | ||
91 | ranges = /* 1MiB I/O space 0x50000000-0x500fffff */ | ||
92 | <0x01000000 0 0 0x50000000 0 0x00100000>, | ||
93 | /* 128MiB non-prefetchable memory 0x58000000-0x5fffffff */ | ||
94 | <0x02000000 0 0x58000000 0x58000000 0 0x08000000>; | ||
95 | |||
96 | /* DMA ranges */ | ||
97 | dma-ranges = | ||
98 | /* 128MiB at 0x00000000-0x07ffffff */ | ||
99 | <0x02000000 0 0x00000000 0x00000000 0 0x08000000>, | ||
100 | /* 64MiB at 0x00000000-0x03ffffff */ | ||
101 | <0x02000000 0 0x00000000 0x00000000 0 0x04000000>, | ||
102 | /* 64MiB at 0x00000000-0x03ffffff */ | ||
103 | <0x02000000 0 0x00000000 0x00000000 0 0x04000000>; | ||
104 | |||
105 | interrupt-map-mask = <0xf800 0 0 7>; | ||
106 | interrupt-map = | ||
107 | <0x4800 0 0 1 &pci_intc 0>, /* Slot 9 */ | ||
108 | <0x4800 0 0 2 &pci_intc 1>, | ||
109 | <0x4800 0 0 3 &pci_intc 2>, | ||
110 | <0x4800 0 0 4 &pci_intc 3>, | ||
111 | <0x5000 0 0 1 &pci_intc 1>, /* Slot 10 */ | ||
112 | <0x5000 0 0 2 &pci_intc 2>, | ||
113 | <0x5000 0 0 3 &pci_intc 3>, | ||
114 | <0x5000 0 0 4 &pci_intc 0>, | ||
115 | <0x5800 0 0 1 &pci_intc 2>, /* Slot 11 */ | ||
116 | <0x5800 0 0 2 &pci_intc 3>, | ||
117 | <0x5800 0 0 3 &pci_intc 0>, | ||
118 | <0x5800 0 0 4 &pci_intc 1>, | ||
119 | <0x6000 0 0 1 &pci_intc 3>, /* Slot 12 */ | ||
120 | <0x6000 0 0 2 &pci_intc 0>, | ||
121 | <0x6000 0 0 3 &pci_intc 0>, | ||
122 | <0x6000 0 0 4 &pci_intc 0>; | ||
123 | pci_intc: interrupt-controller { | ||
124 | interrupt-parent = <&intcon>; | ||
125 | interrupt-controller; | ||
126 | #address-cells = <0>; | ||
127 | #interrupt-cells = <1>; | ||
128 | }; | ||
129 | }; | ||
diff --git a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt index 83aeb1f5a645..e3d5680875b1 100644 --- a/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt +++ b/Documentation/devicetree/bindings/pci/fsl,imx6q-pcie.txt | |||
@@ -4,7 +4,11 @@ This PCIe host controller is based on the Synopsis Designware PCIe IP | |||
4 | and thus inherits all the common properties defined in designware-pcie.txt. | 4 | and thus inherits all the common properties defined in designware-pcie.txt. |
5 | 5 | ||
6 | Required properties: | 6 | Required properties: |
7 | - compatible: "fsl,imx6q-pcie", "fsl,imx6sx-pcie", "fsl,imx6qp-pcie" | 7 | - compatible: |
8 | - "fsl,imx6q-pcie" | ||
9 | - "fsl,imx6sx-pcie", | ||
10 | - "fsl,imx6qp-pcie" | ||
11 | - "fsl,imx7d-pcie" | ||
8 | - reg: base address and length of the PCIe controller | 12 | - reg: base address and length of the PCIe controller |
9 | - interrupts: A list of interrupt outputs of the controller. Must contain an | 13 | - interrupts: A list of interrupt outputs of the controller. Must contain an |
10 | entry for each entry in the interrupt-names property. | 14 | entry for each entry in the interrupt-names property. |
@@ -34,6 +38,14 @@ Additional required properties for imx6sx-pcie: | |||
34 | - clock names: Must include the following additional entries: | 38 | - clock names: Must include the following additional entries: |
35 | - "pcie_inbound_axi" | 39 | - "pcie_inbound_axi" |
36 | 40 | ||
41 | Additional required properties for imx7d-pcie: | ||
42 | - power-domains: Must be set to a phandle pointing to PCIE_PHY power domain | ||
43 | - resets: Must contain phandles to PCIe-related reset lines exposed by SRC | ||
44 | IP block | ||
45 | - reset-names: Must contain the following entires: | ||
46 | - "pciephy" | ||
47 | - "apps" | ||
48 | |||
37 | Example: | 49 | Example: |
38 | 50 | ||
39 | pcie@0x01000000 { | 51 | pcie@0x01000000 { |
diff --git a/Documentation/devicetree/bindings/pci/ti-pci.txt b/Documentation/devicetree/bindings/pci/ti-pci.txt index 60e25161f351..6a07c96227e0 100644 --- a/Documentation/devicetree/bindings/pci/ti-pci.txt +++ b/Documentation/devicetree/bindings/pci/ti-pci.txt | |||
@@ -1,17 +1,22 @@ | |||
1 | TI PCI Controllers | 1 | TI PCI Controllers |
2 | 2 | ||
3 | PCIe Designware Controller | 3 | PCIe Designware Controller |
4 | - compatible: Should be "ti,dra7-pcie"" | 4 | - compatible: Should be "ti,dra7-pcie" for RC |
5 | - reg : Two register ranges as listed in the reg-names property | 5 | Should be "ti,dra7-pcie-ep" for EP |
6 | - reg-names : The first entry must be "ti-conf" for the TI specific registers | ||
7 | The second entry must be "rc-dbics" for the designware pcie | ||
8 | registers | ||
9 | The third entry must be "config" for the PCIe configuration space | ||
10 | - phys : list of PHY specifiers (used by generic PHY framework) | 6 | - phys : list of PHY specifiers (used by generic PHY framework) |
11 | - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the | 7 | - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the |
12 | number of PHYs as specified in *phys* property. | 8 | number of PHYs as specified in *phys* property. |
13 | - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", | 9 | - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>", |
14 | where <X> is the instance number of the pcie from the HW spec. | 10 | where <X> is the instance number of the pcie from the HW spec. |
11 | - num-lanes as specified in ../designware-pcie.txt | ||
12 | |||
13 | HOST MODE | ||
14 | ========= | ||
15 | - reg : Two register ranges as listed in the reg-names property | ||
16 | - reg-names : The first entry must be "ti-conf" for the TI specific registers | ||
17 | The second entry must be "rc-dbics" for the DesignWare PCIe | ||
18 | registers | ||
19 | The third entry must be "config" for the PCIe configuration space | ||
15 | - interrupts : Two interrupt entries must be specified. The first one is for | 20 | - interrupts : Two interrupt entries must be specified. The first one is for |
16 | main interrupt line and the second for MSI interrupt line. | 21 | main interrupt line and the second for MSI interrupt line. |
17 | - #address-cells, | 22 | - #address-cells, |
@@ -19,13 +24,36 @@ PCIe Designware Controller | |||
19 | #interrupt-cells, | 24 | #interrupt-cells, |
20 | device_type, | 25 | device_type, |
21 | ranges, | 26 | ranges, |
22 | num-lanes, | ||
23 | interrupt-map-mask, | 27 | interrupt-map-mask, |
24 | interrupt-map : as specified in ../designware-pcie.txt | 28 | interrupt-map : as specified in ../designware-pcie.txt |
25 | 29 | ||
30 | DEVICE MODE | ||
31 | =========== | ||
32 | - reg : Four register ranges as listed in the reg-names property | ||
33 | - reg-names : "ti-conf" for the TI specific registers | ||
34 | "ep_dbics" for the standard configuration registers as | ||
35 | they are locally accessed within the DIF CS space | ||
36 | "ep_dbics2" for the standard configuration registers as | ||
37 | they are locally accessed within the DIF CS2 space | ||
38 | "addr_space" used to map remote RC address space | ||
39 | - interrupts : one interrupt entries must be specified for main interrupt. | ||
40 | - num-ib-windows : number of inbound address translation windows | ||
41 | - num-ob-windows : number of outbound address translation windows | ||
42 | - ti,syscon-unaligned-access: phandle to the syscon DT node. The 1st argument | ||
43 | should contain the register offset within syscon | ||
44 | and the 2nd argument should contain the bit field | ||
45 | for setting the bit to enable unaligned | ||
46 | access. | ||
47 | |||
26 | Optional Property: | 48 | Optional Property: |
27 | - gpios : Should be added if a gpio line is required to drive PERST# line | 49 | - gpios : Should be added if a gpio line is required to drive PERST# line |
28 | 50 | ||
51 | NOTE: Two DT nodes may be added for each PCI controller; one for host | ||
52 | mode and another for device mode. So in order for PCI to | ||
53 | work in host mode, EP mode DT node should be disabled and in order to PCI to | ||
54 | work in EP mode, host mode DT node should be disabled. Host mode and EP | ||
55 | mode are mutually exclusive. | ||
56 | |||
29 | Example: | 57 | Example: |
30 | axi { | 58 | axi { |
31 | compatible = "simple-bus"; | 59 | compatible = "simple-bus"; |
diff --git a/Documentation/driver-model/devres.txt b/Documentation/driver-model/devres.txt index bf34d5b3a733..e72587fe477d 100644 --- a/Documentation/driver-model/devres.txt +++ b/Documentation/driver-model/devres.txt | |||
@@ -342,8 +342,10 @@ PER-CPU MEM | |||
342 | devm_free_percpu() | 342 | devm_free_percpu() |
343 | 343 | ||
344 | PCI | 344 | PCI |
345 | pcim_enable_device() : after success, all PCI ops become managed | 345 | devm_pci_remap_cfgspace() : ioremap PCI configuration space |
346 | pcim_pin_device() : keep PCI device enabled after release | 346 | devm_pci_remap_cfg_resource() : ioremap PCI configuration space resource |
347 | pcim_enable_device() : after success, all PCI ops become managed | ||
348 | pcim_pin_device() : keep PCI device enabled after release | ||
347 | 349 | ||
348 | PHY | 350 | PHY |
349 | devm_usb_get_phy() | 351 | devm_usb_get_phy() |
diff --git a/Documentation/filesystems/sysfs-pci.txt b/Documentation/filesystems/sysfs-pci.txt index 6ea1ceda6f52..06f1d64c6f70 100644 --- a/Documentation/filesystems/sysfs-pci.txt +++ b/Documentation/filesystems/sysfs-pci.txt | |||
@@ -113,9 +113,18 @@ Supporting PCI access on new platforms | |||
113 | -------------------------------------- | 113 | -------------------------------------- |
114 | 114 | ||
115 | In order to support PCI resource mapping as described above, Linux platform | 115 | In order to support PCI resource mapping as described above, Linux platform |
116 | code must define HAVE_PCI_MMAP and provide a pci_mmap_page_range function. | 116 | code should ideally define ARCH_GENERIC_PCI_MMAP_RESOURCE and use the generic |
117 | Platforms are free to only support subsets of the mmap functionality, but | 117 | implementation of that functionality. To support the historical interface of |
118 | useful return codes should be provided. | 118 | mmap() through files in /proc/bus/pci, platforms may also set HAVE_PCI_MMAP. |
119 | |||
120 | Alternatively, platforms which set HAVE_PCI_MMAP may provide their own | ||
121 | implementation of pci_mmap_page_range() instead of defining | ||
122 | ARCH_GENERIC_PCI_MMAP_RESOURCE. | ||
123 | |||
124 | Platforms which support write-combining maps of PCI resources must define | ||
125 | arch_can_pci_mmap_wc() which shall evaluate to non-zero at runtime when | ||
126 | write-combining is permitted. Platforms which support maps of I/O resources | ||
127 | define arch_can_pci_mmap_io() similarly. | ||
119 | 128 | ||
120 | Legacy resources are protected by the HAVE_PCI_LEGACY define. Platforms | 129 | Legacy resources are protected by the HAVE_PCI_LEGACY define. Platforms |
121 | wishing to support legacy functionality should define it and provide | 130 | wishing to support legacy functionality should define it and provide |
diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt index a77ead911956..eccb675a2852 100644 --- a/Documentation/ioctl/ioctl-number.txt +++ b/Documentation/ioctl/ioctl-number.txt | |||
@@ -191,6 +191,7 @@ Code Seq#(hex) Include File Comments | |||
191 | 'W' 00-1F linux/watchdog.h conflict! | 191 | 'W' 00-1F linux/watchdog.h conflict! |
192 | 'W' 00-1F linux/wanrouter.h conflict! (pre 3.9) | 192 | 'W' 00-1F linux/wanrouter.h conflict! (pre 3.9) |
193 | 'W' 00-3F sound/asound.h conflict! | 193 | 'W' 00-3F sound/asound.h conflict! |
194 | 'W' 40-5F drivers/pci/switch/switchtec.c | ||
194 | 'X' all fs/xfs/xfs_fs.h conflict! | 195 | 'X' all fs/xfs/xfs_fs.h conflict! |
195 | and fs/xfs/linux-2.6/xfs_ioctl32.h | 196 | and fs/xfs/linux-2.6/xfs_ioctl32.h |
196 | and include/linux/falloc.h | 197 | and include/linux/falloc.h |
diff --git a/Documentation/misc-devices/pci-endpoint-test.txt b/Documentation/misc-devices/pci-endpoint-test.txt new file mode 100644 index 000000000000..4ebc3594b32c --- /dev/null +++ b/Documentation/misc-devices/pci-endpoint-test.txt | |||
@@ -0,0 +1,35 @@ | |||
1 | Driver for PCI Endpoint Test Function | ||
2 | |||
3 | This driver should be used as a host side driver if the root complex is | ||
4 | connected to a configurable PCI endpoint running *pci_epf_test* function | ||
5 | driver configured according to [1]. | ||
6 | |||
7 | The "pci_endpoint_test" driver can be used to perform the following tests. | ||
8 | |||
9 | The PCI driver for the test device performs the following tests | ||
10 | *) verifying addresses programmed in BAR | ||
11 | *) raise legacy IRQ | ||
12 | *) raise MSI IRQ | ||
13 | *) read data | ||
14 | *) write data | ||
15 | *) copy data | ||
16 | |||
17 | This misc driver creates /dev/pci-endpoint-test.<num> for every | ||
18 | *pci_epf_test* function connected to the root complex and "ioctls" | ||
19 | should be used to perform the above tests. | ||
20 | |||
21 | ioctl | ||
22 | ----- | ||
23 | PCITEST_BAR: Tests the BAR. The number of the BAR to be tested | ||
24 | should be passed as argument. | ||
25 | PCITEST_LEGACY_IRQ: Tests legacy IRQ | ||
26 | PCITEST_MSI: Tests message signalled interrupts. The MSI number | ||
27 | to be tested should be passed as argument. | ||
28 | PCITEST_WRITE: Perform write tests. The size of the buffer should be passed | ||
29 | as argument. | ||
30 | PCITEST_READ: Perform read tests. The size of the buffer should be passed | ||
31 | as argument. | ||
32 | PCITEST_COPY: Perform read tests. The size of the buffer should be passed | ||
33 | as argument. | ||
34 | |||
35 | [1] -> Documentation/PCI/endpoint/function/binding/pci-test.txt | ||
diff --git a/Documentation/switchtec.txt b/Documentation/switchtec.txt new file mode 100644 index 000000000000..a0a9c7b3d4d5 --- /dev/null +++ b/Documentation/switchtec.txt | |||
@@ -0,0 +1,80 @@ | |||
1 | ======================== | ||
2 | Linux Switchtec Support | ||
3 | ======================== | ||
4 | |||
5 | Microsemi's "Switchtec" line of PCI switch devices is already | ||
6 | supported by the kernel with standard PCI switch drivers. However, the | ||
7 | Switchtec device advertises a special management endpoint which | ||
8 | enables some additional functionality. This includes: | ||
9 | |||
10 | * Packet and Byte Counters | ||
11 | * Firmware Upgrades | ||
12 | * Event and Error logs | ||
13 | * Querying port link status | ||
14 | * Custom user firmware commands | ||
15 | |||
16 | The switchtec kernel module implements this functionality. | ||
17 | |||
18 | |||
19 | Interface | ||
20 | ========= | ||
21 | |||
22 | The primary means of communicating with the Switchtec management firmware is | ||
23 | through the Memory-mapped Remote Procedure Call (MRPC) interface. | ||
24 | Commands are submitted to the interface with a 4-byte command | ||
25 | identifier and up to 1KB of command specific data. The firmware will | ||
26 | respond with a 4 bytes return code and up to 1KB of command specific | ||
27 | data. The interface only processes a single command at a time. | ||
28 | |||
29 | |||
30 | Userspace Interface | ||
31 | =================== | ||
32 | |||
33 | The MRPC interface will be exposed to userspace through a simple char | ||
34 | device: /dev/switchtec#, one for each management endpoint in the system. | ||
35 | |||
36 | The char device has the following semantics: | ||
37 | |||
38 | * A write must consist of at least 4 bytes and no more than 1028 bytes. | ||
39 | The first four bytes will be interpreted as the command to run and | ||
40 | the remainder will be used as the input data. A write will send the | ||
41 | command to the firmware to begin processing. | ||
42 | |||
43 | * Each write must be followed by exactly one read. Any double write will | ||
44 | produce an error and any read that doesn't follow a write will | ||
45 | produce an error. | ||
46 | |||
47 | * A read will block until the firmware completes the command and return | ||
48 | the four bytes of status plus up to 1024 bytes of output data. (The | ||
49 | length will be specified by the size parameter of the read call -- | ||
50 | reading less than 4 bytes will produce an error. | ||
51 | |||
52 | * The poll call will also be supported for userspace applications that | ||
53 | need to do other things while waiting for the command to complete. | ||
54 | |||
55 | The following IOCTLs are also supported by the device: | ||
56 | |||
57 | * SWITCHTEC_IOCTL_FLASH_INFO - Retrieve firmware length and number | ||
58 | of partitions in the device. | ||
59 | |||
60 | * SWITCHTEC_IOCTL_FLASH_PART_INFO - Retrieve address and lengeth for | ||
61 | any specified partition in flash. | ||
62 | |||
63 | * SWITCHTEC_IOCTL_EVENT_SUMMARY - Read a structure of bitmaps | ||
64 | indicating all uncleared events. | ||
65 | |||
66 | * SWITCHTEC_IOCTL_EVENT_CTL - Get the current count, clear and set flags | ||
67 | for any event. This ioctl takes in a switchtec_ioctl_event_ctl struct | ||
68 | with the event_id, index and flags set (index being the partition or PFF | ||
69 | number for non-global events). It returns whether the event has | ||
70 | occurred, the number of times and any event specific data. The flags | ||
71 | can be used to clear the count or enable and disable actions to | ||
72 | happen when the event occurs. | ||
73 | By using the SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL flag, | ||
74 | you can set an event to trigger a poll command to return with | ||
75 | POLLPRI. In this way, userspace can wait for events to occur. | ||
76 | |||
77 | * SWITCHTEC_IOCTL_PFF_TO_PORT and SWITCHTEC_IOCTL_PORT_TO_PFF convert | ||
78 | between PCI Function Framework number (used by the event system) | ||
79 | and Switchtec Logic Port ID and Partition number (which is more | ||
80 | user friendly). | ||