* [PATCH 0/4] ZynqMP PS PCIe DMA Driver
@ 2017-08-08 11:12 Ravi Shankar Jonnalagadda
2017-08-08 11:12 ` [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA Ravi Shankar Jonnalagadda
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ravi Shankar Jonnalagadda @ 2017-08-08 11:12 UTC (permalink / raw)
To: linux-arm-kernel
ZynqMP devices have PCIe Bridge along with DMA in PS.
These devices can be configured as either PCIe Endpoints
or as PCIe Root Complex.
This patch series shall provide a driver to initiate
transactions using this DMA.
Single platform driver shall handle both EndPoint and
Root DMA transfers.
Patch 1 enables Root DMA register translation and
interrupts
Patch 2 corrects styling errors seen with checkpatch
Patch 3 adds DMA driver functionality for both PCI
end points and Root DMA
Patch 4 describes device tree bindings for Root DMA
Ravi Shankar Jonnalagadda (4):
PCI:xilinx-nwl: Enable Root DMA
PCI:xilinx-nwl: Correcting Styling checks
PCI: ZYNQMP PS PCIe DMA driver: Adding support for DMA driver
PCI: ZYNQMP PS PCIe DMA driver: Devicetree binding for Root DMA
.../devicetree/bindings/dma/xilinx/ps-pcie-dma.txt | 67 +
drivers/dma/Kconfig | 12 +
drivers/dma/xilinx/Makefile | 2 +
drivers/dma/xilinx/xilinx_ps_pcie.h | 43 +
drivers/dma/xilinx/xilinx_ps_pcie_main.c | 200 ++
drivers/dma/xilinx/xilinx_ps_pcie_platform.c | 3059 ++++++++++++++++++++
drivers/pci/host/pcie-xilinx-nwl.c | 23 +-
include/linux/dma/xilinx_ps_pcie_dma.h | 69 +
8 files changed, 3471 insertions(+), 4 deletions(-)
create mode 100644 Documentation/devicetree/bindings/dma/xilinx/ps-pcie-dma.txt
create mode 100644 drivers/dma/xilinx/xilinx_ps_pcie.h
create mode 100644 drivers/dma/xilinx/xilinx_ps_pcie_main.c
create mode 100644 drivers/dma/xilinx/xilinx_ps_pcie_platform.c
create mode 100644 include/linux/dma/xilinx_ps_pcie_dma.h
--
2.1.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA
2017-08-08 11:12 [PATCH 0/4] ZynqMP PS PCIe DMA Driver Ravi Shankar Jonnalagadda
@ 2017-08-08 11:12 ` Ravi Shankar Jonnalagadda
2017-08-19 21:15 ` Bjorn Helgaas
2017-08-08 11:12 ` [PATCH 2/4] PCI:xilinx-nwl: Correcting Styling checks Ravi Shankar Jonnalagadda
2017-08-08 11:12 ` [PATCH 4/4] PCI: ZYNQMP PS PCIe DMA driver: Devicetree binding for Root DMA Ravi Shankar Jonnalagadda
2 siblings, 1 reply; 6+ messages in thread
From: Ravi Shankar Jonnalagadda @ 2017-08-08 11:12 UTC (permalink / raw)
To: linux-arm-kernel
Enabling Root DMA interrupts
Adding Root DMA translations to bridge for Register Access
Signed-off-by: Ravi Shankar Jonnalagadda <vjonnal@xilinx.com>
---
drivers/pci/host/pcie-xilinx-nwl.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
index eec641a..5766582 100644
--- a/drivers/pci/host/pcie-xilinx-nwl.c
+++ b/drivers/pci/host/pcie-xilinx-nwl.c
@@ -39,6 +39,11 @@
#define E_ECAM_CONTROL 0x00000228
#define E_ECAM_BASE_LO 0x00000230
#define E_ECAM_BASE_HI 0x00000234
+#define E_DREG_CTRL 0x00000288
+#define E_DREG_BASE_LO 0x00000290
+
+#define DREG_DMA_EN BIT(0)
+#define DREG_DMA_BASE_LO 0xFD0F0000
/* Ingress - address translations */
#define I_MSII_CAPABILITIES 0x00000300
@@ -57,6 +62,10 @@
#define MSGF_MSI_STATUS_HI 0x00000444
#define MSGF_MSI_MASK_LO 0x00000448
#define MSGF_MSI_MASK_HI 0x0000044C
+/* Root DMA Interrupt register */
+#define MSGF_DMA_MASK 0x00000464
+
+#define MSGF_INTR_EN BIT(0)
/* Msg filter mask bits */
#define CFG_ENABLE_PM_MSG_FWD BIT(1)
@@ -766,6 +775,12 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
MSGF_LEG_SR_MASKALL, MSGF_LEG_STATUS);
+ /* Enabling DREG translations */
+ nwl_bridge_writel(pcie, DREG_DMA_EN, E_DREG_CTRL);
+ nwl_bridge_writel(pcie, DREG_DMA_BASE_LO, E_DREG_BASE_LO);
+ /* Enabling Root DMA interrupts */
+ nwl_bridge_writel(pcie, MSGF_INTR_EN, MSGF_DMA_MASK);
+
/* Enable all legacy interrupts */
nwl_bridge_writel(pcie, MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] PCI:xilinx-nwl: Correcting Styling checks
2017-08-08 11:12 [PATCH 0/4] ZynqMP PS PCIe DMA Driver Ravi Shankar Jonnalagadda
2017-08-08 11:12 ` [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA Ravi Shankar Jonnalagadda
@ 2017-08-08 11:12 ` Ravi Shankar Jonnalagadda
2017-08-19 21:18 ` Bjorn Helgaas
2017-08-08 11:12 ` [PATCH 4/4] PCI: ZYNQMP PS PCIe DMA driver: Devicetree binding for Root DMA Ravi Shankar Jonnalagadda
2 siblings, 1 reply; 6+ messages in thread
From: Ravi Shankar Jonnalagadda @ 2017-08-08 11:12 UTC (permalink / raw)
To: linux-arm-kernel
Correcting Style checks thrown by checkpatch scripts
Signed-off-by: Ravi Shankar Jonnalagadda <vjonnal@xilinx.com>
---
drivers/pci/host/pcie-xilinx-nwl.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
index 5766582..3c62e3d 100644
--- a/drivers/pci/host/pcie-xilinx-nwl.c
+++ b/drivers/pci/host/pcie-xilinx-nwl.c
@@ -506,15 +506,15 @@ static int nwl_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
for (i = 0; i < nr_irqs; i++) {
irq_domain_set_info(domain, virq + i, bit + i, &nwl_irq_chip,
- domain->host_data, handle_simple_irq,
- NULL, NULL);
+ domain->host_data, handle_simple_irq,
+ NULL, NULL);
}
mutex_unlock(&msi->lock);
return 0;
}
static void nwl_irq_domain_free(struct irq_domain *domain, unsigned int virq,
- unsigned int nr_irqs)
+ unsigned int nr_irqs)
{
struct irq_data *data = irq_domain_get_irq_data(domain, virq);
struct nwl_pcie *pcie = irq_data_get_irq_chip_data(data);
@@ -767,7 +767,6 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
/* Enable all misc interrupts */
nwl_bridge_writel(pcie, MSGF_MISC_SR_MASKALL, MSGF_MISC_MASK);
-
/* Disable all legacy interrupts */
nwl_bridge_writel(pcie, (u32)~MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
@@ -932,4 +931,5 @@ static struct platform_driver nwl_pcie_driver = {
},
.probe = nwl_pcie_probe,
};
+
builtin_platform_driver(nwl_pcie_driver);
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] PCI: ZYNQMP PS PCIe DMA driver: Devicetree binding for Root DMA
2017-08-08 11:12 [PATCH 0/4] ZynqMP PS PCIe DMA Driver Ravi Shankar Jonnalagadda
2017-08-08 11:12 ` [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA Ravi Shankar Jonnalagadda
2017-08-08 11:12 ` [PATCH 2/4] PCI:xilinx-nwl: Correcting Styling checks Ravi Shankar Jonnalagadda
@ 2017-08-08 11:12 ` Ravi Shankar Jonnalagadda
2 siblings, 0 replies; 6+ messages in thread
From: Ravi Shankar Jonnalagadda @ 2017-08-08 11:12 UTC (permalink / raw)
To: linux-arm-kernel
Binding explaining devicetree usage for using Root DMA capability of ZynqMPSoC
Signed-off-by: Ravi Shankar Jonnalagadda <vjonnal@xilinx.com>
---
.../devicetree/bindings/dma/xilinx/ps-pcie-dma.txt | 67 ++++++++++++++++++++++
1 file changed, 67 insertions(+)
create mode 100644 Documentation/devicetree/bindings/dma/xilinx/ps-pcie-dma.txt
diff --git a/Documentation/devicetree/bindings/dma/xilinx/ps-pcie-dma.txt b/Documentation/devicetree/bindings/dma/xilinx/ps-pcie-dma.txt
new file mode 100644
index 0000000..acdcc44
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/xilinx/ps-pcie-dma.txt
@@ -0,0 +1,67 @@
+* Xilinx PS PCIe Root DMA
+
+Required properties:
+- compatible: Should be "xlnx,ps_pcie_dma-1.00.a"
+- reg: Register offset for Root DMA channels
+- reg-names: Name for the register. Should be "ps_pcie_regbase"
+- interrupts: Interrupt pin for Root DMA
+- interrupt-names: Name for the interrupt. Should be "ps_pcie_rootdma_intr"
+- interrupt-parent: Should be gic in case of zynqmp
+- rootdma: Indicates this platform device is root dma.
+ This is required as the same platform driver will be invoked by pcie end points too
+- dma_vendorid: 16 bit PCIe device vendor id.
+ This can be later used by dma client for matching while using dma_request_channel
+- dma_deviceid: 16 bit PCIe device id
+ This can be later used by dma client for matching while using dma_request_channel
+- numchannels: Indicates number of channels to be enabled for the device.
+ Valid values are from 1 to 4 for zynqmp
+- ps_pcie_channel : One for each channel to be enabled.
+ This array contains channel specific properties.
+ Index 0: Direction of channel
+ Direction of channel can be either PCIe Memory to AXI memory i.e., Host to Card or
+ AXI Memory to PCIe memory i.e., Card to Host
+ PCIe to AXI Channel Direction is represented as 0x1
+ AXI to PCIe Channel Direction is represented as 0x0
+ Index 1: Number of Buffer Descriptors
+ This number describes number of buffer descriptors to be allocated for a channel
+ Index 2: Number of Queues
+ Each Channel has four DMA Buffer Descriptor Queues.
+ By default All four Queues will be managed by Root DMA driver.
+ User may choose to have only two queues either Source and it's Status Queue or
+ Destination and it's Status Queue to be handled by Driver.
+ The other two queues need to be handled by user logic which will not be part of this driver.
+ All Queues on Host is represented by 0x4
+ Two Queues on Host is represented by 0x2
+ Index 3: Coalesce Count
+ This number indicates the number of transfers after which interrupt needs to
+ be raised for the particular channel. The allowed range is from 0 to 255
+ Index 4: Coalesce Count Timer frequency
+ This property is used to control the frequency of poll timer. Poll timer is
+ created for a channel whenever coalesce count value (>= 1) is programmed for the particular
+ channel. This timer is helpful in draining out completed transactions even though interrupt is
+ not generated.
+
+Client Usage:
+ DMA clients can request for these channels using dma_request_channel API
+
+
+Xilinx PS PCIe Root DMA node Example
+++++++++++++++++++++++++++++++++++++
+
+ pci_rootdma: rootdma at fd0f0000 {
+ compatible = "xlnx,ps_pcie_dma-1.00.a";
+ reg = <0x0 0xfd0f0000 0x0 0x1000>;
+ reg-names = "ps_pcie_regbase";
+ interrupts = <0 117 4>;
+ interrupt-names = "ps_pcie_rootdma_intr";
+ interrupt-parent = <&gic>;
+ rootdma;
+ dma_vendorid = /bits/ 16 <0x10EE>;
+ dma_deviceid = /bits/ 16 <0xD021>;
+ numchannels = <0x4>;
+ #size-cells = <0x5>;
+ ps_pcie_channel0 = <0x1 0x7CF 0x4 0x0 0x3E8>;
+ ps_pcie_channel1 = <0x0 0x7CF 0x4 0x0 0x3E8>;
+ ps_pcie_channel2 = <0x1 0x7CF 0x4 0x0 0x3E8>;
+ ps_pcie_channel3 = <0x0 0x7CF 0x4 0x0 0x3E8>;
+ };
--
2.1.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA
2017-08-08 11:12 ` [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA Ravi Shankar Jonnalagadda
@ 2017-08-19 21:15 ` Bjorn Helgaas
0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2017-08-19 21:15 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Aug 08, 2017 at 04:42:16PM +0530, Ravi Shankar Jonnalagadda wrote:
Please update the subject line to match previous changes to this file,
e.g. (note spacing),
PCI: xilinx-nwl: Enable Root DMA
> Enabling Root DMA interrupts
s/Enabling/Enable/ (also in code comments)
> Adding Root DMA translations to bridge for Register Access
s/Adding/Add/
> Signed-off-by: Ravi Shankar Jonnalagadda <vjonnal@xilinx.com>
This should have an ack from Michal, but as far as I'm concerned:
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Since the bulk of this series is in drivers/dma, I assume Dan or Vinod
will take care of it.
> ---
> drivers/pci/host/pcie-xilinx-nwl.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
> index eec641a..5766582 100644
> --- a/drivers/pci/host/pcie-xilinx-nwl.c
> +++ b/drivers/pci/host/pcie-xilinx-nwl.c
> @@ -39,6 +39,11 @@
> #define E_ECAM_CONTROL 0x00000228
> #define E_ECAM_BASE_LO 0x00000230
> #define E_ECAM_BASE_HI 0x00000234
> +#define E_DREG_CTRL 0x00000288
> +#define E_DREG_BASE_LO 0x00000290
> +
> +#define DREG_DMA_EN BIT(0)
> +#define DREG_DMA_BASE_LO 0xFD0F0000
>
> /* Ingress - address translations */
> #define I_MSII_CAPABILITIES 0x00000300
> @@ -57,6 +62,10 @@
> #define MSGF_MSI_STATUS_HI 0x00000444
> #define MSGF_MSI_MASK_LO 0x00000448
> #define MSGF_MSI_MASK_HI 0x0000044C
> +/* Root DMA Interrupt register */
> +#define MSGF_DMA_MASK 0x00000464
> +
> +#define MSGF_INTR_EN BIT(0)
>
> /* Msg filter mask bits */
> #define CFG_ENABLE_PM_MSG_FWD BIT(1)
> @@ -766,6 +775,12 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
> nwl_bridge_writel(pcie, nwl_bridge_readl(pcie, MSGF_LEG_STATUS) &
> MSGF_LEG_SR_MASKALL, MSGF_LEG_STATUS);
>
> + /* Enabling DREG translations */
> + nwl_bridge_writel(pcie, DREG_DMA_EN, E_DREG_CTRL);
> + nwl_bridge_writel(pcie, DREG_DMA_BASE_LO, E_DREG_BASE_LO);
> + /* Enabling Root DMA interrupts */
> + nwl_bridge_writel(pcie, MSGF_INTR_EN, MSGF_DMA_MASK);
> +
> /* Enable all legacy interrupts */
> nwl_bridge_writel(pcie, MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
>
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/4] PCI:xilinx-nwl: Correcting Styling checks
2017-08-08 11:12 ` [PATCH 2/4] PCI:xilinx-nwl: Correcting Styling checks Ravi Shankar Jonnalagadda
@ 2017-08-19 21:18 ` Bjorn Helgaas
0 siblings, 0 replies; 6+ messages in thread
From: Bjorn Helgaas @ 2017-08-19 21:18 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Aug 08, 2017 at 04:42:17PM +0530, Ravi Shankar Jonnalagadda wrote:
s/PCI:xilinx-nwl: Correcting Styling checks/PCI: xilinx-nwl: Clean up whitespace/
> Correcting Style checks thrown by checkpatch scripts
s/Correcting Style checks thrown/Correct whitespace errors reported/
> Signed-off-by: Ravi Shankar Jonnalagadda <vjonnal@xilinx.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/host/pcie-xilinx-nwl.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
> index 5766582..3c62e3d 100644
> --- a/drivers/pci/host/pcie-xilinx-nwl.c
> +++ b/drivers/pci/host/pcie-xilinx-nwl.c
> @@ -506,15 +506,15 @@ static int nwl_irq_domain_alloc(struct irq_domain *domain, unsigned int virq,
>
> for (i = 0; i < nr_irqs; i++) {
> irq_domain_set_info(domain, virq + i, bit + i, &nwl_irq_chip,
> - domain->host_data, handle_simple_irq,
> - NULL, NULL);
> + domain->host_data, handle_simple_irq,
> + NULL, NULL);
> }
> mutex_unlock(&msi->lock);
> return 0;
> }
>
> static void nwl_irq_domain_free(struct irq_domain *domain, unsigned int virq,
> - unsigned int nr_irqs)
> + unsigned int nr_irqs)
> {
> struct irq_data *data = irq_domain_get_irq_data(domain, virq);
> struct nwl_pcie *pcie = irq_data_get_irq_chip_data(data);
> @@ -767,7 +767,6 @@ static int nwl_pcie_bridge_init(struct nwl_pcie *pcie)
> /* Enable all misc interrupts */
> nwl_bridge_writel(pcie, MSGF_MISC_SR_MASKALL, MSGF_MISC_MASK);
>
> -
> /* Disable all legacy interrupts */
> nwl_bridge_writel(pcie, (u32)~MSGF_LEG_SR_MASKALL, MSGF_LEG_MASK);
>
> @@ -932,4 +931,5 @@ static struct platform_driver nwl_pcie_driver = {
> },
> .probe = nwl_pcie_probe,
> };
> +
> builtin_platform_driver(nwl_pcie_driver);
> --
> 2.1.1
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-08-19 21:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-08 11:12 [PATCH 0/4] ZynqMP PS PCIe DMA Driver Ravi Shankar Jonnalagadda
2017-08-08 11:12 ` [PATCH 1/4] PCI:xilinx-nwl: Enable Root DMA Ravi Shankar Jonnalagadda
2017-08-19 21:15 ` Bjorn Helgaas
2017-08-08 11:12 ` [PATCH 2/4] PCI:xilinx-nwl: Correcting Styling checks Ravi Shankar Jonnalagadda
2017-08-19 21:18 ` Bjorn Helgaas
2017-08-08 11:12 ` [PATCH 4/4] PCI: ZYNQMP PS PCIe DMA driver: Devicetree binding for Root DMA Ravi Shankar Jonnalagadda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).