Skip to contentSkip to conversation

PCI: Support for configurable PCI endpoint

GIT PULL Superseded Kishon Vijay Abraham I 4 participants 35 messages Mar 27, 2017 – Apr 5, 2017

Subsystems (12)

v5 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

Hi Bjorn,

Please find the pull request for PCI endpoint support below. I've also included all the history here.

Changes from v4:
*) add #syscon-cells property and used of_parse_phandle_with_args
to perform a configuration in syscon module (as suggested by Rob Herring)
*) Remove unnecessary white space.

Changes from v3:
*) fixed a typo and adapted to https://lkml.org/lkml/2017/3/13/562.

Changes from v2:
*) changed the configfs structure as suggested by Christoph Hellwig. With
this change the framework creates configfs entry for EP function driver and EP controller. Previously these entries have to be created by the the user. (Haven't changed the epc core or epf core except for invoking configfs APIs to create entries for EP function driver and EP controller. That's mostly because the EP function device can still be created by directly invoking the epf core API without using configfs).
*) Now the user has to use configfs entry 'start' to start the link.
This was previously done by the function driver. However in the case of multi function EP, the function driver shouldn't start the link.

Changes from v1:
*) The preparation patches for adding EP support is removed and is sent
separately
*) Added device ID for DRA74x/DRA72x and used it instead of
using "PCI_ANY_ID"
*) Added userguide for PCI endpoint test function

Major Improvements from RFC:
*) support multi-function devices (hw supported not virtual) *) Access host side buffers
*) Raise MSI interrupts
*) Add user space program to use the host side PCI driver *) Adapt all other users of designware to use the new design (only
compile tested. Since I have only dra7xx boards, the new design has only been tested in dra7xx. I'd require the help of others to test the platforms they have access to).

This series has been developed over 4.11-rc1 + [1]
[1] -> https://lkml.org/lkml/2017/3/13/562

Let me know if this has to be re-based to some of your branch.

Thanks
Kishon

The following changes since commit 623e87fec8ab7867fb51b3079196bd10718a60ce:

PCI: dwc: dra7xx: Push request_irq call to the bottom of probe (2017-03-22 20:35:30 +0530)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git tags/pci-endpoint-for-4.12

for you to fetch changes up to e98bf80074be4654faae42fe0f5a622a776b6fdd:

ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP (2017-03-27 15:08:22 +0530)

----------------------------------------------------------------
pci: endpoint: for 4.12

*) Add PCI endpoint core layer
*) Modify designware and dra7xx driver to be configured in EP mode *) Add a PCI endpoint *test* function driver and corresponding host
driver

----------------------------------------------------------------
Kishon Vijay Abraham I (24):
PCI: endpoint: Add EP core layer to enable EP controller and EP functions
Documentation: PCI: Guide to use PCI Endpoint Core Layer
PCI: endpoint: Introduce configfs entry for configuring EP functions
Documentation: PCI: Guide to use pci endpoint configfs
PCI: endpoint: Create configfs entry for EPC device and EPF driver
Documentation: PCI: Add specification for the *pci test* function device
PCI: endpoint: functions: Add an EP function to test PCI
Documentation: PCI: Add binding documentation for pci-test endpoint function
PCI: dwc: designware: Add EP mode support
dt-bindings: PCI: Add dt bindings for pci designware EP mode
PCI: dwc: dra7xx: Facilitate wrapper and msi interrupts to be enabled independently
PCI: dwc: dra7xx: Add EP mode support
dt-bindings: PCI: dra7xx: Add dt bindings for pci dra7xx EP mode
dt-bindings: mfd: syscon: Add documentation for #syscon-cells property
PCI: dwc: dra7xx: Workaround for errata id i870
dt-bindings: PCI: dra7xx: Add dt bindings to enable unaligned access
PCI: Add device IDs for DRA74x and DRA72x
misc: Add host side pci driver for pci test function device
Documentation: misc-devices: Add Documentation for pci-endpoint-test driver
tools: PCI: Add a userspace tool to test PCI endpoint
tools: PCI: Add sample test script to invoke pcitest
Documentation: PCI: Add userguide for PCI endpoint test function
MAINTAINERS: add PCI EP maintainer
ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP

 Documentation/PCI/00-INDEX                                |  10 +++
 Documentation/PCI/endpoint/function/binding/pci-test.txt  |  17 +++++
 Documentation/PCI/endpoint/pci-endpoint-cfs.txt           | 105 ++++++++++++++++++++++++++
 Documentation/PCI/endpoint/pci-endpoint.txt               | 215 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 Documentation/PCI/endpoint/pci-test-function.txt          |  66 ++++++++++++++++
 Documentation/PCI/endpoint/pci-test-howto.txt             | 179 +++++++++++++++++++++++++++++++++++++++++++
 Documentation/devicetree/bindings/mfd/syscon.txt          |   2 +
 Documentation/devicetree/bindings/pci/designware-pcie.txt |  26 +++++--
 Documentation/devicetree/bindings/pci/ti-pci.txt          |  42 +++++++++--
 Documentation/misc-devices/pci-endpoint-test.txt          |  35 +++++++++
 MAINTAINERS                                               |   9 +++
 arch/arm/mach-omap2/clockdomains7xx_data.c                |   2 +-
 drivers/Makefile                                          |   2 +
 drivers/misc/Kconfig                                      |   7 ++
 drivers/misc/Makefile                                     |   1 +
 drivers/misc/pci_endpoint_test.c                          | 534 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/Kconfig                                       |   1 +
 drivers/pci/dwc/Kconfig                                   |  36 ++++++++-
 drivers/pci/dwc/Makefile                                  |   5 +-
 drivers/pci/dwc/pci-dra7xx.c                              | 268 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 drivers/pci/dwc/pcie-designware-ep.c                      | 342 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/dwc/pcie-designware.c                         | 125 ++++++++++++++++++++++++++++++
 drivers/pci/dwc/pcie-designware.h                         | 112 +++++++++++++++++++++++++++
 drivers/pci/endpoint/Kconfig                              |  31 ++++++++
 drivers/pci/endpoint/Makefile                             |   7 ++
 drivers/pci/endpoint/functions/Kconfig                    |  12 +++
 drivers/pci/endpoint/functions/Makefile                   |   5 ++
 drivers/pci/endpoint/functions/pci-epf-test.c             | 510 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/endpoint/pci-ep-cfs.c                         | 509 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/endpoint/pci-epc-core.c                       | 579 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/pci/endpoint/pci-epc-mem.c                        | 143 +++++++++++++++++++++++++++++++++++
 drivers/pci/endpoint/pci-epf-core.c                       | 351 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mod_devicetable.h                           |  10 +++
 include/linux/pci-ep-cfs.h                                |  41 ++++++++++
 include/linux/pci-epc.h                                   | 144 +++++++++++++++++++++++++++++++++++
 include/linux/pci-epf.h                                   | 162 +++++++++++++++++++++++++++++++++++++++
 include/linux/pci_ids.h                                   |   2 +
 include/uapi/linux/Kbuild                                 |   1 +
 include/uapi/linux/pcitest.h                              |  19 +++++
 tools/pci/pcitest.c                                       | 186 +++++++++++++++++++++++++++++++++++++++++++++
 tools/pci/pcitest.sh                                      |  56 ++++++++++++++
 41 files changed, 4869 insertions(+), 40 deletions(-)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-test.txt
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-cfs.txt
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint.txt
 create mode 100644 Documentation/PCI/endpoint/pci-test-function.txt
 create mode 100644 Documentation/PCI/endpoint/pci-test-howto.txt
 create mode 100644 Documentation/misc-devices/pci-endpoint-test.txt
 create mode 100644 drivers/misc/pci_endpoint_test.c
 create mode 100644 drivers/pci/dwc/pcie-designware-ep.c
 create mode 100644 drivers/pci/endpoint/Kconfig
 create mode 100644 drivers/pci/endpoint/Makefile
 create mode 100644 drivers/pci/endpoint/functions/Kconfig
 create mode 100644 drivers/pci/endpoint/functions/Makefile
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-test.c
 create mode 100644 drivers/pci/endpoint/pci-ep-cfs.c
 create mode 100644 drivers/pci/endpoint/pci-epc-core.c
 create mode 100644 drivers/pci/endpoint/pci-epc-mem.c
 create mode 100644 drivers/pci/endpoint/pci-epf-core.c
 create mode 100644 include/linux/pci-ep-cfs.h
 create mode 100644 include/linux/pci-epc.h
 create mode 100644 include/linux/pci-epf.h
 create mode 100644 include/uapi/linux/pcitest.h
 create mode 100644 tools/pci/pcitest.c
 create mode 100644 tools/pci/pcitest.sh
Signature · 1 line
2.11.0
#1 lore raw

PATCH v5 1/24 PCI: endpoint: Add EP core layer to enable EP controller and EP functions

Introduce a new EP core layer in order to support endpoint functions in linux kernel. This comprises of EPC library
(Endpoint Controller Library) and EPF library (Endpoint Function Library). EPC library implements functions that is specific to an endpoint controller and EPF library implements functions that is specific to an endpoint function.

---
 drivers/Makefile                    |   2 +
 drivers/pci/Kconfig                 |   1 +
 drivers/pci/endpoint/Kconfig        |  20 ++
 drivers/pci/endpoint/Makefile       |   6 +
 drivers/pci/endpoint/pci-epc-core.c | 575 ++++++++++++++++++++++++++++++++++++
 drivers/pci/endpoint/pci-epc-mem.c  | 143 +++++++++
 drivers/pci/endpoint/pci-epf-core.c | 347 ++++++++++++++++++++++
 include/linux/mod_devicetable.h     |  10 +
 include/linux/pci-epc.h             | 142 +++++++++
 include/linux/pci-epf.h             | 160 ++++++++++
 10 files changed, 1406 insertions(+)
 create mode 100644 drivers/pci/endpoint/Kconfig
 create mode 100644 drivers/pci/endpoint/Makefile
 create mode 100644 drivers/pci/endpoint/pci-epc-core.c
 create mode 100644 drivers/pci/endpoint/pci-epc-mem.c
 create mode 100644 drivers/pci/endpoint/pci-epf-core.c
 create mode 100644 include/linux/pci-epc.h
 create mode 100644 include/linux/pci-epf.h
drivers/Makefile +2 -0
index 2eced9afba53..a5f8e43b2c4d 100644
@@ -14,7 +14,9 @@ obj-$(CONFIG_GENERIC_PHY)	+= phy/
 obj-$(CONFIG_PINCTRL)		+= pinctrl/
 obj-$(CONFIG_GPIOLIB)		+= gpio/
 obj-y				+= pwm/
+
 obj-$(CONFIG_PCI)		+= pci/
+obj-$(CONFIG_PCI_ENDPOINT)	+= pci/endpoint/
 # PCI dwc controller drivers
 obj-y				+= pci/dwc/
 
drivers/pci/Kconfig +1 -0
index df141420c902..9747c1ec8c74 100644
@@ -134,3 +134,4 @@ config PCI_HYPERV
 source "drivers/pci/hotplug/Kconfig"
 source "drivers/pci/dwc/Kconfig"
 source "drivers/pci/host/Kconfig"
+source "drivers/pci/endpoint/Kconfig"
drivers/pci/endpoint/Kconfig new file +20 -0
new file mode 100644
index 000000000000..a5442ace7077
@@ -0,0 +1,20 @@
+#
+# PCI Endpoint Support
+#
+
+menu "PCI Endpoint"
+
+config PCI_ENDPOINT
+	bool "PCI Endpoint Support"
+	help
+	   Enable this configuration option to support configurable PCI
+	   endpoint. This should be enabled if the platform has a PCI
+	   controller that can operate in endpoint mode.
+
+	   Enabling this option will build the endpoint library, which
+	   includes endpoint controller library and endpoint function
+	   library.
+
+	   If in doubt, say "N" to disable Endpoint support.
+
+endmenu
drivers/pci/endpoint/Makefile new file +6 -0
new file mode 100644
index 000000000000..dc1bc16491e6
@@ -0,0 +1,6 @@
+#
+# Makefile for PCI Endpoint Support
+#
+
+obj-$(CONFIG_PCI_ENDPOINT)		+= pci-epc-core.o pci-epf-core.o\
+					   pci-epc-mem.o
drivers/pci/endpoint/pci-epc-core.c new file +575 -0

575 lines not on this page · raw message

