PCI: Support for configurable PCI endpoint
Subsystems (14)
cover PCI: Support for configurable PCI endpoint
The RFC series that was sent before this patch series can be found at [1]. The patches are split here so that it can be better reviewed.
This main purpose of this patch series is to
*) add PCI endpoint core layer
*) modifie designware/dra7xx driver to be configured in EP mode *) add a PCI endpoint *test* function driver and corresponding host
driver
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 patch series has been developed on top of 4.10-rc1, [2] & [3]
[1] -> https://lwn.net/Articles/700605/
[2] -> https://lkml.org/lkml/2016/12/28/34
[3] -> https://lkml.org/lkml/2017/1/11/238
I've also pushed the tree togit://git.ti.com/linux-phy/linux-phy.git pci_ep_v1
Using PCI EPF Test:
ON THE EP SIDE:
***************
/* EP function is configured using configfs */
# mount -t configfs none /sys/kernel/config
/* PCI EP core layer creates "pci_ep" entry in configfs */
# cd /sys/kernel/config/pci_ep/
/*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint device.
*/
# mkdir dev
/*
* dev has 2 entries. *epc* for binding a EPC device and *epf*
* is a directory containing all the functions of the endpoint */
# ls dev epc epf
/*
* This creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Just pci_epf_test is also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/
# mkdir dev/epf/pci_epf_test.0
/*
* When the above command is given, the function device will
* also be bound to a function driver. To find the list of
* function drivers available in the system, use the following
* command. To create a new driver, the following can be referred
* drivers/pci/endpoint/functions/pci-epf-test.c
*/
# ls /sys/bus/pci-epf/drivers pci_epf_test
/* Now configure the endpoint function */
/* These are the fields that can be configured */
# ls dev/epf/pci_epf_test.0/ baseclass_code function progif_code subsys_id cache_line_size interrupt_pin revid subsys_vendor_id deviceid msi_interrupts subclass_code vendorid
/* The function driver will populate these fields with default values */
# cat dev/epf/pci_epf_test.0/vendorid 0xffff
# cat dev/epf/pci_epf_test.0/interrupt_pin 0x0001
/* The user can configure any of these fields */
# echo 0x104c > dev/epf/pci_epf_test.0/vendorid # echo 16 > dev/epf/pci_epf_test.0/msi_interrupts
/*
* Next is binding this function driver to the controller driver. In
* order to find the possible controller drivers that this function
* driver can be bound to, the following sysfs entry can be used */
# ls /sys/class/pci_epc/ 51000000.pci
/* Now bind the function driver to the controller driver */
# echo "51000000.pcie_ep" > epc [ 494.743487] dra7-pcie 51000000.pcie: no free inbound window [ 494.749367] pci_epf_test pci_epf_test.0: failed to set BAR4 [ 494.755238] dra7-pcie 51000000.pcie: no free inbound window [ 494.761451] pci_epf_test pci_epf_test.0: failed to set BAR5
/*
* the above error messages are due to non availability of free
* inbound windows. So the function drivers in dra7xx can use
* only 4 (BAR0..BAR3) BARs
*/
/****** PCI endpoint is configured ******/
ON THE HOST SIDE:
*****************
# ./pcitest.sh BAR tests
BAR0: OKAY BAR1: OKAY BAR2: OKAY BAR3: OKAY BAR4: NOT OKAY BAR5: NOT OKAY
Interrupt tests
LEGACY IRQ: NOT OKAY MSI1: OKAY MSI2: OKAY MSI3: OKAY MSI4: OKAY MSI5: OKAY MSI6: OKAY MSI7: OKAY MSI8: OKAY MSI9: OKAY MSI10: OKAY MSI11: OKAY MSI12: OKAY MSI13: OKAY MSI14: OKAY MSI15: OKAY MSI16: OKAY MSI17: NOT OKAY MSI18: NOT OKAY MSI19: NOT OKAY MSI20: NOT OKAY MSI21: NOT OKAY MSI22: NOT OKAY MSI23: NOT OKAY MSI24: NOT OKAY MSI25: NOT OKAY MSI26: NOT OKAY MSI27: NOT OKAY MSI28: NOT OKAY MSI29: NOT OKAY MSI30: NOT OKAY MSI31: NOT OKAY MSI32: NOT OKAY
Read Tests
READ ( 1 bytes): OKAY READ ( 1024 bytes): OKAY READ ( 1025 bytes): OKAY READ (1024000 bytes): OKAY READ (1024001 bytes): OKAY
Write Tests
WRITE ( 1 bytes): OKAY WRITE ( 1024 bytes): OKAY WRITE ( 1025 bytes): OKAY WRITE (1024000 bytes): OKAY WRITE (1024001 bytes): OKAY
Copy Tests
COPY ( 1 bytes): OKAY COPY ( 1024 bytes): OKAY COPY ( 1025 bytes): OKAY COPY (1024000 bytes): OKAY COPY (1024001 bytes): OKAY
Kishon Vijay Abraham I (37):
PCI: dwc: dra7xx: Group all host related setup in add_pcie_port
PCI: dwc: designware: Add new *ops* for cpu addr fixup
PCI: dwc: dra7xx: Populate cpu_addr_fixup ops
PCI: dwc: designware: Move the register defines to designware header
file
PCI: dwc: Add platform_set_drvdata
PCI: dwc: Rename cfg_read/cfg_write to read/write
PCI: dwc: designware: Get device pointer at the start of
dw_pcie_host_init
PCI: dwc: Split *struct pcie_port* into host only and core structures
PCI: dwc: designware: Parse *num-lanes* property in dw_pcie_setup_rc
PCI: dwc: designware: Fix style errors in pcie-designware.c
PCI: dwc: Split pcie-designware.c into host and core files
PCI: dwc: Create a new config symbol to enable pci dwc host
PCI: dwc: Remove dependency of designware to CONFIG_PCI
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
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: Modify dbi accessors to take dbi_base as argument
PCI: dwc: Modify dbi accessors to access data of 4/2/1 bytes
PCI: dwc: Add *ops* to start and stop pcie link
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
PCI: dwc: dra7xx: Workaround for errata id i870
dt-bindings: PCI: dra7xx: Add dt bindings to enable legacy mode
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
MAINTAINERS: add PCI EP maintainer
ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to
SW_WKUP
ARM: dts: DRA7: Add pcie1 dt node for EP mode
Documentation/PCI/00-INDEX | 8 + .../PCI/endpoint/function/binding/pci-test.txt | 17 + Documentation/PCI/endpoint/pci-endpoint-cfs.txt | 84 ++ Documentation/PCI/endpoint/pci-endpoint.txt | 190 +++++ Documentation/PCI/endpoint/pci-test-function.txt | 66 ++ .../devicetree/bindings/pci/designware-pcie.txt | 26 +- Documentation/devicetree/bindings/pci/ti-pci.txt | 41 +- Documentation/misc-devices/pci-endpoint-test.txt | 35 + MAINTAINERS | 9 + arch/arm/boot/dts/am572x-idk.dts | 7 +- arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi | 7 +- arch/arm/boot/dts/dra7-evm.dts | 4 + arch/arm/boot/dts/dra7.dtsi | 22 +- arch/arm/boot/dts/dra72-evm-common.dtsi | 4 + arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +- drivers/Makefile | 5 + drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/pci_endpoint_test.c | 533 ++++++++++++ drivers/pci/Kconfig | 1 + drivers/pci/Makefile | 3 - drivers/pci/dwc/Kconfig | 73 +- drivers/pci/dwc/Makefile | 6 +- drivers/pci/dwc/pci-dra7xx.c | 372 +++++++-- drivers/pci/dwc/pci-exynos.c | 83 +- drivers/pci/dwc/pci-imx6.c | 142 ++-- drivers/pci/dwc/pci-keystone-dw.c | 91 +- drivers/pci/dwc/pci-keystone.c | 56 +- drivers/pci/dwc/pci-keystone.h | 4 +- drivers/pci/dwc/pci-layerscape.c | 93 ++- drivers/pci/dwc/pcie-armada8k.c | 92 ++- drivers/pci/dwc/pcie-artpec6.c | 51 +- drivers/pci/dwc/pcie-designware-ep.c | 342 ++++++++ drivers/pci/dwc/pcie-designware-host.c | 620 ++++++++++++++ drivers/pci/dwc/pcie-designware-plat.c | 29 +- drivers/pci/dwc/pcie-designware.c | 868 ++++---------------- drivers/pci/dwc/pcie-designware.h | 254 +++++- drivers/pci/dwc/pcie-hisi.c | 60 +- drivers/pci/dwc/pcie-qcom.c | 72 +- drivers/pci/dwc/pcie-spear13xx.c | 85 +- drivers/pci/endpoint/Kconfig | 25 + 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 | 513 ++++++++++++ drivers/pci/endpoint/pci-ep-cfs.c | 427 ++++++++++ drivers/pci/endpoint/pci-epc-core.c | 548 ++++++++++++ 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 | 141 ++++ include/linux/pci-epf.h | 160 ++++ include/uapi/linux/Kbuild | 1 + include/uapi/linux/pcitest.h | 19 + tools/pci/pcitest.c | 186 +++++ tools/pci/pcitest.sh | 56 ++ 56 files changed, 5880 insertions(+), 1185 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/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/dwc/pcie-designware-host.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-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
1.7.9.5
PATCH 1/37 PCI: dwc: dra7xx: Group all host related setup in add_pcie_port
commit 150645b94348 ("PCI: dra7xx: Move struct pcie_port setup to probe function") moved host related setup to the probe function. However instead of cluttering the probe function with host related setup, group all host related setup in add_pcie_port function. This way when endpoint support is added, all the endpoint related setup can be added in a separate function.
--- drivers/pci/dwc/pci-dra7xx.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +6 -7
@@ -288,9 +288,13 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx, struct platform_device *pdev) {int ret; -struct pcie_port *pp = &dra7xx->pp; -struct device *dev = pp->dev; +struct pcie_port *pp;struct resource *res; +struct device *dev = &pdev->dev; + + pp = &dra7xx->pp; + pp->dev = dev; + pp->ops = &dra7xx_pcie_host_ops; pp->irq =platform_get_irq (pdev,1 );if (pp->irq <0 ) {
@@ -374,7 +378,6 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)void __iomem *base;struct resource *res;struct dra7xx_pcie *dra7xx; -struct pcie_port *pp;struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;char name[10 ];
@@ -384,10 +387,6 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)if (!dra7xx)return -ENOMEM ; - pp = &dra7xx->pp; - pp->dev = dev; - pp->ops = &dra7xx_pcie_host_ops; - irq =platform_get_irq (pdev,0 );if (irq <0 ) {dev_err (dev,"missing IRQ resource\n" );
Signature · 1 line
1.7.9.5
PATCH 2/37 PCI: dwc: designware: Add new *ops* for cpu addr fixup
In reply to Kishon Vijay Abraham ISome platforms (like dra7xx) require only the least 28 bits of the corresponding 32 bit CPU address to be programmed in the address translation unit. This modified address is stored in io_base/mem_base/ cfg0_base/cfg1_base in dra7xx_pcie_host_init. While this is okay for host mode where the address range is fixed, device mode requires different addresses to be programmed based on the host buffer address. Add a new ops to get the least 28 bits of the corresponding 32 bit CPU address and invoke it before programming the address translation unit.
--- drivers/pci/dwc/pcie-designware.c | 3 +++ drivers/pci/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+)
drivers/pci/dwc/pcie-designware.c +3 -0
@@ -195,6 +195,9 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index, {u32 retries, val; +if (pp->ops->cpu_addr_fixup) + cpu_addr = pp->ops->cpu_addr_fixup (cpu_addr); +if (pp->iatu_unroll_enabled) {dw_pcie_writel_unroll (pp, index,PCIE_ATU_UNR_LOWER_BASE ,lower_32_bits (cpu_addr));
drivers/pci/dwc/pcie-designware.h +1 -0
@@ -54,6 +54,7 @@ struct pcie_port { };struct pcie_host_ops { +u64 (*cpu_addr_fixup)(u64 cpu_addr);u32 (*readl_rc)(struct pcie_port *pp,u32 reg);void (*writel_rc)(struct pcie_port *pp,u32 reg,u32 val);int (*rd_own_conf)(struct pcie_port *pp,int where,int size,u32 *val);
Signature · 1 line
1.7.9.5
Re: [PATCH 02/37] PCI: dwc: designware: Add new *ops* for cpu addr fixup
Hi Kishon,
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 36 lines
Some platforms (like dra7xx) require only the least 28 bits of the corresponding 32 bit CPU address to be programmed in the address translation unit. This modified address is stored in io_base/mem_base/ cfg0_base/cfg1_base in
dra7xx_pcie_host_init. While this is okay for host mode where the address range is fixed, device mode requires different addresses to be programmed based on the host buffer address. Add a new ops to get the least 28 bits of the corresponding 32 bit CPU address and invoke it before programming the address translation unit.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pcie-designware.c | 3 +++ drivers/pci/dwc/pcie-designware.h | 1 + 2 files changed, 4 insertions(+)drivers/pci/dwc/pcie-designware.c +3
-0@@ -195,6 +195,9 @@ static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index, {u32 retries, val; +if (pp->ops->cpu_addr_fixup) + cpu_addr = pp->ops->cpu_addr_fixup (cpu_addr); +if (pp->iatu_unroll_enabled) {dw_pcie_writel_unroll (pp, index,PCIE_ATU_UNR_LOWER_BASE ,lower_32_bits (cpu_addr));drivers/pci/dwc/pcie-designware.h +0
-0
drivers/pci/dwc/pcie-designware.h struct pcie_port { · line 60
Quoted 7 lines
drivers/pci/dwc/pcie-designware.h +1
-0@@ -54,6 +54,7 @@ struct pcie_port { };struct pcie_host_ops { +u64 (*cpu_addr_fixup)(u64 cpu_addr);u32 (*readl_rc)(struct pcie_port *pp,u32 reg);void (*writel_rc)(struct pcie_port *pp,u32 reg,u32 val);int (*rd_own_conf)(struct pcie_port *pp,int where,int size,u32 *val);
I think this is an acceptable fixup, I am ok with it.
Joao
PATCH 3/37 PCI: dwc: dra7xx: Populate cpu_addr_fixup ops
In reply to Kishon Vijay Abraham IPopulate cpu_addr_fixup ops to extract the least 28 bits of the corresponding cpu address.
--- drivers/pci/dwc/pci-dra7xx.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +6 -5
@@ -88,6 +88,11 @@ static inline void dra7xx_pcie_writel(struct dra7xx_pcie *pcie, u32 offset,writel (value, pcie->base + offset); } +static u64 dra7xx_pcie_cpu_addr_fixup (u64 pci_addr) +{ +return pci_addr &DRA7XX_CPU_TO_BUS_ADDR ; +} +static int dra7xx_pcie_link_up (struct pcie_port *pp) {struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pp);
@@ -151,11 +156,6 @@ static void dra7xx_pcie_host_init(struct pcie_port *pp) {struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pp); - pp->io_base &=DRA7XX_CPU_TO_BUS_ADDR ; - pp->mem_base &=DRA7XX_CPU_TO_BUS_ADDR ; - pp->cfg0_base &=DRA7XX_CPU_TO_BUS_ADDR ; - pp->cfg1_base &=DRA7XX_CPU_TO_BUS_ADDR ; -dw_pcie_setup_rc (pp);dra7xx_pcie_establish_link (dra7xx);
@@ -164,6 +164,7 @@ static void dra7xx_pcie_host_init(struct pcie_port *pp) }static struct pcie_host_ops dra7xx_pcie_host_ops = { + .cpu_addr_fixup = dra7xx_pcie_cpu_addr_fixup, .link_up = dra7xx_pcie_link_up, .host_init = dra7xx_pcie_host_init, };
Signature · 1 line
1.7.9.5
PATCH 4/37 PCI: dwc: designware: Move the register defines to designware header file
In reply to Kishon Vijay Abraham INo functional change. Move the register defines and other macros from pcie-designware.c to pcie-designware.h. This is in preparation to split the pcie-designware.c file into designware core file and host specific file.
While at that also fix a checkpatch warning.
--- drivers/pci/dwc/pcie-designware.c | 70 ------------------------------------ drivers/pci/dwc/pcie-designware.h | 71 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 70 deletions(-)
drivers/pci/dwc/pcie-designware.c +0 -70
@@ -25,76 +25,6 @@#include "pcie-designware.h" -/* Parameters for the waiting for link up routine */ -#define LINK_WAIT_MAX_RETRIES 10 -#define LINK_WAIT_USLEEP_MIN 90000 -#define LINK_WAIT_USLEEP_MAX 100000 - -/* Parameters for the waiting for iATU enabled routine */ -#define LINK_WAIT_MAX_IATU_RETRIES 5 -#define LINK_WAIT_IATU_MIN 9000 -#define LINK_WAIT_IATU_MAX 10000 - -/* Synopsys-specific PCIe configuration registers */ -#define PCIE_PORT_LINK_CONTROL 0x710 -#define PORT_LINK_MODE_MASK (0x3f << 16) -#define PORT_LINK_MODE_1_LANES (0x1 << 16) -#define PORT_LINK_MODE_2_LANES (0x3 << 16) -#define PORT_LINK_MODE_4_LANES (0x7 << 16) -#define PORT_LINK_MODE_8_LANES (0xf << 16) - -#define PCIE_LINK_WIDTH_SPEED_CONTROL 0x80C -#define PORT_LOGIC_SPEED_CHANGE (0x1 << 17) -#define PORT_LOGIC_LINK_WIDTH_MASK (0x1f << 8) -#define PORT_LOGIC_LINK_WIDTH_1_LANES (0x1 << 8) -#define PORT_LOGIC_LINK_WIDTH_2_LANES (0x2 << 8) -#define PORT_LOGIC_LINK_WIDTH_4_LANES (0x4 << 8) -#define PORT_LOGIC_LINK_WIDTH_8_LANES (0x8 << 8) - -#define PCIE_MSI_ADDR_LO 0x820 -#define PCIE_MSI_ADDR_HI 0x824 -#define PCIE_MSI_INTR0_ENABLE 0x828 -#define PCIE_MSI_INTR0_MASK 0x82C -#define PCIE_MSI_INTR0_STATUS 0x830 - -#define PCIE_ATU_VIEWPORT 0x900 -#define PCIE_ATU_REGION_INBOUND (0x1 << 31) -#define PCIE_ATU_REGION_OUTBOUND (0x0 << 31) -#define PCIE_ATU_REGION_INDEX2 (0x2 << 0) -#define PCIE_ATU_REGION_INDEX1 (0x1 << 0) -#define PCIE_ATU_REGION_INDEX0 (0x0 << 0) -#define PCIE_ATU_CR1 0x904 -#define PCIE_ATU_TYPE_MEM (0x0 << 0) -#define PCIE_ATU_TYPE_IO (0x2 << 0) -#define PCIE_ATU_TYPE_CFG0 (0x4 << 0) -#define PCIE_ATU_TYPE_CFG1 (0x5 << 0) -#define PCIE_ATU_CR2 0x908 -#define PCIE_ATU_ENABLE (0x1 << 31) -#define PCIE_ATU_BAR_MODE_ENABLE (0x1 << 30) -#define PCIE_ATU_LOWER_BASE 0x90C -#define PCIE_ATU_UPPER_BASE 0x910 -#define PCIE_ATU_LIMIT 0x914 -#define PCIE_ATU_LOWER_TARGET 0x918 -#define PCIE_ATU_BUS (x) (((x) & 0xff) << 24) -#define PCIE_ATU_DEV (x) (((x) & 0x1f) << 19) -#define PCIE_ATU_FUNC (x) (((x) & 0x7) << 16) -#define PCIE_ATU_UPPER_TARGET 0x91C - -/* -* iATU Unroll-specific register definitions -* From 4.80 core version the address translation will be made by unroll -*/ -#define PCIE_ATU_UNR_REGION_CTRL1 0x00 -#define PCIE_ATU_UNR_REGION_CTRL2 0x04 -#define PCIE_ATU_UNR_LOWER_BASE 0x08 -#define PCIE_ATU_UNR_UPPER_BASE 0x0C -#define PCIE_ATU_UNR_LIMIT 0x10 -#define PCIE_ATU_UNR_LOWER_TARGET 0x14 -#define PCIE_ATU_UNR_UPPER_TARGET 0x18 - -/* Register address builder */ -#define PCIE_GET_ATU_OUTB_UNR_REG_OFFSET (region) ((0x3 << 20) | (region << 9)) -/* PCIe Port Logic registers */ #define PLR_OFFSET 0x700#define PCIE_PHY_DEBUG_R1 (PLR_OFFSET + 0x2c)
drivers/pci/dwc/pcie-designware.h +71 -0
77 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 04/37] PCI: dwc: designware: Move the register defines to designware header file
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 18 lines
No functional change. Move the register defines and other macros from
pcie-designware.ctopcie-designware.h. This is in preparation to split thepcie-designware.cfile into designware core file and host specific file.While at that also fix a checkpatch warning.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pcie-designware.c | 70 ------------------------------------ drivers/pci/dwc/pcie-designware.h | 71 +++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 70 deletions(-)drivers/pci/dwc/pcie-designware.c +0
-0
drivers/pci/dwc/pcie-designware.c line 26
Quoted 2 lines
drivers/pci/dwc/pcie-designware.c +0
-0@@ -25,76 +25,6 @@#include "pcie-designware.h"
Make sense.
PATCH 5/37 PCI: dwc: Add platform_set_drvdata
In reply to Kishon Vijay Abraham IAdd platform_set_drvdata in all designware based drivers to store the private data structure of the driver so that dev_set_drvdata can be used to get back private data pointer in add_pcie_port/host_init. This is in preparation for splitting struct pcie_port into core and host only structures. After the split pcie_port will not be part of the driver's private data structure and *container_of* used now to get the private data pointer cannot be used.
--- drivers/pci/dwc/pci-dra7xx.c | 3 ++- drivers/pci/dwc/pci-exynos.c | 3 ++- drivers/pci/dwc/pci-imx6.c | 3 ++- drivers/pci/dwc/pci-keystone.c | 2 ++ drivers/pci/dwc/pci-layerscape.c | 2 ++ drivers/pci/dwc/pcie-armada8k.c | 2 ++ drivers/pci/dwc/pcie-artpec6.c | 2 ++ drivers/pci/dwc/pcie-designware-plat.c | 2 ++ drivers/pci/dwc/pcie-hisi.c | 2 ++ drivers/pci/dwc/pcie-qcom.c | 2 ++ drivers/pci/dwc/pcie-spear13xx.c | 3 ++- 11 files changed, 22 insertions(+), 4 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +2 -1
@@ -433,6 +433,8 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)return ret; } +platform_set_drvdata (pdev, dra7xx); +pm_runtime_enable (dev); ret =pm_runtime_get_sync (dev);if (ret <0 ) {
@@ -459,7 +461,6 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)if (ret <0 ) goto err_gpio; -platform_set_drvdata (pdev, dra7xx);return 0 ; err_gpio:
drivers/pci/dwc/pci-exynos.c +2 -1
@@ -583,11 +583,12 @@ static int __init exynos_pcie_probe(struct platform_device *pdev) goto fail_bus_clk; } +platform_set_drvdata (pdev, exynos_pcie); + ret =exynos_add_pcie_port (exynos_pcie, pdev);if (ret <0 ) goto fail_bus_clk; -platform_set_drvdata (pdev, exynos_pcie);return 0 ; fail_bus_clk:
drivers/pci/dwc/pci-imx6.c +2 -1
@@ -719,11 +719,12 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)if (ret) imx6_pcie->link_gen =1 ; +platform_set_drvdata (pdev, imx6_pcie); + ret =imx6_add_pcie_port (imx6_pcie, pdev);if (ret <0 )return ret; -platform_set_drvdata (pdev, imx6_pcie);return 0 ; }
drivers/pci/dwc/pci-keystone.c +2 -0
@@ -422,6 +422,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)if (ret)return ret; +platform_set_drvdata (pdev, ks_pcie); + ret =ks_add_pcie_port (ks_pcie, pdev);if (ret <0 ) goto fail_clk;
drivers/pci/dwc/pci-layerscape.c +2 -0
@@ -268,6 +268,8 @@ static int __init ls_pcie_probe(struct platform_device *pdev)if (!ls_pcie_is_bridge (pcie))return -ENODEV ; +platform_set_drvdata (pdev, pcie); + ret =ls_add_pcie_port (pcie);if (ret <0 )return ret;
drivers/pci/dwc/pcie-armada8k.c +2 -0
@@ -226,6 +226,8 @@ static int armada8k_pcie_probe(struct platform_device *pdev) goto fail; } +platform_set_drvdata (pdev, pcie); + ret =armada8k_add_pcie_port (pcie, pdev);if (ret) goto fail;
drivers/pci/dwc/pcie-artpec6.c +2 -0
@@ -261,6 +261,8 @@ static int artpec6_pcie_probe(struct platform_device *pdev)if (IS_ERR (artpec6_pcie->regmap))return PTR_ERR (artpec6_pcie->regmap); +platform_set_drvdata (pdev, artpec6_pcie); + ret =artpec6_add_pcie_port (artpec6_pcie, pdev);if (ret <0 )return ret;
drivers/pci/dwc/pcie-designware-plat.c +2 -0
@@ -104,6 +104,8 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)if (IS_ERR (pp->dbi_base))return PTR_ERR (pp->dbi_base); +platform_set_drvdata (pdev, dw_plat_pcie); + ret =dw_plat_add_pcie_port (pp, pdev);if (ret <0 )return ret;
drivers/pci/dwc/pcie-hisi.c +2 -0
@@ -287,6 +287,8 @@ static int hisi_pcie_probe(struct platform_device *pdev)if (IS_ERR (pp->dbi_base))return PTR_ERR (pp->dbi_base); +platform_set_drvdata (pdev, hisi_pcie); + ret =hisi_add_pcie_port (hisi_pcie, pdev);if (ret)return ret;
drivers/pci/dwc/pcie-qcom.c +2 -0
@@ -725,6 +725,8 @@ static int qcom_pcie_probe(struct platform_device *pdev)if (ret)return ret; +platform_set_drvdata (pdev, pcie); + ret =dw_pcie_host_init (pp);if (ret) {dev_err (dev,"cannot initialize host\n" );
drivers/pci/dwc/pcie-spear13xx.c +2 -1
@@ -270,11 +270,12 @@ static int spear13xx_pcie_probe(struct platform_device *pdev)if (of_property_read_bool (np,"st,pcie-is-gen1" )) spear13xx_pcie->is_gen1 = true; +platform_set_drvdata (pdev, spear13xx_pcie); + ret =spear13xx_add_pcie_port (spear13xx_pcie, pdev);if (ret <0 ) goto fail_clk; -platform_set_drvdata (pdev, spear13xx_pcie);return 0 ; fail_clk:
Signature · 1 line
1.7.9.5
Re: [PATCH 05/37] PCI: dwc: Add platform_set_drvdata
Hi,
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 24 lines
Add
platform_set_drvdatain all designware based drivers to store the private data structure of the driver so thatdev_set_drvdatacan be used to get back private data pointer in add_pcie_port/host_init. This is in preparation for splitting structpcie_portinto core and host only structures. After the splitpcie_portwill not be part of the driver's private data structure and *container_of* used now to get the private data pointer cannot be used.Cc Jingoo Han <[email protected]>Cc Richard Zhu <[email protected]>Cc Lucas Stach <[email protected]>Cc Murali Karicheri <[email protected]>Cc Minghuan Lian <[email protected]>Cc Mingkai Hu <[email protected]>Cc Roy Zang <[email protected]>Cc Thomas Petazzoni <[email protected]>Cc Niklas Cassel <[email protected]>Cc Jesper Nilsson <[email protected]>Cc Joao Pinto <[email protected]>Cc Zhou Wang <[email protected]>Cc Gabriele Paoloni <[email protected]>Cc Stanimir Varbanov <[email protected]>Cc Pratyush Anand <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>
Quoted 14 lines
--- drivers/pci/dwc/pci-dra7xx.c | 3 ++- drivers/pci/dwc/pci-exynos.c | 3 ++- drivers/pci/dwc/pci-imx6.c | 3 ++- drivers/pci/dwc/pci-keystone.c | 2 ++ drivers/pci/dwc/pci-layerscape.c | 2 ++ drivers/pci/dwc/pcie-armada8k.c | 2 ++ drivers/pci/dwc/pcie-artpec6.c | 2 ++ drivers/pci/dwc/pcie-designware-plat.c | 2 ++ drivers/pci/dwc/pcie-hisi.c | 2 ++ drivers/pci/dwc/pcie-qcom.c | 2 ++ drivers/pci/dwc/pcie-spear13xx.c | 3 ++- 11 files changed, 22 insertions(+), 4 deletions(-)
This is an example of a change that could be merged with another patch that gives it more meaning, like I wrote in the review of patch 9/37.
Thanks,
Joao
PATCH 6/37 PCI: dwc: Rename cfg_read/cfg_write to read/write
In reply to Kishon Vijay Abraham INo functional change. dw_pcie_cfg_read/dw_pcie_cfg_write doesn't do anything specific to access configuration space. It can be just renamed to dw_pcie_read/dw_pcie_write and used to read/write data to dbi space. This is in preparation for added endpoint support to linux kernel.
--- drivers/pci/dwc/pci-dra7xx.c | 16 ++++++++-------- drivers/pci/dwc/pci-exynos.c | 4 ++-- drivers/pci/dwc/pci-keystone-dw.c | 4 ++-- drivers/pci/dwc/pcie-designware.c | 12 ++++++------ drivers/pci/dwc/pcie-designware.h | 4 ++-- drivers/pci/dwc/pcie-qcom.c | 2 +- drivers/pci/dwc/pcie-spear13xx.c | 24 ++++++++++++------------ 7 files changed, 33 insertions(+), 33 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +8 -8
@@ -114,22 +114,22 @@ static int dra7xx_pcie_establish_link(struct dra7xx_pcie *dra7xx) }if (dra7xx->link_gen ==1 ) { -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , -4 , ®); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , +4 , ®);if ((reg &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { reg &= ~((u32 )PCI_EXP_LNKCAP_SLS ); reg |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCAP ,4 , reg); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCAP ,4 , reg); } -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , -2 , ®); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , +2 , ®);if ((reg &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { reg &= ~((u32 )PCI_EXP_LNKCAP_SLS ); reg |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCTL2 ,2 , reg); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCTL2 ,2 , reg); } }
drivers/pci/dwc/pci-exynos.c +2 -2
@@ -429,7 +429,7 @@ static int exynos_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,int ret;exynos_pcie_sideband_dbi_r_mode (exynos_pcie, true); - ret =dw_pcie_cfg_read (pp->dbi_base + where, size, val); + ret =dw_pcie_read (pp->dbi_base + where, size, val);exynos_pcie_sideband_dbi_r_mode (exynos_pcie, false);return ret; }
@@ -441,7 +441,7 @@ static int exynos_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,int ret;exynos_pcie_sideband_dbi_w_mode (exynos_pcie, true); - ret =dw_pcie_cfg_write (pp->dbi_base + where, size, val); + ret =dw_pcie_write (pp->dbi_base + where, size, val);exynos_pcie_sideband_dbi_w_mode (exynos_pcie, false);return ret; }
drivers/pci/dwc/pci-keystone-dw.c +2 -2
@@ -444,7 +444,7 @@ int ks_dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, addr =ks_pcie_cfg_setup (ks_pcie, bus_num, devfn); -return dw_pcie_cfg_read (addr + where, size, val); +return dw_pcie_read (addr + where, size, val); } int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,
@@ -456,7 +456,7 @@ int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, addr =ks_pcie_cfg_setup (ks_pcie, bus_num, devfn); -return dw_pcie_cfg_write (addr + where, size, val); +return dw_pcie_write (addr + where, size, val); }/**
drivers/pci/dwc/pcie-designware.c +6 -6
@@ -33,7 +33,7 @@static struct pci_ops dw_pcie_ops; -int dw_pcie_cfg_read (void __iomem *addr,int size,u32 *val) +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if ((uintptr_t )addr & (size -1 )) { *val =0 ;
@@ -54,7 +54,7 @@ int dw_pcie_cfg_read(void __iomem *addr, int size, u32 *val)return PCIBIOS_SUCCESSFUL ; } -int dw_pcie_cfg_write (void __iomem *addr,int size,u32 val) +int dw_pcie_write (void __iomem *addr,int size,u32 val) {if ((uintptr_t )addr & (size -1 ))return PCIBIOS_BAD_REGISTER_NUMBER ;
@@ -108,7 +108,7 @@ static int dw_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,if (pp->ops->rd_own_conf)return pp->ops->rd_own_conf (pp, where, size, val); -return dw_pcie_cfg_read (pp->dbi_base + where, size, val); +return dw_pcie_read (pp->dbi_base + where, size, val); } static int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,
@@ -117,7 +117,7 @@ static int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,if (pp->ops->wr_own_conf)return pp->ops->wr_own_conf (pp, where, size, val); -return dw_pcie_cfg_write (pp->dbi_base + where, size, val); +return dw_pcie_write (pp->dbi_base + where, size, val); } static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index,
@@ -638,7 +638,7 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,dw_pcie_prog_outbound_atu (pp,PCIE_ATU_REGION_INDEX1 , type, cpu_addr, busdev, cfg_size); - ret =dw_pcie_cfg_read (va_cfg_base + where, size, val); + ret =dw_pcie_read (va_cfg_base + where, size, val);if (pp->num_viewport <=2 ) dw_pcie_prog_outbound_atu(pp, PCIE_ATU_REGION_INDEX1, PCIE_ATU_TYPE_IO, pp->io_base,
@@ -676,7 +676,7 @@ static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,dw_pcie_prog_outbound_atu (pp,PCIE_ATU_REGION_INDEX1 , type, cpu_addr, busdev, cfg_size); - ret =dw_pcie_cfg_write (va_cfg_base + where, size, val); + ret =dw_pcie_write (va_cfg_base + where, size, val);if (pp->num_viewport <=2 ) dw_pcie_prog_outbound_atu(pp, PCIE_ATU_REGION_INDEX1, PCIE_ATU_TYPE_IO, pp->io_base,
drivers/pci/dwc/pcie-designware.h +2 -2
@@ -146,8 +146,8 @@ struct pcie_host_ops {u32 dw_pcie_readl_rc (struct pcie_port *pp,u32 reg);void dw_pcie_writel_rc (struct pcie_port *pp,u32 reg,u32 val); -int dw_pcie_cfg_read (void __iomem *addr,int size,u32 *val); -int dw_pcie_cfg_write (void __iomem *addr,int size,u32 val); +int dw_pcie_read (void __iomem *addr,int size,u32 *val); +int dw_pcie_write (void __iomem *addr,int size,u32 val);irqreturn_t dw_handle_msi_irq (struct pcie_port *pp);void dw_pcie_msi_init (struct pcie_port *pp);int dw_pcie_wait_for_link (struct pcie_port *pp);
drivers/pci/dwc/pcie-qcom.c +1 -1
@@ -630,7 +630,7 @@ static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,return PCIBIOS_SUCCESSFUL ; } -return dw_pcie_cfg_read (pp->dbi_base + where, size, val); +return dw_pcie_read (pp->dbi_base + where, size, val); }static struct pcie_host_ops qcom_pcie_dw_ops = {
drivers/pci/dwc/pcie-spear13xx.c +12 -12
@@ -91,34 +91,34 @@ static int spear13xx_pcie_establish_link(struct spear13xx_pcie *spear13xx_pcie)* default value in capability register is 512 bytes. So force * it to 128 here. */ -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , &val); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , &val); val &= ~PCI_EXP_DEVCTL_READRQ ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , val); +dw_pcie_write (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , val); -dw_pcie_cfg_write (pp->dbi_base +PCI_VENDOR_ID ,2 ,0x104A ); -dw_pcie_cfg_write (pp->dbi_base +PCI_DEVICE_ID ,2 ,0xCD80 ); +dw_pcie_write (pp->dbi_base +PCI_VENDOR_ID ,2 ,0x104A ); +dw_pcie_write (pp->dbi_base +PCI_DEVICE_ID ,2 ,0xCD80 );/* * if is_gen1 is set then handle it, so that some buggy card * also works */ if (spear13xx_pcie->is_gen1) { -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , -4 , &val); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , +4 , &val);if ((val &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { val &= ~((u32 )PCI_EXP_LNKCAP_SLS ); val |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCAP ,4 , val); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCAP ,4 , val); } -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , -2 , &val); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , +2 , &val);if ((val &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { val &= ~((u32 )PCI_EXP_LNKCAP_SLS ); val |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCTL2 ,2 , val); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCTL2 ,2 , val); } }
Signature · 1 line
1.7.9.5
Re: [PATCH 06/37] PCI: dwc: Rename cfg_read/cfg_write to read/write
Hi,
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 228 lines
No functional change. dw_pcie_cfg_read/dw_pcie_cfg_write doesn't do anything specific to access configuration space. It can be just renamed to dw_pcie_read/dw_pcie_write and used to read/write data to dbi space. This is in preparation for added endpoint support to linux kernel.
Cc Jingoo Han <[email protected]>Cc Murali Karicheri <[email protected]>Cc Joao Pinto <[email protected]>Cc Stanimir Varbanov <[email protected]>Cc Pratyush Anand <[email protected]>Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pci-dra7xx.c | 16 ++++++++-------- drivers/pci/dwc/pci-exynos.c | 4 ++-- drivers/pci/dwc/pci-keystone-dw.c | 4 ++-- drivers/pci/dwc/pcie-designware.c | 12 ++++++------ drivers/pci/dwc/pcie-designware.h | 4 ++-- drivers/pci/dwc/pcie-qcom.c | 2 +- drivers/pci/dwc/pcie-spear13xx.c | 24 ++++++++++++------------ 7 files changed, 33 insertions(+), 33 deletions(-)drivers/pci/dwc/pci-dra7xx.c +8
-8@@ -114,22 +114,22 @@ static int dra7xx_pcie_establish_link(struct dra7xx_pcie *dra7xx) }if (dra7xx->link_gen ==1 ) { -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , -4 , ®); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , +4 , ®);if ((reg &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { reg &= ~((u32 )PCI_EXP_LNKCAP_SLS ); reg |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCAP ,4 , reg); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCAP ,4 , reg); } -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , -2 , ®); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , +2 , ®);if ((reg &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { reg &= ~((u32 )PCI_EXP_LNKCAP_SLS ); reg |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCTL2 ,2 , reg); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCTL2 ,2 , reg); } }drivers/pci/dwc/pci-exynos.c +2
-2@@ -429,7 +429,7 @@ static int exynos_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,int ret;exynos_pcie_sideband_dbi_r_mode (exynos_pcie, true); - ret =dw_pcie_cfg_read (pp->dbi_base + where, size, val); + ret =dw_pcie_read (pp->dbi_base + where, size, val);exynos_pcie_sideband_dbi_r_mode (exynos_pcie, false);return ret; }@@ -441,7 +441,7 @@ static int exynos_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,int ret;exynos_pcie_sideband_dbi_w_mode (exynos_pcie, true); - ret =dw_pcie_cfg_write (pp->dbi_base + where, size, val); + ret =dw_pcie_write (pp->dbi_base + where, size, val);exynos_pcie_sideband_dbi_w_mode (exynos_pcie, false);return ret; }drivers/pci/dwc/pci-keystone-dw.c +2
-2@@ -444,7 +444,7 @@ int ks_dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, addr =ks_pcie_cfg_setup (ks_pcie, bus_num, devfn); -return dw_pcie_cfg_read (addr + where, size, val); +return dw_pcie_read (addr + where, size, val); } int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,@@ -456,7 +456,7 @@ int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus, addr =ks_pcie_cfg_setup (ks_pcie, bus_num, devfn); -return dw_pcie_cfg_write (addr + where, size, val); +return dw_pcie_write (addr + where, size, val); }/** drivers/pci/dwc/pcie-designware.c +6
-6@@ -33,7 +33,7 @@static struct pci_ops dw_pcie_ops; -int dw_pcie_cfg_read (void __iomem *addr,int size,u32 *val) +int dw_pcie_read (void __iomem *addr,int size,u32 *val) {if ((uintptr_t )addr & (size -1 )) { *val =0 ;@@ -54,7 +54,7 @@ int dw_pcie_cfg_read(void __iomem *addr, int size, u32 *val)return PCIBIOS_SUCCESSFUL ; } -int dw_pcie_cfg_write (void __iomem *addr,int size,u32 val) +int dw_pcie_write (void __iomem *addr,int size,u32 val) {if ((uintptr_t )addr & (size -1 ))return PCIBIOS_BAD_REGISTER_NUMBER ;@@ -108,7 +108,7 @@ static int dw_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,if (pp->ops->rd_own_conf)return pp->ops->rd_own_conf (pp, where, size, val); -return dw_pcie_cfg_read (pp->dbi_base + where, size, val); +return dw_pcie_read (pp->dbi_base + where, size, val); } static int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,@@ -117,7 +117,7 @@ static int dw_pcie_wr_own_conf(struct pcie_port *pp, int where, int size,if (pp->ops->wr_own_conf)return pp->ops->wr_own_conf (pp, where, size, val); -return dw_pcie_cfg_write (pp->dbi_base + where, size, val); +return dw_pcie_write (pp->dbi_base + where, size, val); } static void dw_pcie_prog_outbound_atu(struct pcie_port *pp, int index,@@ -638,7 +638,7 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus,dw_pcie_prog_outbound_atu (pp,PCIE_ATU_REGION_INDEX1 , type, cpu_addr, busdev, cfg_size); - ret =dw_pcie_cfg_read (va_cfg_base + where, size, val); + ret =dw_pcie_read (va_cfg_base + where, size, val);if (pp->num_viewport <=2 ) dw_pcie_prog_outbound_atu(pp, PCIE_ATU_REGION_INDEX1, PCIE_ATU_TYPE_IO, pp->io_base,@@ -676,7 +676,7 @@ static int dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,dw_pcie_prog_outbound_atu (pp,PCIE_ATU_REGION_INDEX1 , type, cpu_addr, busdev, cfg_size); - ret =dw_pcie_cfg_write (va_cfg_base + where, size, val); + ret =dw_pcie_write (va_cfg_base + where, size, val);if (pp->num_viewport <=2 ) dw_pcie_prog_outbound_atu(pp, PCIE_ATU_REGION_INDEX1, PCIE_ATU_TYPE_IO, pp->io_base,drivers/pci/dwc/pcie-designware.h +2
-2@@ -146,8 +146,8 @@ struct pcie_host_ops {u32 dw_pcie_readl_rc (struct pcie_port *pp,u32 reg);void dw_pcie_writel_rc (struct pcie_port *pp,u32 reg,u32 val); -int dw_pcie_cfg_read (void __iomem *addr,int size,u32 *val); -int dw_pcie_cfg_write (void __iomem *addr,int size,u32 val); +int dw_pcie_read (void __iomem *addr,int size,u32 *val); +int dw_pcie_write (void __iomem *addr,int size,u32 val);irqreturn_t dw_handle_msi_irq (struct pcie_port *pp);void dw_pcie_msi_init (struct pcie_port *pp);int dw_pcie_wait_for_link (struct pcie_port *pp);drivers/pci/dwc/pcie-qcom.c +1
-1@@ -630,7 +630,7 @@ static int qcom_pcie_rd_own_conf(struct pcie_port *pp, int where, int size,return PCIBIOS_SUCCESSFUL ; } -return dw_pcie_cfg_read (pp->dbi_base + where, size, val); +return dw_pcie_read (pp->dbi_base + where, size, val); }static struct pcie_host_ops qcom_pcie_dw_ops = {drivers/pci/dwc/pcie-spear13xx.c +10
-10@@ -91,34 +91,34 @@ static int spear13xx_pcie_establish_link(struct spear13xx_pcie *spear13xx_pcie)* default value in capability register is 512 bytes. So force * it to 128 here. */ -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , &val); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , &val); val &= ~PCI_EXP_DEVCTL_READRQ ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , val); +dw_pcie_write (pp->dbi_base + exp_cap_off +PCI_EXP_DEVCTL ,2 , val); -dw_pcie_cfg_write (pp->dbi_base +PCI_VENDOR_ID ,2 ,0x104A ); -dw_pcie_cfg_write (pp->dbi_base +PCI_DEVICE_ID ,2 ,0xCD80 ); +dw_pcie_write (pp->dbi_base +PCI_VENDOR_ID ,2 ,0x104A ); +dw_pcie_write (pp->dbi_base +PCI_DEVICE_ID ,2 ,0xCD80 );/* * if is_gen1 is set then handle it, so that some buggy card * also works */ if (spear13xx_pcie->is_gen1) { -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , -4 , &val); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , +4 , &val);if ((val &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { val &= ~((u32 )PCI_EXP_LNKCAP_SLS ); val |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCAP ,4 , val); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCAP ,4 , val); } -dw_pcie_cfg_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , -2 , &val); +dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , +2 , &val);
drivers/pci/dwc/pcie-spear13xx.c static int spear13xx_pcie_establish_link(struct spear13xx_pcie *spear13xx_pcie) · line 124
Quoted 10 lines
drivers/pci/dwc/pcie-spear13xx.c +2
-2if ((val &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { val &= ~((u32 )PCI_EXP_LNKCAP_SLS ); val |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_cfg_write (pp->dbi_base + exp_cap_off + -PCI_EXP_LNKCTL2 ,2 , val); +dw_pcie_write (pp->dbi_base + exp_cap_off + +PCI_EXP_LNKCTL2 ,2 , val); } }
Make sense.
PATCH 7/37 PCI: dwc: designware: Get device pointer at the start of dw_pcie_host_init
In reply to Kishon Vijay Abraham INo functional change. Get device pointer at the beginning of dw_pcie_host_init instead of getting it all over dw_pcie_host_init. This is in preparation for splitting struct pcie_port into host and core structures (Once split pcie_port will not have device pointer).
--- drivers/pci/dwc/pcie-designware.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/pci/dwc/pcie-designware.c +17 -16
@@ -449,8 +449,9 @@ static u8 dw_pcie_iatu_unroll_enabled(struct pcie_port *pp)int dw_pcie_host_init (struct pcie_port *pp) { -struct device_node *np = pp->dev->of_node; -struct platform_device *pdev =to_platform_device (pp->dev); +struct device *dev = pp->dev; +struct device_node *np = dev->of_node; +struct platform_device *pdev =to_platform_device (dev);struct pci_bus *bus, *child;struct resource *cfg_res;int i, ret;
@@ -464,14 +465,14 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->cfg0_size; }else if (!pp->va_cfg0_base) { -dev_err (pp->dev,"missing *config* reg space\n" ); +dev_err (dev,"missing *config* reg space\n" ); } ret =of_pci_get_host_bridge_resources (np,0 ,0xff , &res, &pp->io_base);if (ret)return ret; - ret =devm_request_pci_bus_resources (&pdev->dev, &res); + ret =devm_request_pci_bus_resources (dev, &res);if (ret) goto error;
@@ -481,7 +482,7 @@ int dw_pcie_host_init(struct pcie_port *pp)case IORESOURCE_IO : ret =pci_remap_iospace (win->res, pp->io_base);if (ret) { -dev_warn (pp->dev,"error %d: failed to map resource %pR\n" , +dev_warn (dev,"error %d: failed to map resource %pR\n" , ret, win->res);resource_list_destroy_entry (win); }else {
@@ -511,10 +512,10 @@ int dw_pcie_host_init(struct pcie_port *pp) }if (!pp->dbi_base) { - pp->dbi_base =devm_ioremap (pp->dev, pp->cfg->start, + pp->dbi_base =devm_ioremap (dev, pp->cfg->start,resource_size (pp->cfg));if (!pp->dbi_base) { -dev_err (pp->dev,"error with ioremap\n" ); +dev_err (dev,"error with ioremap\n" ); ret = -ENOMEM ; goto error; }
@@ -523,20 +524,20 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->mem_base = pp->mem->start;if (!pp->va_cfg0_base) { - pp->va_cfg0_base =devm_ioremap (pp->dev, pp->cfg0_base, + pp->va_cfg0_base =devm_ioremap (dev, pp->cfg0_base, pp->cfg0_size);if (!pp->va_cfg0_base) { -dev_err (pp->dev,"error with ioremap in function\n" ); +dev_err (dev,"error with ioremap in function\n" ); ret = -ENOMEM ; goto error; } }if (!pp->va_cfg1_base) { - pp->va_cfg1_base =devm_ioremap (pp->dev, pp->cfg1_base, + pp->va_cfg1_base =devm_ioremap (dev, pp->cfg1_base, pp->cfg1_size);if (!pp->va_cfg1_base) { -dev_err (pp->dev,"error with ioremap\n" ); +dev_err (dev,"error with ioremap\n" ); ret = -ENOMEM ; goto error; }
@@ -552,11 +553,11 @@ int dw_pcie_host_init(struct pcie_port *pp)if (IS_ENABLED (CONFIG_PCI_MSI )) {if (!pp->ops->msi_host_init) { - pp->irq_domain =irq_domain_add_linear (pp->dev->of_node, + pp->irq_domain =irq_domain_add_linear (dev->of_node,MAX_MSI_IRQS , &msi_domain_ops, &dw_pcie_msi_chip);if (!pp->irq_domain) { -dev_err (pp->dev,"irq domain init failed\n" ); +dev_err (dev,"irq domain init failed\n" ); ret = -ENXIO ; goto error; }
@@ -575,12 +576,12 @@ int dw_pcie_host_init(struct pcie_port *pp) pp->root_bus_nr = pp->busn->start;if (IS_ENABLED (CONFIG_PCI_MSI )) { - bus =pci_scan_root_bus_msi (pp->dev, pp->root_bus_nr, + bus =pci_scan_root_bus_msi (dev, pp->root_bus_nr, &dw_pcie_ops, pp, &res, &dw_pcie_msi_chip); - dw_pcie_msi_chip.dev = pp->dev; + dw_pcie_msi_chip.dev = dev; }else - bus =pci_scan_root_bus (pp->dev, pp->root_bus_nr, &dw_pcie_ops, + bus =pci_scan_root_bus (dev, pp->root_bus_nr, &dw_pcie_ops, pp, &res);if (!bus) { ret = -ENOMEM ;
Signature · 1 line
1.7.9.5
Re: [PATCH 07/37] PCI: dwc: designware: Get device pointer at the start of dw_pcie_host_init
Hi!
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 5 lines
No functional change. Get device pointer at the beginning of
dw_pcie_host_initinstead of getting it all overdw_pcie_host_init. This is in preparation for splitting structpcie_portinto host and core structures (Once splitpcie_portwill not have device pointer).
I think change should be condense with another patch to reduce the patch-set number and to give it real meaning. I understand why you are breaking so much the patch, it is has a lot of changes, but in my opinion is too much fragmented.
Thanks
Joao
PATCH 8/37 PCI: dwc: Split *struct pcie_port* into host only and core structures
In reply to Kishon Vijay Abraham IKeep only the host specific members in *struct pcie_port* and move the common members (i.e common to both host and endpoint) to *struct dw_pcie*. This is in preparation for adding endpoint mode support to designware driver.
While at that also fix checkpatch warnings.
---
I've pushed the series togit://git.ti.com/linux-phy/linux-phy.git pci_ep_v1
I have access to only dra7 based boards, so I was able to test only that. Testing in other plaforms would be highly appreciated.
drivers/pci/dwc/pci-dra7xx.c | 76 +++++++----- drivers/pci/dwc/pci-exynos.c | 78 +++++++----- drivers/pci/dwc/pci-imx6.c | 128 ++++++++++---------- drivers/pci/dwc/pci-keystone-dw.c | 83 +++++++------ drivers/pci/dwc/pci-keystone.c | 54 +++++---- drivers/pci/dwc/pci-keystone.h | 4 +- drivers/pci/dwc/pci-layerscape.c | 91 +++++++++----- drivers/pci/dwc/pcie-armada8k.c | 85 +++++++------ drivers/pci/dwc/pcie-artpec6.c | 48 ++++---- drivers/pci/dwc/pcie-designware-plat.c | 27 +++-- drivers/pci/dwc/pcie-designware.c | 203 +++++++++++++++++--------------- drivers/pci/dwc/pcie-designware.h | 69 ++++++----- drivers/pci/dwc/pcie-hisi.c | 55 +++++---- drivers/pci/dwc/pcie-qcom.c | 70 +++++++---- drivers/pci/dwc/pcie-spear13xx.c | 74 +++++++----- 15 files changed, 665 insertions(+), 480 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +46 -30
@@ -67,7 +67,7 @@#define EXP_CAP_ID_OFFSET 0x70struct dra7xx_pcie { -struct pcie_port pp; +struct dw_pcie *pci;void __iomem *base;/* DT ti_conf */ int phy_count;/* DT phy-names count */ struct phy **phy;
@@ -75,7 +75,7 @@ struct dra7xx_pcie {struct irq_domain *irq_domain; }; -#define to_dra7xx_pcie (x) container_of((x), struct dra7xx_pcie, pp) +#define to_dra7xx_pcie (x) dev_get_drvdata((x)->dev)static inline u32 dra7xx_pcie_readl (struct dra7xx_pcie *pcie,u32 offset) {
@@ -93,9 +93,9 @@ static u64 dra7xx_pcie_cpu_addr_fixup(u64 pci_addr)return pci_addr &DRA7XX_CPU_TO_BUS_ADDR ; } -static int dra7xx_pcie_link_up (struct pcie_port *pp) +static int dra7xx_pcie_link_up (struct dw_pcie *pci) { -struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pp); +struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pci);u32 reg =dra7xx_pcie_readl (dra7xx,PCIECTRL_DRA7XX_CONF_PHY_CS );return !!(reg &LINK_UP );
@@ -103,32 +103,32 @@ static int dra7xx_pcie_link_up(struct pcie_port *pp)static int dra7xx_pcie_establish_link (struct dra7xx_pcie *dra7xx) { -struct pcie_port *pp = &dra7xx->pp; -struct device *dev = pp->dev; +struct dw_pcie *pci = dra7xx->pci; +struct device *dev = pci->dev;u32 reg;u32 exp_cap_off =EXP_CAP_ID_OFFSET ; -if (dw_pcie_link_up (pp)) { +if (dw_pcie_link_up (pci)) {dev_err (dev,"link is already up\n" );return 0 ; }if (dra7xx->link_gen ==1 ) { -dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCAP , +dw_pcie_read (pci->dbi_base + exp_cap_off +PCI_EXP_LNKCAP ,4 , ®);if ((reg &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { reg &= ~((u32 )PCI_EXP_LNKCAP_SLS ); reg |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_write (pp->dbi_base + exp_cap_off + +dw_pcie_write (pci->dbi_base + exp_cap_off +PCI_EXP_LNKCAP ,4 , reg); } -dw_pcie_read (pp->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 , +dw_pcie_read (pci->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 ,2 , ®);if ((reg &PCI_EXP_LNKCAP_SLS ) !=PCI_EXP_LNKCAP_SLS_2_5GB ) { reg &= ~((u32 )PCI_EXP_LNKCAP_SLS ); reg |=PCI_EXP_LNKCAP_SLS_2_5GB ; -dw_pcie_write (pp->dbi_base + exp_cap_off + +dw_pcie_write (pci->dbi_base + exp_cap_off +PCI_EXP_LNKCTL2 ,2 , reg); } }
@@ -137,7 +137,7 @@ static int dra7xx_pcie_establish_link(struct dra7xx_pcie *dra7xx) reg |=LTSSM_EN ;dra7xx_pcie_writel (dra7xx,PCIECTRL_DRA7XX_CONF_DEVICE_CMD , reg); -return dw_pcie_wait_for_link (pp); +return dw_pcie_wait_for_link (pci); }static void dra7xx_pcie_enable_interrupts (struct dra7xx_pcie *dra7xx)
@@ -154,7 +154,8 @@ static void dra7xx_pcie_enable_interrupts(struct dra7xx_pcie *dra7xx)static void dra7xx_pcie_host_init (struct pcie_port *pp) { -struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pp); +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pci);dw_pcie_setup_rc (pp);
@@ -163,9 +164,7 @@ static void dra7xx_pcie_host_init(struct pcie_port *pp)dra7xx_pcie_enable_interrupts (dra7xx); } -static struct pcie_host_ops dra7xx_pcie_host_ops = { - .cpu_addr_fixup = dra7xx_pcie_cpu_addr_fixup, - .link_up = dra7xx_pcie_link_up, +static struct dw_pcie_host_ops dra7xx_pcie_host_ops = { .host_init = dra7xx_pcie_host_init, };
@@ -184,8 +183,9 @@ static int dra7xx_pcie_intx_map(struct irq_domain *domain, unsigned int irq,static int dra7xx_pcie_init_irq_domain (struct pcie_port *pp) { -struct device *dev = pp->dev; -struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pp); +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev; +struct dra7xx_pcie *dra7xx =to_dra7xx_pcie (pci);struct device_node *node = dev->of_node;struct device_node *pcie_intc_node =of_get_next_child (node,NULL );
@@ -207,7 +207,8 @@ static int dra7xx_pcie_init_irq_domain(struct pcie_port *pp)static irqreturn_t dra7xx_pcie_msi_irq_handler (int irq,void *arg) {struct dra7xx_pcie *dra7xx = arg; -struct pcie_port *pp = &dra7xx->pp; +struct dw_pcie *pci = dra7xx->pci; +struct pcie_port *pp = &pci->pp;u32 reg; reg =dra7xx_pcie_readl (dra7xx,PCIECTRL_DRA7XX_CONF_IRQSTATUS_MSI );
@@ -234,7 +235,8 @@ static irqreturn_t dra7xx_pcie_msi_irq_handler(int irq, void *arg)static irqreturn_t dra7xx_pcie_irq_handler (int irq,void *arg) {struct dra7xx_pcie *dra7xx = arg; -struct device *dev = dra7xx->pp.dev; +struct dw_pcie *pci = dra7xx->pci; +struct device *dev = pci->dev;u32 reg; reg =dra7xx_pcie_readl (dra7xx,PCIECTRL_DRA7XX_CONF_IRQSTATUS_MAIN );
@@ -292,9 +294,9 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,struct pcie_port *pp;struct resource *res;struct device *dev = &pdev->dev; +struct dw_pcie *pci = dra7xx->pci; - pp = &dra7xx->pp; - pp->dev = dev; + pp = &pci->pp; pp->ops = &dra7xx_pcie_host_ops; pp->irq =platform_get_irq (pdev,1 );
@@ -316,8 +318,8 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,return ret; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"rc_dbics" ); - pp->dbi_base =devm_ioremap (dev, res->start,resource_size (res)); -if (!pp->dbi_base) + pci->dbi_base =devm_ioremap (dev, res->start,resource_size (res)); +if (!pci->dbi_base)return -ENOMEM ; ret =dw_pcie_host_init (pp);
@@ -329,6 +331,11 @@ static int __init dra7xx_add_pcie_port(struct dra7xx_pcie *dra7xx,return 0 ; } +static const struct dw_pcie_ops dw_pcie_ops = { + .cpu_addr_fixup = dra7xx_pcie_cpu_addr_fixup, + .link_up = dra7xx_pcie_link_up, +}; +static void dra7xx_pcie_disable_phy (struct dra7xx_pcie *dra7xx) {int phy_count = dra7xx->phy_count;
@@ -378,6 +385,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)struct phy **phy;void __iomem *base;struct resource *res; +struct dw_pcie *pci;struct dra7xx_pcie *dra7xx;struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;
@@ -388,6 +396,13 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)if (!dra7xx)return -ENOMEM ; + pci =devm_kzalloc (dev,sizeof (*pci),GFP_KERNEL ); +if (!pci) +return -ENOMEM ; + + pci->dev = dev; + pci->ops = &dw_pcie_ops; + irq =platform_get_irq (pdev,0 );if (irq <0 ) {dev_err (dev,"missing IRQ resource\n" );
@@ -425,6 +440,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev) dra7xx->base = base; dra7xx->phy = phy; + dra7xx->pci = pci; dra7xx->phy_count = phy_count; ret =dra7xx_pcie_enable_phy (dra7xx);
@@ -477,13 +493,13 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)static int dra7xx_pcie_suspend (struct device *dev) {struct dra7xx_pcie *dra7xx =dev_get_drvdata (dev); -struct pcie_port *pp = &dra7xx->pp; +struct dw_pcie *pci = dra7xx->pci;u32 val;/* clear MSE */ - val =dw_pcie_readl_rc (pp,PCI_COMMAND ); + val =dw_pcie_readl_dbi (pci,PCI_COMMAND ); val &= ~PCI_COMMAND_MEMORY ; -dw_pcie_writel_rc (pp,PCI_COMMAND , val); +dw_pcie_writel_dbi (pci,PCI_COMMAND , val);return 0 ; }
@@ -491,13 +507,13 @@ static int dra7xx_pcie_suspend(struct device *dev)static int dra7xx_pcie_resume (struct device *dev) {struct dra7xx_pcie *dra7xx =dev_get_drvdata (dev); -struct pcie_port *pp = &dra7xx->pp; +struct dw_pcie *pci = dra7xx->pci;u32 val;/* set MSE */ - val =dw_pcie_readl_rc (pp,PCI_COMMAND ); + val =dw_pcie_readl_dbi (pci,PCI_COMMAND ); val |=PCI_COMMAND_MEMORY ; -dw_pcie_writel_rc (pp,PCI_COMMAND , val); +dw_pcie_writel_dbi (pci,PCI_COMMAND , val);return 0 ; }
drivers/pci/dwc/pci-exynos.c +46 -32
193 lines not on this page · raw message
drivers/pci/dwc/pci-imx6.c +69 -59
364 lines not on this page · raw message
drivers/pci/dwc/pci-keystone-dw.c +50 -33
234 lines not on this page · raw message
drivers/pci/dwc/pci-keystone.c +32 -22
146 lines not on this page · raw message
drivers/pci/dwc/pci-keystone.h +2 -2
@@ -17,7 +17,7 @@#define MAX_LEGACY_HOST_IRQS 4struct keystone_pcie { -struct pcie_port pp;/* pp.dbi_base is DT 0th res */ +struct dw_pcie *pci;struct clk *clk;/* PCI Device ID */ u32 device_id;
@@ -54,10 +54,10 @@ int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,int ks_dw_pcie_rd_other_conf (struct pcie_port *pp,struct pci_bus *bus,unsigned int devfn,int where,int size,u32 *val);void ks_dw_pcie_setup_rc_app_regs (struct keystone_pcie *ks_pcie); -int ks_dw_pcie_link_up (struct pcie_port *pp);void ks_dw_pcie_initiate_link_train (struct keystone_pcie *ks_pcie);void ks_dw_pcie_msi_set_irq (struct pcie_port *pp,int irq);void ks_dw_pcie_msi_clear_irq (struct pcie_port *pp,int irq);void ks_dw_pcie_v3_65_scan_bus (struct pcie_port *pp);int ks_dw_pcie_msi_host_init (struct pcie_port *pp,struct msi_controller *chip); +int ks_dw_pcie_link_up (struct dw_pcie *pci);
drivers/pci/dwc/pci-layerscape.c +59 -32
221 lines not on this page · raw message
drivers/pci/dwc/pcie-armada8k.c +47 -38
189 lines not on this page · raw message
drivers/pci/dwc/pcie-artpec6.c +28 -20
120 lines not on this page · raw message
drivers/pci/dwc/pcie-designware-plat.c +16 -11
@@ -25,7 +25,7 @@#include "pcie-designware.h" struct dw_plat_pcie { -struct pcie_port pp;/* pp.dbi_base is DT 0th resource */ +struct dw_pcie *pci; };static irqreturn_t dw_plat_pcie_msi_irq_handler (int irq,void *arg)
@@ -37,21 +37,23 @@ static irqreturn_t dw_plat_pcie_msi_irq_handler(int irq, void *arg)static void dw_plat_pcie_host_init (struct pcie_port *pp) { +struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +dw_pcie_setup_rc (pp); -dw_pcie_wait_for_link (pp); +dw_pcie_wait_for_link (pci);if (IS_ENABLED (CONFIG_PCI_MSI ))dw_pcie_msi_init (pp); } -static struct pcie_host_ops dw_plat_pcie_host_ops = { +static struct dw_pcie_host_ops dw_plat_pcie_host_ops = { .host_init = dw_plat_pcie_host_init, };static int dw_plat_add_pcie_port (struct pcie_port *pp,struct platform_device *pdev) { -struct device *dev = pp->dev; +struct device *dev = &pdev->dev;int ret; pp->irq =platform_get_irq (pdev,1 );
@@ -88,7 +90,7 @@ static int dw_plat_pcie_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct dw_plat_pcie *dw_plat_pcie; -struct pcie_port *pp; +struct dw_pcie *pci;struct resource *res;/* Resource from DT */ int ret;
@@ -96,17 +98,20 @@ static int dw_plat_pcie_probe(struct platform_device *pdev)if (!dw_plat_pcie)return -ENOMEM ; - pp = &dw_plat_pcie->pp; - pp->dev = dev; + pci =devm_kzalloc (dev,sizeof (*pci),GFP_KERNEL ); +if (!pci) +return -ENOMEM ; + + pci->dev = dev; res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - pp->dbi_base =devm_ioremap_resource (dev, res); -if (IS_ERR (pp->dbi_base)) -return PTR_ERR (pp->dbi_base); + pci->dbi_base =devm_ioremap_resource (dev, res); +if (IS_ERR (pci->dbi_base)) +return PTR_ERR (pci->dbi_base);platform_set_drvdata (pdev, dw_plat_pcie); - ret =dw_plat_add_pcie_port (pp, pdev); + ret =dw_plat_add_pcie_port (&pci->pp, pdev);if (ret <0 )return ret;
drivers/pci/dwc/pcie-designware.c +108 -95
399 lines not on this page · raw message
drivers/pci/dwc/pcie-designware.h +41 -28
96 lines not on this page · raw message
drivers/pci/dwc/pcie-hisi.c +33 -22
136 lines not on this page · raw message
drivers/pci/dwc/pcie-qcom.c +45 -25
193 lines not on this page · raw message
drivers/pci/dwc/pcie-spear13xx.c +43 -31
186 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 9/37 PCI: dwc: designware: Parse *num-lanes* property in dw_pcie_setup_rc
In reply to Kishon Vijay Abraham I*num-lanes* dt property is parsed in dw_pcie_host_init. However *num-lanes* property is applicable to both root complex mode and endpoint mode. As a first step, move the parsing of this property outside dw_pcie_host_init. This is in preparation for splitting pcie-designware.c to pcie-designware.c and pcie-designware-host.c
--- drivers/pci/dwc/pcie-designware.c | 18 +++++++++++------- drivers/pci/dwc/pcie-designware.h | 1 - 2 files changed, 11 insertions(+), 8 deletions(-)
drivers/pci/dwc/pcie-designware.c +11 -7
@@ -551,10 +551,6 @@ int dw_pcie_host_init(struct pcie_port *pp) } } - ret =of_property_read_u32 (np,"num-lanes" , &pci->lanes); -if (ret) - pci->lanes =0 ; - ret =of_property_read_u32 (np,"num-viewport" , &pci->num_viewport);if (ret) pci->num_viewport =2 ;
@@ -751,18 +747,26 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,void dw_pcie_setup_rc (struct pcie_port *pp) { +int ret; +u32 lanes;u32 val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev; +struct device_node *np = dev->of_node;/* get iATU unroll support */ pci->iatu_unroll_enabled =dw_pcie_iatu_unroll_enabled (pci);dev_dbg (pci->dev,"iATU unroll: %s\n" , pci->iatu_unroll_enabled ?"enabled" :"disabled" ); + ret =of_property_read_u32 (np,"num-lanes" , &lanes); +if (ret) + lanes =0 ; +/* set the number of lanes */ val =dw_pcie_readl_dbi (pci,PCIE_PORT_LINK_CONTROL ); val &= ~PORT_LINK_MODE_MASK ; -switch (pci->lanes) { +switch (lanes) {case 1 : val |=PORT_LINK_MODE_1_LANES ;break ;
@@ -776,7 +780,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) val |=PORT_LINK_MODE_8_LANES ;break ;default : -dev_err (pci->dev,"num-lanes %u: invalid value\n" , pci->lanes); +dev_err (pci->dev,"num-lanes %u: invalid value\n" , lanes);return ; }dw_pcie_writel_dbi (pci,PCIE_PORT_LINK_CONTROL , val);
@@ -784,7 +788,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)/* set link width speed control register */ val =dw_pcie_readl_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL ); val &= ~PORT_LOGIC_LINK_WIDTH_MASK ; -switch (pci->lanes) { +switch (lanes) {case 1 : val |=PORT_LOGIC_LINK_WIDTH_1_LANES ;break ;
drivers/pci/dwc/pcie-designware.h +0 -1
@@ -148,7 +148,6 @@ struct dw_pcie_ops {struct dw_pcie {struct device *dev;void __iomem *dbi_base; -u32 lanes;u32 num_viewport;u8 iatu_unroll_enabled;struct pcie_port pp;
Signature · 1 line
1.7.9.5
Re: [PATCH 09/37] PCI: dwc: designware: Parse *num-lanes* property in dw_pcie_setup_rc
Hi,
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 36 lines
*num-lanes* dt property is parsed in
dw_pcie_host_init. However *num-lanes* property is applicable to both root complex mode and endpoint mode. As a first step, move the parsing of this property outsidedw_pcie_host_init. This is in preparation for splittingpcie-designware.ctopcie-designware.candpcie-designware-host.cSigned-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pcie-designware.c | 18 +++++++++++------- drivers/pci/dwc/pcie-designware.h | 1 - 2 files changed, 11 insertions(+), 8 deletions(-)drivers/pci/dwc/pcie-designware.c +3
-4@@ -551,10 +551,6 @@ int dw_pcie_host_init(struct pcie_port *pp) } } - ret =of_property_read_u32 (np,"num-lanes" , &pci->lanes); -if (ret) - pci->lanes =0 ; - ret =of_property_read_u32 (np,"num-viewport" , &pci->num_viewport);if (ret) pci->num_viewport =2 ;@@ -751,18 +747,26 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,void dw_pcie_setup_rc (struct pcie_port *pp) { +int ret; +u32 lanes;u32 val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev;
drivers/pci/dwc/pcie-designware.c static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · line 764
Quoted 10 lines
drivers/pci/dwc/pcie-designware.c +4
-0+struct device_node *np = dev->of_node;/* get iATU unroll support */ pci->iatu_unroll_enabled =dw_pcie_iatu_unroll_enabled (pci);dev_dbg (pci->dev,"iATU unroll: %s\n" , pci->iatu_unroll_enabled ?"enabled" :"disabled" ); + ret =of_property_read_u32 (np,"num-lanes" , &lanes); +if (ret) + lanes =0 ;
You moved from host_init to root complex setup function, which in my opinion did not improve (in this scope).
I suggest that instead of making so much intermediary patches, which is nice to understand your development sequence, but hard to review. Wouldn't be better to condense some of the patches? We would have a cloear vision of the final product :)
Joao
Quoted 40 lines
drivers/pci/dwc/pcie-designware.c +4
-3+/* set the number of lanes */ val =dw_pcie_readl_dbi (pci,PCIE_PORT_LINK_CONTROL ); val &= ~PORT_LINK_MODE_MASK ; -switch (pci->lanes) { +switch (lanes) {case 1 : val |=PORT_LINK_MODE_1_LANES ;break ;@@ -776,7 +780,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp) val |=PORT_LINK_MODE_8_LANES ;break ;default : -dev_err (pci->dev,"num-lanes %u: invalid value\n" , pci->lanes); +dev_err (pci->dev,"num-lanes %u: invalid value\n" , lanes);return ; }dw_pcie_writel_dbi (pci,PCIE_PORT_LINK_CONTROL , val);@@ -784,7 +788,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)/* set link width speed control register */ val =dw_pcie_readl_dbi (pci,PCIE_LINK_WIDTH_SPEED_CONTROL ); val &= ~PORT_LOGIC_LINK_WIDTH_MASK ; -switch (pci->lanes) { +switch (lanes) {case 1 : val |=PORT_LOGIC_LINK_WIDTH_1_LANES ;break ;drivers/pci/dwc/pcie-designware.h +0
-1@@ -148,7 +148,6 @@ struct dw_pcie_ops {struct dw_pcie {struct device *dev;void __iomem *dbi_base; -u32 lanes;u32 num_viewport;u8 iatu_unroll_enabled;struct pcie_port pp;
Re: [PATCH 09/37] PCI: dwc: designware: Parse *num-lanes* property in dw_pcie_setup_rc
Hi,
Quoted 53 lines · Joao Pinto
Hi,
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 36 lines
*num-lanes* dt property is parsed in
dw_pcie_host_init. However *num-lanes* property is applicable to both root complex mode and endpoint mode. As a first step, move the parsing of this property outsidedw_pcie_host_init. This is in preparation for splittingpcie-designware.ctopcie-designware.candpcie-designware-host.cSigned-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pcie-designware.c | 18 +++++++++++------- drivers/pci/dwc/pcie-designware.h | 1 - 2 files changed, 11 insertions(+), 8 deletions(-)drivers/pci/dwc/pcie-designware.c +3
-4@@ -551,10 +551,6 @@ int dw_pcie_host_init(struct pcie_port *pp) } } - ret =of_property_read_u32 (np,"num-lanes" , &pci->lanes); -if (ret) - pci->lanes =0 ; - ret =of_property_read_u32 (np,"num-viewport" , &pci->num_viewport);if (ret) pci->num_viewport =2 ;@@ -751,18 +747,26 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,void dw_pcie_setup_rc (struct pcie_port *pp) { +int ret; +u32 lanes;u32 val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev;drivers/pci/dwc/pcie-designware.c static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · line 764
Quoted 10 lines
drivers/pci/dwc/pcie-designware.c +4
-0+struct device_node *np = dev->of_node;/* get iATU unroll support */ pci->iatu_unroll_enabled =dw_pcie_iatu_unroll_enabled (pci);dev_dbg (pci->dev,"iATU unroll: %s\n" , pci->iatu_unroll_enabled ?"enabled" :"disabled" ); + ret =of_property_read_u32 (np,"num-lanes" , &lanes); +if (ret) + lanes =0 ;You moved from
host_initto root complex setup function, which in my opinion did not improve (in this scope).
Quoted 3 lines
I suggest that instead of making so much intermediary patches, which is nice to understand your development sequence, but hard to review. Wouldn't be better to condense some of the patches? We would have a cloear vision of the final product :)
I thought the other way. If squashing patches is easier to review, I'll do it.
Btw, thanks for reviewing.
Cheers
Kishon
Re: [PATCH 09/37] PCI: dwc: designware: Parse *num-lanes* property in dw_pcie_setup_rc
Hi,
?s 5:19 AM de 1/16/2017, Kishon Vijay Abraham I escreveu:
Quoted 56 lines
Hi,
Quoted 53 lines · Joao Pinto
Hi,
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 36 lines
*num-lanes* dt property is parsed in
dw_pcie_host_init. However *num-lanes* property is applicable to both root complex mode and endpoint mode. As a first step, move the parsing of this property outsidedw_pcie_host_init. This is in preparation for splittingpcie-designware.ctopcie-designware.candpcie-designware-host.cSigned-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pcie-designware.c | 18 +++++++++++------- drivers/pci/dwc/pcie-designware.h | 1 - 2 files changed, 11 insertions(+), 8 deletions(-)drivers/pci/dwc/pcie-designware.c +3
-4@@ -551,10 +551,6 @@ int dw_pcie_host_init(struct pcie_port *pp) } } - ret =of_property_read_u32 (np,"num-lanes" , &pci->lanes); -if (ret) - pci->lanes =0 ; - ret =of_property_read_u32 (np,"num-viewport" , &pci->num_viewport);if (ret) pci->num_viewport =2 ;@@ -751,18 +747,26 @@ static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn,void dw_pcie_setup_rc (struct pcie_port *pp) { +int ret; +u32 lanes;u32 val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +struct device *dev = pci->dev;drivers/pci/dwc/pcie-designware.c static int dw_pcie_wr_conf(struct pci_bus *bus, u32 devfn, · line 764
Quoted 10 lines
drivers/pci/dwc/pcie-designware.c +4
-0+struct device_node *np = dev->of_node;/* get iATU unroll support */ pci->iatu_unroll_enabled =dw_pcie_iatu_unroll_enabled (pci);dev_dbg (pci->dev,"iATU unroll: %s\n" , pci->iatu_unroll_enabled ?"enabled" :"disabled" ); + ret =of_property_read_u32 (np,"num-lanes" , &lanes); +if (ret) + lanes =0 ;You moved from
host_initto root complex setup function, which in my opinion did not improve (in this scope).
Quoted 5 lines
Quoted 3 lines
I suggest that instead of making so much intermediary patches, which is nice to understand your development sequence, but hard to review. Wouldn't be better to condense some of the patches? We would have a cloear vision of the final product :)
I thought the other way. If squashing patches is easier to review, I'll do it.
I understand. To break it in small pieces is good to understand clearly what is done and how was done, but I would break too much. That's a personal opinion of course, lets see what others say :).
Thanks,
Joao
Quoted 6 lines
Btw, thanks for reviewing.
Cheers
Kishon
PATCH 10/37 PCI: dwc: designware: Fix style errors in pcie-designware.c
In reply to Kishon Vijay Abraham INo functional change. Fix all checkpatch warnings and check errors in pcie-designware.c
--- drivers/pci/dwc/pcie-designware.c | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
drivers/pci/dwc/pcie-designware.c +21 -21
@@ -40,13 +40,13 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val)return PCIBIOS_BAD_REGISTER_NUMBER ; } -if (size ==4 ) +if (size ==4 ) { *val =readl (addr); -else if (size ==2 ) + }else if (size ==2 ) { *val =readw (addr); -else if (size ==1 ) + }else if (size ==1 ) { *val =readb (addr); -else { + }else { *val =0 ;return PCIBIOS_BAD_REGISTER_NUMBER ; }
@@ -203,16 +203,15 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)for (i =0 ; i <MAX_MSI_CTRLS ; i++) {dw_pcie_rd_own_conf (pp,PCIE_MSI_INTR0_STATUS + i *12 ,4 , - (u32 *)&val); + (u32 *)&val);if (val) { ret =IRQ_HANDLED ; pos =0 ;while ((pos =find_next_bit (&val,32 , pos)) !=32 ) { irq =irq_find_mapping (pp->irq_domain, - i *32 + pos); -dw_pcie_wr_own_conf (pp, -PCIE_MSI_INTR0_STATUS + i *12 , -4 ,1 << pos); + i *32 + pos); +dw_pcie_wr_own_conf (pp,PCIE_MSI_INTR0_STATUS + + i *12 ,4 ,1 << pos);generic_handle_irq (irq); pos++; }
@@ -278,8 +277,9 @@ static void dw_pcie_msi_set_irq(struct pcie_port *pp, int irq)static int assign_irq (int no_irqs,struct msi_desc *desc,int *pos) {int irq, pos0, i; -struct pcie_port *pp = (struct pcie_port *)msi_desc_to_pci_sysdata (desc); +struct pcie_port *pp; + pp = (struct pcie_port *)msi_desc_to_pci_sysdata (desc); pos0 =bitmap_find_free_region (pp->msi_irq_in_use,MAX_MSI_IRQS ,order_base_2 (no_irqs));if (pos0 <0 )
@@ -341,7 +341,7 @@ static void dw_msi_setup_msg(struct pcie_port *pp, unsigned int irq, u32 pos) }static int dw_msi_setup_irq (struct msi_controller *chip,struct pci_dev *pdev, -struct msi_desc *desc) +struct msi_desc *desc) {int irq, pos;struct pcie_port *pp = pdev->bus->sysdata;
@@ -389,7 +389,7 @@ static void dw_msi_teardown_irq(struct msi_controller *chip, unsigned int irq) {struct irq_data *data =irq_get_irq_data (irq);struct msi_desc *msi =irq_data_get_msi_desc (data); -struct pcie_port *pp = (struct pcie_port *)msi_desc_to_pci_sysdata (msi); +struct pcie_port *pp = (struct pcie_port *)msi_desc_to_pci_sysdata (msi);clear_irq_range (pp, irq,1 , data->hwirq); }
@@ -431,7 +431,7 @@ int dw_pcie_link_up(struct dw_pcie *pci) }static int dw_pcie_msi_map (struct irq_domain *domain,unsigned int irq, -irq_hw_number_t hwirq) +irq_hw_number_t hwirq) {irq_set_chip_and_handler (irq, &dw_msi_irq_chip, handle_simple_irq);irq_set_chip_data (irq, domain->host_data);
@@ -468,8 +468,8 @@ int dw_pcie_host_init(struct pcie_port *pp) cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" );if (cfg_res) { - pp->cfg0_size =resource_size (cfg_res)/2 ; - pp->cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_size =resource_size (cfg_res) /2 ; + pp->cfg1_size =resource_size (cfg_res) /2 ; pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->cfg0_size; }else if (!pp->va_cfg0_base) {
@@ -508,8 +508,8 @@ int dw_pcie_host_init(struct pcie_port *pp)break ;case 0 : pp->cfg = win->res; - pp->cfg0_size =resource_size (pp->cfg)/2 ; - pp->cfg1_size =resource_size (pp->cfg)/2 ; + pp->cfg0_size =resource_size (pp->cfg) /2 ; + pp->cfg1_size =resource_size (pp->cfg) /2 ; pp->cfg0_base = pp->cfg->start; pp->cfg1_base = pp->cfg->start + pp->cfg0_size;break ;
@@ -615,7 +615,7 @@ int dw_pcie_host_init(struct pcie_port *pp) }static int dw_pcie_rd_other_conf (struct pcie_port *pp,struct pci_bus *bus, -u32 devfn,int where,int size,u32 *val) +u32 devfn,int where,int size,u32 *val) {int ret, type;u32 busdev, cfg_size;
@@ -654,7 +654,7 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, }static int dw_pcie_wr_other_conf (struct pcie_port *pp,struct pci_bus *bus, -u32 devfn,int where,int size,u32 val) +u32 devfn,int where,int size,u32 val) {int ret, type;u32 busdev, cfg_size;
@@ -711,7 +711,7 @@ static int dw_pcie_valid_device(struct pcie_port *pp, struct pci_bus *bus, }static int dw_pcie_rd_conf (struct pci_bus *bus,u32 devfn,int where, -int size,u32 *val) +int size,u32 *val) {struct pcie_port *pp = bus->sysdata;
@@ -727,7 +727,7 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, }static int dw_pcie_wr_conf (struct pci_bus *bus,u32 devfn, -int where,int size,u32 val) +int where,int size,u32 val) {struct pcie_port *pp = bus->sysdata;
Signature · 1 line
1.7.9.5
Re: [PATCH 10/37] PCI: dwc: designware: Fix style errors in pcie-designware.c
?s 10:25 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 140 lines
No functional change. Fix all checkpatch warnings and check errors in
pcie-designware.cSigned-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/pcie-designware.c | 42 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 21 deletions(-)drivers/pci/dwc/pcie-designware.c +20
-20@@ -40,13 +40,13 @@ int dw_pcie_read(void __iomem *addr, int size, u32 *val)return PCIBIOS_BAD_REGISTER_NUMBER ; } -if (size ==4 ) +if (size ==4 ) { *val =readl (addr); -else if (size ==2 ) + }else if (size ==2 ) { *val =readw (addr); -else if (size ==1 ) + }else if (size ==1 ) { *val =readb (addr); -else { + }else { *val =0 ;return PCIBIOS_BAD_REGISTER_NUMBER ; }@@ -203,16 +203,15 @@ irqreturn_t dw_handle_msi_irq(struct pcie_port *pp)for (i =0 ; i <MAX_MSI_CTRLS ; i++) {dw_pcie_rd_own_conf (pp,PCIE_MSI_INTR0_STATUS + i *12 ,4 , - (u32 *)&val); + (u32 *)&val);if (val) { ret =IRQ_HANDLED ; pos =0 ;while ((pos =find_next_bit (&val,32 , pos)) !=32 ) { irq =irq_find_mapping (pp->irq_domain, - i *32 + pos); -dw_pcie_wr_own_conf (pp, -PCIE_MSI_INTR0_STATUS + i *12 , -4 ,1 << pos); + i *32 + pos); +dw_pcie_wr_own_conf (pp,PCIE_MSI_INTR0_STATUS + + i *12 ,4 ,1 << pos);generic_handle_irq (irq); pos++; }@@ -278,8 +277,9 @@ static void dw_pcie_msi_set_irq(struct pcie_port *pp, int irq)static int assign_irq (int no_irqs,struct msi_desc *desc,int *pos) {int irq, pos0, i; -struct pcie_port *pp = (struct pcie_port *)msi_desc_to_pci_sysdata (desc); +struct pcie_port *pp; + pp = (struct pcie_port *)msi_desc_to_pci_sysdata (desc); pos0 =bitmap_find_free_region (pp->msi_irq_in_use,MAX_MSI_IRQS ,order_base_2 (no_irqs));if (pos0 <0 )@@ -341,7 +341,7 @@ static void dw_msi_setup_msg(struct pcie_port *pp, unsigned int irq, u32 pos) }static int dw_msi_setup_irq (struct msi_controller *chip,struct pci_dev *pdev, -struct msi_desc *desc) +struct msi_desc *desc) {int irq, pos;struct pcie_port *pp = pdev->bus->sysdata;@@ -389,7 +389,7 @@ static void dw_msi_teardown_irq(struct msi_controller *chip, unsigned int irq) {struct irq_data *data =irq_get_irq_data (irq);struct msi_desc *msi =irq_data_get_msi_desc (data); -struct pcie_port *pp = (struct pcie_port *)msi_desc_to_pci_sysdata (msi); +struct pcie_port *pp = (struct pcie_port *)msi_desc_to_pci_sysdata (msi);clear_irq_range (pp, irq,1 , data->hwirq); }@@ -431,7 +431,7 @@ int dw_pcie_link_up(struct dw_pcie *pci) }static int dw_pcie_msi_map (struct irq_domain *domain,unsigned int irq, -irq_hw_number_t hwirq) +irq_hw_number_t hwirq) {irq_set_chip_and_handler (irq, &dw_msi_irq_chip, handle_simple_irq);irq_set_chip_data (irq, domain->host_data);@@ -468,8 +468,8 @@ int dw_pcie_host_init(struct pcie_port *pp) cfg_res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"config" );if (cfg_res) { - pp->cfg0_size =resource_size (cfg_res)/2 ; - pp->cfg1_size =resource_size (cfg_res)/2 ; + pp->cfg0_size =resource_size (cfg_res) /2 ; + pp->cfg1_size =resource_size (cfg_res) /2 ; pp->cfg0_base = cfg_res->start; pp->cfg1_base = cfg_res->start + pp->cfg0_size; }else if (!pp->va_cfg0_base) {@@ -508,8 +508,8 @@ int dw_pcie_host_init(struct pcie_port *pp)break ;case 0 : pp->cfg = win->res; - pp->cfg0_size =resource_size (pp->cfg)/2 ; - pp->cfg1_size =resource_size (pp->cfg)/2 ; + pp->cfg0_size =resource_size (pp->cfg) /2 ; + pp->cfg1_size =resource_size (pp->cfg) /2 ; pp->cfg0_base = pp->cfg->start; pp->cfg1_base = pp->cfg->start + pp->cfg0_size;break ;@@ -615,7 +615,7 @@ int dw_pcie_host_init(struct pcie_port *pp) }static int dw_pcie_rd_other_conf (struct pcie_port *pp,struct pci_bus *bus, -u32 devfn,int where,int size,u32 *val) +u32 devfn,int where,int size,u32 *val) {int ret, type;u32 busdev, cfg_size;@@ -654,7 +654,7 @@ static int dw_pcie_rd_other_conf(struct pcie_port *pp, struct pci_bus *bus, }static int dw_pcie_wr_other_conf (struct pcie_port *pp,struct pci_bus *bus, -u32 devfn,int where,int size,u32 val) +u32 devfn,int where,int size,u32 val) {int ret, type;u32 busdev, cfg_size;@@ -711,7 +711,7 @@ static int dw_pcie_valid_device(struct pcie_port *pp, struct pci_bus *bus, }static int dw_pcie_rd_conf (struct pci_bus *bus,u32 devfn,int where, -int size,u32 *val) +int size,u32 *val) {struct pcie_port *pp = bus->sysdata;
drivers/pci/dwc/pcie-designware.c static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, · line 733
Quoted 8 lines
drivers/pci/dwc/pcie-designware.c +1
-1@@ -727,7 +727,7 @@ static int dw_pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, }static int dw_pcie_wr_conf (struct pci_bus *bus,u32 devfn, -int where,int size,u32 val) +int where,int size,u32 val) {struct pcie_port *pp = bus->sysdata;
Always good to make clean up! Thanks!
PATCH 11/37 PCI: dwc: Split pcie-designware.c into host and core files
In reply to Kishon Vijay Abraham ISplit pcie-designware.c into pcie-designware-host.c that contains the host specific parts of the driver and pcie-designware.c that contains the parts used by both host driver and endpoint driver.
--- drivers/pci/dwc/Makefile | 2 +- drivers/pci/dwc/pcie-designware-host.c | 619 ++++++++++++++++++++++++++++++++ drivers/pci/dwc/pcie-designware.c | 613 +------------------------------ drivers/pci/dwc/pcie-designware.h | 8 + 4 files changed, 634 insertions(+), 608 deletions(-) create mode 100644 drivers/pci/dwc/pcie-designware-host.c
drivers/pci/dwc/Makefile +1 -1
@@ -1,4 +1,4 @@ -obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW) += pcie-designware.o pcie-designware-host.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-host.c new file +619 -0
619 lines not on this page · raw message
drivers/pci/dwc/pcie-designware.c +6 -607
657 lines not on this page · raw message
drivers/pci/dwc/pcie-designware.h +8 -0
@@ -14,6 +14,10 @@#ifndef _PCIE_DESIGNWARE_H#define _PCIE_DESIGNWARE_H +#include <linux/irq.h> +#include <linux/msi.h> +#include <linux/pci.h> +/* Parameters for the waiting for link up routine */ #define LINK_WAIT_MAX_RETRIES 10#define LINK_WAIT_USLEEP_MIN 90000
@@ -167,4 +171,8 @@ struct dw_pcie {void dw_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val);int dw_pcie_link_up (struct dw_pcie *pci);int dw_pcie_wait_for_link (struct dw_pcie *pci); +void dw_pcie_prog_outbound_atu (struct dw_pcie *pci,int index, +int type,u64 cpu_addr,u64 pci_addr, +u32 size); +void dw_pcie_setup (struct dw_pcie *pci);#endif /* _PCIE_DESIGNWARE_H */
Signature · 1 line
1.7.9.5
Re: [PATCH 11/37] PCI: dwc: Split pcie-designware.c into host and core files
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 18 lines
Split
pcie-designware.cintopcie-designware-host.cthat contains the host specific parts of the driver andpcie-designware.cthat contains the parts used by both host driver and endpoint driver.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Makefile | 2 +- drivers/pci/dwc/pcie-designware-host.c | 619 ++++++++++++++++++++++++++++++++ drivers/pci/dwc/pcie-designware.c | 613 +------------------------------ drivers/pci/dwc/pcie-designware.h | 8 + 4 files changed, 634 insertions(+), 608 deletions(-) create mode 100644 drivers/pci/dwc/pcie-designware-host.cdrivers/pci/dwc/Makefile +0
-0@@ -1,4 +1,4 @@
(snip...)
drivers/pci/dwc/Makefile static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, · line 152
Quoted 11 lines
drivers/pci/dwc/Makefile +2
-3-static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, - int type, u64 cpu_addr, u64 pci_addr, - u32 size) +void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, + u64 cpu_addr, u64 pci_addr, u32 size) { u32 retries, val;@@ -186,220 +151,6 @@ static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, dev_err(pci->dev, "iATU is not being enabled\n"); }
Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host.
Quoted 9 lines
drivers/pci/dwc/Makefile +0
-8-static struct irq_chip dw_msi_irq_chip = { - .name = "PCI-MSI", - .irq_enable = pci_msi_unmask_irq, - .irq_disable = pci_msi_mask_irq, - .irq_mask = pci_msi_mask_irq, - .irq_unmask = pci_msi_unmask_irq, -}; -
(snip...)
drivers/pci/dwc/Makefile static u8 dw_pcie_iatu_unroll_enabled(struct dw_pcie *pci) · line 193
Quoted 11 lines
drivers/pci/dwc/Makefile +0
-5- -static const struct irq_domain_ops msi_domain_ops = { - .map = dw_pcie_msi_map, -}; - static u8 dw_pcie_iatu_unroll_enabled(struct dw_pcie *pci) { u32 val;@@ -454,303 +192,11 @@ static u8 dw_pcie_iatu_unroll_enabled(struct dw_pcie *pci) return 0; }
Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host.
(snip...)
Quoted 16 lines
drivers/pci/dwc/pcie-designware.h +4
-0@@ -14,6 +14,10 @@#ifndef _PCIE_DESIGNWARE_H#define _PCIE_DESIGNWARE_H +#include <linux/irq.h> +#include <linux/msi.h> +#include <linux/pci.h> +/* Parameters for the waiting for link up routine */ #define LINK_WAIT_MAX_RETRIES 10#define LINK_WAIT_USLEEP_MIN 90000
drivers/pci/dwc/pcie-designware.h struct dw_pcie { · line 177
Quoted 7 lines
drivers/pci/dwc/pcie-designware.h +4
-0@@ -167,4 +171,8 @@ struct dw_pcie {void dw_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val);int dw_pcie_link_up (struct dw_pcie *pci);int dw_pcie_wait_for_link (struct dw_pcie *pci); +void dw_pcie_prog_outbound_atu (struct dw_pcie *pci,int index, +int type,u64 cpu_addr,u64 pci_addr, +u32 size); +void dw_pcie_setup (struct dw_pcie *pci);
Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host as static.
drivers/pci/dwc/pcie-designware.h struct dw_pcie { · line 178
Quoted 2 lines
drivers/pci/dwc/pcie-designware.h +0
-0#endif /* _PCIE_DESIGNWARE_H */
Thanks,
Joao
Re: [PATCH 11/37] PCI: dwc: Split pcie-designware.c into host and core files
Hi Joao,
Quoted 30 lines · Joao Pinto
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 18 lines
Split
pcie-designware.cintopcie-designware-host.cthat contains the host specific parts of the driver andpcie-designware.cthat contains the parts used by both host driver and endpoint driver.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Makefile | 2 +- drivers/pci/dwc/pcie-designware-host.c | 619 ++++++++++++++++++++++++++++++++ drivers/pci/dwc/pcie-designware.c | 613 +------------------------------ drivers/pci/dwc/pcie-designware.h | 8 + 4 files changed, 634 insertions(+), 608 deletions(-) create mode 100644 drivers/pci/dwc/pcie-designware-host.cdrivers/pci/dwc/Makefile +0
-0@@ -1,4 +1,4 @@(snip...)
Quoted 8 lines
drivers/pci/dwc/Makefile +2
-3-static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, - int type, u64 cpu_addr, u64 pci_addr, - u32 size) +void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, + u64 cpu_addr, u64 pci_addr, u32 size) { u32 retries, val;
Quoted 6 lines
drivers/pci/dwc/Makefile static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, · line 152
Quoted 3 lines
drivers/pci/dwc/Makefile +0
-0@@ -186,220 +151,6 @@ static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, dev_err(pci->dev, "iATU is not being enabled\n"); }Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host.
That is not true. Outbound ATU should be programmed to access host side buffers and inbound ATU should be programmed for the host to access EP mem space.
Thanks
Kishon
Re: [PATCH 11/37] PCI: dwc: Split pcie-designware.c into host and core files
Hi,
?s 5:21 AM de 1/16/2017, Kishon Vijay Abraham I escreveu:
Quoted 40 lines
Hi Joao,
Quoted 30 lines · Joao Pinto
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 18 lines
Split
pcie-designware.cintopcie-designware-host.cthat contains the host specific parts of the driver andpcie-designware.cthat contains the parts used by both host driver and endpoint driver.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Makefile | 2 +- drivers/pci/dwc/pcie-designware-host.c | 619 ++++++++++++++++++++++++++++++++ drivers/pci/dwc/pcie-designware.c | 613 +------------------------------ drivers/pci/dwc/pcie-designware.h | 8 + 4 files changed, 634 insertions(+), 608 deletions(-) create mode 100644 drivers/pci/dwc/pcie-designware-host.cdrivers/pci/dwc/Makefile +0
-0@@ -1,4 +1,4 @@(snip...)
Quoted 8 lines
drivers/pci/dwc/Makefile +2
-3-static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, - int type, u64 cpu_addr, u64 pci_addr, - u32 size) +void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, + u64 cpu_addr, u64 pci_addr, u32 size) { u32 retries, val;Quoted 6 lines
drivers/pci/dwc/Makefile static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, · line 152
Quoted 3 lines
drivers/pci/dwc/Makefile +0
-0@@ -186,220 +151,6 @@ static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, dev_err(pci->dev, "iATU is not being enabled\n"); }Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host.
Quoted 2 lines
That is not true. Outbound ATU should be programmed to access host side buffers and inbound ATU should be programmed for the host to access EP mem space.
Sorry, I was not clear enough. What I was trying to suggest is, since the ATU programming is done by the host, wouldn't be better to include it in the pcie-designware-host? It is just an architectural detail.
Quoted 4 lines
Thanks
Kishon
Re: [PATCH 11/37] PCI: dwc: Split pcie-designware.c into host and core files
Hi Joao,
Quoted 44 lines · Joao Pinto
Hi,
?s 5:21 AM de 1/16/2017, Kishon Vijay Abraham I escreveu:
Quoted 40 lines
Hi Joao,
Quoted 36 lines · Joao Pinto
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 18 lines
Split
pcie-designware.cintopcie-designware-host.cthat contains the host specific parts of the driver andpcie-designware.cthat contains the parts used by both host driver and endpoint driver.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Makefile | 2 +- drivers/pci/dwc/pcie-designware-host.c | 619 ++++++++++++++++++++++++++++++++ drivers/pci/dwc/pcie-designware.c | 613 +------------------------------ drivers/pci/dwc/pcie-designware.h | 8 + 4 files changed, 634 insertions(+), 608 deletions(-) create mode 100644 drivers/pci/dwc/pcie-designware-host.cdrivers/pci/dwc/Makefile +0
-0@@ -1,4 +1,4 @@(snip...)
drivers/pci/dwc/Makefile static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, · line 152
Quoted 11 lines
drivers/pci/dwc/Makefile +2
-3-static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, - int type, u64 cpu_addr, u64 pci_addr, - u32 size) +void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, + u64 cpu_addr, u64 pci_addr, u32 size) { u32 retries, val;@@ -186,220 +151,6 @@ static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, dev_err(pci->dev, "iATU is not being enabled\n"); }Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host.
Quoted 6 lines
Quoted 2 lines
That is not true. Outbound ATU should be programmed to access host side buffers and inbound ATU should be programmed for the host to access EP mem space.
Sorry, I was not clear enough. What I was trying to suggest is, since the ATU programming is done by the host, wouldn't be better to include it in the pcie-designware-host? It is just an architectural detail.
ATU programming is required in EP mode. See "[PATCH 24/37] PCI: dwc:
designware: Add EP mode support" in this patch series.
Anything that's required by both EP mode and RC mode, I've placed in pcie-designware.c
Thanks
Kishon
Re: [PATCH 11/37] PCI: dwc: Split pcie-designware.c into host and core files
?s 11:30 AM de 1/16/2017, Kishon Vijay Abraham I escreveu:
Quoted 54 lines
Hi Joao,
Quoted 44 lines · Joao Pinto
Hi,
?s 5:21 AM de 1/16/2017, Kishon Vijay Abraham I escreveu:
Quoted 40 lines
Hi Joao,
Quoted 36 lines · Joao Pinto
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 18 lines
Split
pcie-designware.cintopcie-designware-host.cthat contains the host specific parts of the driver andpcie-designware.cthat contains the parts used by both host driver and endpoint driver.Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Makefile | 2 +- drivers/pci/dwc/pcie-designware-host.c | 619 ++++++++++++++++++++++++++++++++ drivers/pci/dwc/pcie-designware.c | 613 +------------------------------ drivers/pci/dwc/pcie-designware.h | 8 + 4 files changed, 634 insertions(+), 608 deletions(-) create mode 100644 drivers/pci/dwc/pcie-designware-host.cdrivers/pci/dwc/Makefile +0
-0@@ -1,4 +1,4 @@(snip...)
drivers/pci/dwc/Makefile static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, · line 152
Quoted 11 lines
drivers/pci/dwc/Makefile +2
-3-static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, - int type, u64 cpu_addr, u64 pci_addr, - u32 size) +void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, + u64 cpu_addr, u64 pci_addr, u32 size) { u32 retries, val;@@ -186,220 +151,6 @@ static void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, dev_err(pci->dev, "iATU is not being enabled\n"); }Kishon, iATU only makes sense in The Root Complex (host), so it should be inside the pcie-designware-host.
Quoted 6 lines
Quoted 2 lines
That is not true. Outbound ATU should be programmed to access host side buffers and inbound ATU should be programmed for the host to access EP mem space.
Sorry, I was not clear enough. What I was trying to suggest is, since the ATU programming is done by the host, wouldn't be better to include it in the pcie-designware-host? It is just an architectural detail.
Quoted 5 lines
ATU programming is required in EP mode. See "[PATCH 24/37] PCI: dwc:
designware: Add EP mode support" in this patch series.Anything that's required by both EP mode and RC mode, I've placed in
pcie-designware.c
Agreed!
Quoted 4 lines
Thanks
Kishon
PATCH 12/37 PCI: dwc: Create a new config symbol to enable pci dwc host
In reply to Kishon Vijay Abraham INow that pci designware host has a separate file, create a new config symbol to select the host only driver. This is in preparation to enable endpoint support to designware driver.
--- drivers/pci/dwc/Kconfig | 26 +++++++++++++++----------- drivers/pci/dwc/Makefile | 3 ++- drivers/pci/dwc/pcie-designware.h | 29 +++++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 16 deletions(-)
drivers/pci/dwc/Kconfig +15 -11
@@ -3,13 +3,17 @@ menu "DesignWare PCI Core Support" config PCIE_DW bool + +config PCIE_DW_HOST + bool depends on PCI_MSI_IRQ_DOMAIN + select PCIE_DW config PCI_DRA7XX bool "TI DRA7xx PCIe controller" depends on OF && HAS_IOMEM && TI_PIPE3 depends on PCI_MSI_IRQ_DOMAIN - select PCIE_DW + select PCIE_DW_HOST help Enables support for the PCIe controller in the DRA7xx SoC. There are two instances of PCIe controller in DRA7xx. This controller can
@@ -18,7 +22,7 @@ config PCI_DRA7XX config PCIE_DW_PLAT bool "Platform bus based DesignWare PCIe Controller" depends on PCI_MSI_IRQ_DOMAIN - select PCIE_DW + select PCIE_DW_HOST ---help--- This selects the DesignWare PCIe controller support. Select this if you have a PCIe controller on Platform bus.
@@ -32,21 +36,21 @@ config PCI_EXYNOS depends on SOC_EXYNOS5440 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCI_IMX6 bool "Freescale i.MX6 PCIe controller" depends on SOC_IMX6Q || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCIE_SPEAR13XX bool "STMicroelectronics SPEAr PCIe controller" depends on ARCH_SPEAR13XX || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe support on SPEAr13XX SoCs.
@@ -55,7 +59,7 @@ config PCI_KEYSTONE depends on ARCH_KEYSTONE || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want to enable PCI controller support on Keystone SoCs. The PCI controller on Keystone is based on Designware hardware
@@ -67,7 +71,7 @@ config PCI_LAYERSCAPE depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN select MFD_SYSCON - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on Layerscape SoCs.
@@ -76,7 +80,7 @@ config PCI_HISI bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers" depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on HiSilicon Hip05 and Hip06 SoCs
@@ -86,7 +90,7 @@ config PCIE_QCOM depends on (ARCH_QCOM || COMPILE_TEST) && OF depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here to enable PCIe controller support on Qualcomm SoCs. The PCIe controller uses the Designware core plus Qualcomm-specific
@@ -97,7 +101,7 @@ config PCIE_ARMADA_8K depends on ARCH_MVEBU || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want to enable PCIe controller support on Armada-8K SoCs. The PCIe controller on Armada-8K is based on
@@ -109,7 +113,7 @@ config PCIE_ARTPEC6 depends on MACH_ARTPEC6 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here to enable PCIe controller support on Axis ARTPEC-6 SoCs. This PCIe controller uses the DesignWare core.
drivers/pci/dwc/Makefile +2 -1
@@ -1,4 +1,5 @@ -obj-$(CONFIG_PCIE_DW) += pcie-designware.o pcie-designware-host.o +obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.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.h +25 -4
@@ -162,10 +162,6 @@ struct dw_pcie {int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val); -irqreturn_t dw_handle_msi_irq (struct pcie_port *pp); -void dw_pcie_msi_init (struct pcie_port *pp); -void dw_pcie_setup_rc (struct pcie_port *pp); -int dw_pcie_host_init (struct pcie_port *pp);u32 dw_pcie_readl_dbi (struct dw_pcie *pci,u32 reg);void dw_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val);
@@ -175,4 +171,29 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, u64 cpu_addr, u64 pci_addr, u32 size);void dw_pcie_setup (struct dw_pcie *pci); + +#ifdef CONFIG_PCIE_DW_HOST +irqreturn_t dw_handle_msi_irq (struct pcie_port *pp); +void dw_pcie_msi_init (struct pcie_port *pp); +void dw_pcie_setup_rc (struct pcie_port *pp); +int dw_pcie_host_init (struct pcie_port *pp); +#else +static inline irqreturn_t dw_handle_msi_irq (struct pcie_port *pp) +{ +return IRQ_NONE ; +} + +static inline void dw_pcie_msi_init (struct pcie_port *pp) +{ +} + +static inline void dw_pcie_setup_rc (struct pcie_port *pp) +{ +} + +static inline int dw_pcie_host_init (struct pcie_port *pp) +{ +return 0 ; +} +#endif #endif /* _PCIE_DESIGNWARE_H */
Signature · 1 line
1.7.9.5
Re: [PATCH 12/37] PCI: dwc: Create a new config symbol to enable pci dwc host
Hi Kishon,
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 11 lines
Now that pci designware host has a separate file, create a new config symbol to select the host only driver. This is in preparation to enable endpoint support to designware driver.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Kconfig | 26 +++++++++++++++----------- drivers/pci/dwc/Makefile | 3 ++- drivers/pci/dwc/pcie-designware.h | 29 +++++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 16 deletions(-)
You are already working in a base where dwc/ already exists. I know you made a rename / re-structure patch for pci, but I think it was not yet accepted, right? I don't see it in any of Bjorn' dev branches.
Thanks.
Quoted 168 lines
drivers/pci/dwc/Kconfig +15
-11@@ -3,13 +3,17 @@ menu "DesignWare PCI Core Support" config PCIE_DW bool + +config PCIE_DW_HOST + bool depends on PCI_MSI_IRQ_DOMAIN + select PCIE_DW config PCI_DRA7XX bool "TI DRA7xx PCIe controller" depends on OF && HAS_IOMEM && TI_PIPE3 depends on PCI_MSI_IRQ_DOMAIN - select PCIE_DW + select PCIE_DW_HOST help Enables support for the PCIe controller in the DRA7xx SoC. There are two instances of PCIe controller in DRA7xx. This controller can@@ -18,7 +22,7 @@ config PCI_DRA7XX config PCIE_DW_PLAT bool "Platform bus based DesignWare PCIe Controller" depends on PCI_MSI_IRQ_DOMAIN - select PCIE_DW + select PCIE_DW_HOST ---help--- This selects the DesignWare PCIe controller support. Select this if you have a PCIe controller on Platform bus.@@ -32,21 +36,21 @@ config PCI_EXYNOS depends on SOC_EXYNOS5440 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCI_IMX6 bool "Freescale i.MX6 PCIe controller" depends on SOC_IMX6Q || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCIE_SPEAR13XX bool "STMicroelectronics SPEAr PCIe controller" depends on ARCH_SPEAR13XX || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe support on SPEAr13XX SoCs.@@ -55,7 +59,7 @@ config PCI_KEYSTONE depends on ARCH_KEYSTONE || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want to enable PCI controller support on Keystone SoCs. The PCI controller on Keystone is based on Designware hardware@@ -67,7 +71,7 @@ config PCI_LAYERSCAPE depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN select MFD_SYSCON - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on Layerscape SoCs.@@ -76,7 +80,7 @@ config PCI_HISI bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers" depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on HiSilicon Hip05 and Hip06 SoCs@@ -86,7 +90,7 @@ config PCIE_QCOM depends on (ARCH_QCOM || COMPILE_TEST) && OF depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here to enable PCIe controller support on Qualcomm SoCs. The PCIe controller uses the Designware core plus Qualcomm-specific@@ -97,7 +101,7 @@ config PCIE_ARMADA_8K depends on ARCH_MVEBU || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want to enable PCIe controller support on Armada-8K SoCs. The PCIe controller on Armada-8K is based on@@ -109,7 +113,7 @@ config PCIE_ARTPEC6 depends on MACH_ARTPEC6 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here to enable PCIe controller support on Axis ARTPEC-6 SoCs. This PCIe controller uses the DesignWare core.drivers/pci/dwc/Makefile +2
-1@@ -1,4 +1,5 @@ -obj-$(CONFIG_PCIE_DW) += pcie-designware.o pcie-designware-host.o +obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.odrivers/pci/dwc/pcie-designware.h +25
-4@@ -162,10 +162,6 @@ struct dw_pcie {int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val); -irqreturn_t dw_handle_msi_irq (struct pcie_port *pp); -void dw_pcie_msi_init (struct pcie_port *pp); -void dw_pcie_setup_rc (struct pcie_port *pp); -int dw_pcie_host_init (struct pcie_port *pp);u32 dw_pcie_readl_dbi (struct dw_pcie *pci,u32 reg);void dw_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val);@@ -175,4 +171,29 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, u64 cpu_addr, u64 pci_addr, u32 size);void dw_pcie_setup (struct dw_pcie *pci); + +#ifdef CONFIG_PCIE_DW_HOST +irqreturn_t dw_handle_msi_irq (struct pcie_port *pp); +void dw_pcie_msi_init (struct pcie_port *pp); +void dw_pcie_setup_rc (struct pcie_port *pp); +int dw_pcie_host_init (struct pcie_port *pp); +#else +static inline irqreturn_t dw_handle_msi_irq (struct pcie_port *pp) +{ +return IRQ_NONE ; +} + +static inline void dw_pcie_msi_init (struct pcie_port *pp) +{ +} + +static inline void dw_pcie_setup_rc (struct pcie_port *pp) +{ +} + +static inline int dw_pcie_host_init (struct pcie_port *pp) +{ +return 0 ; +} +#endif #endif /* _PCIE_DESIGNWARE_H */
Re: [PATCH 12/37] PCI: dwc: Create a new config symbol to enable pci dwc host
Hi Joao,
Quoted 15 lines · Joao Pinto
Hi Kishon,
?s 10:26 AM de 1/12/2017, Kishon Vijay Abraham I escreveu:
Quoted 11 lines
Now that pci designware host has a separate file, create a new config symbol to select the host only driver. This is in preparation to enable endpoint support to designware driver.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- drivers/pci/dwc/Kconfig | 26 +++++++++++++++----------- drivers/pci/dwc/Makefile | 3 ++- drivers/pci/dwc/pcie-designware.h | 29 +++++++++++++++++++++++++---- 3 files changed, 42 insertions(+), 16 deletions(-)
Quoted 3 lines
You are already working in a base where dwc/ already exists. I know you made a rename / re-structure patch for pci, but I think it was not yet accepted, right? I don't see it in any of Bjorn' dev branches.
He said he'll merge that a little later.
Thanks
Kishon
Quoted 172 lines
Thanks.
Quoted 168 lines
drivers/pci/dwc/Kconfig +15
-11@@ -3,13 +3,17 @@ menu "DesignWare PCI Core Support" config PCIE_DW bool + +config PCIE_DW_HOST + bool depends on PCI_MSI_IRQ_DOMAIN + select PCIE_DW config PCI_DRA7XX bool "TI DRA7xx PCIe controller" depends on OF && HAS_IOMEM && TI_PIPE3 depends on PCI_MSI_IRQ_DOMAIN - select PCIE_DW + select PCIE_DW_HOST help Enables support for the PCIe controller in the DRA7xx SoC. There are two instances of PCIe controller in DRA7xx. This controller can@@ -18,7 +22,7 @@ config PCI_DRA7XX config PCIE_DW_PLAT bool "Platform bus based DesignWare PCIe Controller" depends on PCI_MSI_IRQ_DOMAIN - select PCIE_DW + select PCIE_DW_HOST ---help--- This selects the DesignWare PCIe controller support. Select this if you have a PCIe controller on Platform bus.@@ -32,21 +36,21 @@ config PCI_EXYNOS depends on SOC_EXYNOS5440 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCI_IMX6 bool "Freescale i.MX6 PCIe controller" depends on SOC_IMX6Q || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST config PCIE_SPEAR13XX bool "STMicroelectronics SPEAr PCIe controller" depends on ARCH_SPEAR13XX || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe support on SPEAr13XX SoCs.@@ -55,7 +59,7 @@ config PCI_KEYSTONE depends on ARCH_KEYSTONE || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want to enable PCI controller support on Keystone SoCs. The PCI controller on Keystone is based on Designware hardware@@ -67,7 +71,7 @@ config PCI_LAYERSCAPE depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN select MFD_SYSCON - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on Layerscape SoCs.@@ -76,7 +80,7 @@ config PCI_HISI bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers" depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want PCIe controller support on HiSilicon Hip05 and Hip06 SoCs@@ -86,7 +90,7 @@ config PCIE_QCOM depends on (ARCH_QCOM || COMPILE_TEST) && OF depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here to enable PCIe controller support on Qualcomm SoCs. The PCIe controller uses the Designware core plus Qualcomm-specific@@ -97,7 +101,7 @@ config PCIE_ARMADA_8K depends on ARCH_MVEBU || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here if you want to enable PCIe controller support on Armada-8K SoCs. The PCIe controller on Armada-8K is based on@@ -109,7 +113,7 @@ config PCIE_ARTPEC6 depends on MACH_ARTPEC6 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS - select PCIE_DW + select PCIE_DW_HOST help Say Y here to enable PCIe controller support on Axis ARTPEC-6 SoCs. This PCIe controller uses the DesignWare core.drivers/pci/dwc/Makefile +2
-1@@ -1,4 +1,5 @@ -obj-$(CONFIG_PCIE_DW) += pcie-designware.o pcie-designware-host.o +obj-$(CONFIG_PCIE_DW) += pcie-designware.o +obj-$(CONFIG_PCIE_DW_HOST) += pcie-designware-host.o obj-$(CONFIG_PCIE_DW_PLAT) += pcie-designware-plat.o obj-$(CONFIG_PCI_DRA7XX) += pci-dra7xx.o obj-$(CONFIG_PCI_EXYNOS) += pci-exynos.odrivers/pci/dwc/pcie-designware.h +25
-4@@ -162,10 +162,6 @@ struct dw_pcie {int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val); -irqreturn_t dw_handle_msi_irq (struct pcie_port *pp); -void dw_pcie_msi_init (struct pcie_port *pp); -void dw_pcie_setup_rc (struct pcie_port *pp); -int dw_pcie_host_init (struct pcie_port *pp);u32 dw_pcie_readl_dbi (struct dw_pcie *pci,u32 reg);void dw_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val);@@ -175,4 +171,29 @@ void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index, int type, u64 cpu_addr, u64 pci_addr, u32 size);void dw_pcie_setup (struct dw_pcie *pci); + +#ifdef CONFIG_PCIE_DW_HOST +irqreturn_t dw_handle_msi_irq (struct pcie_port *pp); +void dw_pcie_msi_init (struct pcie_port *pp); +void dw_pcie_setup_rc (struct pcie_port *pp); +int dw_pcie_host_init (struct pcie_port *pp); +#else +static inline irqreturn_t dw_handle_msi_irq (struct pcie_port *pp) +{ +return IRQ_NONE ; +} + +static inline void dw_pcie_msi_init (struct pcie_port *pp) +{ +} + +static inline void dw_pcie_setup_rc (struct pcie_port *pp) +{ +} + +static inline int dw_pcie_host_init (struct pcie_port *pp) +{ +return 0 ; +} +#endif #endif /* _PCIE_DESIGNWARE_H */
PATCH 13/37 PCI: dwc: Remove dependency of designware to CONFIG_PCI
In reply to Kishon Vijay Abraham ICONFIG_PCI is used to enable the host mode PCI. In preparation for adding endpoint mode support to designware driver, remove the dependency of designware to CONFIG_PCI and make only the host specific part depend on CONFIG_PCI.
--- drivers/Makefile | 3 +++ drivers/pci/Makefile | 3 --- drivers/pci/dwc/Kconfig | 13 ++++++++++++- 3 files changed, 15 insertions(+), 4 deletions(-)
drivers/Makefile +3 -0
@@ -15,6 +15,9 @@ obj-$(CONFIG_PINCTRL) += pinctrl/ obj-$(CONFIG_GPIOLIB) += gpio/ obj-y += pwm/ obj-$(CONFIG_PCI) += pci/ +# PCI dwc controller drivers +obj-y += pci/dwc/ + obj-$(CONFIG_PARISC) += parisc/ obj-$(CONFIG_RAPIDIO) += rapidio/ obj-y += video/
drivers/pci/Makefile +0 -3
@@ -66,8 +66,5 @@ obj-$(CONFIG_OF) += of.o ccflags-$(CONFIG_PCI_DEBUG) := -DDEBUG -# PCI dwc controller drivers -obj-y += dwc/ - # PCI host controller drivers obj-y += host/
drivers/pci/dwc/Kconfig +12 -1
@@ -1,16 +1,17 @@ menu "DesignWare PCI Core Support" - depends on PCI config PCIE_DW bool config PCIE_DW_HOST bool + depends on PCI depends on PCI_MSI_IRQ_DOMAIN select PCIE_DW config PCI_DRA7XX bool "TI DRA7xx PCIe controller" + depends on PCI depends on OF && HAS_IOMEM && TI_PIPE3 depends on PCI_MSI_IRQ_DOMAIN select PCIE_DW_HOST
@@ -21,6 +22,7 @@ config PCI_DRA7XX config PCIE_DW_PLAT bool "Platform bus based DesignWare PCIe Controller" + depends on PCI depends on PCI_MSI_IRQ_DOMAIN select PCIE_DW_HOST ---help---
@@ -33,6 +35,7 @@ config PCIE_DW_PLAT config PCI_EXYNOS bool "Samsung Exynos PCIe controller" + depends on PCI depends on SOC_EXYNOS5440 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
@@ -40,6 +43,7 @@ config PCI_EXYNOS config PCI_IMX6 bool "Freescale i.MX6 PCIe controller" + depends on PCI depends on SOC_IMX6Q || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
@@ -47,6 +51,7 @@ config PCI_IMX6 config PCIE_SPEAR13XX bool "STMicroelectronics SPEAr PCIe controller" + depends on PCI depends on ARCH_SPEAR13XX || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
@@ -56,6 +61,7 @@ config PCIE_SPEAR13XX config PCI_KEYSTONE bool "TI Keystone PCIe controller" + depends on PCI depends on ARCH_KEYSTONE || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
@@ -68,6 +74,7 @@ config PCI_KEYSTONE config PCI_LAYERSCAPE bool "Freescale Layerscape PCIe controller" + depends on PCI depends on OF && (ARM || ARCH_LAYERSCAPE || COMPILE_TEST) depends on PCI_MSI_IRQ_DOMAIN select MFD_SYSCON
@@ -78,6 +85,7 @@ config PCI_LAYERSCAPE config PCI_HISI depends on OF && ARM64 bool "HiSilicon Hip05 and Hip06 SoCs PCIe controllers" + depends on PCI depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS select PCIE_DW_HOST
@@ -87,6 +95,7 @@ config PCI_HISI config PCIE_QCOM bool "Qualcomm PCIe controller" + depends on PCI depends on (ARCH_QCOM || COMPILE_TEST) && OF depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
@@ -98,6 +107,7 @@ config PCIE_QCOM config PCIE_ARMADA_8K bool "Marvell Armada-8K PCIe controller" + depends on PCI depends on ARCH_MVEBU || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
@@ -110,6 +120,7 @@ config PCIE_ARMADA_8K config PCIE_ARTPEC6 bool "Axis ARTPEC-6 PCIe controller" + depends on PCI depends on MACH_ARTPEC6 || COMPILE_TEST depends on PCI_MSI_IRQ_DOMAIN select PCIEPORTBUS
Signature · 1 line
1.7.9.5
PATCH 14/37 PCI: endpoint: Add EP core layer to enable EP controller and EP functions
In reply to Kishon Vijay Abraham IIntroduce 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 | 21 ++ drivers/pci/endpoint/Makefile | 6 + drivers/pci/endpoint/pci-epc-core.c | 548 +++++++++++++++++++++++++++++++++++ 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 | 141 +++++++++ include/linux/pci-epf.h | 160 ++++++++++ 10 files changed, 1379 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
@@ -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
@@ -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 +21 -0
@@ -0,0 +1,21 @@ +# +# PCI Endpoint Support +# + +menu "PCI Endpoint" + +config PCI_ENDPOINT + bool "PCI Endpoint Support" + select CONFIGFS_FS + 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
@@ -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 +548 -0
548 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
@@ -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 +141 -0
141 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
1.7.9.5
PATCH 15/37 Documentation: PCI: Guide to use PCI Endpoint Core Layer
In reply to Kishon Vijay Abraham IAdd 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 | 190 +++++++++++++++++++++++++++ 2 files changed, 192 insertions(+) create mode 100644 Documentation/PCI/endpoint/pci-endpoint.txt
Documentation/PCI/00-INDEX +2 -0
@@ -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 +190 -0
190 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 16/37 PCI: endpoint: Introduce configfs entry for configuring EP functions
In reply to Kishon Vijay Abraham IIntroduce 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 | 4 +- drivers/pci/endpoint/Makefile | 2 +- drivers/pci/endpoint/pci-ep-cfs.c | 427 +++++++++++++++++++++++++++++++++++++ 3 files changed, 431 insertions(+), 2 deletions(-) create mode 100644 drivers/pci/endpoint/pci-ep-cfs.c
drivers/pci/endpoint/Kconfig +3 -1
@@ -14,7 +14,9 @@ config PCI_ENDPOINT Enabling this option will build the endpoint library, which includes endpoint controller library and endpoint function - library. + library. This will also enable the configfs entry required to + configure the endpoint function and used to bind the + function with a endpoint controller. If in doubt, say "N" to disable Endpoint support.
drivers/pci/endpoint/Makefile +1 -1
@@ -3,4 +3,4 @@ # obj-$(CONFIG_PCI_ENDPOINT) := pci-epc-core.o pci-epf-core.o\ - pci-epc-mem.o + pci-epc-mem.o pci-ep-cfs.o
drivers/pci/endpoint/pci-ep-cfs.c new file +427 -0
427 lines not on this page · raw message
Signature · 1 line
1.7.9.5
Re: [PATCH 16/37] PCI: endpoint: Introduce configfs entry for configuring EP functions
Hi Kishon,
a couple comments on the configfs layout based on my experiments with your previous drop to implement a NVMe device using it.
I don't think most of these configfs files should be present here, as they are properties of the implemented PCIe devices. E.g. for my NVMe device they will be sort of hardcoded most of the time, as they would be for other devices that would always have a fixed vendor/device/ class ID, cacheline size, etc.
In the end what we'll to be able to do here is to be able to create a directory for each function driver, which then can create it's own attributes inside it.
Re: [PATCH 16/37] PCI: endpoint: Introduce configfs entry for configuring EP functions
Hi Christoph,
Quoted 4 lines · Christoph Hellwig
Hi Kishon,
a couple comments on the configfs layout based on my experiments with your previous drop to implement a NVMe device using it.
Thanks for trying it out!
Quoted 6 lines
I don't think most of these configfs files should be present here, as they are properties of the implemented PCIe devices. E.g. for my NVMe device they will be sort of hardcoded most of the time, as they would be for other devices that would always have a fixed vendor/device/ class ID, cacheline size, etc.
Actually not all devices have hardcoded headers. E.g the platform I'm using doesn't have hardcoded headers and it can be configured based on the function the user would like to use. If the devices are hardcoded, then using configfs can be skipped altogether. In such cases, APIs like pci_epf_create() can directly be used by the drivers instead of going via configfs.
Thanks
Kishon
Re: [PATCH 16/37] PCI: endpoint: Introduce configfs entry for configuring EP functions
Quoted 5 lines · Kishon Vijay Abraham I
Actually not all devices have hardcoded headers. E.g the platform I'm using doesn't have hardcoded headers and it can be configured based on the function the user would like to use. If the devices are hardcoded, then using configfs can be skipped altogether. In such cases, APIs like
pci_epf_create()can directly be used by the drivers instead of going via configfs.
That's exactly what I meant - the IDs need to be set by the driver for the implemented PCI device, and it's not up to the gadget core to configur e them, it's up to the implementation of the PCIe device which PCI it exposes.
PATCH 17/37 Documentation: PCI: Guide to use pci endpoint configfs
In reply to Kishon Vijay Abraham IAdd 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 | 84 +++++++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 Documentation/PCI/endpoint/pci-endpoint-cfs.txt
Documentation/PCI/00-INDEX +2 -0
@@ -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 +84 -0
84 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 18/37 Documentation: PCI: Add specification for the *pci test* function device
In reply to Kishon Vijay Abraham IAdd 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
@@ -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
1.7.9.5
PATCH 19/37 PCI: endpoint: functions: Add an EP function to test PCI
In reply to Kishon Vijay Abraham IThis 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 | 3 +- drivers/pci/endpoint/functions/Kconfig | 12 + drivers/pci/endpoint/functions/Makefile | 5 + drivers/pci/endpoint/functions/pci-epf-test.c | 513 +++++++++++++++++++++++++ 5 files changed, 534 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
@@ -20,4 +20,6 @@ config PCI_ENDPOINT If in doubt, say "N" to disable Endpoint support. +source "drivers/pci/endpoint/functions/Kconfig" + endmenu
drivers/pci/endpoint/Makefile +2 -1
@@ -3,4 +3,5 @@ # obj-$(CONFIG_PCI_ENDPOINT) := pci-epc-core.o pci-epf-core.o\ - pci-epc-mem.o pci-ep-cfs.o + pci-epc-mem.o pci-ep-cfs.o \ + functions/
drivers/pci/endpoint/functions/Kconfig new file +12 -0
@@ -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
@@ -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 +513 -0
513 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 20/37 Documentation: PCI: Add binding documentation for pci-test endpoint function
In reply to Kishon Vijay Abraham IAdd 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
@@ -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
@@ -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 0xffff +revid : dont'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
1.7.9.5
PATCH 21/37 PCI: dwc: Modify dbi accessors to take dbi_base as argument
In reply to Kishon Vijay Abraham Idwc has 2 dbi address space labelled dbics and dbics2. The existing helper to access dbi address space can access only dbics. However dbics2 has to be accessed for programming the BAR registers in the case of EP mode. This is in preparation for adding EP mode support to dwc driver.
--- drivers/pci/dwc/pci-dra7xx.c | 10 +++-- drivers/pci/dwc/pci-exynos.c | 10 +++-- drivers/pci/dwc/pci-imx6.c | 67 ++++++++++++++++------------ drivers/pci/dwc/pci-keystone-dw.c | 15 ++++--- drivers/pci/dwc/pcie-armada8k.c | 39 +++++++++------- drivers/pci/dwc/pcie-artpec6.c | 7 +-- drivers/pci/dwc/pcie-designware-host.c | 17 +++---- drivers/pci/dwc/pcie-designware.c | 76 ++++++++++++++++++-------------- drivers/pci/dwc/pcie-designware.h | 10 +++-- drivers/pci/dwc/pcie-hisi.c | 17 ++++--- 10 files changed, 153 insertions(+), 115 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +6 -4
@@ -494,12 +494,13 @@ static int dra7xx_pcie_suspend(struct device *dev) {struct dra7xx_pcie *dra7xx =dev_get_drvdata (dev);struct dw_pcie *pci = dra7xx->pci; +void __iomem *base = pci->dbi_base;u32 val;/* clear MSE */ - val =dw_pcie_readl_dbi (pci,PCI_COMMAND ); + val =dw_pcie_readl_dbi (pci, base,PCI_COMMAND ); val &= ~PCI_COMMAND_MEMORY ; -dw_pcie_writel_dbi (pci,PCI_COMMAND , val); +dw_pcie_writel_dbi (pci, base,PCI_COMMAND , val);return 0 ; }
@@ -508,12 +509,13 @@ static int dra7xx_pcie_resume(struct device *dev) {struct dra7xx_pcie *dra7xx =dev_get_drvdata (dev);struct dw_pcie *pci = dra7xx->pci; +void __iomem *base = pci->dbi_base;u32 val;/* set MSE */ - val =dw_pcie_readl_dbi (pci,PCI_COMMAND ); + val =dw_pcie_readl_dbi (pci, base,PCI_COMMAND ); val |=PCI_COMMAND_MEMORY ; -dw_pcie_writel_dbi (pci,PCI_COMMAND , val); +dw_pcie_writel_dbi (pci, base,PCI_COMMAND , val);return 0 ; }
drivers/pci/dwc/pci-exynos.c +6 -4
@@ -405,23 +405,25 @@ static void exynos_pcie_enable_interrupts(struct exynos_pcie *exynos_pcie)exynos_pcie_msi_init (exynos_pcie); } -static u32 exynos_pcie_readl_dbi (struct dw_pcie *pci,u32 reg) +static u32 exynos_pcie_readl_dbi (struct dw_pcie *pci,void __iomem *base, +u32 reg) {struct exynos_pcie *exynos_pcie =to_exynos_pcie (pci);u32 val;exynos_pcie_sideband_dbi_r_mode (exynos_pcie, true); - val =readl (pci->dbi_base + reg); + val =readl (base + reg);exynos_pcie_sideband_dbi_r_mode (exynos_pcie, false);return val; } -static void exynos_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val) +static void exynos_pcie_writel_dbi (struct dw_pcie *pci,void __iomem *base, +u32 reg,u32 val) {struct exynos_pcie *exynos_pcie =to_exynos_pcie (pci);exynos_pcie_sideband_dbi_w_mode (exynos_pcie, true); -writel (val, pci->dbi_base + reg); +writel (val, base + reg);exynos_pcie_sideband_dbi_w_mode (exynos_pcie, false); }
drivers/pci/dwc/pci-imx6.c +39 -28
238 lines not on this page · raw message
drivers/pci/dwc/pci-keystone-dw.c +9 -6
@@ -378,6 +378,7 @@ static void ks_dw_pcie_clear_dbi_mode(struct keystone_pcie *ks_pcie)void ks_dw_pcie_setup_rc_app_regs (struct keystone_pcie *ks_pcie) {struct dw_pcie *pci = ks_pcie->pci; +void __iomem *base = pci->dbi_base;struct pcie_port *pp = &pci->pp;u32 start = pp->mem->start, end = pp->mem->end;int i, tr_size;
@@ -385,8 +386,8 @@ void ks_dw_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie)/* Disable BARs for inbound access */ ks_dw_pcie_set_dbi_mode (ks_pcie); -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,0 ); -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_1 ,0 ); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0 ); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_1 ,0 );ks_dw_pcie_clear_dbi_mode (ks_pcie);/* Set outbound translation size per window division */
@@ -482,14 +483,15 @@ int ks_dw_pcie_wr_other_conf(struct pcie_port *pp, struct pci_bus *bus,void ks_dw_pcie_v3_65_scan_bus (struct pcie_port *pp) {struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +void __iomem *base = pci->dbi_base;struct keystone_pcie *ks_pcie =to_keystone_pcie (pci);/* Configure and set up BAR0 */ ks_dw_pcie_set_dbi_mode (ks_pcie);/* Enable BAR0 */ -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,1 ); -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,SZ_4K -1 ); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,1 ); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,SZ_4K -1 );ks_dw_pcie_clear_dbi_mode (ks_pcie);
@@ -497,7 +499,7 @@ void ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp)* For BAR0, just setting bus address for inbound writes (MSI) should * be sufficient. Use physical address to avoid any conflicts. */ -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 , ks_pcie->app.start); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 , ks_pcie->app.start); }/**
@@ -506,8 +508,9 @@ void ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp)int ks_dw_pcie_link_up (struct dw_pcie *pci) {u32 val; +void __iomem *base = pci->dbi_base; - val =dw_pcie_readl_dbi (pci,DEBUG0 ); + val =dw_pcie_readl_dbi (pci, base,DEBUG0 );return (val <SSM_STATE_MASK ) ==LTSSM_STATE_L0 ; }
drivers/pci/dwc/pcie-armada8k.c +22 -17
@@ -73,8 +73,9 @@ static int armada8k_pcie_link_up(struct dw_pcie *pci) {u32 reg;u32 mask =PCIE_GLB_STS_RDLH_LINK_UP |PCIE_GLB_STS_PHY_LINK_UP ; +void __iomem *base = pci->dbi_base; - reg =dw_pcie_readl_dbi (pci,PCIE_GLOBAL_STATUS_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_STATUS_REG );if ((reg & mask) == mask)return 1 ;
@@ -86,47 +87,50 @@ static int armada8k_pcie_link_up(struct dw_pcie *pci)static void armada8k_pcie_establish_link (struct armada8k_pcie *pcie) {struct dw_pcie *pci = pcie->pci; +void __iomem *base = pci->dbi_base;u32 reg;if (!dw_pcie_link_up (pci)) {/* Disable LTSSM state machine to enable configuration */ - reg =dw_pcie_readl_dbi (pci,PCIE_GLOBAL_CONTROL_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ); reg &= ~(PCIE_APP_LTSSM_EN ); -dw_pcie_writel_dbi (pci,PCIE_GLOBAL_CONTROL_REG , reg); +dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG , reg); }/* Set the device to root complex mode */ - reg =dw_pcie_readl_dbi (pci,PCIE_GLOBAL_CONTROL_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ); reg &= ~(PCIE_DEVICE_TYPE_MASK <<PCIE_DEVICE_TYPE_SHIFT ); reg |=PCIE_DEVICE_TYPE_RC <<PCIE_DEVICE_TYPE_SHIFT ; -dw_pcie_writel_dbi (pci,PCIE_GLOBAL_CONTROL_REG , reg); +dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG , reg);/* Set the PCIe master AxCache attributes */ -dw_pcie_writel_dbi (pci,PCIE_ARCACHE_TRC_REG ,ARCACHE_DEFAULT_VALUE ); -dw_pcie_writel_dbi (pci,PCIE_AWCACHE_TRC_REG ,AWCACHE_DEFAULT_VALUE ); +dw_pcie_writel_dbi (pci, base,PCIE_ARCACHE_TRC_REG , +ARCACHE_DEFAULT_VALUE ); +dw_pcie_writel_dbi (pci, base,PCIE_AWCACHE_TRC_REG , +AWCACHE_DEFAULT_VALUE );/* Set the PCIe master AxDomain attributes */ - reg =dw_pcie_readl_dbi (pci,PCIE_ARUSER_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_ARUSER_REG ); reg &= ~(AX_USER_DOMAIN_MASK <<AX_USER_DOMAIN_SHIFT ); reg |=DOMAIN_OUTER_SHAREABLE <<AX_USER_DOMAIN_SHIFT ; -dw_pcie_writel_dbi (pci,PCIE_ARUSER_REG , reg); +dw_pcie_writel_dbi (pci, base,PCIE_ARUSER_REG , reg); - reg =dw_pcie_readl_dbi (pci,PCIE_AWUSER_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_AWUSER_REG ); reg &= ~(AX_USER_DOMAIN_MASK <<AX_USER_DOMAIN_SHIFT ); reg |=DOMAIN_OUTER_SHAREABLE <<AX_USER_DOMAIN_SHIFT ; -dw_pcie_writel_dbi (pci,PCIE_AWUSER_REG , reg); +dw_pcie_writel_dbi (pci, base,PCIE_AWUSER_REG , reg);/* Enable INT A-D interrupts */ - reg =dw_pcie_readl_dbi (pci,PCIE_GLOBAL_INT_MASK1_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_INT_MASK1_REG ); reg |=PCIE_INT_A_ASSERT_MASK |PCIE_INT_B_ASSERT_MASK |PCIE_INT_C_ASSERT_MASK |PCIE_INT_D_ASSERT_MASK ; -dw_pcie_writel_dbi (pci,PCIE_GLOBAL_INT_MASK1_REG , reg); +dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_INT_MASK1_REG , reg);if (!dw_pcie_link_up (pci)) {/* Configuration done. Start LTSSM */ - reg =dw_pcie_readl_dbi (pci,PCIE_GLOBAL_CONTROL_REG ); + reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ); reg |=PCIE_APP_LTSSM_EN ; -dw_pcie_writel_dbi (pci,PCIE_GLOBAL_CONTROL_REG , reg); +dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG , reg); }/* Wait until the link becomes active again */
@@ -147,6 +151,7 @@ static irqreturn_t armada8k_pcie_irq_handler(int irq, void *arg) {struct armada8k_pcie *pcie = arg;struct dw_pcie *pci = pcie->pci; +void __iomem *base = pci->dbi_base;u32 val;/*
@@ -154,8 +159,8 @@ static irqreturn_t armada8k_pcie_irq_handler(int irq, void *arg)* PCI device. However, they are also latched into the PCIe * controller, so we simply discard them. */ - val =dw_pcie_readl_dbi (pci,PCIE_GLOBAL_INT_CAUSE1_REG ); -dw_pcie_writel_dbi (pci,PCIE_GLOBAL_INT_CAUSE1_REG , val); + val =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_INT_CAUSE1_REG ); +dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_INT_CAUSE1_REG , val);return IRQ_HANDLED ; }
drivers/pci/dwc/pcie-artpec6.c +4 -3
@@ -81,6 +81,7 @@ static void artpec6_pcie_writel(struct artpec6_pcie *artpec6_pcie, u32 offset, ustatic int artpec6_pcie_establish_link (struct artpec6_pcie *artpec6_pcie) {struct dw_pcie *pci = artpec6_pcie->pci; +void __iomem *base = pci->dbi_base;struct pcie_port *pp = &pci->pp;u32 val;unsigned int retries;
@@ -140,7 +141,7 @@ static int artpec6_pcie_establish_link(struct artpec6_pcie *artpec6_pcie)* Enable writing to config regs. This is required as the Synopsys * driver changes the class code. That register needs DBI write enable. */ -dw_pcie_writel_dbi (pci,MISC_CONTROL_1_OFF ,DBI_RO_WR_EN ); +dw_pcie_writel_dbi (pci, base,MISC_CONTROL_1_OFF ,DBI_RO_WR_EN ); pp->io_base &=ARTPEC6_CPU_TO_BUS_ADDR ; pp->mem_base &=ARTPEC6_CPU_TO_BUS_ADDR ;
@@ -160,8 +161,8 @@ static int artpec6_pcie_establish_link(struct artpec6_pcie *artpec6_pcie)return 0 ;dev_dbg (pci->dev,"DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n" , -dw_pcie_readl_dbi (pci,PCIE_PHY_DEBUG_R0 ), -dw_pcie_readl_dbi (pci,PCIE_PHY_DEBUG_R1 )); +dw_pcie_readl_dbi (pci, base,PCIE_PHY_DEBUG_R0 ), +dw_pcie_readl_dbi (pci, base,PCIE_PHY_DEBUG_R1 ));return -ETIMEDOUT ; }
drivers/pci/dwc/pcie-designware-host.c +9 -8
@@ -567,31 +567,32 @@ void dw_pcie_setup_rc(struct pcie_port *pp) {u32 val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +void __iomem *base = pci->dbi_base;dw_pcie_setup (pci);/* setup RC BARs */ -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_0 ,0x00000004 ); -dw_pcie_writel_dbi (pci,PCI_BASE_ADDRESS_1 ,0x00000000 ); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x00000004 ); +dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_1 ,0x00000000 );/* setup interrupt pins */ - val =dw_pcie_readl_dbi (pci,PCI_INTERRUPT_LINE ); + val =dw_pcie_readl_dbi (pci, base,PCI_INTERRUPT_LINE ); val &=0xffff00ff ; val |=0x00000100 ; -dw_pcie_writel_dbi (pci,PCI_INTERRUPT_LINE , val); +dw_pcie_writel_dbi (pci, base,PCI_INTERRUPT_LINE , val);/* setup bus numbers */ - val =dw_pcie_readl_dbi (pci,PCI_PRIMARY_BUS ); + val =dw_pcie_readl_dbi (pci, base,PCI_PRIMARY_BUS ); val &=0xff000000 ; val |=0x00010100 ; -dw_pcie_writel_dbi (pci,PCI_PRIMARY_BUS , val); +dw_pcie_writel_dbi (pci, base,PCI_PRIMARY_BUS , val);/* setup command register */ - val =dw_pcie_readl_dbi (pci,PCI_COMMAND ); + val =dw_pcie_readl_dbi (pci, base,PCI_COMMAND ); val &=0xffff0000 ; val |=PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER |PCI_COMMAND_SERR ; -dw_pcie_writel_dbi (pci,PCI_COMMAND , val); +dw_pcie_writel_dbi (pci, base,PCI_COMMAND , val);/* * If the platform provides ->rd_other_conf, it means the platform
drivers/pci/dwc/pcie-designware.c +42 -34
163 lines not on this page · raw message
drivers/pci/dwc/pcie-designware.h +6 -4
@@ -144,8 +144,9 @@ struct pcie_port {struct dw_pcie_ops {u64 (*cpu_addr_fixup)(u64 cpu_addr); -u32 (*readl_dbi)(struct dw_pcie *pcie,u32 reg); -void (*writel_dbi)(struct dw_pcie *pcie,u32 reg,u32 val); +u32 (*readl_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg); +void (*writel_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg, +u32 val);int (*link_up)(struct dw_pcie *pcie); };
@@ -163,8 +164,9 @@ struct dw_pcie {int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val); -u32 dw_pcie_readl_dbi (struct dw_pcie *pci,u32 reg); -void dw_pcie_writel_dbi (struct dw_pcie *pci,u32 reg,u32 val); +u32 dw_pcie_readl_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg); +void dw_pcie_writel_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg, +u32 val);int dw_pcie_link_up (struct dw_pcie *pci);int dw_pcie_wait_for_link (struct dw_pcie *pci); void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index,
drivers/pci/dwc/pcie-hisi.c +10 -7
@@ -150,10 +150,11 @@ static int hisi_pcie_cfg_read(struct pcie_port *pp, int where, int size,u32 reg_val;void *walker = ®_val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +void __iomem *base = pci->dbi_base; walker += (where &0x3 ); reg = where & ~0x3 ; - reg_val =dw_pcie_readl_dbi (pci, reg); + reg_val =dw_pcie_readl_dbi (pci, base, reg);if (size ==1 ) *val = *(u8 __force *) walker;
@@ -175,19 +176,20 @@ static int hisi_pcie_cfg_write(struct pcie_port *pp, int where, int size,u32 reg;void *walker = ®_val;struct dw_pcie *pci =to_dw_pcie_from_pp (pp); +void __iomem *base = pci->dbi_base; walker += (where &0x3 ); reg = where & ~0x3 ;if (size ==4 ) -dw_pcie_writel_dbi (pci, reg, val); +dw_pcie_writel_dbi (pci, base, reg, val);else if (size ==2 ) { - reg_val =dw_pcie_readl_dbi (pci, reg); + reg_val =dw_pcie_readl_dbi (pci, base, reg); *(u16 __force *) walker = val; -dw_pcie_writel_dbi (pci, reg, reg_val); +dw_pcie_writel_dbi (pci, base, reg, reg_val); }else if (size ==1 ) { - reg_val =dw_pcie_readl_dbi (pci, reg); + reg_val =dw_pcie_readl_dbi (pci, base, reg); *(u8 __force *) walker = val; -dw_pcie_writel_dbi (pci, reg, reg_val); +dw_pcie_writel_dbi (pci, base, reg, reg_val); }else return PCIBIOS_BAD_REGISTER_NUMBER ;
@@ -207,9 +209,10 @@ static int hisi_pcie_link_up_hip05(struct hisi_pcie *hisi_pcie)static int hisi_pcie_link_up_hip06 (struct hisi_pcie *hisi_pcie) {struct dw_pcie *pci = hisi_pcie->pci; +void __iomem *base = pci->dbi_base;u32 val; - val =dw_pcie_readl_dbi (pci,PCIE_SYS_STATE4 ); + val =dw_pcie_readl_dbi (pci, base,PCIE_SYS_STATE4 );return ((val &PCIE_LTSSM_STATE_MASK ) ==PCIE_LTSSM_LINKUP_STATE ); }
Signature · 1 line
1.7.9.5
PATCH 22/37 PCI: dwc: Modify dbi accessors to access data of 4/2/1 bytes
In reply to Kishon Vijay Abraham IPreviously dbi accessors can be used to access data of size 4 bytes. But there might be situations (like accessing MSI_MESSAGE_CONTROL in order to set/get the number of required MSI interrupts in EP mode) where dbi accessors must be used to access data of size 2. This is in preparation for adding endpoint mode support to designware driver.
--- drivers/pci/dwc/pci-dra7xx.c | 8 ++-- drivers/pci/dwc/pci-exynos.c | 16 +++---- drivers/pci/dwc/pci-imx6.c | 58 +++++++++++------------ drivers/pci/dwc/pci-keystone-dw.c | 13 +++--- drivers/pci/dwc/pcie-armada8k.c | 38 +++++++-------- drivers/pci/dwc/pcie-artpec6.c | 6 +-- drivers/pci/dwc/pcie-designware-host.c | 16 +++---- drivers/pci/dwc/pcie-designware.c | 79 +++++++++++++++++++------------- drivers/pci/dwc/pcie-designware.h | 14 +++--- drivers/pci/dwc/pcie-hisi.c | 14 +++--- 10 files changed, 140 insertions(+), 122 deletions(-)
drivers/pci/dwc/pci-dra7xx.c +4 -4
@@ -498,9 +498,9 @@ static int dra7xx_pcie_suspend(struct device *dev)u32 val;/* clear MSE */ - val =dw_pcie_readl_dbi (pci, base,PCI_COMMAND ); + val =dw_pcie_read_dbi (pci, base,PCI_COMMAND ,0x4 ); val &= ~PCI_COMMAND_MEMORY ; -dw_pcie_writel_dbi (pci, base,PCI_COMMAND , val); +dw_pcie_write_dbi (pci, base,PCI_COMMAND ,0x4 , val);return 0 ; }
@@ -513,9 +513,9 @@ static int dra7xx_pcie_resume(struct device *dev)u32 val;/* set MSE */ - val =dw_pcie_readl_dbi (pci, base,PCI_COMMAND ); + val =dw_pcie_read_dbi (pci, base,PCI_COMMAND ,0x4 ); val |=PCI_COMMAND_MEMORY ; -dw_pcie_writel_dbi (pci, base,PCI_COMMAND , val); +dw_pcie_write_dbi (pci, base,PCI_COMMAND ,0x4 , val);return 0 ; }
drivers/pci/dwc/pci-exynos.c +8 -8
@@ -405,25 +405,25 @@ static void exynos_pcie_enable_interrupts(struct exynos_pcie *exynos_pcie)exynos_pcie_msi_init (exynos_pcie); } -static u32 exynos_pcie_readl_dbi (struct dw_pcie *pci,void __iomem *base, -u32 reg) +static u32 exynos_pcie_read_dbi (struct dw_pcie *pci,void __iomem *base, +u32 reg,int size) {struct exynos_pcie *exynos_pcie =to_exynos_pcie (pci);u32 val;exynos_pcie_sideband_dbi_r_mode (exynos_pcie, true); - val =readl (base + reg); +dw_pcie_read (base + reg, size, &val);exynos_pcie_sideband_dbi_r_mode (exynos_pcie, false);return val; } -static void exynos_pcie_writel_dbi (struct dw_pcie *pci,void __iomem *base, -u32 reg,u32 val) +static void exynos_pcie_write_dbi (struct dw_pcie *pci,void __iomem *base, +u32 reg,int size,u32 val) {struct exynos_pcie *exynos_pcie =to_exynos_pcie (pci);exynos_pcie_sideband_dbi_w_mode (exynos_pcie, true); -writel (val, base + reg); +dw_pcie_write (base + reg, size, val);exynos_pcie_sideband_dbi_w_mode (exynos_pcie, false); }
@@ -530,8 +530,8 @@ static int __init exynos_add_pcie_port(struct exynos_pcie *exynos_pcie, }static const struct dw_pcie_ops dw_pcie_ops = { - .readl_dbi = exynos_pcie_readl_dbi, - .writel_dbi = exynos_pcie_writel_dbi, + .read_dbi = exynos_pcie_read_dbi, + .write_dbi = exynos_pcie_write_dbi, .link_up = exynos_pcie_link_up, };
drivers/pci/dwc/pci-imx6.c +29 -29
185 lines not on this page · raw message
drivers/pci/dwc/pci-keystone-dw.c +7 -6
@@ -386,8 +386,8 @@ void ks_dw_pcie_setup_rc_app_regs(struct keystone_pcie *ks_pcie)/* Disable BARs for inbound access */ ks_dw_pcie_set_dbi_mode (ks_pcie); -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0 ); -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_1 ,0 ); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x4 ,0 ); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_1 ,0x4 ,0 );ks_dw_pcie_clear_dbi_mode (ks_pcie);/* Set outbound translation size per window division */
@@ -490,8 +490,8 @@ void ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp)ks_dw_pcie_set_dbi_mode (ks_pcie);/* Enable BAR0 */ -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,1 ); -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,SZ_4K -1 ); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x4 ,1 ); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x4 ,SZ_4K -1 );ks_dw_pcie_clear_dbi_mode (ks_pcie);
@@ -499,7 +499,8 @@ void ks_dw_pcie_v3_65_scan_bus(struct pcie_port *pp)* For BAR0, just setting bus address for inbound writes (MSI) should * be sufficient. Use physical address to avoid any conflicts. */ -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 , ks_pcie->app.start); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x4 , + ks_pcie->app.start); }/**
@@ -510,7 +511,7 @@ int ks_dw_pcie_link_up(struct dw_pcie *pci)u32 val;void __iomem *base = pci->dbi_base; - val =dw_pcie_readl_dbi (pci, base,DEBUG0 ); + val =dw_pcie_read_dbi (pci, base,DEBUG0 ,0x4 );return (val <SSM_STATE_MASK ) ==LTSSM_STATE_L0 ; }
drivers/pci/dwc/pcie-armada8k.c +19 -19
@@ -75,7 +75,7 @@ static int armada8k_pcie_link_up(struct dw_pcie *pci)u32 mask =PCIE_GLB_STS_RDLH_LINK_UP |PCIE_GLB_STS_PHY_LINK_UP ;void __iomem *base = pci->dbi_base; - reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_STATUS_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_GLOBAL_STATUS_REG ,0x4 );if ((reg & mask) == mask)return 1 ;
@@ -92,45 +92,45 @@ static void armada8k_pcie_establish_link(struct armada8k_pcie *pcie)if (!dw_pcie_link_up (pci)) {/* Disable LTSSM state machine to enable configuration */ - reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ,0x4 ); reg &= ~(PCIE_APP_LTSSM_EN ); -dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG , reg); +dw_pcie_write_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ,0x4 , reg); }/* Set the device to root complex mode */ - reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ,0x4 ); reg &= ~(PCIE_DEVICE_TYPE_MASK <<PCIE_DEVICE_TYPE_SHIFT ); reg |=PCIE_DEVICE_TYPE_RC <<PCIE_DEVICE_TYPE_SHIFT ; -dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG , reg); +dw_pcie_write_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ,0x4 , reg);/* Set the PCIe master AxCache attributes */ -dw_pcie_writel_dbi (pci, base,PCIE_ARCACHE_TRC_REG , -ARCACHE_DEFAULT_VALUE ); -dw_pcie_writel_dbi (pci, base,PCIE_AWCACHE_TRC_REG , -AWCACHE_DEFAULT_VALUE ); +dw_pcie_write_dbi (pci, base,PCIE_ARCACHE_TRC_REG ,0x4 , +ARCACHE_DEFAULT_VALUE ); +dw_pcie_write_dbi (pci, base,PCIE_AWCACHE_TRC_REG ,0x4 , +AWCACHE_DEFAULT_VALUE );/* Set the PCIe master AxDomain attributes */ - reg =dw_pcie_readl_dbi (pci, base,PCIE_ARUSER_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_ARUSER_REG ,0x4 ); reg &= ~(AX_USER_DOMAIN_MASK <<AX_USER_DOMAIN_SHIFT ); reg |=DOMAIN_OUTER_SHAREABLE <<AX_USER_DOMAIN_SHIFT ; -dw_pcie_writel_dbi (pci, base,PCIE_ARUSER_REG , reg); +dw_pcie_write_dbi (pci, base,PCIE_ARUSER_REG ,0x4 , reg); - reg =dw_pcie_readl_dbi (pci, base,PCIE_AWUSER_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_AWUSER_REG ,0x4 ); reg &= ~(AX_USER_DOMAIN_MASK <<AX_USER_DOMAIN_SHIFT ); reg |=DOMAIN_OUTER_SHAREABLE <<AX_USER_DOMAIN_SHIFT ; -dw_pcie_writel_dbi (pci, base,PCIE_AWUSER_REG , reg); +dw_pcie_write_dbi (pci, base,PCIE_AWUSER_REG ,0x4 , reg);/* Enable INT A-D interrupts */ - reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_INT_MASK1_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_GLOBAL_INT_MASK1_REG ,0x4 ); reg |=PCIE_INT_A_ASSERT_MASK |PCIE_INT_B_ASSERT_MASK |PCIE_INT_C_ASSERT_MASK |PCIE_INT_D_ASSERT_MASK ; -dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_INT_MASK1_REG , reg); +dw_pcie_write_dbi (pci, base,PCIE_GLOBAL_INT_MASK1_REG ,0x4 , reg);if (!dw_pcie_link_up (pci)) {/* Configuration done. Start LTSSM */ - reg =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ); + reg =dw_pcie_read_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ,0x4 ); reg |=PCIE_APP_LTSSM_EN ; -dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG , reg); +dw_pcie_write_dbi (pci, base,PCIE_GLOBAL_CONTROL_REG ,0x4 , reg); }/* Wait until the link becomes active again */
@@ -159,8 +159,8 @@ static irqreturn_t armada8k_pcie_irq_handler(int irq, void *arg)* PCI device. However, they are also latched into the PCIe * controller, so we simply discard them. */ - val =dw_pcie_readl_dbi (pci, base,PCIE_GLOBAL_INT_CAUSE1_REG ); -dw_pcie_writel_dbi (pci, base,PCIE_GLOBAL_INT_CAUSE1_REG , val); + val =dw_pcie_read_dbi (pci, base,PCIE_GLOBAL_INT_CAUSE1_REG ,0x4 ); +dw_pcie_write_dbi (pci, base,PCIE_GLOBAL_INT_CAUSE1_REG ,0x4 , val);return IRQ_HANDLED ; }
drivers/pci/dwc/pcie-artpec6.c +3 -3
@@ -141,7 +141,7 @@ static int artpec6_pcie_establish_link(struct artpec6_pcie *artpec6_pcie)* Enable writing to config regs. This is required as the Synopsys * driver changes the class code. That register needs DBI write enable. */ -dw_pcie_writel_dbi (pci, base,MISC_CONTROL_1_OFF ,DBI_RO_WR_EN ); +dw_pcie_write_dbi (pci, base,MISC_CONTROL_1_OFF ,0x4 ,DBI_RO_WR_EN ); pp->io_base &=ARTPEC6_CPU_TO_BUS_ADDR ; pp->mem_base &=ARTPEC6_CPU_TO_BUS_ADDR ;
@@ -161,8 +161,8 @@ static int artpec6_pcie_establish_link(struct artpec6_pcie *artpec6_pcie)return 0 ;dev_dbg (pci->dev,"DEBUG_R0: 0x%08x, DEBUG_R1: 0x%08x\n" , -dw_pcie_readl_dbi (pci, base,PCIE_PHY_DEBUG_R0 ), -dw_pcie_readl_dbi (pci, base,PCIE_PHY_DEBUG_R1 )); +dw_pcie_read_dbi (pci, base,PCIE_PHY_DEBUG_R0 ,0x4 ), +dw_pcie_read_dbi (pci, base,PCIE_PHY_DEBUG_R1 ,0x4 ));return -ETIMEDOUT ; }
drivers/pci/dwc/pcie-designware-host.c +8 -8
@@ -572,27 +572,27 @@ void dw_pcie_setup_rc(struct pcie_port *pp)dw_pcie_setup (pci);/* setup RC BARs */ -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x00000004 ); -dw_pcie_writel_dbi (pci, base,PCI_BASE_ADDRESS_1 ,0x00000000 ); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_0 ,0x4 ,0x00000004 ); +dw_pcie_write_dbi (pci, base,PCI_BASE_ADDRESS_1 ,0x4 ,0x00000000 );/* setup interrupt pins */ - val =dw_pcie_readl_dbi (pci, base,PCI_INTERRUPT_LINE ); + val =dw_pcie_read_dbi (pci, base,PCI_INTERRUPT_LINE ,0x4 ); val &=0xffff00ff ; val |=0x00000100 ; -dw_pcie_writel_dbi (pci, base,PCI_INTERRUPT_LINE , val); +dw_pcie_write_dbi (pci, base,PCI_INTERRUPT_LINE ,0x4 , val);/* setup bus numbers */ - val =dw_pcie_readl_dbi (pci, base,PCI_PRIMARY_BUS ); + val =dw_pcie_read_dbi (pci, base,PCI_PRIMARY_BUS ,0x4 ); val &=0xff000000 ; val |=0x00010100 ; -dw_pcie_writel_dbi (pci, base,PCI_PRIMARY_BUS , val); +dw_pcie_write_dbi (pci, base,PCI_PRIMARY_BUS ,0x4 , val);/* setup command register */ - val =dw_pcie_readl_dbi (pci, base,PCI_COMMAND ); + val =dw_pcie_read_dbi (pci, base,PCI_COMMAND ,0x4 ); val &=0xffff0000 ; val |=PCI_COMMAND_IO |PCI_COMMAND_MEMORY |PCI_COMMAND_MASTER |PCI_COMMAND_SERR ; -dw_pcie_writel_dbi (pci, base,PCI_COMMAND , val); +dw_pcie_write_dbi (pci, base,PCI_COMMAND ,0x4 , val);/* * If the platform provides ->rd_other_conf, it means the platform
drivers/pci/dwc/pcie-designware.c +47 -32
138 lines not on this page · raw message
drivers/pci/dwc/pcie-designware.h +8 -6
@@ -144,9 +144,10 @@ struct pcie_port {struct dw_pcie_ops {u64 (*cpu_addr_fixup)(u64 cpu_addr); -u32 (*readl_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg); -void (*writel_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg, -u32 val); +u32 (*read_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg, +int size); +void (*write_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg, +int size,u32 val);int (*link_up)(struct dw_pcie *pcie); };
@@ -164,9 +165,10 @@ struct dw_pcie {int dw_pcie_read (void __iomem *addr,int size,u32 *val);int dw_pcie_write (void __iomem *addr,int size,u32 val); -u32 dw_pcie_readl_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg); -void dw_pcie_writel_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg, -u32 val); +u32 dw_pcie_read_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg, +int size); +void dw_pcie_write_dbi (struct dw_pcie *pci,void __iomem *base,u32 reg, +int size,u32 val);int dw_pcie_link_up (struct dw_pcie *pci);int dw_pcie_wait_for_link (struct dw_pcie *pci); void dw_pcie_prog_outbound_atu(struct dw_pcie *pci, int index,
drivers/pci/dwc/pcie-hisi.c +7 -7
@@ -154,7 +154,7 @@ static int hisi_pcie_cfg_read(struct pcie_port *pp, int where, int size, walker += (where &0x3 ); reg = where & ~0x3 ; - reg_val =dw_pcie_readl_dbi (pci, base, reg); + reg_val =dw_pcie_read_dbi (pci, base, reg,0x4 );if (size ==1 ) *val = *(u8 __force *) walker;
@@ -181,15 +181,15 @@ static int hisi_pcie_cfg_write(struct pcie_port *pp, int where, int size, walker += (where &0x3 ); reg = where & ~0x3 ;if (size ==4 ) -dw_pcie_writel_dbi (pci, base, reg, val); +dw_pcie_write_dbi (pci, base, reg,0x4 , val);else if (size ==2 ) { - reg_val =dw_pcie_readl_dbi (pci, base, reg); + reg_val =dw_pcie_read_dbi (pci, base, reg,0x4 ); *(u16 __force *) walker = val; -dw_pcie_writel_dbi (pci, base, reg, reg_val); +dw_pcie_write_dbi (pci, base, reg,0x4 , reg_val); }else if (size ==1 ) { - reg_val =dw_pcie_readl_dbi (pci, base, reg); + reg_val =dw_pcie_read_dbi (pci, base, reg,0x4 ); *(u8 __force *) walker = val; -dw_pcie_writel_dbi (pci, base, reg, reg_val); +dw_pcie_write_dbi (pci, base, reg,0x4 , reg_val); }else return PCIBIOS_BAD_REGISTER_NUMBER ;
@@ -212,7 +212,7 @@ static int hisi_pcie_link_up_hip06(struct hisi_pcie *hisi_pcie)void __iomem *base = pci->dbi_base;u32 val; - val =dw_pcie_readl_dbi (pci, base,PCIE_SYS_STATE4 ); + val =dw_pcie_read_dbi (pci, base,PCIE_SYS_STATE4 ,0x4 );return ((val &PCIE_LTSSM_STATE_MASK ) ==PCIE_LTSSM_LINKUP_STATE ); }
Signature · 1 line
1.7.9.5
PATCH 23/37 PCI: dwc: Add *ops* to start and stop pcie link
In reply to Kishon Vijay Abraham IAdd start_link and stop_link ops in dw_pcie_ops to start or stop the link. This will be used by endpoint functions to start the link once the setup has been done.
--- drivers/pci/dwc/pcie-designware.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/pci/dwc/pcie-designware.h +2 -0
@@ -149,6 +149,8 @@ struct dw_pcie_ops {void (*write_dbi)(struct dw_pcie *pcie,void __iomem *base,u32 reg,int size,u32 val);int (*link_up)(struct dw_pcie *pcie); +int (*start_link)(struct dw_pcie *pcie); +void (*stop_link)(struct dw_pcie *pcie); };struct dw_pcie {
Signature · 1 line
1.7.9.5
PATCH 24/37 PCI: dwc: designware: Add EP mode support
In reply to Kishon Vijay Abraham IAdd 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 | 51 +++++ drivers/pci/dwc/pcie-designware.h | 70 +++++++ 5 files changed, 469 insertions(+) create mode 100644 drivers/pci/dwc/pcie-designware-ep.c
drivers/pci/dwc/Kconfig +5 -0
@@ -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
@@ -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 +51 -0
57 lines not on this page · raw message
drivers/pci/dwc/pcie-designware.h +70 -0
118 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 25/37 dt-bindings: PCI: Add dt bindings for pci designware EP mode
In reply to Kishon Vijay Abraham IAdd 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
@@ -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
1.7.9.5
Re: [PATCH 25/37] dt-bindings: PCI: Add dt bindings for pci designware EP mode
Quoted 6 lines · Kishon Vijay Abraham I
Add device tree binding documentation for pci designware EP mode.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- .../devicetree/bindings/pci/designware-pcie.txt | 26 ++++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-)
PATCH 26/37 PCI: dwc: dra7xx: Facilitate wrapper and msi interrupts to be enabled independently
In reply to Kishon Vijay Abraham INo 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
@@ -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
1.7.9.5
PATCH 27/37 PCI: dwc: dra7xx: Add EP mode support
In reply to Kishon Vijay Abraham IThe 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
@@ -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
@@ -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
@@ -117,6 +117,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
1.7.9.5
PATCH 28/37 dt-bindings: PCI: dra7xx: Add dt bindings for pci dra7xx EP mode
In reply to Kishon Vijay Abraham IAdd 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
@@ -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 should 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
1.7.9.5
Re: [PATCH 28/37] dt-bindings: PCI: dra7xx: Add dt bindings for pci dra7xx EP mode
Quoted 55 lines · Kishon Vijay Abraham I
Add device tree binding documentation for pci dra7xx EP mode.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Documentation/devicetree/bindings/pci/ti-pci.txt | 37 ++++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-)Documentation/devicetree/bindings/pci/ti-pci.txt +18
-7@@ -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
Documentation/devicetree/bindings/pci/ti-pci.txt PCIe Designware Controller · line 46
Quoted 10 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +7
-0+ 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 should be added for each PCI controller; one for host
s/should/may/
Don't define dts source structure here. You could also have 2 files with each config and just include the right one for each board.
We don't want overlapping memory regions defined in DT and this kind of violates that, but I guess status is sufficient.
With that,
Quoted 15 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +5
-0+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 · 6 lines
1.7.9.5 -- 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
PATCH 29/37 PCI: dwc: dra7xx: Workaround for errata id i870
In reply to Kishon Vijay Abraham IAccording 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 | 50 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+)
drivers/pci/dwc/pci-dra7xx.c +50 -0
@@ -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"
@@ -531,6 +533,48 @@ static int dra7xx_pcie_enable_phy(struct dra7xx_pcie *dra7xx) {}, }; +/* +* dra7xx_pcie_ep_legacy_mode: 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_legacy_mode (struct device *dev) +{ +int ret; +struct device_node *np = dev->of_node; +struct regmap *regmap; +unsigned int reg; +unsigned int field; + + regmap =syscon_regmap_lookup_by_phandle (np,"syscon-legacy-mode" ); +if (IS_ERR (regmap)) { +dev_dbg (dev,"can't get syscon-legacy-mode\n" ); +return -EINVAL ; + } + +if (of_property_read_u32_index (np,"syscon-legacy-mode" ,1 , ®)) { +dev_err (dev,"couldn't get legacy mode register offset\n" ); +return -EINVAL ; + } + +if (of_property_read_u32_index (np,"syscon-legacy-mode" ,2 , &field)) { +dev_err (dev,"can't get bit field for setting legacy mode\n" ); +return -EINVAL ; + } + + ret =regmap_update_bits (regmap, reg, field, field); +if (ret) +dev_err (dev,"failed to set legacy mode\n" ); + +return ret; +} +static int __init dra7xx_pcie_probe (struct platform_device *pdev) {u32 reg;
@@ -643,6 +687,7 @@ static int __init dra7xx_pcie_probe(struct platform_device *pdev)case DW_PCIE_RC_TYPE :dra7xx_pcie_writel (dra7xx,PCIECTRL_TI_CONF_DEVICE_TYPE ,DEVICE_TYPE_RC ); + ret =dra7xx_add_pcie_port (dra7xx, pdev);if (ret <0 ) goto err_gpio;
@@ -650,6 +695,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_legacy_mode (dev); +if (ret) + goto err_gpio; + ret =dra7xx_add_pcie_ep (dra7xx, pdev);if (ret <0 ) goto err_gpio;
Signature · 1 line
1.7.9.5
PATCH 30/37 dt-bindings: PCI: dra7xx: Add dt bindings to enable legacy mode
In reply to Kishon Vijay Abraham IUpdate device tree binding documentation of TI's dra7xx PCI controller to include property for enabling legacy mode.
--- Documentation/devicetree/bindings/pci/ti-pci.txt | 4 ++++ 1 file changed, 4 insertions(+)
Documentation/devicetree/bindings/pci/ti-pci.txt +4 -0
@@ -39,6 +39,10 @@ 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 + - syscon-legacy-mode: 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 + legacy mode Optional Property: - gpios : Should be added if a gpio line is required to drive PERST# line
Signature · 1 line
1.7.9.5
Rob Herring
maintainerRe: [PATCH 30/37] dt-bindings: PCI: dra7xx: Add dt bindings to enable legacy mode
Quoted 13 lines · Kishon Vijay Abraham I
Update device tree binding documentation of TI's dra7xx PCI controller to include property for enabling legacy mode.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Documentation/devicetree/bindings/pci/ti-pci.txt | 4 ++++ 1 file changed, 4 insertions(+)Documentation/devicetree/bindings/pci/ti-pci.txt +0
-0
Documentation/devicetree/bindings/pci/ti-pci.txt DEVICE MODE · line 45
Quoted 7 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +4
-0@@ -39,6 +39,10 @@ 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 + - syscon-legacy-mode: 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 + legacy mode
What's legacy mode?
Quoted 10 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +0
-0Optional Property: - gpios : Should be added if a gpio line is required to drive PERST# lineSignature · 6 lines
1.7.9.5 -- 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
Re: [PATCH 30/37] dt-bindings: PCI: dra7xx: Add dt bindings to enable legacy mode
Hi,
Quoted 9 lines · Rob Herring
Quoted 8 lines · Kishon Vijay Abraham I
Update device tree binding documentation of TI's dra7xx PCI controller to include property for enabling legacy mode.
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- Documentation/devicetree/bindings/pci/ti-pci.txt | 4 ++++ 1 file changed, 4 insertions(+)
Quoted 14 lines
Documentation/devicetree/bindings/pci/ti-pci.txt DEVICE MODE · line 45
Quoted 12 lines
Documentation/devicetree/bindings/pci/ti-pci.txt +4
-0@@ -39,6 +39,10 @@ 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 + - syscon-legacy-mode: 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 + legacy modeWhat's legacy mode?
It's the name of the bit-field defined in TRM used to add workaround for errata id i870 (See [PATCH 29/37] PCI: dwc: dra7xx: Workaround for errata id i870 of this series). I'm not sure what it does internally.
Thanks
Kishon
PATCH 31/37 misc: Add host side pci driver for pci test function device
In reply to Kishon Vijay Abraham IAdd 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 | 533 ++++++++++++++++++++++++++++++++++++++ include/uapi/linux/Kbuild | 1 + include/uapi/linux/pcitest.h | 19 ++ 5 files changed, 561 insertions(+) create mode 100644 drivers/misc/pci_endpoint_test.c create mode 100644 include/uapi/linux/pcitest.h
drivers/misc/Kconfig +7 -0
@@ -766,6 +766,13 @@ config PANEL_BOOT_MESSAGE An empty message will only clear the display at driver init time. Any other printf()-formatted message is valid with newline and escape codes. +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
@@ -53,6 +53,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 +533 -0
533 lines not on this page · raw message
include/uapi/linux/Kbuild +1 -0
@@ -329,6 +329,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
@@ -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
1.7.9.5
Re: [PATCH 31/37] misc: Add host side pci driver for pci test function device
Quoted 4 lines · 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.
Just curious: what would you think of a text based (e.g. debugfs) interface to avoid the need for a userspace tool here?
drivers/misc/pci_endpoint_test.c line 521
Quoted 5 lines
drivers/misc/pci_endpoint_test.c new file +5
-0+static const struct pci_device_id pci_endpoint_test_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_TI ,PCI_ANY_ID ) }, + { } +}; +MODULE_DEVICE_TABLE (pci, pci_endpoint_test_tbl);
Also this looks really odd, and dangerous. Probing for any TI device will bind to all kinds of legit devices. It would be good if you could squeeze out a single id for this device out of the TI group responsible for allocating it. Otherwise we might try some other venues, e.g. Red Hat through Qumranet has PCI IDs available for virtio, which might have some left for other Linux uses.
In general I fear the PCI ID allocation will become a worse and worse issue once your framework goes in and we'll grow more PCI device models in the kernel.
Re: [PATCH 31/37] misc: Add host side pci driver for pci test function device
Hi,
Quoted 8 lines · Christoph Hellwig
Quoted 4 lines · 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.
Just curious: what would you think of a text based (e.g. debugfs) interface to avoid the need for a userspace tool here?
I felt having a userspace tool gives the flexibility to add more tests (iterations, sizes etc..) while the driver can just focus on performing simple tests. Say we'd like to perform infinite read/write tests, it's better if the userspace tool invokes read/write tests repeatedly instead of that being implemented in the driver.
Quoted 10 lines
drivers/misc/pci_endpoint_test.c line 521
Quoted 6 lines
drivers/misc/pci_endpoint_test.c new file +5
-0+static const struct pci_device_id pci_endpoint_test_tbl[] = { + {PCI_DEVICE (PCI_VENDOR_ID_TI ,PCI_ANY_ID ) }, + { } +}; +MODULE_DEVICE_TABLE (pci, pci_endpoint_test_tbl);Also this looks really odd, and dangerous. Probing for any TI device will bind to all kinds of legit devices. It would be good if you could squeeze out a single id for this device
There is actually an id for the device, but I think we'll need an id for every function right?
Having said that the id for the device is better than PCI_ANY_ID. Will fix it in my next revision.
Thanks
Kishon
PATCH 32/37 Documentation: misc-devices: Add Documentation for pci-endpoint-test driver
In reply to Kishon Vijay Abraham IAdd 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
@@ -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
1.7.9.5
PATCH 33/37 tools: PCI: Add a userspace tool to test PCI endpoint
In reply to Kishon Vijay Abraham IAdd 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
@@ -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
1.7.9.5
PATCH 34/37 tools: PCI: Add sample test script to invoke pcitest
In reply to Kishon Vijay Abraham IAdd 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
@@ -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
1.7.9.5
PATCH 35/37 MAINTAINERS: add PCI EP maintainer
In reply to Kishon Vijay Abraham IAdd maintainer for the newly introduced PCI EP framework.
--- MAINTAINERS | 9 +++++++++ 1 file changed, 9 insertions(+)
MAINTAINERS +9 -0
@@ -9407,6 +9407,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/helgaas/pci.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
1.7.9.5
PATCH 36/37 ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
In reply to Kishon Vijay Abraham IThe 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
@@ -524,7 +524,7 @@ .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
1.7.9.5
Tony Lindgren
maintainerRe: [PATCH 36/37] ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
Quoted 4 lines · 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 toHW_AUTOin RC mode. However in EP mode, the host system is not able to access the MEMSPACE and setting the CLKSTCTRL toSW_WKUPfixes it.
I guess ideally in the long run we would set this dynamically based on the selected mode, right?
Regards,
Tony
Quoted 26 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-omap2/clockdomains7xx_data.c +1
-1@@ -524,7 +524,7 @@ .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 · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 36/37] ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
Hi Tony,
Quoted 8 lines · Tony Lindgren
Quoted 4 lines · 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 toHW_AUTOin RC mode. However in EP mode, the host system is not able to access the MEMSPACE and setting the CLKSTCTRL toSW_WKUPfixes it.I guess ideally in the long run we would set this dynamically based on the selected mode, right?
The programming sequence mentioned in the TRM w.r.t clock programming is same for both host mode or device mode. Though we never faced any issues in host mode when HW_AUTO is set, it's better to follow TRM recommended settings IMHO.
Thanks
Kishon
Quoted 31 lines
Regards,
Tony
Quoted 26 lines
Signed-off-by Kishon Vijay Abraham I <[email protected]>--- arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/arm/mach-omap2/clockdomains7xx_data.c +1
-1@@ -524,7 +524,7 @@ .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 · 6 lines
1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 36/37] ARM: DRA7: clockdomain: Change the CLKTRCTRL of CM_PCIE_CLKSTCTRL to SW_WKUP
Quoted 9 lines · Kishon Vijay Abraham I
Hi Tony,
Quoted 6 lines · Tony Lindgren
Quoted 4 lines · 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 toHW_AUTOin RC mode. However in EP mode, the host system is not able to access the MEMSPACE and setting the CLKSTCTRL toSW_WKUPfixes it.
Quoted 6 lines
Quoted 2 lines
I guess ideally in the long run we would set this dynamically based on the selected mode, right?
The programming sequence mentioned in the TRM w.r.t clock programming is same for both host mode or device mode. Though we never faced any issues in host mode when
HW_AUTOis set, it's better to follow TRM recommended settings IMHO.
OK best to merge this with the whole series:
PATCH 37/37 ARM: dts: DRA7: Add pcie1 dt node for EP mode
In reply to Kishon Vijay Abraham IAdd pcie1 dt node in order for the controller to operate in endpoint mode. However since none of the dra7 based boards have slots configured to operate in endpoint mode, keep EP mode disabled.
--- arch/arm/boot/dts/am572x-idk.dts | 7 ++++++- arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi | 7 ++++++- arch/arm/boot/dts/dra7-evm.dts | 4 ++++ arch/arm/boot/dts/dra7.dtsi | 22 +++++++++++++++++++++- arch/arm/boot/dts/dra72-evm-common.dtsi | 4 ++++ 5 files changed, 41 insertions(+), 3 deletions(-)
arch/arm/boot/dts/am572x-idk.dts +6 -1
@@ -88,6 +88,11 @@ load-gpios = <&gpio3 19 GPIO_ACTIVE_LOW>; }; -&pcie1 { +&pcie1_rc { + status = "okay"; + gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; +}; + +&pcie1_ep { gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; };
arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi +6 -1
@@ -556,7 +556,12 @@ }; }; -&pcie1 { +&pcie1_rc { + status = "ok"; + gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; +}; + +&pcie1_ep { gpios = <&gpio2 8 GPIO_ACTIVE_LOW>; };
arch/arm/boot/dts/dra7-evm.dts +4 -0
@@ -937,3 +937,7 @@ status = "okay"; }; }; + +&pcie1_rc { + status = "okay"; +};
arch/arm/boot/dts/dra7.dtsi +21 -1
@@ -272,7 +272,11 @@ #address-cells = <1>; ranges = <0x51000000 0x51000000 0x3000 0x0 0x20000000 0x10000000>; - pcie1: pcie at 51000000 { + /** + * To enable PCI endpoint mode, disable the pcie1_rc + * node and enable pcie1_ep mode. + */ + pcie1_rc: pcie at 51000000 { compatible = "ti,dra7-pcie"; reg = <0x51000000 0x2000>, <0x51002000 0x14c>, <0x1000 0x2000>; reg-names = "rc_dbics", "ti_conf", "config";
@@ -293,12 +297,28 @@ <0 0 0 2 &pcie1_intc 2>, <0 0 0 3 &pcie1_intc 3>, <0 0 0 4 &pcie1_intc 4>; + status = "disabled"; pcie1_intc: interrupt-controller { interrupt-controller; #address-cells = <0>; #interrupt-cells = <1>; }; }; + + pcie1_ep: pcie_ep at 51000000 { + compatible = "ti,dra7-pcie-ep"; + reg = <0x51000000 0x28>, <0x51002000 0x14c>, <0x51001000 0x28>, <0x1000 0x10000000>; + reg-names = "ep_dbics", "ti_conf", "ep_dbics2", "addr_space"; + interrupts = <0 232 0x4>; + num-lanes = <1>; + num-ib-windows = <4>; + num-ob-windows = <16>; + ti,hwmods = "pcie1"; + phys = <&pcie1_phy>; + phy-names = "pcie-phy0"; + syscon-legacy-mode = <&scm_conf1 0x14 2>; + status = "disabled"; + }; }; axi at 1 {
arch/arm/boot/dts/dra72-evm-common.dtsi +4 -0
@@ -545,3 +545,7 @@ status = "okay"; }; }; + +&pcie1_rc { + status = "okay"; +};
Signature · 1 line
1.7.9.5
Tony Lindgren
maintainerRe: [PATCH 37/37] ARM: dts: DRA7: Add pcie1 dt node for EP mode
Quoted 4 lines · Kishon Vijay Abraham I
Add pcie1 dt node in order for the controller to operate in endpoint mode. However since none of the dra7 based boards have slots configured to operate in endpoint mode, keep EP mode disabled.
Can this be merged separately later on without breaking anything?
Regards,
Tony
Re: [PATCH 37/37] ARM: dts: DRA7: Add pcie1 dt node for EP mode
Hi Tony,
Quoted 7 lines · Tony Lindgren
Quoted 4 lines · Kishon Vijay Abraham I
Add pcie1 dt node in order for the controller to operate in endpoint mode. However since none of the dra7 based boards have slots configured to operate in endpoint mode, keep EP mode disabled.
Can this be merged separately later on without breaking anything?
yes, I'll resend this once rest of the EP support gets in.
Thanks
Kishon
cover PCI: Support for configurable PCI endpoint
In reply to Kishon Vijay Abraham I- list
Hi Bjorn,
How do you want to handle this series? I'll send one more version of the series including the directory restructuring in the same series. Should it be based on your -next?
Cheers
Kishon
Quoted 310 lines · Kishon Vijay Abraham I
The RFC series that was sent before this patch series can be found at [1]. The patches are split here so that it can be better reviewed.
This main purpose of this patch series is to
*) add PCI endpoint core layer
*) modifie designware/dra7xx driver to be configured in EP mode *) add a PCI endpoint *test* function driver and corresponding host
driverMajor 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 patch series has been developed on top of 4.10-rc1, [2] & [3]
[1] -> https://lwn.net/Articles/700605/
[2] -> https://lkml.org/lkml/2016/12/28/34
[3] -> https://lkml.org/lkml/2017/1/11/238I've also pushed the tree to
git://git.ti.com/linux-phy/linux-phy.gitpci_ep_v1Using PCI EPF Test:
ON THE EP SIDE:
***************
/* EP function is configured using configfs */# mount -t configfs none /sys/kernel/config/* PCI EP core layer creates "
pci_ep" entry in configfs */# cd /sys/kernel/config/pci_ep//*
* This is the 1st step in creating an endpoint function. This
* creates the endpoint device.
*/# mkdir dev/*
* dev has 2 entries. *epc* for binding a EPC device and *epf*
* is a directory containing all the functions of the endpoint */# ls dev epc epf/*
* This creates the endpoint function device *instance*. The string
* before the .<num> suffix will identify the driver this
* EP function will bind to.
* Justpci_epf_testis also valid. The .<num> suffix is used
* if there are multiple PCI controllers and all of them wants
* to use the same function.
*/# mkdir dev/epf/pci_epf_test.0/*
* When the above command is given, the function device will
* also be bound to a function driver. To find the list of
* function drivers available in the system, use the following
* command. To create a new driver, the following can be referred
*drivers/pci/endpoint/functions/pci-epf-test.c
*/# ls /sys/bus/pci-epf/drivers pci_epf_test/* Now configure the endpoint function */
/* These are the fields that can be configured */# ls dev/epf/pci_epf_test.0/ baseclass_code function progif_code subsys_id cache_line_size interrupt_pin revid subsys_vendor_id deviceid msi_interrupts subclass_code vendorid/* The function driver will populate these fields with default values */
# cat dev/epf/pci_epf_test.0/vendorid 0xffff# cat dev/epf/pci_epf_test.0/interrupt_pin 0x0001/* The user can configure any of these fields */
# echo 0x104c > dev/epf/pci_epf_test.0/vendorid # echo 16 > dev/epf/pci_epf_test.0/msi_interrupts/*
* Next is binding this function driver to the controller driver. In
* order to find the possible controller drivers that this function
* driver can be bound to, the following sysfs entry can be used */# ls /sys/class/pci_epc/ 51000000.pci/* Now bind the function driver to the controller driver */
# echo "51000000.pcie_ep" > epc [ 494.743487] dra7-pcie 51000000.pcie: no free inbound window [ 494.749367] pci_epf_test pci_epf_test.0: failed to set BAR4 [ 494.755238] dra7-pcie 51000000.pcie: no free inbound window [ 494.761451] pci_epf_test pci_epf_test.0: failed to set BAR5/*
* the above error messages are due to non availability of free
* inbound windows. So the function drivers in dra7xx can use
* only 4 (BAR0..BAR3) BARs
*//****** PCI endpoint is configured ******/
ON THE HOST SIDE:
*****************# ./pcitest.sh BAR testsBAR0: OKAY BAR1: OKAY BAR2: OKAY BAR3: OKAY BAR4: NOT OKAY BAR5: NOT OKAYInterrupt tests
LEGACY IRQ: NOT OKAY MSI1: OKAY MSI2: OKAY MSI3: OKAY MSI4: OKAY MSI5: OKAY MSI6: OKAY MSI7: OKAY MSI8: OKAY MSI9: OKAY MSI10: OKAY MSI11: OKAY MSI12: OKAY MSI13: OKAY MSI14: OKAY MSI15: OKAY MSI16: OKAY MSI17: NOT OKAY MSI18: NOT OKAY MSI19: NOT OKAY MSI20: NOT OKAY MSI21: NOT OKAY MSI22: NOT OKAY MSI23: NOT OKAY MSI24: NOT OKAY MSI25: NOT OKAY MSI26: NOT OKAY MSI27: NOT OKAY MSI28: NOT OKAY MSI29: NOT OKAY MSI30: NOT OKAY MSI31: NOT OKAY MSI32: NOT OKAYRead Tests
READ ( 1 bytes): OKAY READ ( 1024 bytes): OKAY READ ( 1025 bytes): OKAY READ (1024000 bytes): OKAY READ (1024001 bytes): OKAYWrite Tests
WRITE ( 1 bytes): OKAY WRITE ( 1024 bytes): OKAY WRITE ( 1025 bytes): OKAY WRITE (1024000 bytes): OKAY WRITE (1024001 bytes): OKAYCopy Tests
COPY ( 1 bytes): OKAY COPY ( 1024 bytes): OKAY COPY ( 1025 bytes): OKAY COPY (1024000 bytes): OKAY COPY (1024001 bytes): OKAYKishon Vijay Abraham I (37):
PCI: dwc: dra7xx: Group all host related setup inadd_pcie_port
PCI: dwc: designware: Add new *ops* for cpu addr fixup
PCI: dwc: dra7xx: Populatecpu_addr_fixupops
PCI: dwc: designware: Move the register defines to designware header
file
PCI: dwc: Addplatform_set_drvdata
PCI: dwc: Rename cfg_read/cfg_write to read/write
PCI: dwc: designware: Get device pointer at the start of
dw_pcie_host_init
PCI: dwc: Split *struct pcie_port* into host only and core structures
PCI: dwc: designware: Parse *num-lanes* property indw_pcie_setup_rc
PCI: dwc: designware: Fix style errors inpcie-designware.c
PCI: dwc: Splitpcie-designware.cinto host and core files
PCI: dwc: Create a new config symbol to enable pci dwc host
PCI: dwc: Remove dependency of designware toCONFIG_PCI
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
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: Modify dbi accessors to takedbi_baseas argument
PCI: dwc: Modify dbi accessors to access data of 4/2/1 bytes
PCI: dwc: Add *ops* to start and stop pcie link
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
PCI: dwc: dra7xx: Workaround for errata id i870
dt-bindings: PCI: dra7xx: Add dt bindings to enable legacy mode
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
MAINTAINERS: add PCI EP maintainer
ARM: DRA7: clockdomain: Change the CLKTRCTRL ofCM_PCIE_CLKSTCTRLto
SW_WKUP
ARM: dts: DRA7: Add pcie1 dt node for EP modeDocumentation/PCI/00-INDEX | 8 + .../PCI/endpoint/function/binding/pci-test.txt | 17 + Documentation/PCI/endpoint/pci-endpoint-cfs.txt | 84 ++ Documentation/PCI/endpoint/pci-endpoint.txt | 190 +++++ Documentation/PCI/endpoint/pci-test-function.txt | 66 ++ .../devicetree/bindings/pci/designware-pcie.txt | 26 +- Documentation/devicetree/bindings/pci/ti-pci.txt | 41 +- Documentation/misc-devices/pci-endpoint-test.txt | 35 + MAINTAINERS | 9 + arch/arm/boot/dts/am572x-idk.dts | 7 +- arch/arm/boot/dts/am57xx-beagle-x15-common.dtsi | 7 +- arch/arm/boot/dts/dra7-evm.dts | 4 + arch/arm/boot/dts/dra7.dtsi | 22 +- arch/arm/boot/dts/dra72-evm-common.dtsi | 4 + arch/arm/mach-omap2/clockdomains7xx_data.c | 2 +- drivers/Makefile | 5 + drivers/misc/Kconfig | 7 + drivers/misc/Makefile | 1 + drivers/misc/pci_endpoint_test.c | 533 ++++++++++++ drivers/pci/Kconfig | 1 + drivers/pci/Makefile | 3 - drivers/pci/dwc/Kconfig | 73 +- drivers/pci/dwc/Makefile | 6 +- drivers/pci/dwc/pci-dra7xx.c | 372 +++++++-- drivers/pci/dwc/pci-exynos.c | 83 +- drivers/pci/dwc/pci-imx6.c | 142 ++-- drivers/pci/dwc/pci-keystone-dw.c | 91 +- drivers/pci/dwc/pci-keystone.c | 56 +- drivers/pci/dwc/pci-keystone.h | 4 +- drivers/pci/dwc/pci-layerscape.c | 93 ++- drivers/pci/dwc/pcie-armada8k.c | 92 ++- drivers/pci/dwc/pcie-artpec6.c | 51 +- drivers/pci/dwc/pcie-designware-ep.c | 342 ++++++++ drivers/pci/dwc/pcie-designware-host.c | 620 ++++++++++++++ drivers/pci/dwc/pcie-designware-plat.c | 29 +- drivers/pci/dwc/pcie-designware.c | 868 ++++---------------- drivers/pci/dwc/pcie-designware.h | 254 +++++- drivers/pci/dwc/pcie-hisi.c | 60 +- drivers/pci/dwc/pcie-qcom.c | 72 +- drivers/pci/dwc/pcie-spear13xx.c | 85 +- drivers/pci/endpoint/Kconfig | 25 + 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 | 513 ++++++++++++ drivers/pci/endpoint/pci-ep-cfs.c | 427 ++++++++++ drivers/pci/endpoint/pci-epc-core.c | 548 ++++++++++++ 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 | 141 ++++ include/linux/pci-epf.h | 160 ++++ include/uapi/linux/Kbuild | 1 + include/uapi/linux/pcitest.h | 19 + tools/pci/pcitest.c | 186 +++++ tools/pci/pcitest.sh | 56 ++ 56 files changed, 5880 insertions(+), 1185 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/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/dwc/pcie-designware-host.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-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
cover PCI: Support for configurable PCI endpoint
Quoted 7 lines · Kishon Vijay Abraham I
- list
Hi Bjorn,
How do you want to handle this series? I'll send one more version of the series including the directory restructuring in the same series. Should it be based on your -next?
I think if you base it on my pci/host-designware branch, it should work pretty well. I haven't merged that into -next yet, but I will soon.
I'm not sure there was consensus on all the patches yet, but if you can group the easy ones at the beginning, I should be able to at least get quite a few out of the way.
Bjorn
cover PCI: Support for configurable PCI endpoint
Hi Bjorn,
Quoted 9 lines · Bjorn Helgaas
Quoted 7 lines · Kishon Vijay Abraham I
- list
Hi Bjorn,
How do you want to handle this series? I'll send one more version of the series including the directory restructuring in the same series. Should it be based on your -next?
Quoted 7 lines
I think if you base it on my pci/host-designware branch, it should work pretty well. I haven't merged that into -next yet, but I will soon.
I'm not sure there was consensus on all the patches yet, but if you can group the easy ones at the beginning, I should be able to at least get quite a few out of the way.
I've split this series and sent only the designware host driver rework part [1]. I created those patches after cherrypicking "PCI: designware: Check for iATU unroll only on platforms that use ATU" since it's not present in pci/host-designware branch.
The endpoint support has some minor comments which I'll fix and send in the next couple of days.
I'll send the endpoint series next (which will include endpoint framework, endpoint support in designware driver and endpoint support in dra7xx driver). Will that be fine? Also which branch should it be based on? pci -next?
Thanks
Kishon
[1] -> https://lkml.org/lkml/2017/2/15/273
Quoted 3 lines
Bjorn