Add Cadence PCIe endpoint driver with new uclass
v3 cover Add Cadence PCIe endpoint driver with new uclass
This patchset adds support for new uclass, UCLASS_PCI_EP allowing new set of PCI endpoint drivers.
Included in the patch is also a driver for Cadence PCIe endpoint.
Changes in V2:
- Removed "pci.h: add missing maskbit" as it was already merged by Simon.
- Added PCI endpoint sandbox driver
- Added testing for sandbox driver
- Addressed issues raised by Simon in UCLASS_PCI_EP class implementation
Changes in v3:
- Added function to read bar config
- Fixed a bug in set MSI implementation (missing -1)
- Elaborate a bit more in comments
- Added MAINTAINER entry for PCI Endpoint
- Added more description to commit message and kmsg
- Removed some unused functionality that can't be tested.
- Removed entries from sandbox config and added implies and select to arch/Kconfig sandbox entry.
- Added more testing of sandbox driver
Ramon Fried (4):
drivers: pci_ep: Introduce UCLASS_PCI_EP uclass
pci_ep: add Cadence PCIe endpoint driver
pci_ep: add pci endpoint sandbox driver
test: pci_ep: add basic pci_ep tests
MAINTAINERS | 6 + arch/Kconfig | 2 + arch/sandbox/dts/test.dts | 4 + arch/sandbox/include/asm/test.h | 8 + .../pci_endpoint/cdns,cdns-pcie-ep.txt | 18 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/pci_endpoint/Kconfig | 34 ++ drivers/pci_endpoint/Makefile | 8 + drivers/pci_endpoint/pci_ep-uclass.c | 211 +++++++++ drivers/pci_endpoint/pcie-cadence-ep.c | 177 ++++++++ drivers/pci_endpoint/pcie-cadence.h | 309 +++++++++++++ drivers/pci_endpoint/sandbox-pci_ep.c | 182 ++++++++ include/dm/uclass-id.h | 1 + include/pci_ep.h | 414 ++++++++++++++++++ test/dm/Makefile | 1 + test/dm/pci_ep.c | 64 +++ 17 files changed, 1442 insertions(+) create mode 100644 doc/device-tree-bindings/pci_endpoint/cdns,cdns-pcie-ep.txt create mode 100644 drivers/pci_endpoint/Kconfig create mode 100644 drivers/pci_endpoint/Makefile create mode 100644 drivers/pci_endpoint/pci_ep-uclass.c create mode 100644 drivers/pci_endpoint/pcie-cadence-ep.c create mode 100644 drivers/pci_endpoint/pcie-cadence.h create mode 100644 drivers/pci_endpoint/sandbox-pci_ep.c create mode 100644 include/pci_ep.h create mode 100644 test/dm/pci_ep.c
Signature · 1 line
2.21.0
PATCH v3 1/4 drivers: pci_ep: Introduce UCLASS_PCI_EP uclass
Introduce new UCLASS_PCI_EP class for handling PCI endpoint devices, allowing to set various attributes of the PCI endpoint device, such as:
* configuration space header
* BAR definitions
* outband memory mapping
* start/stop PCI link
---
Changes in v3: None
MAINTAINERS | 6 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/pci_endpoint/Kconfig | 17 ++ drivers/pci_endpoint/Makefile | 6 + drivers/pci_endpoint/pci_ep-uclass.c | 211 ++++++++++++++ include/dm/uclass-id.h | 1 + include/pci_ep.h | 414 +++++++++++++++++++++++++++ 8 files changed, 658 insertions(+) create mode 100644 drivers/pci_endpoint/Kconfig create mode 100644 drivers/pci_endpoint/Makefile create mode 100644 drivers/pci_endpoint/pci_ep-uclass.c create mode 100644 include/pci_ep.h
MAINTAINERS +6 -0
@@ -626,6 +626,12 @@ M: Simon Glass <[email protected]> S: Maintained F: tools/patman/ +PCI Endpoint +M: Ramon Fried <[email protected]> +S: Maintained +F: drivers/pci_endpoint/ +F: include/pci_ep.h + POWER M: Jaehoon Chung <[email protected]> S: Maintained
drivers/Kconfig +2 -0
@@ -64,6 +64,8 @@ source "drivers/nvme/Kconfig" source "drivers/pci/Kconfig" +source "drivers/pci_endpoint/Kconfig" + source "drivers/pch/Kconfig" source "drivers/pcmcia/Kconfig"
drivers/Makefile +1 -0
@@ -85,6 +85,7 @@ obj-$(CONFIG_FPGA) += fpga/ obj-y += misc/ obj-$(CONFIG_MMC) += mmc/ obj-$(CONFIG_NVME) += nvme/ +obj-$(CONFIG_PCI_ENDPOINT) += pci_endpoint/ obj-y += pcmcia/ obj-y += dfu/ obj-$(CONFIG_PCH) += pch/
drivers/pci_endpoint/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# PCI Endpoint Support +# + +menu "PCI Endpoint" + +config PCI_ENDPOINT + bool "PCI Endpoint Support" + depends on DM + help + Enable this configuration option to support configurable PCI + endpoints. This should be enabled if the platform has a PCI + controllers that can operate in endpoint mode (as a device + connected to PCI host or bridge). + +endmenu
drivers/pci_endpoint/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2019 +# Ramon Fried <[email protected]> + +obj-y += pci_ep-uclass.o
drivers/pci_endpoint/pci_ep-uclass.c new file +211 -0
211 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -67,6 +67,7 @@ enum uclass_id {UCLASS_PANEL_BACKLIGHT ,/* Backlight controller for panel */ UCLASS_PCH ,/* x86 platform controller hub */ UCLASS_PCI ,/* PCI bus */ +UCLASS_PCI_EP ,/* PCI endpoint device */ UCLASS_PCI_GENERIC ,/* Generic PCI bus device */ UCLASS_PHY ,/* Physical Layer (PHY) device */ UCLASS_PINCONFIG, /* Pin configuration node device */
include/pci_ep.h new file +414 -0
414 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 1/4 drivers: pci_ep: Introduce UCLASS_PCI_EP uclass
Quoted 15 lines · Ramon Fried
Introduce new
UCLASS_PCI_EPclass for handling PCI endpoint devices, allowing to set various attributes of the PCI endpoint device, such as:
* configuration space header
* BAR definitions
* outband memory mapping
* start/stop PCI linkSigned-off-by Ramon Fried <[email protected]>---
Changes in v3: None
Quoted 13 lines
MAINTAINERS | 6 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/pci_endpoint/Kconfig | 17 ++ drivers/pci_endpoint/Makefile | 6 + drivers/pci_endpoint/pci_ep-uclass.c | 211 ++++++++++++++ include/dm/uclass-id.h | 1 + include/pci_ep.h | 414 +++++++++++++++++++++++++++ 8 files changed, 658 insertions(+) create mode 100644 drivers/pci_endpoint/Kconfig create mode 100644 drivers/pci_endpoint/Makefile create mode 100644 drivers/pci_endpoint/pci_ep-uclass.c create mode 100644 include/pci_ep.h
PATCH v3 1/4 drivers: pci_ep: Introduce UCLASS_PCI_EP uclass
In reply to Ramon FriedQuoted 10 lines · Ramon Fried
Introduce new
UCLASS_PCI_EPclass for handling PCI endpoint devices, allowing to set various attributes of the PCI endpoint device, such as:
* configuration space header
* BAR definitions
* outband memory mapping
* start/stop PCI linkSigned-off-by Ramon Fried <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/827452bb/attachment.sig>
PATCH v3 2/4 pci_ep: add Cadence PCIe endpoint driver
In reply to Ramon FriedAdd Cadence PCIe endpoint driver supporting configuration of header, bars and MSI for device.
---
Changes in v3: None
.../pci_endpoint/cdns,cdns-pcie-ep.txt | 18 + drivers/pci_endpoint/Kconfig | 8 + drivers/pci_endpoint/Makefile | 1 + drivers/pci_endpoint/pcie-cadence-ep.c | 177 ++++++++++ drivers/pci_endpoint/pcie-cadence.h | 309 ++++++++++++++++++ 5 files changed, 513 insertions(+) create mode 100644 doc/device-tree-bindings/pci_endpoint/cdns,cdns-pcie-ep.txt create mode 100644 drivers/pci_endpoint/pcie-cadence-ep.c create mode 100644 drivers/pci_endpoint/pcie-cadence.h
doc/device-tree-bindings/pci_endpoint/cdns,cdns-pcie-ep.txt new file +18 -0
@@ -0,0 +1,18 @@ +* Cadence PCIe endpoint controller + +Required properties: +- compatible: Should contain "cdns,cdns-pcie-ep" to identify the IP used. +- reg: Should contain the controller register base address. + +Optional properties: +- max-functions: Maximum number of functions that can be configured (default 1). +- cdns,max-outbound-regions: Set to maximum number of outbound regions (default 8) + +Example: + +pcie_ep at fc000000 { + compatible = "cdns,cdns-pcie-ep"; + reg = <0x0 0xfc000000 0x0 0x01000000>; + cdns,max-outbound-regions = <16>; + max-functions = /bits/ 8 <8>; +};
drivers/pci_endpoint/Kconfig +8 -0
@@ -14,4 +14,12 @@ config PCI_ENDPOINT controllers that can operate in endpoint mode (as a device connected to PCI host or bridge). +config PCIE_CADENCE_EP + bool "Cadence PCIe endpoint controller" + depends on PCI_ENDPOINT + help + Say Y here if you want to support the Cadence PCIe controller in + endpoint mode. This PCIe controller may be embedded into many + different vendors SoCs. + endmenu
drivers/pci_endpoint/Makefile +1 -0
@@ -4,3 +4,4 @@ # Ramon Fried <[email protected]> obj-y += pci_ep-uclass.o +obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o
drivers/pci_endpoint/pcie-cadence-ep.c new file +177 -0
177 lines not on this page · raw message
drivers/pci_endpoint/pcie-cadence.h new file +309 -0
309 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 2/4 pci_ep: add Cadence PCIe endpoint driver
Quoted 9 lines · Ramon Fried
Add Cadence PCIe endpoint driver supporting configuration of header, bars and MSI for device.
Signed-off-by Ramon Fried <[email protected]>---
Changes in v3: None
Quoted 9 lines
.../pci_endpoint/cdns,cdns-pcie-ep.txt | 18 + drivers/pci_endpoint/Kconfig | 8 + drivers/pci_endpoint/Makefile | 1 + drivers/pci_endpoint/pcie-cadence-ep.c | 177 ++++++++++ drivers/pci_endpoint/pcie-cadence.h | 309 ++++++++++++++++++ 5 files changed, 513 insertions(+) create mode 100644 doc/device-tree-bindings/pci_endpoint/cdns,cdns-pcie-ep.txt create mode 100644 drivers/pci_endpoint/pcie-cadence-ep.c create mode 100644 drivers/pci_endpoint/pcie-cadence.h
It would be better if you avoided the #includes in your header file.
PATCH v3 2/4 pci_ep: add Cadence PCIe endpoint driver
In reply to Ramon FriedQuoted 5 lines · Ramon Fried
Add Cadence PCIe endpoint driver supporting configuration of header, bars and MSI for device.
Signed-off-by Ramon Fried <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/6d92bbf0/attachment.sig>
PATCH v3 3/4 pci_ep: add pci endpoint sandbox driver
In reply to Ramon FriedAdd a dummy PCI endpoint for sandbox. Supporting only a single function, it allows setting and reading header configuration.
---
Changes in v3:
- Added more description to commit message and kmsg
- Removed some unused functionality that can't be tested.
- Removed entries from sandbox config and added implies and select to arch/Kconfig sandbox entry.
arch/Kconfig | 2 + arch/sandbox/dts/test.dts | 4 + drivers/pci_endpoint/Kconfig | 9 ++ drivers/pci_endpoint/Makefile | 1 + drivers/pci_endpoint/sandbox-pci_ep.c | 182 ++++++++++++++++++++++++++ 5 files changed, 198 insertions(+) create mode 100644 drivers/pci_endpoint/sandbox-pci_ep.c
arch/Kconfig +2 -0
@@ -89,6 +89,7 @@ config SANDBOX select DM_SPI_FLASH select HAVE_BLOCK_DEVICE select LZO + select PCI_ENDPOINT select SPI select SUPPORT_OF_CONTROL imply BITREVERSE
@@ -118,6 +119,7 @@ config SANDBOX imply VIRTIO_BLK imply VIRTIO_NET imply DM_SOUND + imply PCI_SANDBOX_EP imply PCH config SH
arch/sandbox/dts/test.dts +4 -0
@@ -475,6 +475,10 @@ }; }; + pci_ep: pci_ep { + compatible = "sandbox,pci_ep"; + }; + probing { compatible = "simple-bus"; test1 {
drivers/pci_endpoint/Kconfig +9 -0
@@ -22,4 +22,13 @@ config PCIE_CADENCE_EP endpoint mode. This PCIe controller may be embedded into many different vendors SoCs. +config PCI_SANDBOX_EP + bool "Sandbox PCIe endpoint controller" + depends on PCI_ENDPOINT + help + Say Y here if you want to support the Sandbox PCIe controller in + endpoint mode. + The sandbox driver act as a dummy driver which stores and + retrieves PCIe endpoint configuration as is. + endmenu
drivers/pci_endpoint/Makefile +1 -0
@@ -5,3 +5,4 @@ obj-y += pci_ep-uclass.o obj-$(CONFIG_PCIE_CADENCE_EP) += pcie-cadence-ep.o +obj-$(CONFIG_PCI_SANDBOX_EP) += sandbox-pci_ep.o
drivers/pci_endpoint/sandbox-pci_ep.c new file +182 -0
182 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 3/4 pci_ep: add pci endpoint sandbox driver
Quoted 15 lines · Ramon Fried
Add a dummy PCI endpoint for sandbox. Supporting only a single function, it allows setting and reading header configuration.
Signed-off-by Ramon Fried <[email protected]>---
Changes in v3:
- Added more description to commit message and kmsg
- Removed some unused functionality that can't be tested.
- Removed entries from sandbox config and added implies and select toarch/Kconfigsandbox entry.
Quoted 7 lines
arch/Kconfig | 2 + arch/sandbox/dts/test.dts | 4 + drivers/pci_endpoint/Kconfig | 9 ++ drivers/pci_endpoint/Makefile | 1 + drivers/pci_endpoint/sandbox-pci_ep.c | 182 ++++++++++++++++++++++++++ 5 files changed, 198 insertions(+) create mode 100644 drivers/pci_endpoint/sandbox-pci_ep.c
PATCH v3 3/4 pci_ep: add pci endpoint sandbox driver
In reply to Ramon FriedQuoted 6 lines · Ramon Fried
Add a dummy PCI endpoint for sandbox. Supporting only a single function, it allows setting and reading header configuration.
Signed-off-by Ramon Fried <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/765019dd/attachment.sig>
PATCH v3 4/4 test: pci_ep: add basic pci_ep tests
In reply to Ramon FriedAdd basic PCI endpoint sandbox testing.
---
Changes in v3:
- Added more testing of sandbox driver
arch/sandbox/include/asm/test.h | 8 +++++ test/dm/Makefile | 1 + test/dm/pci_ep.c | 64 +++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 test/dm/pci_ep.c
arch/sandbox/include/asm/test.h +8 -0
@@ -185,4 +185,12 @@ int sandbox_get_beep_frequency(struct udevice *dev);*/ int sandbox_get_pch_spi_protect (struct udevice *dev); +/** +* sandbox_get_pci_ep_irq_count() - Get the PCI EP IRQ count +* +* @dev: Device to check +* @return irq count +*/ +int sandbox_get_pci_ep_irq_count (struct udevice *dev); +#endif
test/dm/Makefile +1 -0
@@ -30,6 +30,7 @@ obj-y += ofnode.o obj-$(CONFIG_OSD) += osd.o obj-$(CONFIG_DM_VIDEO) += panel.o obj-$(CONFIG_DM_PCI) += pci.o +obj-$(CONFIG_PCI_ENDPOINT) += pci_ep.o obj-$(CONFIG_PCH) += pch.o obj-$(CONFIG_PHY) += phy.o obj-$(CONFIG_POWER_DOMAIN) += power-domain.o
test/dm/pci_ep.c new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.21.0
PATCH v3 4/4 test: pci_ep: add basic pci_ep tests
Quoted 6 lines · Ramon Fried
Add basic PCI endpoint sandbox testing.
Signed-off-by Ramon Fried <[email protected]>---
Quoted 8 lines
Changes in v3:
- Added more testing of sandbox driverarch/sandbox/include/asm/test.h | 8 +++++ test/dm/Makefile | 1 + test/dm/pci_ep.c | 64 +++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) create mode 100644 test/dm/pci_ep.c
PATCH v3 4/4 test: pci_ep: add basic pci_ep tests
In reply to Ramon FriedQuoted 4 lines · Ramon Fried
Add basic PCI endpoint sandbox testing.
Signed-off-by Ramon Fried <[email protected]>Reviewed-by Simon Glass <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/d9b5be64/attachment.sig>
PATCH v3 4/4 test: pci_ep: add basic pci_ep tests
Quoted 8 lines · Tom Rini
Quoted 4 lines · Ramon Fried
Add basic PCI endpoint sandbox testing.
Signed-off-by Ramon Fried <[email protected]>Reviewed-by Simon Glass <[email protected]>Applied to u-boot/master, thanks!
This is however now breaking:
https://travis-ci.org/u-boot/u-boot/jobs/557569099
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190711/9aa978b4/attachment.sig>
PATCH v3 4/4 test: pci_ep: add basic pci_ep tests
Quoted 8 lines · Tom Rini
Quoted 7 lines · Tom Rini
Quoted 4 lines · Ramon Fried
Add basic PCI endpoint sandbox testing.
Signed-off-by Ramon Fried <[email protected]>Reviewed-by Simon Glass <[email protected]>
Quoted 8 lines
Quoted 1 line
Applied to u-boot/master, thanks!
This is however now breaking:
https://travis-ci.org/u-boot/u-boot/jobs/557569099--
Tom
I don't know even where to start here. Simon, can you look at the log ?
v3 cover Add Cadence PCIe endpoint driver with new uclass
In reply to Ramon FriedHi Simon,
Kind reminder, just touching base.
Thanks,
Ramon.
Quoted 62 lines · Ramon Fried
This patchset adds support for new uclass,
UCLASS_PCI_EPallowing new set of PCI endpoint drivers.
Included in the patch is also a driver for Cadence PCIe endpoint.Changes in V2:
- Removed "pci.h: add missing maskbit" as it was already merged by Simon.
- Added PCI endpoint sandbox driver
- Added testing for sandbox driver
- Addressed issues raised by Simon inUCLASS_PCI_EPclass implementationChanges in v3:
- Added function to read bar config
- Fixed a bug in set MSI implementation (missing -1)
- Elaborate a bit more in comments
- Added MAINTAINER entry for PCI Endpoint
- Added more description to commit message and kmsg
- Removed some unused functionality that can't be tested.
- Removed entries from sandbox config and added implies and select toarch/Kconfigsandbox entry.
- Added more testing of sandbox driverRamon Fried (4):
drivers:pci_ep: IntroduceUCLASS_PCI_EPuclass
pci_ep: add Cadence PCIe endpoint driver
pci_ep: add pci endpoint sandbox driver
test:pci_ep: add basicpci_eptestsMAINTAINERS | 6 + arch/Kconfig | 2 + arch/sandbox/dts/test.dts | 4 + arch/sandbox/include/asm/test.h | 8 + .../pci_endpoint/cdns,cdns-pcie-ep.txt | 18 + drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/pci_endpoint/Kconfig | 34 ++ drivers/pci_endpoint/Makefile | 8 + drivers/pci_endpoint/pci_ep-uclass.c | 211 +++++++++ drivers/pci_endpoint/pcie-cadence-ep.c | 177 ++++++++ drivers/pci_endpoint/pcie-cadence.h | 309 +++++++++++++ drivers/pci_endpoint/sandbox-pci_ep.c | 182 ++++++++ include/dm/uclass-id.h | 1 + include/pci_ep.h | 414 ++++++++++++++++++ test/dm/Makefile | 1 + test/dm/pci_ep.c | 64 +++ 17 files changed, 1442 insertions(+) create mode 100644 doc/device-tree-bindings/pci_endpoint/cdns,cdns-pcie-ep.txt create mode 100644 drivers/pci_endpoint/Kconfig create mode 100644 drivers/pci_endpoint/Makefile create mode 100644 drivers/pci_endpoint/pci_ep-uclass.c create mode 100644 drivers/pci_endpoint/pcie-cadence-ep.c create mode 100644 drivers/pci_endpoint/pcie-cadence.h create mode 100644 drivers/pci_endpoint/sandbox-pci_ep.c create mode 100644 include/pci_ep.h create mode 100644 test/dm/pci_ep.c--
2.21.0