drivers/pci/endpoint/pci-epc-mem.c new file +143 -0

143 lines not on this page · raw message

drivers/pci/endpoint/pci-epf-core.c new file +347 -0

347 lines not on this page · raw message

include/linux/mod_devicetable.h +10 -0
index 8850fcaf50db..566fda587fcf 100644
@@ -428,6 +428,16 @@ struct i2c_device_id {
 	kernel_ulong_t driver_data;	/* Data private to the driver */
 };
 
+/* pci_epf */
+
+#define PCI_EPF_NAME_SIZE	20
+#define PCI_EPF_MODULE_PREFIX	"pci_epf:"
+
+struct pci_epf_device_id {
+	char name[PCI_EPF_NAME_SIZE];
+	kernel_ulong_t driver_data;
+};
+
 /* spi */
 
 #define SPI_NAME_SIZE	32
include/linux/pci-epc.h new file +142 -0

142 lines not on this page · raw message

include/linux/pci-epf.h new file +160 -0

160 lines not on this page · raw message

Signature · 1 line
2.11.0
#2 lore raw

PATCH v5 2/24 Documentation: PCI: Guide to use PCI Endpoint Core Layer

In reply to Kishon Vijay Abraham I

Add Documentation to help users use endpoint library to enable endpoint mode in the PCI controller and add new PCI endpoint functions.

---
 Documentation/PCI/00-INDEX                  |   2 +
 Documentation/PCI/endpoint/pci-endpoint.txt | 215 ++++++++++++++++++++++++++++
 2 files changed, 217 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint.txt
Documentation/PCI/00-INDEX +2 -0
index 147231f1613e..ba950b296bd8 100644
@@ -12,3 +12,5 @@ pci.txt
 	- info on the PCI subsystem for device driver authors
 pcieaer-howto.txt
 	- the PCI Express Advanced Error Reporting Driver Guide HOWTO
+endpoint/pci-endpoint.txt
+	- guide to add endpoint controller driver and endpoint function driver.
Documentation/PCI/endpoint/pci-endpoint.txt new file +215 -0

215 lines not on this page · raw message

Signature · 1 line
2.11.0
#3 lore raw

PATCH v5 3/24 PCI: endpoint: Introduce configfs entry for configuring EP functions

In reply to Kishon Vijay Abraham I

Introduce a new configfs entry to configure the EP function (like configuring the standard configuration header entries) and to bind the EP function with EP controller.

---
 drivers/pci/endpoint/Kconfig      |   9 +
 drivers/pci/endpoint/Makefile     |   1 +
 drivers/pci/endpoint/pci-ep-cfs.c | 509 ++++++++++++++++++++++++++++++++++++++
 include/linux/pci-ep-cfs.h        |  41 +++
 4 files changed, 560 insertions(+)
 create mode 100644 drivers/pci/endpoint/pci-ep-cfs.c
 create mode 100644 include/linux/pci-ep-cfs.h
drivers/pci/endpoint/Kconfig +9 -0
index a5442ace7077..c86bca9b7de3 100644
@@ -17,4 +17,13 @@ config PCI_ENDPOINT
 
 	   If in doubt, say "N" to disable Endpoint support.
 
+config PCI_ENDPOINT_CONFIGFS
+	bool "PCI Endpoint Configfs Support"
+	depends on PCI_ENDPOINT
+	select CONFIGFS_FS
+	help
+	   This will enable the configfs entry that can be used to
+	   configure the endpoint function and used to bind the
+	   function with a endpoint controller.
+
 endmenu
drivers/pci/endpoint/Makefile +1 -0
index dc1bc16491e6..7219d51bb401 100644
@@ -2,5 +2,6 @@
 # Makefile for PCI Endpoint Support
 #
 
+obj-$(CONFIG_PCI_ENDPOINT_CONFIGFS)	+= pci-ep-cfs.o
 obj-$(CONFIG_PCI_ENDPOINT)		+= pci-epc-core.o pci-epf-core.o\
 					   pci-epc-mem.o
drivers/pci/endpoint/pci-ep-cfs.c new file +509 -0

509 lines not on this page · raw message

include/linux/pci-ep-cfs.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.11.0
#4 lore raw

PATCH v5 4/24 Documentation: PCI: Guide to use pci endpoint configfs

In reply to Kishon Vijay Abraham I

Add Documentation to help users use pci endpoint to configure pci endpoint function and to bind the endpoint function with endpoint controller.

---
 Documentation/PCI/00-INDEX                      |   2 +
 Documentation/PCI/endpoint/pci-endpoint-cfs.txt | 105 ++++++++++++++++++++++++
 2 files changed, 107 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/pci-endpoint-cfs.txt
Documentation/PCI/00-INDEX +2 -0
index ba950b296bd8..f84a23c7c74b 100644
@@ -14,3 +14,5 @@ pcieaer-howto.txt
 	- the PCI Express Advanced Error Reporting Driver Guide HOWTO
 endpoint/pci-endpoint.txt
 	- guide to add endpoint controller driver and endpoint function driver.
+endpoint/pci-endpoint-cfs.txt
+	- guide to use configfs to configure the pci endpoint function.
Documentation/PCI/endpoint/pci-endpoint-cfs.txt new file +105 -0

105 lines not on this page · raw message

Signature · 1 line
2.11.0
#5 lore raw

PATCH v5 5/24 PCI: endpoint: Create configfs entry for EPC device and EPF driver

In reply to Kishon Vijay Abraham I

Invoke API's provided by pci-ep-cfs to create configfs entry for every EPC device and EPF driver to help users in creating EPF device and binding the EPF device to the EPC device.

---
 drivers/pci/endpoint/pci-epc-core.c | 4 ++++
 drivers/pci/endpoint/pci-epf-core.c | 4 ++++
 include/linux/pci-epc.h             | 2 ++
 include/linux/pci-epf.h             | 2 ++
 4 files changed, 12 insertions(+)
drivers/pci/endpoint/pci-epc-core.c +4 -0
index 06808ed7ee1f..29cbe9a73b30 100644
@@ -24,6 +24,7 @@
 
 #include <linux/pci-epc.h>
 #include <linux/pci-epf.h>
+#include <linux/pci-ep-cfs.h>
 
 static struct class *pci_epc_class;
 
@@ -441,6 +442,7 @@ EXPORT_SYMBOL_GPL(pci_epc_linkup);
  */
 void pci_epc_destroy(struct pci_epc *epc)
 {
+	pci_ep_cfs_remove_epc_group(epc->group);
 	device_unregister(&epc->dev);
 	kfree(epc);
 }
@@ -507,6 +509,8 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops,
 	if (ret)
 		goto put_dev;
 
+	epc->group = pci_ep_cfs_add_epc_group(dev_name(dev));
+
 	return epc;
 
 put_dev:
drivers/pci/endpoint/pci-epf-core.c +4 -0
index 4c903fc1cd30..9ec1639ef749 100644
@@ -24,6 +24,7 @@
 
 #include <linux/pci-epc.h>
 #include <linux/pci-epf.h>
+#include <linux/pci-ep-cfs.h>
 
 static struct bus_type pci_epf_bus_type;
 static struct device_type pci_epf_type;
@@ -143,6 +144,7 @@ EXPORT_SYMBOL_GPL(pci_epf_alloc_space);
  */
 void pci_epf_unregister_driver(struct pci_epf_driver *driver)
 {
+	pci_ep_cfs_remove_epf_group(driver->group);
 	driver_unregister(&driver->driver);
 }
 EXPORT_SYMBOL_GPL(pci_epf_unregister_driver);
@@ -172,6 +174,8 @@ int __pci_epf_register_driver(struct pci_epf_driver *driver,
 	if (ret)
 		return ret;
 
+	driver->group = pci_ep_cfs_add_epf_group(driver->driver.name);
+
 	return 0;
 }
 EXPORT_SYMBOL_GPL(__pci_epf_register_driver);
include/linux/pci-epc.h +2 -0
index ad0cd465737e..d6eb32291462 100644
@@ -77,6 +77,7 @@ struct pci_epc_mem {
  * @ops: function pointers for performing endpoint operations
  * @mem: address space of the endpoint controller
  * @max_functions: max number of functions that can be configured in this EPC
+ * @group: configfs group representing the PCI EPC device
  * @lock: spinlock to protect pci_epc ops
  */
 struct pci_epc {
@@ -85,6 +86,7 @@ struct pci_epc {
 	const struct pci_epc_ops	*ops;
 	struct pci_epc_mem		*mem;
 	u8				max_functions;
+	struct config_group		*group;
 	/* spinlock to protect against concurrent access of EP controller */
 	spinlock_t			lock;
 };
include/linux/pci-epf.h +2 -0
index 54f133868a6e..5ff2c5a592c3 100644
@@ -82,6 +82,7 @@ struct pci_epf_ops {
  * @driver: PCI EPF driver
  * @ops: set of function pointers for performing EPF operations
  * @owner: the owner of the module that registers the PCI EPF driver
+ * @group: configfs group corresponding to the PCI EPF driver
  * @id_table: identifies EPF devices for probing
  */
 struct pci_epf_driver {
@@ -91,6 +92,7 @@ struct pci_epf_driver {
 	struct device_driver	driver;
 	struct pci_epf_ops	*ops;
 	struct module		*owner;
+	struct config_group	*group;
 	const struct pci_epf_device_id	*id_table;
 };
 
Signature · 1 line
2.11.0
#6 lore raw

PATCH v5 6/24 Documentation: PCI: Add specification for the *pci test* function device

In reply to Kishon Vijay Abraham I

Add specification for the *pci test* virtual function device. The endpoint function driver and the host pci driver should be created based on this specification.

---
 Documentation/PCI/00-INDEX                       |  2 +
 Documentation/PCI/endpoint/pci-test-function.txt | 66 ++++++++++++++++++++++++
 2 files changed, 68 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/pci-test-function.txt
Documentation/PCI/00-INDEX +2 -0
index f84a23c7c74b..4e5a2832f4e7 100644
@@ -16,3 +16,5 @@ endpoint/pci-endpoint.txt
 	- guide to add endpoint controller driver and endpoint function driver.
 endpoint/pci-endpoint-cfs.txt
 	- guide to use configfs to configure the pci endpoint function.
+endpoint/pci-test-function.txt
+	- specification of *pci test* function device.
Documentation/PCI/endpoint/pci-test-function.txt new file +66 -0

66 lines not on this page · raw message

Signature · 1 line
2.11.0
#7 lore raw

PATCH v5 7/24 PCI: endpoint: functions: Add an EP function to test PCI

In reply to Kishon Vijay Abraham I

Adds a new endpoint function driver (to program the virtual test device) making use of the EP-core library.

---
 drivers/pci/endpoint/Kconfig                  |   2 +
 drivers/pci/endpoint/Makefile                 |   2 +-
 drivers/pci/endpoint/functions/Kconfig        |  12 +
 drivers/pci/endpoint/functions/Makefile       |   5 +
 drivers/pci/endpoint/functions/pci-epf-test.c | 510 ++++++++++++++++++++++++++
 5 files changed, 530 insertions(+), 1 deletion(-)
 create mode 100644 drivers/pci/endpoint/functions/Kconfig
 create mode 100644 drivers/pci/endpoint/functions/Makefile
 create mode 100644 drivers/pci/endpoint/functions/pci-epf-test.c
drivers/pci/endpoint/Kconfig +2 -0
index c86bca9b7de3..c23f146fb5a6 100644
@@ -26,4 +26,6 @@ config PCI_ENDPOINT_CONFIGFS
 	   configure the endpoint function and used to bind the
 	   function with a endpoint controller.
 
+source "drivers/pci/endpoint/functions/Kconfig"
+
 endmenu
drivers/pci/endpoint/Makefile +1 -1
index 7219d51bb401..1041f80a4645 100644
@@ -4,4 +4,4 @@
 
 obj-$(CONFIG_PCI_ENDPOINT_CONFIGFS)	+= pci-ep-cfs.o
 obj-$(CONFIG_PCI_ENDPOINT)		+= pci-epc-core.o pci-epf-core.o\
-					   pci-epc-mem.o
+					   pci-epc-mem.o functions/
drivers/pci/endpoint/functions/Kconfig new file +12 -0
new file mode 100644
index 000000000000..175edad42d2f
@@ -0,0 +1,12 @@
+#
+# PCI Endpoint Functions
+#
+
+config PCI_EPF_TEST
+	tristate "PCI Endpoint Test driver"
+	depends on PCI_ENDPOINT
+	help
+	   Enable this configuration option to enable the test driver
+	   for PCI Endpoint.
+
+	   If in doubt, say "N" to disable Endpoint test driver.
drivers/pci/endpoint/functions/Makefile new file +5 -0
new file mode 100644
index 000000000000..6d94a4801838
@@ -0,0 +1,5 @@
+#
+# Makefile for PCI Endpoint Functions
+#
+
+obj-$(CONFIG_PCI_EPF_TEST)		+= pci-epf-test.o
drivers/pci/endpoint/functions/pci-epf-test.c new file +510 -0

510 lines not on this page · raw message

Signature · 1 line
2.11.0
#8 lore raw

PATCH v5 8/24 Documentation: PCI: Add binding documentation for pci-test endpoint function

In reply to Kishon Vijay Abraham I

Add binding documentation for pci-test endpoint function that helps in adding and configuring pci-test endpoint function.

---
 Documentation/PCI/00-INDEX                              |  2 ++
 .../PCI/endpoint/function/binding/pci-test.txt          | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/function/binding/pci-test.txt
Documentation/PCI/00-INDEX +2 -0
index 4e5a2832f4e7..53717b7fcdd4 100644
@@ -18,3 +18,5 @@ endpoint/pci-endpoint-cfs.txt
 	- guide to use configfs to configure the pci endpoint function.
 endpoint/pci-test-function.txt
 	- specification of *pci test* function device.
+endpoint/function/binding/
+	- binding documentation for pci endpoint function
Documentation/PCI/endpoint/function/binding/pci-test.txt new file +17 -0
new file mode 100644
index 000000000000..c44fc18d78cc
@@ -0,0 +1,17 @@
+PCI TEST ENDPOINT FUNCTION
+
+name: Should be "pci_epf_test" to bind to the pci_epf_test driver.
+
+Configurable Fields:
+vendorid	 : should be 0x104c
+deviceid	 : should be 0xb500 for DRA74x and 0xb501 for DRA72x
+revid		 : don't care
+progif_code	 : don't care
+subclass_code	 : don't care
+baseclass_code	 : should be 0xff
+cache_line_size	 : don't care
+subsys_vendor_id : don't care
+subsys_id	 : don't care
+interrupt_pin	 : Should be 1 - INTA, 2 - INTB, 3 - INTC, 4 -INTD
+msi_interrupts	 : Should be 1 to 32 depending on the number of msi interrupts
+		   to test
Signature · 1 line
2.11.0
#9 lore raw

PATCH v5 9/24 PCI: dwc: designware: Add EP mode support

In reply to Kishon Vijay Abraham I

Add endpoint mode support to designware driver. This uses the EP Core layer introduced recently to add endpoint mode support. *Any* function driver can now use this designware device in order to achieve the EP functionality.

---
 drivers/pci/dwc/Kconfig              |   5 +
 drivers/pci/dwc/Makefile             |   1 +
 drivers/pci/dwc/pcie-designware-ep.c | 342 +++++++++++++++++++++++++++++++++++
 drivers/pci/dwc/pcie-designware.c    | 125 +++++++++++++
 drivers/pci/dwc/pcie-designware.h    | 105 +++++++++++
 5 files changed, 578 insertions(+)
 create mode 100644 drivers/pci/dwc/pcie-designware-ep.c
drivers/pci/dwc/Kconfig +5 -0
index dfb8a69afc28..00335c71404e 100644
@@ -9,6 +9,11 @@ config PCIE_DW_HOST
 	depends on PCI_MSI_IRQ_DOMAIN
         select PCIE_DW
 
+config PCIE_DW_EP
+	bool
+	depends on PCI_ENDPOINT
+	select PCIE_DW
+
 config PCI_DRA7XX
 	bool "TI DRA7xx PCIe controller"
 	depends on PCI
drivers/pci/dwc/Makefile +1 -0
index a2df13c28798..b38425d36200 100644
@@ -1,5 +1,6 @@
 obj-$(CONFIG_PCIE_DW) += pcie-designware.o
 obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o
+obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o
 obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o
 obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o
 obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
drivers/pci/dwc/pcie-designware-ep.c new file +342 -0

342 lines not on this page · raw message

drivers/pci/dwc/pcie-designware.c +125 -0

131 lines not on this page · raw message

drivers/pci/dwc/pcie-designware.h +105 -0

164 lines not on this page · raw message

Signature · 1 line
2.11.0
#10 lore raw

PATCH v5 10/24 dt-bindings: PCI: Add dt bindings for pci designware EP mode

In reply to Kishon Vijay Abraham I

Add device tree binding documentation for pci designware EP mode.

---
 .../devicetree/bindings/pci/designware-pcie.txt    | 26 +++++++++++++++-------
 1 file changed, 18 insertions(+), 8 deletions(-)
Documentation/devicetree/bindings/pci/designware-pcie.txt +18 -8
index 1392c705ceca..b2480dd38c11 100644
@@ -6,30 +6,40 @@ Required properties:
 - reg-names: Must be "config" for the PCIe configuration space.
     (The old way of getting the configuration address space from "ranges"
     is deprecated and should be avoided.)
+- num-lanes: number of lanes to use
+RC mode:
 - #address-cells: set to <3>
 - #size-cells: set to <2>
 - device_type: set to "pci"
 - ranges: ranges for the PCI memory and I/O regions
 - #interrupt-cells: set to <1>
-- interrupt-map-mask and interrupt-map: standard PCI properties
-	to define the mapping of the PCIe interface to interrupt
+- interrupt-map-mask and interrupt-map: standard PCI
+	properties to define the mapping of the PCIe interface to interrupt
 	numbers.
-- num-lanes: number of lanes to use
+EP mode:
+- num-ib-windows: number of inbound address translation
+        windows
+- num-ob-windows: number of outbound address translation
+        windows
 
 Optional properties:
-- num-viewport: number of view ports configured in hardware.  If a platform
-  does not specify it, the driver assumes 2.
 - num-lanes: number of lanes to use (this property should be specified unless
   the link is brought already up in BIOS)
 - reset-gpio: gpio pin number of power good signal
-- bus-range: PCI bus numbers covered (it is recommended for new devicetrees to
-  specify this property, to keep backwards compatibility a range of 0x00-0xff
-  is assumed if not present)
 - clocks: Must contain an entry for each entry in clock-names.
 	See ../clocks/clock-bindings.txt for details.
 - clock-names: Must include the following entries:
 	- "pcie"
 	- "pcie_bus"
+RC mode:
+- num-viewport: number of view ports configured in
+  hardware. If a platform does not specify it, the driver assumes 2.
+- bus-range: PCI bus numbers covered (it is recommended
+  for new devicetrees to specify this property, to keep backwards
+  compatibility a range of 0x00-0xff is assumed if not present)
+EP mode:
+- max-functions: maximum number of functions that can be
+  configured
 
 Example configuration:
 
Signature · 1 line
2.11.0
#11 lore raw

PATCH v5 11/24 PCI: dwc: dra7xx: Facilitate wrapper and msi interrupts to be enabled independently

In reply to Kishon Vijay Abraham I

No functional change. Split dra7xx_pcie_enable_interrupts into dra7xx_pcie_enable_wrapper_interrupts and dra7xx_pcie_enable_msi_interrupts so that wrapper interrupts and msi interrupts can be enabled independently. This is in preparation for adding EP mode support to dra7xx driver since EP mode doesn't have to enable msi_interrupts.

---
 drivers/pci/dwc/pci-dra7xx.c | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +18 -6
index 7c9ed6a6675c..d78974d20360 100644
@@ -140,18 +140,30 @@ static int dra7xx_pcie_establish_link(struct dra7xx_pcie *dra7xx)
 	return dw_pcie_wait_for_link(pci);
 }
 
-static void dra7xx_pcie_enable_interrupts(struct dra7xx_pcie *dra7xx)
+static void dra7xx_pcie_enable_msi_interrupts(struct dra7xx_pcie *dra7xx)
 {
-	dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN,
-			   ~INTERRUPTS);
-	dra7xx_pcie_writel(dra7xx,
-			   PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN, INTERRUPTS);
 	dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI,
 			   ~LEG_EP_INTERRUPTS & ~MSI);
-	dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI,
+
+	dra7xx_pcie_writel(dra7xx,
+			   PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MSI,
 			   MSI | LEG_EP_INTERRUPTS);
 }
 
+static void dra7xx_pcie_enable_wrapper_interrupts(struct dra7xx_pcie *dra7xx)
+{
+	dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN,
+			   ~INTERRUPTS);
+	dra7xx_pcie_writel(dra7xx, PCIECTRL_DRA7XX_CONF_IRQENABLE_SET_MAIN,
+			   INTERRUPTS);
+}
+
+static void dra7xx_pcie_enable_interrupts(struct dra7xx_pcie *dra7xx)
+{
+	dra7xx_pcie_enable_wrapper_interrupts(dra7xx);
+	dra7xx_pcie_enable_msi_interrupts(dra7xx);
+}
+
 static void dra7xx_pcie_host_init(struct pcie_port *pp)
 {
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
Signature · 1 line
2.11.0
#12 lore raw

PATCH v5 12/24 PCI: dwc: dra7xx: Add EP mode support

In reply to Kishon Vijay Abraham I

The PCIe controller integrated in dra7xx SoCs is capable of operating in endpoint mode. Add endpoint mode support to dra7xx driver.

---
 drivers/pci/dwc/Kconfig           |  31 +++++-
 drivers/pci/dwc/Makefile          |   4 +-
 drivers/pci/dwc/pci-dra7xx.c      | 197 +++++++++++++++++++++++++++++++++++---
 drivers/pci/dwc/pcie-designware.h |   7 ++
 4 files changed, 221 insertions(+), 18 deletions(-)
drivers/pci/dwc/Kconfig +27 -4
index 00335c71404e..96e6d17d2ae1 100644
@@ -16,14 +16,37 @@ config PCIE_DW_EP
 
 config PCI_DRA7XX
 	bool "TI DRA7xx PCIe controller"
-	depends on PCI
+	depends on (PCI && PCI_MSI_IRQ_DOMAIN) || PCI_ENDPOINT
 	depends on OF && HAS_IOMEM && TI_PIPE3
+	help
+	 Enables support for the PCIe controller in the DRA7xx SoC. There
+	 are two instances of PCIe controller in DRA7xx. This controller can
+	 work either as EP or RC. In order to enable host specific features
+	 PCI_DRA7XX_HOST must be selected and in order to enable device
+	 specific features PCI_DRA7XX_EP must be selected. This uses
+	 the Designware core.
+
+if PCI_DRA7XX
+
+config PCI_DRA7XX_HOST
+	bool "PCI DRA7xx Host Mode"
+	depends on PCI
 	depends on PCI_MSI_IRQ_DOMAIN
 	select PCIE_DW_HOST
+	default y
 	help
-	 Enables support for the PCIe controller in the DRA7xx SoC.  There
-	 are two instances of PCIe controller in DRA7xx.  This controller can
-	 act both as EP and RC.  This reuses the Designware core.
+	 Enables support for the PCIe controller in the DRA7xx SoC to work in
+	 host mode.
+
+config PCI_DRA7XX_EP
+	bool "PCI DRA7xx Endpoint Mode"
+	depends on PCI_ENDPOINT
+	select PCIE_DW_EP
+	help
+	 Enables support for the PCIe controller in the DRA7xx SoC to work in
+	 endpoint mode.
+
+endif
 
 config PCIE_DW_PLAT
 	bool "Platform bus based DesignWare PCIe Controller"
drivers/pci/dwc/Makefile +3 -1
index b38425d36200..f31a8596442a 100644
@@ -2,7 +2,9 @@ obj-$(CONFIG_PCIE_DW) += pcie-designware.o
 obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o
 obj-$(CONFIG_PCIE_DW_EP) += pcie-designware-ep.o
 obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o
-obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o
+ifneq ($(filter y,$(CONFIG_PCI_DRA7XX_HOST) $(CONFIG_PCI_DRA7XX_EP)),)
+        obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o
+endif
 obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.o
 obj-$(CONFIG_PCI_IMX6) += pci-imx6.o
 obj-$(CONFIG_PCIE_SPEAR13XX) += pcie-spear13xx.o
drivers/pci/dwc/pci-dra7xx.c +184 -13

307 lines not on this page · raw message

drivers/pci/dwc/pcie-designware.h +7 -0
index 3cafba40abbc..c6a840575796 100644
@@ -120,6 +120,13 @@ enum dw_pcie_region_type {
 	DW_PCIE_REGION_OUTBOUND,
 };
 
+enum dw_pcie_device_mode {
+	DW_PCIE_UNKNOWN_TYPE,
+	DW_PCIE_EP_TYPE,
+	DW_PCIE_LEG_EP_TYPE,
+	DW_PCIE_RC_TYPE,
+};
+
 struct dw_pcie_host_ops {
 	int (*rd_own_conf)(struct pcie_port *pp, int where, int size, u32 *val);
 	int (*wr_own_conf)(struct pcie_port *pp, int where, int size, u32 val);
Signature · 1 line
2.11.0
#13 lore raw

PATCH v5 13/24 dt-bindings: PCI: dra7xx: Add dt bindings for pci dra7xx EP mode

In reply to Kishon Vijay Abraham I

Add device tree binding documentation for pci dra7xx EP mode.

---
 Documentation/devicetree/bindings/pci/ti-pci.txt | 37 +++++++++++++++++++-----
 1 file changed, 30 insertions(+), 7 deletions(-)
Documentation/devicetree/bindings/pci/ti-pci.txt +30 -7
index 60e25161f351..190828a5f32a 100644
@@ -1,17 +1,22 @@
 TI PCI Controllers
 
 PCIe Designware Controller
- - compatible: Should be "ti,dra7-pcie""
- - reg : Two register ranges as listed in the reg-names property
- - reg-names : The first entry must be "ti-conf" for the TI specific registers
-	       The second entry must be "rc-dbics" for the designware pcie
-	       registers
-	       The third entry must be "config" for the PCIe configuration space
+ - compatible: Should be "ti,dra7-pcie" for RC
+	       Should be "ti,dra7-pcie-ep" for EP
  - phys : list of PHY specifiers (used by generic PHY framework)
  - phy-names : must be "pcie-phy0", "pcie-phy1", "pcie-phyN".. based on the
 	       number of PHYs as specified in *phys* property.
  - ti,hwmods : Name of the hwmod associated to the pcie, "pcie<X>",
 	       where <X> is the instance number of the pcie from the HW spec.
+ - num-lanes as specified in ../designware-pcie.txt
+
+HOST MODE
+=========
+ - reg : Two register ranges as listed in the reg-names property
+ - reg-names : The first entry must be "ti-conf" for the TI specific registers
+	       The second entry must be "rc-dbics" for the designware pcie
+	       registers
+	       The third entry must be "config" for the PCIe configuration space
  - interrupts : Two interrupt entries must be specified. The first one is for
 		main interrupt line and the second for MSI interrupt line.
  - #address-cells,
@@ -19,13 +24,31 @@ PCIe Designware Controller
    #interrupt-cells,
    device_type,
    ranges,
-   num-lanes,
    interrupt-map-mask,
    interrupt-map : as specified in ../designware-pcie.txt
 
+DEVICE MODE
+===========
+ - reg : Four register ranges as listed in the reg-names property
+ - reg-names : "ti-conf" for the TI specific registers
+	       "ep_dbics" for the standard configuration registers as
+		they are locally accessed within the DIF CS space
+	       "ep_dbics2" for the standard configuration registers as
+		they are locally accessed within the DIF CS2 space
+	       "addr_space" used to map remote RC address space
+ - interrupts : one interrupt entries must be specified for main interrupt.
+ - num-ib-windows : number of inbound address translation windows
+ - num-ob-windows : number of outbound address translation windows
+
 Optional Property:
  - gpios : Should be added if a gpio line is required to drive PERST# line
 
+NOTE: Two dt nodes may be added for each PCI controller; one for host
+mode and another for device mode. So in order for PCI to
+work in host mode, EP mode dt node should be disabled and in order to PCI to
+work in EP mode, host mode dt node should be disabled. And host mode and EP
+mode are mutually exclusive.
+
 Example:
 axi {
 	compatible = "simple-bus";
Signature · 1 line
2.11.0
#14 lore raw

PATCH v5 14/24 dt-bindings: mfd: syscon: Add documentation for #syscon-cells property

In reply to Kishon Vijay Abraham I

Add documentation for the optional #syscon-cells property to determine the number of cells that should be given in the phandle while referencing the syscon-node.

---
 Documentation/devicetree/bindings/mfd/syscon.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.txt +2 -0
index 408f768686f1..446b47e8fb71 100644
@@ -16,6 +16,8 @@ Required properties:
 Optional property:
 - reg-io-width: the size (in bytes) of the IO accesses that should be
   performed on the device.
+- #syscon-cells: determine the number of cells that should be given in the
+  phandle while referencing this syscon-node.
 
 Examples:
 gpr: iomuxc-gpr at 020e0000 {
Signature · 1 line
2.11.0
#18 lore raw

PATCH v5 15/24 PCI: dwc: dra7xx: Workaround for errata id i870

In reply to Kishon Vijay Abraham I

According to errata i870, access to the PCIe slave port that are not 32-bit aligned will result in incorrect mapping to TLP Address and Byte enable fields.

Accessing non 32-bit aligned data causes incorrect data in the target buffer if memcpy is used. Implement the workaround for this errata here.

---
 drivers/pci/dwc/pci-dra7xx.c | 47 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
drivers/pci/dwc/pci-dra7xx.c +47 -0
index 35c18534469c..79fb213e4877 100644
@@ -26,6 +26,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/resource.h>
 #include <linux/types.h>
+#include <linux/mfd/syscon.h>
+#include <linux/regmap.h>
 
 #include "pcie-designware.h"
 
@@ -528,6 +530,46 @@ static const struct of_device_id of_dra7xx_pcie_match[] = {
 	{},
 };
 
+/*
+ * dra7xx_pcie_ep_unaligned_memaccess: workaround for AM572x/AM571x Errata i870
+ * @dra7xx: the dra7xx device where the workaround should be applied
+ *
+ * Access to the PCIe slave port that are not 32-bit aligned will result
+ * in incorrect mapping to TLP Address and Byte enable fields. Therefore,
+ * byte and half-word accesses are not possible to byte offset 0x1, 0x2, or
+ * 0x3.
+ *
+ * To avoid this issue set PCIE_SS1_AXI2OCP_LEGACY_MODE_ENABLE to 1.
+ */
+static int dra7xx_pcie_ep_unaligned_memaccess(struct device *dev)
+{
+	int ret;
+	struct device_node *np = dev->of_node;
+	struct of_phandle_args args;
+	struct regmap *regmap;
+
+	regmap = syscon_regmap_lookup_by_phandle(np,
+						 "ti,syscon-unaligned-access");
+	if (IS_ERR(regmap)) {
+		dev_dbg(dev, "can't get ti,syscon-unaligned-access\n");
+		return -EINVAL;
+	}
+
+	of_parse_phandle_with_args(np, "ti,syscon-unaligned-access",
+				   "#syscon-cells", 0, &args);
+	if (args.args_count != 2) {
+		dev_err(dev, "does not conform to #syscon-cells\n");
+		return -EINVAL;
+	}
+
+	ret = regmap_update_bits(regmap, args.args[0], args.args[1],
+				 args.args[1]);
+	if (ret)
+		dev_err(dev, "failed to enable unaligned access\n");
+
+	return ret;
+}
+
 static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 {
 	u32 reg;
@@ -644,6 +686,11 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)
 	case DW_PCIE_EP_TYPE:
 		dra7xx_pcie_writel(dra7xx, PCIECTRL_TI_CONF_DEVICE_TYPE,
 				   DEVICE_TYPE_EP);
+
+		ret = dra7xx_pcie_ep_unaligned_memaccess(dev);
+		if (ret)
+			goto err_gpio;
+
 		ret = dra7xx_add_pcie_ep(dra7xx, pdev);
 		if (ret < 0)
 			goto err_gpio;
Signature · 1 line
2.11.0
#19 lore raw

PATCH v5 16/24 dt-bindings: PCI: dra7xx: Add dt bindings to enable unaligned access

In reply to Kishon Vijay Abraham I

Update device tree binding documentation of TI's dra7xx PCI controller to include property for enabling unaligned mem access.

---
 Documentation/devicetree/bindings/pci/ti-pci.txt | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/pci/ti-pci.txt +5 -0
index 190828a5f32a..b69dd7dbd29e 100644
@@ -39,6 +39,11 @@ DEVICE MODE
  - interrupts : one interrupt entries must be specified for main interrupt.
  - num-ib-windows : number of inbound address translation windows
  - num-ob-windows : number of outbound address translation windows
+ - ti,syscon-unaligned-access: phandle to the syscon dt node. The 1st argument
+			       should contain the register offset within syscon
+			       and the 2nd argument should contain the bit field
+			       for setting the bit to enable unaligned
+			       access.
 
 Optional Property:
  - gpios : Should be added if a gpio line is required to drive PERST# line
Signature · 1 line
2.11.0
#21 lore raw

PATCH v5 17/24 PCI: Add device IDs for DRA74x and DRA72x

In reply to Kishon Vijay Abraham I

Add device IDs for DRA74x and DRA72x devices. These devices have configurable PCI endpoint.

---
 include/linux/pci_ids.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
index a4f77feecbb0..5f6b71d15393 100644
@@ -862,6 +862,8 @@
 #define PCI_DEVICE_ID_TI_X620		0xac8d
 #define PCI_DEVICE_ID_TI_X420		0xac8e
 #define PCI_DEVICE_ID_TI_XX20_FM	0xac8f
+#define PCI_DEVICE_ID_TI_DRA74x		0xb500
+#define PCI_DEVICE_ID_TI_DRA72x		0xb501
 
 #define PCI_VENDOR_ID_SONY		0x104d
 
Signature · 1 line
2.11.0
#22 lore raw

PATCH v5 18/24 misc: Add host side pci driver for pci test function device

In reply to Kishon Vijay Abraham I

Add PCI endpoint test driver that can verify base address register, legacy interrupt/MSI interrupt and read/write/copy buffers between host and device. The corresponding pci-epf-test function driver should be used on the EP side.

---
 drivers/misc/Kconfig             |   7 +
 drivers/misc/Makefile            |   1 +
 drivers/misc/pci_endpoint_test.c | 534 +++++++++++++++++++++++++++++++++++++++
 include/uapi/linux/Kbuild        |   1 +
 include/uapi/linux/pcitest.h     |  19 ++
 5 files changed, 562 insertions(+)
 create mode 100644 drivers/misc/pci_endpoint_test.c
 create mode 100644 include/uapi/linux/pcitest.h
drivers/misc/Kconfig +7 -0
index c290990d73ed..15ac29d7a840 100644
@@ -771,6 +771,13 @@ config PANEL_BOOT_MESSAGE
 
 endif # PANEL
 
+config PCI_ENDPOINT_TEST
+	depends on PCI || COMPILE_TEST
+	tristate "PCI Endpoint Test driver"
+	---help---
+           Enable this configuration option to enable the host side test driver
+           for PCI Endpoint.
+
 source "drivers/misc/c2port/Kconfig"
 source "drivers/misc/eeprom/Kconfig"
 source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
index 7a3ea89339b4..6e139cd70421 100644
@@ -54,6 +54,7 @@ obj-$(CONFIG_ECHO)		+= echo/
 obj-$(CONFIG_VEXPRESS_SYSCFG)	+= vexpress-syscfg.o
 obj-$(CONFIG_CXL_BASE)		+= cxl/
 obj-$(CONFIG_PANEL)             += panel.o
+obj-$(CONFIG_PCI_ENDPOINT_TEST)	+= pci_endpoint_test.o
 
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_core.o
 lkdtm-$(CONFIG_LKDTM)		+= lkdtm_bugs.o
drivers/misc/pci_endpoint_test.c new file +534 -0

534 lines not on this page · raw message

include/uapi/linux/Kbuild +1 -0
index dd9820b1c779..baee6db08287 100644
@@ -333,6 +333,7 @@ header-y += parport.h
 header-y += patchkey.h
 header-y += pci.h
 header-y += pci_regs.h
+header-y += pcitest.h
 header-y += perf_event.h
 header-y += personality.h
 header-y += pfkeyv2.h
include/uapi/linux/pcitest.h new file +19 -0
new file mode 100644
index 000000000000..a6aa10c45ad1
@@ -0,0 +1,19 @@
+/**
+ * pcitest.h - PCI test uapi defines
+ *
+ * Copyright (C) 2017 Texas Instruments
+ * Author: Kishon Vijay Abraham I <[email protected]>
+ *
+ */
+
+#ifndef __UAPI_LINUX_PCITEST_H
+#define __UAPI_LINUX_PCITEST_H
+
+#define PCITEST_BAR		_IO('P', 0x1)
+#define PCITEST_LEGACY_IRQ	_IO('P', 0x2)
+#define PCITEST_MSI		_IOW('P', 0x3, int)
+#define PCITEST_WRITE		_IOW('P', 0x4, unsigned long)
+#define PCITEST_READ		_IOW('P', 0x5, unsigned long)
+#define PCITEST_COPY		_IOW('P', 0x6, unsigned long)
+
+#endif /* __UAPI_LINUX_PCITEST_H */
Signature · 1 line
2.11.0
#23 lore raw

PATCH v5 19/24 Documentation: misc-devices: Add Documentation for pci-endpoint-test driver

In reply to Kishon Vijay Abraham I

Add Documentation for pci-endpoint-test driver.

---
 Documentation/misc-devices/pci-endpoint-test.txt | 35 ++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 Documentation/misc-devices/pci-endpoint-test.txt
Documentation/misc-devices/pci-endpoint-test.txt new file +35 -0
new file mode 100644
index 000000000000..438571898d27
@@ -0,0 +1,35 @@
+Driver for PCI Endpoint Test Function
+
+This driver should be used as a host side driver if the root complex is
+connected to a configurable pci endpoint running *pci_epf_test* function
+driver configured according to [1].
+
+The "pci_endpoint_test" driver can be used to perform the following tests.
+
+The PCI driver for the test device performs the following tests
+	*) verifying addresses programmed in BAR
+	*) raise legacy IRQ
+	*) raise MSI IRQ
+	*) read data
+	*) write data
+	*) copy data
+
+This misc driver creates /dev/pci-endpoint-test.<num> for every
+*pci_epf_test* function connected to the root complex and "ioctls"
+should be used to perform the above tests.
+
+ioctl
+-----
+ PCITEST_BAR: Tests the BAR. The number of the BAR that has to be tested
+	      should be passed as argument.
+ PCITEST_LEGACY_IRQ: Tests legacy IRQ
+ PCITEST_MSI: Tests message signalled interrupts. The MSI number that has
+	      to be tested should be passed as argument.
+ PCITEST_WRITE: Perform write tests. The size of the buffer should be passed
+		as argument.
+ PCITEST_READ: Perform read tests. The size of the buffer should be passed
+	       as argument.
+ PCITEST_COPY: Perform read tests. The size of the buffer should be passed
+	       as argument.
+
+[1] -> Documentation/PCI/endpoint/function/binding/pci-test.txt
Signature · 1 line
2.11.0
#24 lore raw

PATCH v5 20/24 tools: PCI: Add a userspace tool to test PCI endpoint

In reply to Kishon Vijay Abraham I

Add a userspace tool to invoke the ioctls exposed by the PCI endpoint test driver to perform various PCI tests.

---
 tools/pci/pcitest.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 186 insertions(+)
 create mode 100644 tools/pci/pcitest.c
tools/pci/pcitest.c new file +186 -0
new file mode 100644
index 000000000000..39b5b0ba569e
@@ -0,0 +1,186 @@
+/**
+ * Userspace PCI Endpoint Test Module
+ *
+ * Copyright (C) 2017 Texas Instruments
+ * Author: Kishon Vijay Abraham I <[email protected]>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <linux/pcitest.h>
+
+#define BILLION 1E9
+
+static char *result[] = { "NOT OKAY", "OKAY" };
+
+struct pci_test {
+	char		*device;
+	char		barnum;
+	bool		legacyirq;
+	unsigned int	msinum;
+	bool		read;
+	bool		write;
+	bool		copy;
+	unsigned long	size;
+};
+
+static int run_test(struct pci_test *test)
+{
+	long ret;
+	int fd;
+	struct timespec start, end;
+	double time;
+
+	fd = open(test->device, O_RDWR);
+	if (fd < 0) {
+		perror("can't open PCI Endpoint Test device");
+		return fd;
+	}
+
+	if (test->barnum >= 0 && test->barnum <= 5) {
+		ret = ioctl(fd, PCITEST_BAR, test->barnum);
+		fprintf(stdout, "BAR%d:\t\t", test->barnum);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
+	if (test->legacyirq) {
+		ret = ioctl(fd, PCITEST_LEGACY_IRQ, 0);
+		fprintf(stdout, "LEGACY IRQ:\t");
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
+	if (test->msinum > 0 && test->msinum <= 32) {
+		ret = ioctl(fd, PCITEST_MSI, test->msinum);
+		fprintf(stdout, "MSI%d:\t\t", test->msinum);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
+	if (test->write) {
+		ret = ioctl(fd, PCITEST_WRITE, test->size);
+		fprintf(stdout, "WRITE (%7ld bytes):\t\t", test->size);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
+	if (test->read) {
+		ret = ioctl(fd, PCITEST_READ, test->size);
+		fprintf(stdout, "READ (%7ld bytes):\t\t", test->size);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
+	if (test->copy) {
+		ret = ioctl(fd, PCITEST_COPY, test->size);
+		fprintf(stdout, "COPY (%7ld bytes):\t\t", test->size);
+		if (ret < 0)
+			fprintf(stdout, "TEST FAILED\n");
+		else
+			fprintf(stdout, "%s\n", result[ret]);
+	}
+
+	fflush(stdout);
+}
+
+int main(int argc, char **argv)
+{
+	int c;
+	struct pci_test *test;
+
+	test = calloc(1, sizeof(*test));
+	if (!test) {
+		perror("Fail to allocate memory for pci_test\n");
+		return -ENOMEM;
+	}
+
+	/* since '0' is a valid BAR number, initialize it to -1 */
+	test->barnum = -1;
+
+	/* set default size as 100KB */
+	test->size = 0x19000;
+
+	/* set default endpoint device */
+	test->device = "/dev/pci-endpoint-test.0";
+
+	while ((c = getopt(argc, argv, "D:b:m:lrwcs:")) != EOF)
+	switch (c) {
+	case 'D':
+		test->device = optarg;
+		continue;
+	case 'b':
+		test->barnum = atoi(optarg);
+		if (test->barnum < 0 || test->barnum > 5)
+			goto usage;
+		continue;
+	case 'l':
+		test->legacyirq = true;
+		continue;
+	case 'm':
+		test->msinum = atoi(optarg);
+		if (test->msinum < 1 || test->msinum > 32)
+			goto usage;
+		continue;
+	case 'r':
+		test->read = true;
+		continue;
+	case 'w':
+		test->write = true;
+		continue;
+	case 'c':
+		test->copy = true;
+		continue;
+	case 's':
+		test->size = strtoul(optarg, NULL, 0);
+		continue;
+	case '?':
+	case 'h':
+	default:
+usage:
+		fprintf(stderr,
+			"usage: %s [options]\n"
+			"Options:\n"
+			"\t-D <dev>		pci endpoint test device {default: /dev/pci-endpoint-test.0}\n"
+			"\t-b <bar num>		BAR test (bar number between 0..5)\n"
+			"\t-m <msi num>		MSI test (msi number between 1..32)\n"
+			"\t-r			Read buffer test\n"
+			"\t-w			Write buffer test\n"
+			"\t-c			Copy buffer test\n"
+			"\t-s <size>		Size of buffer {default: 100KB}\n",
+			argv[0]);
+		return -EINVAL;
+	}
+
+	run_test(test);
+	return 0;
+}
Signature · 1 line
2.11.0
#25 lore raw

PATCH v5 21/24 tools: PCI: Add sample test script to invoke pcitest

In reply to Kishon Vijay Abraham I

Add a simple test script that invokes the pcitest userspace tool to perform all the PCI endpoint tests (BAR tests, interrupt tests, read tests, write tests and copy tests).

---
 tools/pci/pcitest.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
 create mode 100644 tools/pci/pcitest.sh
tools/pci/pcitest.sh new file +56 -0
new file mode 100644
index 000000000000..5442bbea4c22
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+echo "BAR tests"
+echo
+
+bar=0
+
+while [ $bar -lt 6 ]
+do
+	pcitest -b $bar
+	bar=`expr $bar + 1`
+done
+echo
+
+echo "Interrupt tests"
+echo
+
+pcitest -l
+msi=1
+
+while [ $msi -lt 33 ]
+do
+        pcitest -m $msi
+        msi=`expr $msi + 1`
+done
+echo
+
+echo "Read Tests"
+echo
+
+pcitest -r -s 1
+pcitest -r -s 1024
+pcitest -r -s 1025
+pcitest -r -s 1024000
+pcitest -r -s 1024001
+echo
+
+echo "Write Tests"
+echo
+
+pcitest -w -s 1
+pcitest -w -s 1024
+pcitest -w -s 1025
+pcitest -w -s 1024000
+pcitest -w -s 1024001
+echo
+
+echo "Copy Tests"
+echo
+
+pcitest -c -s 1
+pcitest -c -s 1024
+pcitest -c -s 1025
+pcitest -c -s 1024000
+pcitest -c -s 1024001
+echo
Signature · 1 line
2.11.0
#26 lore raw

PATCH v5 22/24 Documentation: PCI: Add userguide for PCI endpoint test function

In reply to Kishon Vijay Abraham I

Add documentation to help users use pci-epf-test function driver and pci_endpoint_test host driver for testing PCI.

---
 Documentation/PCI/00-INDEX                    |   2 +
 Documentation/PCI/endpoint/pci-test-howto.txt | 179 ++++++++++++++++++++++++++
 2 files changed, 181 insertions(+)
 create mode 100644 Documentation/PCI/endpoint/pci-test-howto.txt
Documentation/PCI/00-INDEX +2 -0
index 53717b7fcdd4..fd533c79fa19 100644
@@ -18,5 +18,7 @@ endpoint/pci-endpoint-cfs.txt
 	- guide to use configfs to configure the pci endpoint function.
 endpoint/pci-test-function.txt
 	- specification of *pci test* function device.
+endpoint/pci-test-howto.txt
+	- userguide for PCI endpoint test function.
 endpoint/function/binding/
 	- binding documentation for pci endpoint function
Documentation/PCI/endpoint/pci-test-howto.txt new file +179 -0

179 lines not on this page · raw message

Signature · 1 line
2.11.0
#27 lore raw

PATCH v5 23/24 MAINTAINERS: add PCI EP maintainer

In reply to Kishon Vijay Abraham I

Add maintainer for the newly introduced PCI EP framework.

---
 MAINTAINERS | 9 +++++++++
 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
index c265a5fe4848..3c1b947811e2 100644
@@ -9581,6 +9581,15 @@ F:	include/linux/pci*
 F:	arch/x86/pci/
 F:	arch/x86/kernel/quirks.c
 
+PCI EP SUBSYSTEM
+M:	Kishon Vijay Abraham I <[email protected]>
+L:	linux-pci at vger.kernel.org
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git
+S:	Supported
+F:	drivers/pci/endpoint/
+F:	drivers/misc/pci_endpoint_test.c
+F:	tools/pci/
+
 PCI DRIVER FOR ALTERA PCIE IP
 M:	Ley Foon Tan <[email protected]>
 L:	rfi at lists.rocketboards.org (moderated for non-subscribers)
Signature · 1 line
2.11.0
#28 lore raw

PATCH v5 24/24 ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP

In reply to Kishon Vijay Abraham I

The PCIe programming sequence in TRM suggests CLKSTCTRL of PCIe should be set to SW_WKUP. There are no issues when CLKSTCTRL is set to HW_AUTO in RC mode. However in EP mode, the host system is not able to access the MEMSPACE and setting the CLKSTCTRL to SW_WKUP fixes it.

---
 arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap2/clockdomains7xx_data.c +1 -1
index 6c679659cda5..67ebff829cf2 100644
@@ -524,7 +524,7 @@ static struct clockdomain pcie_7xx_clkdm = {
 	.dep_bit	  = DRA7XX_PCIE_STATDEP_SHIFT,
 	.wkdep_srcs	  = pcie_wkup_sleep_deps,
 	.sleepdep_srcs	  = pcie_wkup_sleep_deps,
-	.flags		  = CLKDM_CAN_HWSUP_SWSUP,
+	.flags		  = CLKDM_CAN_SWSUP,
 };
 
 static struct clockdomain atl_7xx_clkdm = {
Signature · 1 line
2.11.0
#29 lore raw
In reply to Kishon Vijay Abraham I
Quoted 57 lines · Kishon Vijay Abraham I

Hi Bjorn,

Please find the pull request for PCI endpoint support below. I've also included all the history here.

Changes from v4:
*) add #syscon-cells property and used of_parse_phandle_with_args
to perform a configuration in syscon module (as suggested by Rob Herring)
*) Remove unnecessary white space.

Changes from v3:
*) fixed a typo and adapted to https://lkml.org/lkml/2017/3/13/562.

Changes from v2:
*) changed the configfs structure as suggested by Christoph Hellwig. With
this change the framework creates configfs entry for EP function driver and EP controller. Previously these entries have to be created by the the user. (Haven't changed the epc core or epf core except for invoking configfs APIs to create entries for EP function driver and EP controller. That's mostly because the EP function device can still be created by directly invoking the epf core API without using configfs).
*) Now the user has to use configfs entry 'start' to start the link.
This was previously done by the function driver. However in the case of multi function EP, the function driver shouldn't start the link.

Changes from v1:
*) The preparation patches for adding EP support is removed and is sent
separately
*) Added device ID for DRA74x/DRA72x and used it instead of
using "PCI_ANY_ID"
*) Added userguide for PCI endpoint test function

Major Improvements from RFC:
*) support multi-function devices (hw supported not virtual) *) Access host side buffers
*) Raise MSI interrupts
*) Add user space program to use the host side PCI driver *) Adapt all other users of designware to use the new design (only
compile tested. Since I have only dra7xx boards, the new design has only been tested in dra7xx. I'd require the help of others to test the platforms they have access to).

This series has been developed over 4.11-rc1 + [1]
[1] -> https://lkml.org/lkml/2017/3/13/562

Let me know if this has to be re-based to some of your branch.

Thanks
Kishon

The following changes since commit 623e87fec8ab7867fb51b3079196bd10718a60ce:

PCI: dwc: dra7xx: Push request_irq call to the bottom of probe (2017-03-22 20:35:30 +0530)

are available in the git repository at:

Quoted 7 lines

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git tags/pci-endpoint-for-4.12

for you to fetch changes up to e98bf80074be4654faae42fe0f5a622a776b6fdd:

ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP (2017-03-27 15:08:22 +0530)

----------------------------------------------------------------

FWIW:
I've tested Kishon's tag pci-endpoint-for-4.12 and PCIe on artpec6 SoC is still working fine.

I also included the DRA7xx PCIe driver in my kernel so that pcie-designware-ep.c gets built.

My only worry is that the code in pcie-designware-ep.c is not compile tested if DRA7xx is not selected (as it is the only driver using PCIE_DW_EP at the moment).

#30 lore raw

Hi Niklas,

Quoted 62 lines · Niklas Cassel
Quoted 61 lines · Kishon Vijay Abraham I

Hi Bjorn,

Please find the pull request for PCI endpoint support below. I've also included all the history here.

Changes from v4:
*) add #syscon-cells property and used of_parse_phandle_with_args
to perform a configuration in syscon module (as suggested by Rob Herring)
*) Remove unnecessary white space.

Changes from v3:
*) fixed a typo and adapted to https://lkml.org/lkml/2017/3/13/562.

Changes from v2:
*) changed the configfs structure as suggested by Christoph Hellwig. With
this change the framework creates configfs entry for EP function driver and EP controller. Previously these entries have to be created by the the user. (Haven't changed the epc core or epf core except for invoking configfs APIs to create entries for EP function driver and EP controller. That's mostly because the EP function device can still be created by directly invoking the epf core API without using configfs).
*) Now the user has to use configfs entry 'start' to start the link.
This was previously done by the function driver. However in the case of multi function EP, the function driver shouldn't start the link.

Changes from v1:
*) The preparation patches for adding EP support is removed and is sent
separately
*) Added device ID for DRA74x/DRA72x and used it instead of
using "PCI_ANY_ID"
*) Added userguide for PCI endpoint test function

Major Improvements from RFC:
*) support multi-function devices (hw supported not virtual) *) Access host side buffers
*) Raise MSI interrupts
*) Add user space program to use the host side PCI driver *) Adapt all other users of designware to use the new design (only
compile tested. Since I have only dra7xx boards, the new design has only been tested in dra7xx. I'd require the help of others to test the platforms they have access to).

This series has been developed over 4.11-rc1 + [1]
[1] -> https://lkml.org/lkml/2017/3/13/562

Let me know if this has to be re-based to some of your branch.

Thanks
Kishon

The following changes since commit 623e87fec8ab7867fb51b3079196bd10718a60ce:

PCI: dwc: dra7xx: Push request_irq call to the bottom of probe (2017-03-22 20:35:30 +0530)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git tags/pci-endpoint-for-4.12

for you to fetch changes up to e98bf80074be4654faae42fe0f5a622a776b6fdd:

Quoted 7 lines
Quoted 3 lines

ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP (2017-03-27 15:08:22 +0530)

----------------------------------------------------------------

FWIW:
I've tested Kishon's tag pci-endpoint-for-4.12 and PCIe on artpec6 SoC is still working fine.

Thanks for testing it.

Quoted 8 lines

I also included the DRA7xx PCIe driver in my kernel so that pcie-designware-ep.c gets built.

My only worry is that the code in pcie-designware-ep.c is not compile tested if DRA7xx is not selected (as it is the only driver using PCIE_DW_EP at the moment).

yeah, we should plan to include COMPILE_TEST in all pci drivers but I guess there is some problem with non-ARM builds [1]. As Bjorn mentioned in the thread, we could add #ifdef ARM and then include COMPILE_TEST.

Thanks
Kishon

[1] -> http://www.spinics.net/lists/linux-pci/msg58134.html

Thanks
Kishon

Quoted 1 line
#31 lore raw

Hi,

Quoted 78 lines · Kishon Vijay Abraham I

Hi Niklas,

Quoted 62 lines · Niklas Cassel
Quoted 61 lines · Kishon Vijay Abraham I

Hi Bjorn,

Please find the pull request for PCI endpoint support below. I've also included all the history here.

Changes from v4:
*) add #syscon-cells property and used of_parse_phandle_with_args
to perform a configuration in syscon module (as suggested by Rob Herring)
*) Remove unnecessary white space.

Changes from v3:
*) fixed a typo and adapted to https://lkml.org/lkml/2017/3/13/562.

Changes from v2:
*) changed the configfs structure as suggested by Christoph Hellwig. With
this change the framework creates configfs entry for EP function driver and EP controller. Previously these entries have to be created by the the user. (Haven't changed the epc core or epf core except for invoking configfs APIs to create entries for EP function driver and EP controller. That's mostly because the EP function device can still be created by directly invoking the epf core API without using configfs).
*) Now the user has to use configfs entry 'start' to start the link.
This was previously done by the function driver. However in the case of multi function EP, the function driver shouldn't start the link.

Changes from v1:
*) The preparation patches for adding EP support is removed and is sent
separately
*) Added device ID for DRA74x/DRA72x and used it instead of
using "PCI_ANY_ID"
*) Added userguide for PCI endpoint test function

Major Improvements from RFC:
*) support multi-function devices (hw supported not virtual) *) Access host side buffers
*) Raise MSI interrupts
*) Add user space program to use the host side PCI driver *) Adapt all other users of designware to use the new design (only
compile tested. Since I have only dra7xx boards, the new design has only been tested in dra7xx. I'd require the help of others to test the platforms they have access to).

This series has been developed over 4.11-rc1 + [1]
[1] -> https://lkml.org/lkml/2017/3/13/562

Let me know if this has to be re-based to some of your branch.

Thanks
Kishon

The following changes since commit 623e87fec8ab7867fb51b3079196bd10718a60ce:

PCI: dwc: dra7xx: Push request_irq call to the bottom of probe (2017-03-22 20:35:30 +0530)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git tags/pci-endpoint-for-4.12

for you to fetch changes up to e98bf80074be4654faae42fe0f5a622a776b6fdd:

Quoted 7 lines
Quoted 3 lines

ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP (2017-03-27 15:08:22 +0530)

----------------------------------------------------------------

FWIW:
I've tested Kishon's tag pci-endpoint-for-4.12 and PCIe on artpec6 SoC is still working fine.

Thanks for testing it.

Quoted 4 lines

I also included the DRA7xx PCIe driver in my kernel so that pcie-designware-ep.c gets built.

Quoted 8 lines
Quoted 4 lines

My only worry is that the code in pcie-designware-ep.c is not compile tested if DRA7xx is not selected (as it is the only driver using PCIE_DW_EP at the moment).

yeah, we should plan to include COMPILE_TEST in all pci drivers but I guess there is some problem with non-ARM builds [1]. As Bjorn mentioned in the thread, we could add #ifdef ARM and then include COMPILE_TEST.

I think I misunderstood your concern. yeah, there is no direct way to compile pcie-designware-ep.c without selecting DRA7xx.

Thanks
Kishon

#32 lore raw

On 03/29/2017 02:36 PM, Kishon Vijay Abraham I wrote:
(snip)

Quoted 15 lines
Quoted 15 lines
Quoted 4 lines

FWIW:
I've tested Kishon's tag pci-endpoint-for-4.12 and PCIe on artpec6 SoC is still working fine.

Thanks for testing it.

Quoted 8 lines

I also included the DRA7xx PCIe driver in my kernel so that pcie-designware-ep.c gets built.

My only worry is that the code in pcie-designware-ep.c is not compile tested if DRA7xx is not selected (as it is the only driver using PCIE_DW_EP at the moment).

Quoted 6 lines
Quoted 3 lines

yeah, we should plan to include COMPILE_TEST in all pci drivers but I guess there is some problem with non-ARM builds [1]. As Bjorn mentioned in the thread, we could add #ifdef ARM and then include COMPILE_TEST.

I think I misunderstood your concern. yeah, there is no direct way to compile pcie-designware-ep.c without selecting DRA7xx.

There is no way to compile pcie-designware-host.c + pcie-designware.c without selecting a driver that selects PCIE_DW_HOST,
so I guess the same "problem" applies there.

As long as kbuild builds PCI_DRA7XX_EP (and any driver that selects PCIE_DW_HOST), we should be fine.

maintainer
#15 lore raw

Re: [PATCH v5 14/24] dt-bindings: mfd: syscon: Add documentation for #syscon-cells property

In reply to Kishon Vijay Abraham I
Quoted 5 lines · Kishon Vijay Abraham I

Add documentation for the optional #syscon-cells property to determine the number of cells that should be given in the phandle while referencing the syscon-node.

I did? When?

I'm not remembering why we need this. Generally, phandles to a syscon are for a single defined purpose. When do we need a list of them?

Rob

Quoted 25 lines
---
 Documentation/devicetree/bindings/mfd/syscon.txt | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/mfd/syscon.txt +2 -0
index 408f768686f1..446b47e8fb71 100644
@@ -16,6 +16,8 @@ Required properties:
 Optional property:
 - reg-io-width: the size (in bytes) of the IO accesses that should be
   performed on the device.
+- #syscon-cells: determine the number of cells that should be given in the
+  phandle while referencing this syscon-node.
 
 Examples:
 gpr: iomuxc-gpr at 020e0000 {
Signature · 6 lines
2.11.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maintainer
#16 lore raw

Re: [PATCH v5 14/24] dt-bindings: mfd: syscon: Add documentation for #syscon-cells property

Quoted 11 lines · Rob Herring
Quoted 5 lines · Kishon Vijay Abraham I

Add documentation for the optional #syscon-cells property to determine the number of cells that should be given in the phandle while referencing the syscon-node.

I did? When?

I'm not remembering why we need this. Generally, phandles to a syscon are for a single defined purpose. When do we need a list of them?

Ah, I remember now the context. I suggested using standard parsing function rather than open coding. I wasn't suggesting changing the binding. Instead of of_parse_phandle_with_args, can't of_parse_phandle_with_fixed_args work?

Rob

maintainer Acked-by on v5 16/24
#20 lore raw

Re: [PATCH v5 16/24] dt-bindings: PCI: dra7xx: Add dt bindings to enable unaligned access

In reply to Kishon Vijay Abraham I
Quoted 7 lines · Kishon Vijay Abraham I

Update device tree binding documentation of TI's dra7xx PCI controller to include property for enabling unaligned mem access.

---
 Documentation/devicetree/bindings/pci/ti-pci.txt | 5 +++++
 1 file changed, 5 insertions(+)
#33 lore raw
In reply to Kishon Vijay Abraham I
Quoted 4 lines · Kishon Vijay Abraham I

Hi Bjorn,

Please find the pull request for PCI endpoint support below. I've also included all the history here.

I tentatively applied this to pci/host-designware with the mostly trival textual changes below. If you post the series again, please include them.

I saw some acks to prior revisions, but few of them were included in this
series. Can you collect them up? If there are no other substantial
changes, I can insert them into my branch manually.

Bjorn

Documentation/PCI/00-INDEX +3 -3
index fd533c79fa19..00c9a90b6f38 100644
@@ -15,10 +15,10 @@ pcieaer-howto.txt
 endpoint/pci-endpoint.txt
 	- guide to add endpoint controller driver and endpoint function driver.
 endpoint/pci-endpoint-cfs.txt
-	- guide to use configfs to configure the pci endpoint function.
+	- guide to use configfs to configure the PCI endpoint function.
 endpoint/pci-test-function.txt
-	- specification of *pci test* function device.
+	- specification of *PCI test* function device.
 endpoint/pci-test-howto.txt
 	- userguide for PCI endpoint test function.
 endpoint/function/binding/
-	- binding documentation for pci endpoint function
+	- binding documentation for PCI endpoint function
Documentation/PCI/endpoint/function/binding/pci-test.txt +1 -1
index c44fc18d78cc..3b68b955fb50 100644
@@ -13,5 +13,5 @@ cache_line_size	 : don't care
 subsys_vendor_id : don't care
 subsys_id	 : don't care
 interrupt_pin	 : Should be 1 - INTA, 2 - INTB, 3 - INTC, 4 -INTD
-msi_interrupts	 : Should be 1 to 32 depending on the number of msi interrupts
+msi_interrupts	 : Should be 1 to 32 depending on the number of MSI interrupts
 		   to test
Documentation/PCI/endpoint/pci-endpoint-cfs.txt +3 -3
index 8b2a8280b131..d740f29960a4 100644
@@ -1,10 +1,10 @@
                    CONFIGURING PCI ENDPOINT USING CONFIGFS
                     Kishon Vijay Abraham I <[email protected]>
 
-The PCI Endpoint Core exposes configfs entry (pci_ep) in order to configure the
-PCI endpoint function and in order to bind the endpoint function
+The PCI Endpoint Core exposes configfs entry (pci_ep) to configure the
+PCI endpoint function and to bind the endpoint function
 with the endpoint controller. (For introducing other mechanisms to
-configure the PCI Endpoint Function refer [1]).
+configure the PCI Endpoint Function refer to [1]).
 
 *) Mounting configfs
 
Documentation/PCI/endpoint/pci-endpoint.txt +20 -20
index 4a3e4388b37b..9b1d66829290 100644
@@ -2,27 +2,27 @@
 		    Kishon Vijay Abraham I <[email protected]>
 
 This document is a guide to use the PCI Endpoint Framework in order to create
-endpoint controller driver, endpoint function driver and using configfs
+endpoint controller driver, endpoint function driver, and using configfs
 interface to bind the function driver to the controller driver.
 
 1. Introduction
 
-*Linux* has a comprehensive PCI subsystem to support PCI controllers that
+Linux has a comprehensive PCI subsystem to support PCI controllers that
 operates in Root Complex mode. The subsystem has capability to scan PCI bus,
-assign memory resources and irq resources, load PCI driver (based on
-vendorid, deviceid), support other services like hot-plug, power management,
+assign memory resources and IRQ resources, load PCI driver (based on
+vendor ID, device ID), support other services like hot-plug, power management,
 advanced error reporting and virtual channels.
 
-However PCI controller IPs integrated in certain SoC is capable of operating
+However the PCI controller IP integrated in some SoCs is capable of operating
 either in Root Complex mode or Endpoint mode. PCI Endpoint Framework will
-add endpoint mode support in *Linux*. This will help to run Linux in an
+add endpoint mode support in Linux. This will help to run Linux in an
 EP system which can have a wide variety of use cases from testing or
-validation, co-processor accelerator etc..
+validation, co-processor accelerator, etc.
 
 2. PCI Endpoint Core
 
-The PCI Endpoint Core layer comprises of 3 components: the Endpoint Controller
-library, the Endpoint Function library and the configfs layer to bind the
+The PCI Endpoint Core layer comprises 3 components: the Endpoint Controller
+library, the Endpoint Function library, and the configfs layer to bind the
 endpoint function with the endpoint controller.
 
 2.1 PCI Endpoint Controller(EPC) Library
@@ -42,20 +42,20 @@ by the PCI controller driver.
 	 * write_header: ops to populate configuration space header
 	 * set_bar: ops to configure the BAR
 	 * clear_bar: ops to reset the BAR
-	 * alloc_addr_space: ops to allocate *in* PCI controller address space
+	 * alloc_addr_space: ops to allocate in PCI controller address space
 	 * free_addr_space: ops to free the allocated address space
 	 * raise_irq: ops to raise a legacy or MSI interrupt
 	 * start: ops to start the PCI link
 	 * stop: ops to stop the PCI link
 
    The PCI controller driver can then create a new EPC device by invoking
-   devm_pci_epc_create/pci_epc_create.
+   devm_pci_epc_create()/pci_epc_create().
 
 *) devm_pci_epc_destroy()/pci_epc_destroy()
 
    The PCI controller driver can destroy the EPC device created by either
-   devm_pci_epc_create or pci_epc_create using devm_pci_epc_destroy() or
-   /pci_epc_destroy()
+   devm_pci_epc_create() or pci_epc_create() using devm_pci_epc_destroy() or
+   pci_epc_destroy().
 
 *) pci_epc_linkup()
 
@@ -112,27 +112,27 @@ by the PCI endpoint function driver.
 2.1.3 Other APIs
 
 There are other APIs provided by the EPC library. These are used for binding
-the epf device with epc device. pci-ep-cfs.c can be used as reference for
+the EPF device with EPC device. pci-ep-cfs.c can be used as reference for
 using these APIs.
 
 *) pci_epc_get()
 
-   Get a reference to the pci endpoint controller based on the device name of
+   Get a reference to the PCI endpoint controller based on the device name of
    the controller.
 
 *) pci_epc_put()
 
-   Release the reference to the pci endpoint controller obtained using
+   Release the reference to the PCI endpoint controller obtained using
    pci_epc_get()
 
 *) pci_epc_add_epf()
 
-   Add a pci endpoint function to a pci endpoint controller. A pcie device
-   can have upto 8 functions according to the specification.
+   Add a PCI endpoint function to a PCI endpoint controller. A PCIe device
+   can have up to 8 functions according to the specification.
 
 *) pci_epc_remove_epf()
 
-   Remove the pci endpoint function from pci endpoint controller.
+   Remove the PCI endpoint function from PCI endpoint controller.
 
 *) pci_epc_start()
 
@@ -147,7 +147,7 @@ using these APIs.
 2.2 PCI Endpoint Function(EPF) Library
 
 The EPF library provides APIs to be used by the function driver and the EPC
-library in order to provide endpoint mode functionality.
+library to provide endpoint mode functionality.
 
 2.2.1 APIs for the PCI Endpoint Function Driver
 
Documentation/PCI/endpoint/pci-test-function.txt +3 -3
index 1324376ec6a3..0c519c9bf94a 100644
@@ -32,8 +32,8 @@ This register will be used by the host driver to indicate the function
 that the endpoint device must perform.
 
 Bitfield Description:
-  Bit 0		: raise legacy irq
-  Bit 1		: raise MSI irq
+  Bit 0		: raise legacy IRQ
+  Bit 1		: raise MSI IRQ
   Bit 2 - 7	: MSI interrupt number
   Bit 8		: read command (read data from RC buffer)
   Bit 9		: write command (write data to RC buffer)
@@ -51,7 +51,7 @@ Bitfield Description:
   Bit 3		: write fail
   Bit 4		: copy success
   Bit 5		: copy fail
-  Bit 6		: irq raised
+  Bit 6		: IRQ raised
   Bit 7		: source address is invalid
   Bit 8		: destination address is invalid
 
Documentation/PCI/endpoint/pci-test-howto.txt +1 -1
index 730b70c73055..75f48c3bb191 100644
@@ -49,7 +49,7 @@ configurable fields.
 	  cache_line_size	msi_interrupts	subclass_code	vendorid
 	  deviceid          	progif_code	subsys_id
 
-The pci endpoint function driver populates these entries with default values
+The PCI endpoint function driver populates these entries with default values
 when the device is bound to the driver. The pci-epf-test driver populates
 vendorid with 0xffff and interrupt_pin with 0x0001
 
Documentation/devicetree/bindings/pci/ti-pci.txt +5 -5
index b69dd7dbd29e..6a07c96227e0 100644
@@ -14,7 +14,7 @@ HOST MODE
 =========
  - reg : Two register ranges as listed in the reg-names property
  - reg-names : The first entry must be "ti-conf" for the TI specific registers
-	       The second entry must be "rc-dbics" for the designware pcie
+	       The second entry must be "rc-dbics" for the DesignWare PCIe
 	       registers
 	       The third entry must be "config" for the PCIe configuration space
  - interrupts : Two interrupt entries must be specified. The first one is for
@@ -39,7 +39,7 @@ DEVICE MODE
  - interrupts : one interrupt entries must be specified for main interrupt.
  - num-ib-windows : number of inbound address translation windows
  - num-ob-windows : number of outbound address translation windows
- - ti,syscon-unaligned-access: phandle to the syscon dt node. The 1st argument
+ - ti,syscon-unaligned-access: phandle to the syscon DT node. The 1st argument
 			       should contain the register offset within syscon
 			       and the 2nd argument should contain the bit field
 			       for setting the bit to enable unaligned
@@ -48,10 +48,10 @@ DEVICE MODE
 Optional Property:
  - gpios : Should be added if a gpio line is required to drive PERST# line
 
-NOTE: Two dt nodes may be added for each PCI controller; one for host
+NOTE: Two DT nodes may be added for each PCI controller; one for host
 mode and another for device mode. So in order for PCI to
-work in host mode, EP mode dt node should be disabled and in order to PCI to
-work in EP mode, host mode dt node should be disabled. And host mode and EP
+work in host mode, EP mode DT node should be disabled and in order to PCI to
+work in EP mode, host mode DT node should be disabled. Host mode and EP
 mode are mutually exclusive.
 
 Example:
Documentation/misc-devices/pci-endpoint-test.txt +3 -3
index 438571898d27..4ebc3594b32c 100644
@@ -1,7 +1,7 @@
 Driver for PCI Endpoint Test Function
 
 This driver should be used as a host side driver if the root complex is
-connected to a configurable pci endpoint running *pci_epf_test* function
+connected to a configurable PCI endpoint running *pci_epf_test* function
 driver configured according to [1].
 
 The "pci_endpoint_test" driver can be used to perform the following tests.
@@ -20,10 +20,10 @@ should be used to perform the above tests.
 
 ioctl
 -----
- PCITEST_BAR: Tests the BAR. The number of the BAR that has to be tested
+ PCITEST_BAR: Tests the BAR. The number of the BAR to be tested
 	      should be passed as argument.
  PCITEST_LEGACY_IRQ: Tests legacy IRQ
- PCITEST_MSI: Tests message signalled interrupts. The MSI number that has
+ PCITEST_MSI: Tests message signalled interrupts. The MSI number
 	      to be tested should be passed as argument.
  PCITEST_WRITE: Perform write tests. The size of the buffer should be passed
 		as argument.
MAINTAINERS +1 -1
index 3c1b947811e2..15ed84389092 100644
@@ -9581,7 +9581,7 @@ F:	include/linux/pci*
 F:	arch/x86/pci/
 F:	arch/x86/kernel/quirks.c
 
-PCI EP SUBSYSTEM
+PCI ENDPOINT SUBSYSTEM
 M:	Kishon Vijay Abraham I <[email protected]>
 L:	linux-pci at vger.kernel.org
 T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kishon/pci-endpoint.git
drivers/misc/pci_endpoint_test.c +3 -3
index 5f4f8f8ff1c2..09c10f426b64 100644
@@ -424,7 +424,7 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 	err = devm_request_irq(dev, pdev->irq, pci_endpoint_test_irqhandler,
 			       IRQF_SHARED, DRV_MODULE_NAME, test);
 	if (err) {
-		dev_err(dev, "failed to request irq\n");
+		dev_err(dev, "failed to request IRQ %d\n", pdev->irq);
 		goto err_disable_msi;
 	}
 
@@ -433,8 +433,8 @@ static int pci_endpoint_test_probe(struct pci_dev *pdev,
 				       pci_endpoint_test_irqhandler,
 				       IRQF_SHARED, DRV_MODULE_NAME, test);
 		if (err)
-			dev_err(dev, "failed to request irq for MSI %d\n",
-				i + 1);
+			dev_err(dev, "failed to request IRQ %d for MSI %d\n",
+				pdev->irq + i, i + 1);
 	}
 
 	for (bar = BAR_0; bar <= BAR_5; bar++) {
drivers/pci/dwc/Kconfig +2 -2
index 345ad67dca3c..b7e15526d676 100644
@@ -21,8 +21,8 @@ config PCI_DRA7XX
 	help
 	 Enables support for the PCIe controller in the DRA7xx SoC. There
 	 are two instances of PCIe controller in DRA7xx. This controller can
-	 work either as EP or RC. In order to enable host specific features
-	 PCI_DRA7XX_HOST must be selected and in order to enable device
+	 work either as EP or RC. In order to enable host-specific features
+	 PCI_DRA7XX_HOST must be selected and in order to enable device-
 	 specific features PCI_DRA7XX_EP must be selected. This uses
 	 the Designware core.
 
drivers/pci/endpoint/pci-epc-core.c +14 -14
index 29cbe9a73b30..9ae9e59b2a74 100644
@@ -43,7 +43,7 @@ static int devm_pci_epc_match(struct device *dev, void *res, void *match_data)
 }
 
 /**
- * pci_epc_put() - release the pci endpoint controller
+ * pci_epc_put() - release the PCI endpoint controller
  * @epc: epc returned by pci_epc_get()
  *
  * release the refcount the caller obtained by invoking pci_epc_get()
@@ -59,7 +59,7 @@ void pci_epc_put(struct pci_epc *epc)
 EXPORT_SYMBOL_GPL(pci_epc_put);
 
 /**
- * pci_epc_get() - get the pci endpoint controller
+ * pci_epc_get() - get the PCI endpoint controller
  * @epc_name: device name of the endpoint controller
  *
  * Invoke to get struct pci_epc * corresponding to the device name of the
@@ -225,11 +225,11 @@ int pci_epc_set_msi(struct pci_epc *epc, u8 interrupts)
 EXPORT_SYMBOL_GPL(pci_epc_set_msi);
 
 /**
- * pci_epc_unmap_addr() - unmap cpu address from pci address
+ * pci_epc_unmap_addr() - unmap CPU address from PCI address
  * @epc: the EPC device on which address is allocated
  * @phys_addr: physical address of the local system
  *
- * Invoke to unmap the cpu address from pci address.
+ * Invoke to unmap the CPU address from PCI address.
  */
 void pci_epc_unmap_addr(struct pci_epc *epc, phys_addr_t phys_addr)
 {
@@ -248,13 +248,13 @@ void pci_epc_unmap_addr(struct pci_epc *epc, phys_addr_t phys_addr)
 EXPORT_SYMBOL_GPL(pci_epc_unmap_addr);
 
 /**
- * pci_epc_map_addr() - map cpu address to pci address
+ * pci_epc_map_addr() - map CPU address to PCI address
  * @epc: the EPC device on which address is allocated
  * @phys_addr: physical address of the local system
- * @pci_addr: pci address to which the physical address should be mapped
+ * @pci_addr: PCI address to which the physical address should be mapped
  * @size: the size of the allocation
  *
- * Invoke to map cpu address with pci address.
+ * Invoke to map CPU address with PCI address.
  */
 int pci_epc_map_addr(struct pci_epc *epc, phys_addr_t phys_addr,
 		     u64 pci_addr, size_t size)
@@ -279,7 +279,7 @@ EXPORT_SYMBOL_GPL(pci_epc_map_addr);
 /**
  * pci_epc_clear_bar() - reset the BAR
  * @epc: the EPC device for which the BAR has to be cleared
- * @bar: the bar number that has to be reset
+ * @bar: the BAR number that has to be reset
  *
  * Invoke to reset the BAR of the endpoint device.
  */
@@ -302,7 +302,7 @@ EXPORT_SYMBOL_GPL(pci_epc_clear_bar);
 /**
  * pci_epc_set_bar() - configure BAR in order for host to assign PCI addr space
  * @epc: the EPC device on which BAR has to be configured
- * @bar: the bar number that has to be configured
+ * @bar: the BAR number that has to be configured
  * @size: the size of the addr space
  * @flags: specify memory allocation/io allocation/32bit address/64 bit address
  *
@@ -358,13 +358,13 @@ int pci_epc_write_header(struct pci_epc *epc, struct pci_epf_header *header)
 EXPORT_SYMBOL_GPL(pci_epc_write_header);
 
 /**
- * pci_epc_add_epf() - bind pci endpoint function to an endpoint controller
+ * pci_epc_add_epf() - bind PCI endpoint function to an endpoint controller
  * @epc: the EPC device to which the endpoint function should be added
  * @epf: the endpoint function to be added
  *
  * A PCI endpoint device can have one or more functions. In the case of PCIe,
- * the specification allows upto 8 PCIe endpoint functions. Invoke
- * pci_epc_add_epf() to add a pci endpoint function to an endpoint controller.
+ * the specification allows up to 8 PCIe endpoint functions. Invoke
+ * pci_epc_add_epf() to add a PCI endpoint function to an endpoint controller.
  */
 int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf)
 {
@@ -392,11 +392,11 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf)
 EXPORT_SYMBOL_GPL(pci_epc_add_epf);
 
 /**
- * pci_epc_remove_epf() - remove pci endpoint function from endpoint controller
+ * pci_epc_remove_epf() - remove PCI endpoint function from endpoint controller
  * @epc: the EPC device from which the endpoint function should be removed
  * @epf: the endpoint function to be removed
  *
- * Invoke to remove pci endpoint function from the endpoint controller.
+ * Invoke to remove PCI endpoint function from the endpoint controller.
  */
 void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf)
 {
drivers/pci/endpoint/pci-epf-core.c +2 -2
index 9ec1639ef749..92db7dcd911c 100644
@@ -87,7 +87,7 @@ EXPORT_SYMBOL_GPL(pci_epf_bind);
 /**
  * pci_epf_free_space() - free the allocated PCI EPF register space
  * @addr: the virtual address of the PCI EPF register space
- * @bar: the bar number corresponding to the register space
+ * @bar: the BAR number corresponding to the register space
  *
  * Invoke to free the allocated PCI EPF register space.
  */
@@ -109,7 +109,7 @@ EXPORT_SYMBOL_GPL(pci_epf_free_space);
 /**
  * pci_epf_alloc_space() - allocate memory for the PCI EPF register space
  * @size: the size of the memory that has to be allocated
- * @bar: the bar number corresponding to the allocated register space
+ * @bar: the BAR number corresponding to the allocated register space
  *
  * Invoke to allocate memory for the PCI EPF register space.
  */
include/linux/pci-epc.h +5 -5
index d6eb32291462..af5edbf3eea3 100644
@@ -27,8 +27,8 @@ enum pci_epc_irq_type {
  * @write_header: ops to populate configuration space header
  * @set_bar: ops to configure the BAR
  * @clear_bar: ops to reset the BAR
- * @map_addr: ops to map cpu address to pci address
- * @unmap_addr: ops to unmap cpu address and pci address
+ * @map_addr: ops to map CPU address to PCI address
+ * @unmap_addr: ops to unmap CPU address and PCI address
  * @set_msi: ops to set the requested number of MSI interrupts in the MSI
  *	     capability register
  * @get_msi: ops to get the number of MSI interrupts allocated by the RC from
@@ -58,9 +58,9 @@ struct pci_epc_ops {
 
 /**
  * struct pci_epc_mem - address space of the endpoint controller
- * @phys_base: physical base address of the pci address space
- * @size: the size of the pci address space
- * @bitmap: bitmap to manage the pci address space
+ * @phys_base: physical base address of the PCI address space
+ * @size: the size of the PCI address space
+ * @bitmap: bitmap to manage the PCI address space
  * @pages: number of bits representing the address region
  */
 struct pci_epc_mem {
include/linux/pci-epf.h +3 -3
index 5ff2c5a592c3..0d529cb90143 100644
@@ -38,7 +38,7 @@ enum pci_barno {
  * struct pci_epf_header - represents standard configuration header
  * @vendorid: identifies device manufacturer
  * @deviceid: identifies a particular device
- * @revid: specifies a device specific revision identifier
+ * @revid: specifies a device-specific revision identifier
  * @progif_code: identifies a specific register-level programming interface
  * @subclass_code: identifies more specifically the function of the device
  * @baseclass_code: broadly classifies the type of function the device performs
@@ -115,11 +115,11 @@ struct pci_epf_bar {
  * @name: the name of the PCI EPF device
  * @header: represents standard configuration header
  * @bar: represents the BAR of EPF device
- * @msi_interrupts: number of msi interrupts required by this function
+ * @msi_interrupts: number of MSI interrupts required by this function
  * @func_no: unique function number within this endpoint device
  * @epc: the EPC device to which this EPF device is bound
  * @driver: the EPF driver to which this EPF device is bound
- * @list: to add pci_epf as a list of pci endpoint functions to pci_epc
+ * @list: to add pci_epf as a list of PCI endpoint functions to pci_epc
  */
 struct pci_epf {
 	struct device		dev;
tools/pci/pcitest.c +1 -1
index 39b5b0ba569e..ad54a58d7dda 100644
@@ -170,7 +170,7 @@ int main(int argc, char **argv)
 		fprintf(stderr,
 			"usage: %s [options]\n"
 			"Options:\n"
-			"\t-D <dev>		pci endpoint test device {default: /dev/pci-endpoint-test.0}\n"
+			"\t-D <dev>		PCI endpoint test device {default: /dev/pci-endpoint-test.0}\n"
 			"\t-b <bar num>		BAR test (bar number between 0..5)\n"
 			"\t-m <msi num>		MSI test (msi number between 1..32)\n"
 			"\t-r			Read buffer test\n"
cl.new renamed from cl.orig +87 -89

379 lines not on this page · raw message

#17 lore raw

Re: [PATCH v5 14/24] dt-bindings: mfd: syscon: Add documentation for #syscon-cells property

In reply to Rob Herring

Hi Rob,

Quoted 10 lines · Rob Herring
Quoted 9 lines · Rob Herring
Quoted 5 lines · Kishon Vijay Abraham I

Add documentation for the optional #syscon-cells property to determine the number of cells that should be given in the phandle while referencing the syscon-node.

I did? When?

Quoted 7 lines
Quoted 2 lines

I'm not remembering why we need this. Generally, phandles to a syscon are for a single defined purpose. When do we need a list of them?

Ah, I remember now the context. I suggested using standard parsing function rather than open coding. I wasn't suggesting changing the binding. Instead of of_parse_phandle_with_args, can't of_parse_phandle_with_fixed_args work?

yes, it can be used. Will change it my next revision.

Thanks
Kishon

#34 lore raw
In reply to Bjorn Helgaas

Hi Bjorn,

Quoted 8 lines · Bjorn Helgaas
Quoted 4 lines · Kishon Vijay Abraham I

Hi Bjorn,

Please find the pull request for PCI endpoint support below. I've also included all the history here.

I tentatively applied this to pci/host-designware with the mostly trival textual changes below. If you post the series again, please include them.

Sure, I've used pci/host-designware as the base for the next revision.

Quoted 4 lines

I saw some acks to prior revisions, but few of them were included in this
series. Can you collect them up? If there are no other substantial
changes, I can insert them into my branch manually.

Yeah, looks like I've missed including Joao Pinto's Acked-by in some of the patches. I'll include them in the next revision.

Thanks
Kishon