misc: Add afi config drivers support.
Subsystems (3)
cover misc: Add afi config drivers support.
Xilinx SoC platforms (Zynq and ZynqMP) connect the PS to the programmable logic (PL) through the AXI port.This AXI port helps to establish the data path between the PS and PL. In-order to establish to proper communication data path between PS and PL the AXI port data path should be configured with the proper Bus-width values
This patch series Adds afi config drivers support to handle the PS-PL AXI port bus-width configurations.
Nava kishore Manne (5):
misc: doc: Add binding doc for the afi config driver
misc: zynq: Add afi config driver
firmware: xilinx: Add afi ioctl support
misc: doc: Add binding doc for the zynqmp afi config driver
misc: zynqmp: Add afi config driver
.../bindings/misc/xlnx,zynq-afi-fpga.yaml | 47 ++++++ .../bindings/misc/xlnx,zynqmp-afi-fpga.yaml | 136 ++++++++++++++++++ drivers/firmware/xilinx/zynqmp.c | 13 ++ drivers/misc/Kconfig | 22 +++ drivers/misc/Makefile | 2 + drivers/misc/zynq-afi.c | 81 +++++++++++ drivers/misc/zynqmp-afi.c | 83 +++++++++++ include/linux/firmware/xlnx-zynqmp.h | 7 + 8 files changed, 391 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/xlnx,zynq-afi-fpga.yaml create mode 100644 Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml create mode 100644 drivers/misc/zynq-afi.c create mode 100644 drivers/misc/zynqmp-afi.c
Signature · 1 line
2.18.0
PATCH 1/5 misc: doc: Add binding doc for the afi config driver
This patch adds the binding document for the afi config driver.
--- .../bindings/misc/xlnx,zynq-afi-fpga.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/xlnx,zynq-afi-fpga.yaml
Documentation/devicetree/bindings/misc/xlnx,zynq-afi-fpga.yaml new file +47 -0
@@ -0,0 +1,47 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/xlnx,zynq-afi-fpga.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx Zynq AFI interface Manager. + +maintainers: + - Nava kishore Manne <[email protected]> + +description: | + The Zynq Processing System core provides access from PL masters to PS + internal peripherals, and memory through AXI FIFO interface(AFI) + interfaces. + +properties: + compatible: + items: + - enum: + - xlnx,zynq-afi-fpga + reg: + maxItems: 1 + + xlnx,afi-buswidth: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Size of the afi bus width. + 0 - 64-bit AXI data width. + 1 - 32-bit AXI data width. + maxItems: 1 + +required: + - compatible + - reg + - xlnx,afi-buswidth + +additionalProperties: false + +examples: + - | + afi0: afi@f8008000 { + compatible = "xlnx,zynq-afi-fpga"; + reg = <0xf8008000 0x1000>; + xlnx,afi-buswidth = <1>; + }; +...
Signature · 1 line
2.18.0
PATCH 2/5 misc: zynq: Add afi config driver
In reply to Nava kishore ManneThis patch adds zynq afi config driver. This is useful for the configuration of the PS-PL interface on zynq platform.
--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynq-afi.c | 81 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 drivers/misc/zynq-afi.c
drivers/misc/Kconfig +11 -0
@@ -445,6 +445,17 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A host ports using only one USB controller. +config ZYNQ_AFI + tristate "Xilinx ZYNQ AFI support" + help + Zynq AFI driver support for writing to the AFI registers + for configuring PS_PL Bus-width. Xilinx Zynq SoC connect + the PS to the programmable logic (PL) through the AXI port. + This AXI port helps to establish the data path between the + PS and PL.In-order to establish the proper communication path + between PS and PL, the AXI port data path should be configured + with the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI) += habanalabs/ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o +obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.o
drivers/misc/zynq-afi.c new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
2.18.0
Greg KH
maintainerRe: [PATCH 2/5] misc: zynq: Add afi config driver
Quoted 2 lines · Nava kishore Manne
This patch adds zynq afi config driver. This is useful for the configuration of the PS-PL interface on zynq platform.
What is "PS-PL"? Can you describe it better please?
Quoted 98 lines
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynq-afi.c | 81 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 drivers/misc/zynq-afi.cdrivers/misc/Kconfig +11
-0@@ -445,6 +445,17 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A host ports using only one USB controller. +config ZYNQ_AFI + tristate "Xilinx ZYNQ AFI support" + help + Zynq AFI driver support for writing to the AFI registers + for configuring PS_PL Bus-width. Xilinx Zynq SoC connect + the PS to the programmable logic (PL) through the AXI port. + This AXI port helps to establish the data path between the + PS and PL.In-order to establish the proper communication path + between PS and PL, the AXI port data path should be configured + with the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile +1
-0@@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI) += habanalabs/ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o +obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.odrivers/misc/zynq-afi.c new file +52
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx ZYNQ AFI driver. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> + +/* Registers and special values for doing register-based operations */ +#define AFI_RDCHAN_CTRL_OFFSET 0x00 +#define AFI_WRCHAN_CTRL_OFFSET 0x14 + +#define AFI_BUSWIDTH_MASK 0x01 + +/** +* struct afi_fpga - AFI register description +* @membase: pointer to register struct +* @afi_width: AFI bus width to be written +*/ +struct zynq_afi_fpga { +void __iomem *membase; +u32 afi_width; +}; + +static int zynq_afi_fpga_probe (struct platform_device *pdev) +{ +struct zynq_afi_fpga *afi_fpga; +struct resource *res; +u32 reg_val; +u32 val; + + afi_fpga =devm_kzalloc (&pdev->dev,sizeof (*afi_fpga),GFP_KERNEL ); +if (!afi_fpga) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + afi_fpga->membase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (afi_fpga->membase)) +return PTR_ERR (afi_fpga->membase); + + val =device_property_read_u32 (&pdev->dev,"xlnx,afi-width" , + &afi_fpga->afi_width); +if (val) { +dev_err (&pdev->dev,"failed to get the afi bus width\n" ); +return -EINVAL ; + } + + reg_val =readl (afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET );
drivers/misc/zynq-afi.c line 62
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+ reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET ); + reg_val =readl (afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + +return 0 ; +}
I do not understand, why is this driver needed at all? Why can't you do the above from userspace?
All this does is write some values to the hardware at probe time, who needs this?
thanks,
greg k-h
RE: [PATCH 2/5] misc: zynq: Add afi config driver
Hi Greg,
Please find my response inline.
Quoted 13 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:17 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 2/5] misc: zynq: Add afi config driver
Quoted 6 lines
Quoted 2 lines · Nava kishore Manne
This patch adds zynq afi config driver. This is useful for the configuration of the PS-PL interface on zynq platform.
What is "PS-PL"? Can you describe it better please?
PS-PL interface is nothing but the interface between processing system(PS) that contains arm cores and Programmable Logic(PL) i.e FPGA. Will update the description in v2.
Quoted 114 lines
Quoted 15 lines
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynq-afi.c | 81 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 drivers/misc/zynq-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
f532c59bb59b..877b43b3377d100644drivers/misc/Kconfig config HISI_HIKEY_USB · line 445
Quoted 1 line
drivers/misc/Kconfig +0
-0@@ -445,6 +445,17 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A hostports
drivers/misc/Makefile obj-$(CONFIG_HABANA_AI) +=
Quoted 21 lines
drivers/misc/Kconfig +11
-0using only one USB controller. +config ZYNQ_AFI + tristate "Xilinx ZYNQ AFI support" + help + Zynq AFI driver support for writing to the AFI registers + for configuring PS_PL Bus-width. Xilinx Zynq SoC connect + the PS to the programmable logic (PL) through the AXI port. + This AXI port helps to establish the data path between the + PS and PL.In-order to establish the proper communication path + between PS and PL, the AXI port data path should be configured + with the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile index renamed from drivers/misc/Makefile +0
-0
99b6f15a3c70..e9b03843100f100644drivers/misc/Makefile +0
-0@@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI) +=habanalabs/
Quoted 34 lines
drivers/misc/Makefile +1
-0obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o +obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.odrivers/misc/zynq-afi.c new renamed from drivers/misc/zynq-afi.c +0
-0file mode 100644 index 000000000000..04317d1bdb98
drivers/misc/zynq-afi.c new file +25
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx ZYNQ AFI driver. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> + +/* Registers and special values for doing register-based operations */ +#define AFI_RDCHAN_CTRL_OFFSET 0x00 +#define AFI_WRCHAN_CTRL_OFFSET 0x14 + +#define AFI_BUSWIDTH_MASK 0x01 + +/** +* struct afi_fpga - AFI register description +* @membase: pointer to register struct +* @afi_width: AFI bus width to be written +*/ +struct zynq_afi_fpga { +void __iomem *membase;drivers/misc/zynq-afi.c line 35
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+u32 afi_width; +}; + +static int zynq_afi_fpga_probe (struct platform_device *pdev) { +struct zynq_afi_fpga *afi_fpga; +struct resource *res; +u32 reg_val; +u32 val; + + afi_fpga = devm_kzalloc(&pdev->dev, sizeof(*afi_fpga),
GFP_KERNEL);Quoted 16 lines
drivers/misc/zynq-afi.c new file +16
-0+if (!afi_fpga) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + afi_fpga->membase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (afi_fpga->membase)) +return PTR_ERR (afi_fpga->membase); + + val =device_property_read_u32 (&pdev->dev,"xlnx,afi-width" , + &afi_fpga->afi_width); +if (val) { +dev_err (&pdev->dev,"failed to get the afi bus width\n" ); +return -EINVAL ; + } + + reg_val =readl (afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET );drivers/misc/zynq-afi.c line 62
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+ reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET ); + reg_val =readl (afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + +return 0 ; +}I do not understand, why is this driver needed at all? Why can't you do the above from userspace?
Quoted 2 lines
All this does is write some values to the hardware at probe time, who needs this?
This driver will be used by the overlay framework for configuring the interface after programming the FPGA and before probing the drivers that are present in the PL.
Regards,
Navakishore.
Greg KH
maintainerRe: [PATCH 2/5] misc: zynq: Add afi config driver
Quoted 140 lines · Nava kishore Manne
Hi Greg,
Please find my response inline.
Quoted 13 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:17 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 2/5] misc: zynq: Add afi config driverQuoted 6 lines
Quoted 2 lines · Nava kishore Manne
This patch adds zynq afi config driver. This is useful for the configuration of the PS-PL interface on zynq platform.
What is "PS-PL"? Can you describe it better please?
PS-PL interface is nothing but the interface between processing system(PS) that contains arm cores and Programmable Logic(PL) i.e FPGA. Will update the description in v2.
Quoted 114 lines
Quoted 15 lines
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynq-afi.c | 81 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 drivers/misc/zynq-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
f532c59bb59b..877b43b3377d100644drivers/misc/Kconfig config HISI_HIKEY_USB · line 445
Quoted 1 line
drivers/misc/Kconfig +0
-0@@ -445,6 +445,17 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A hostports
drivers/misc/Makefile obj-$(CONFIG_HABANA_AI) +=
Quoted 21 lines
drivers/misc/Kconfig +11
-0using only one USB controller. +config ZYNQ_AFI + tristate "Xilinx ZYNQ AFI support" + help + Zynq AFI driver support for writing to the AFI registers + for configuring PS_PL Bus-width. Xilinx Zynq SoC connect + the PS to the programmable logic (PL) through the AXI port. + This AXI port helps to establish the data path between the + PS and PL.In-order to establish the proper communication path + between PS and PL, the AXI port data path should be configured + with the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile index renamed from drivers/misc/Makefile +0
-0
99b6f15a3c70..e9b03843100f100644drivers/misc/Makefile +0
-0@@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI) +=habanalabs/
Quoted 34 lines
drivers/misc/Makefile +1
-0obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o +obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.odrivers/misc/zynq-afi.c new renamed from drivers/misc/zynq-afi.c +0
-0file mode 100644 index 000000000000..04317d1bdb98
drivers/misc/zynq-afi.c new file +25
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx ZYNQ AFI driver. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> + +/* Registers and special values for doing register-based operations */ +#define AFI_RDCHAN_CTRL_OFFSET 0x00 +#define AFI_WRCHAN_CTRL_OFFSET 0x14 + +#define AFI_BUSWIDTH_MASK 0x01 + +/** +* struct afi_fpga - AFI register description +* @membase: pointer to register struct +* @afi_width: AFI bus width to be written +*/ +struct zynq_afi_fpga { +void __iomem *membase;drivers/misc/zynq-afi.c line 35
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+u32 afi_width; +}; + +static int zynq_afi_fpga_probe (struct platform_device *pdev) { +struct zynq_afi_fpga *afi_fpga; +struct resource *res; +u32 reg_val; +u32 val; + + afi_fpga = devm_kzalloc(&pdev->dev, sizeof(*afi_fpga),
GFP_KERNEL);Quoted 16 lines
drivers/misc/zynq-afi.c new file +16
-0+if (!afi_fpga) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + afi_fpga->membase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (afi_fpga->membase)) +return PTR_ERR (afi_fpga->membase); + + val =device_property_read_u32 (&pdev->dev,"xlnx,afi-width" , + &afi_fpga->afi_width); +if (val) { +dev_err (&pdev->dev,"failed to get the afi bus width\n" ); +return -EINVAL ; + } + + reg_val =readl (afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET );drivers/misc/zynq-afi.c line 62
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+ reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET ); + reg_val =readl (afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + +return 0 ; +}I do not understand, why is this driver needed at all? Why can't you do the above from userspace?
Quoted 4 lines
Quoted 2 lines
All this does is write some values to the hardware at probe time, who needs this?
This driver will be used by the overlay framework for configuring the interface after programming the FPGA and before probing the drivers that are present in the PL.
What is a "overlay framework"? And why does the kernel have to do this? Why can't you write these hardware values from userspace?
confused,
greg k-h
RE: [PATCH 2/5] misc: zynq: Add afi config driver
Hi Greg,
Please find my response inline.
Quoted 158 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 8:57 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 2/5] misc: zynq: Add afi config driverQuoted 17 lines · Nava kishore Manne
Hi Greg,
Please find my response inline.
Quoted 13 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:17 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 2/5] misc: zynq: Add afi config driverQuoted 7 lines
Quoted 6 lines · Nava kishore Manne
Quoted 2 lines
This patch adds zynq afi config driver. This is useful for the configuration of the PS-PL interface on zynq platform.
What is "PS-PL"? Can you describe it better please?
PS-PL interface is nothing but the interface between processing system(PS)
that contains arm cores and Programmable Logic(PL) i.e FPGA.
Quoted 119 lines
Will update the description in v2.
Quoted 116 lines
Quoted 15 lines
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynq-afi.c | 81 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644
drivers/misc/zynq-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
f532c59bb59b..877b43b3377d100644drivers/misc/Kconfig config HISI_HIKEY_USB · line 445
Quoted 1 line
drivers/misc/Kconfig +0
-0@@ -445,6 +445,17 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A hostports
drivers/misc/Makefile obj-$(CONFIG_HABANA_AI) +=
Quoted 21 lines
drivers/misc/Kconfig +11
-0using only one USB controller. +config ZYNQ_AFI + tristate "Xilinx ZYNQ AFI support" + help + Zynq AFI driver support for writing to the AFI registers + for configuring PS_PL Bus-width. Xilinx Zynq SoC connect + the PS to the programmable logic (PL) through the AXI port. + This AXI port helps to establish the data path between the + PS and PL.In-order to establish the proper communication path + between PS and PL, the AXI port data path should be configured + with the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile index renamed from drivers/misc/Makefile +0
-0
99b6f15a3c70..e9b03843100f100644drivers/misc/Makefile +0
-0@@ -56,3 +56,4 @@ obj-$(CONFIG_HABANA_AI) +=habanalabs/
Quoted 34 lines
drivers/misc/Makefile +1
-0obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o +obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.odrivers/misc/zynq-afi.c new renamed from drivers/misc/zynq-afi.c +0
-0file mode 100644 index 000000000000..04317d1bdb98
drivers/misc/zynq-afi.c new file +25
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx ZYNQ AFI driver. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> + +/* Registers and special values for doing register-based operations */ +#define AFI_RDCHAN_CTRL_OFFSET 0x00 +#define AFI_WRCHAN_CTRL_OFFSET 0x14 + +#define AFI_BUSWIDTH_MASK 0x01 + +/** +* struct afi_fpga - AFI register description +* @membase: pointer to register struct +* @afi_width: AFI bus width to be written +*/ +struct zynq_afi_fpga { +void __iomem *membase;drivers/misc/zynq-afi.c line 35
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+u32 afi_width; +}; + +static int zynq_afi_fpga_probe (struct platform_device *pdev) { +struct zynq_afi_fpga *afi_fpga; +struct resource *res; +u32 reg_val; +u32 val; + + afi_fpga = devm_kzalloc(&pdev->dev, sizeof(*afi_fpga),
GFP_KERNEL);Quoted 16 lines
drivers/misc/zynq-afi.c new file +16
-0+if (!afi_fpga) +return -ENOMEM ; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + afi_fpga->membase =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (afi_fpga->membase)) +return PTR_ERR (afi_fpga->membase); + + val =device_property_read_u32 (&pdev->dev,"xlnx,afi-width" , + &afi_fpga->afi_width); +if (val) { +dev_err (&pdev->dev,"failed to get the afi bus width\n" ); +return -EINVAL ; + } + + reg_val =readl (afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET );drivers/misc/zynq-afi.c line 62
Quoted 10 lines
drivers/misc/zynq-afi.c new file +10
-0+ reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_RDCHAN_CTRL_OFFSET ); + reg_val =readl (afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + reg_val &= ~AFI_BUSWIDTH_MASK ; +writel (reg_val | afi_fpga->afi_width, + afi_fpga->membase +AFI_WRCHAN_CTRL_OFFSET ); + +return 0 ; +}I do not understand, why is this driver needed at all? Why can't you do the above from userspace?
All this does is write some values to the hardware at probe time, who needs this?
Quoted 9 lines
Quoted 1 line
This driver will be used by the overlay framework for configuring the
interface after programming the FPGA and before probing the drivers that are present in the PL.
What is a "overlay framework"? And why does the kernel have to do this? Why can't you write these hardware values from userspace?
confused,
The Zynq based processing system (PS) that contains ARM cores and Xilinx programmable logic (PL/FPGA) in a single device. The PS and PL can be tightly or loosely coupled using multiple interfaces and other signals. This enables the designer to effectively integrate user-created hardware accelerators and other functions in the PL logic that are accessible to the processors and can also access memory resources in the PS.
https://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf (Page No: 41)
To Program/Re-Program the PL at runtime in Linux we have a an FPGA Manger Framework and this frame work uses DT-Overlays to programming the FPGA and probing the relevant PL drivers. For more info please refer this link: https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/fpga/fpga-region.txt
Every Zynq/ZynqMP PL(FPGA) design has its own PS-PL configuration. So after programming the FPGA and before probing the relevant PL drivers these PS-PL configurations should be set.
Example DT-Overlay file to program the PL(FPGA) from Linux:
/dts-v1/;
/plugin/;
/ {
fragment@0 { /* fragment 0 contains Bitstream info */
target = <&fpga_full>;
overlay0: __overlay__ {
#address-cells = <2>;
#size-cells = <2>;
firmware-name = "Base_Zynq_MPSoC_wrapper.bit.bin";
resets = <&zynqmp_reset 116>;
};
};
fragment@1 { /* fragment 1 contains PS-PL configurations */
target = <&amba>;
overlay1: __overlay__ {
afi0: afi@f8008000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "xlnx,zynq-afi-fpga";
reg = <0xf8008000 0x24>;
xlnx,afi-width = <0x1>;
};
};
};
fragment@2 { /* Fragment 2 contains the relevant drivers for the IP's present in the FPGA design*/
target = <&amba>;
overlay2: __overlay__ {
axi_gpio_0: gpio@a0000000 {
#gpio-cells = <2>;
clock-names = "s_axi_aclk";
clocks = <&zynqmp_clk 71>;
compatible = "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x0 0xa0000000 0x0 0x1000>;
};
};
} ;
};In-order to support the PL(FPGA) programming and to configure the interface between PS and PL using FPGA Manager. This Driver is needed in the kernel space.
@Moritz Fischer: Can you please let us know your thoughts on this.
Regards,
Navakishore.
kernel test robot
build botRe: [PATCH 2/5] misc: zynq: Add afi config driver
In reply to Nava kishore ManneThank you for the patch! Perhaps something to improve:
Hi Nava,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on robh/for-next linus/master v5.12-rc8 next-20210420] [cannot apply to xlnx/master]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Nava-kishore-Manne/misc-doc-Add-binding-doc-for-the-afi-config-driver/20210420-171153 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 9204ff94868496f2d9b8b173af52ec455160c364 config: h8300-randconfig-r006-20210420 (attached as .config) compiler: h8300-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/af0a9229443d76e4125dea6297fd56ea5f8f2a81
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Nava-kishore-Manne/misc-doc-Add-binding-doc-for-the-afi-config-driver/20210420-171153 git checkout af0a9229443d76e4125dea6297fd56ea5f8f2a81
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
All warnings (new ones prefixed by >>):
>> drivers/misc/zynq-afi.c:27: warning: expecting prototype for struct afi_fpga. Prototype was for struct zynq_afi_fpga instead
vim +27 drivers/misc/zynq-afi.c
18
19 /**
20 * struct afi_fpga - AFI register description
21 * @membase: pointer to register struct
22 * @afi_width: AFI bus width to be written
23 */
24 struct zynq_afi_fpga {
25 void __iomem *membase;
26 u32 afi_width;
> 27 };
28 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Re: [PATCH 2/5] misc: zynq: Add afi config driver
In reply to Nava kishore ManneQuoted 8 lines · Nava kishore Manne
drivers/misc/Kconfig +0
-0@@ -445,6 +445,17 @@ config HISI_HIKEY_USB switching between the dual-role USB-C port and the USB-A host ports using only one USB controller.
drivers/misc/Kconfig config HISI_HIKEY_USB · line 457
Quoted 10 lines
drivers/misc/Kconfig +10
-0+config ZYNQ_AFI + tristate "Xilinx ZYNQ AFI support" + help + Zynq AFI driver support for writing to the AFI registers + for configuring PS_PL Bus-width. Xilinx Zynq SoC connect + the PS to the programmable logic (PL) through the AXI port. + This AXI port helps to establish the data path between the + PS and PL.In-order to establish the proper communication path + between PS and PL, the AXI port data path should be configured + with the proper Bus-width values
End that last sentence with a period ('.').
thanks.
Signature · 1 line
~Randy
PATCH 3/5 firmware: xilinx: Add afi ioctl support
In reply to Nava kishore ManneThis patch adds afi ioctl to support dynamic PS-PL bus width settings.
--- drivers/firmware/xilinx/zynqmp.c | 13 +++++++++++++ include/linux/firmware/xlnx-zynqmp.h | 7 +++++++ 2 files changed, 20 insertions(+)
drivers/firmware/xilinx/zynqmp.c +13 -0
@@ -713,6 +713,19 @@ int zynqmp_pm_read_pggs(u32 index, u32 *value) }EXPORT_SYMBOL_GPL (zynqmp_pm_read_pggs); +/** +* zynqmp_pm_afi() - PM API for setting the PS-PL bus width +* @index: Register index value +* @value: value to be written into the register +* +* Return: Returns status, either success or error+reason +*/ +int zynqmp_pm_afi (u32 index,u32 value) +{ +return zynqmp_pm_invoke_fn (PM_IOCTL ,0 ,IOCTL_AFI , index, value,NULL ); +} +EXPORT_SYMBOL_GPL (zynqmp_pm_afi); +/** * zynqmp_pm_set_boot_health_status() - PM API for setting healthy boot status * @value: Status value to be written
include/linux/firmware/xlnx-zynqmp.h +7 -0
@@ -113,6 +113,7 @@ enum pm_ioctl_id {IOCTL_READ_PGGS =15 ,/* Set healthy bit value */ IOCTL_SET_BOOT_HEALTH_STATUS =17 , + IOCTL_AFI = 18, }; enum pm_query_id {
@@ -353,6 +354,7 @@ int zynqmp_pm_write_pggs(u32 index, u32 value);int zynqmp_pm_read_pggs (u32 index,u32 *value);int zynqmp_pm_system_shutdown (const u32 type,const u32 subtype);int zynqmp_pm_set_boot_health_status (u32 value); +int zynqmp_pm_afi (u32 index,u32 value);#else static inline struct zynqmp_eemi_ops *zynqmp_pm_get_eemi_ops (void ) {
@@ -537,6 +539,11 @@ static inline int zynqmp_pm_set_boot_health_status(u32 value) {return -ENODEV ; } + +static inline int zynqmp_pm_afi (u32 index,u32 value) +{ +return -ENODEV ; +}#endif #endif /* __FIRMWARE_ZYNQMP_H__ */
Signature · 1 line
2.18.0
PATCH 4/5 misc: doc: Add binding doc for the zynqmp afi config driver
In reply to Nava kishore ManneThis patch adds the binding document for the zynqmp afi config driver.
--- .../bindings/misc/xlnx,zynqmp-afi-fpga.yaml | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml new file +136 -0
@@ -0,0 +1,136 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/xlnx,zynqmp-afi-fpga.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx ZynqMP AFI interface Manager. + +maintainers: + - Nava kishore Manne <[email protected]> + +description: | + The Zynq UltraScale+ MPSoC Processing System core provides access from PL + masters to PS internal peripherals, and memory through AXI FIFO interface(AFI) + interfaces. + +properties: + compatible: + items: + - enum: + - xlnx,zynqmp-afi-fpga + + config-afi: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + Pairs of <regid value > + The possible values of regid and values are + regid - Regids of the register to be written possible values + 0- AFIFM0_RDCTRL + 1- AFIFM0_WRCTRL + 2- AFIFM1_RDCTRL + 3- AFIFM1_WRCTRL + 4- AFIFM2_RDCTRL + 5- AFIFM2_WRCTRL + 6- AFIFM3_RDCTRL + 7- AFIFM3_WRCTRL + 8- AFIFM4_RDCTRL + 9- AFIFM4_WRCTRL + 10- AFIFM5_RDCTRL + 11- AFIFM5_WRCTRL + 12- AFIFM6_RDCTRL + 13- AFIFM6_WRCTRL + 14- AFIFS + 15- AFIFS_SS2 + value - Array of values to be written. + for FM0_RDCTRL(0) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM0_WRCTRL(1) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM1_RDCTRL(2) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM1_WRCTRL(3) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM2_RDCTRL(4) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM2_WRCTRL(5) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM3_RDCTRL(6) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM3_WRCTRL(7) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM4_RDCTRL(8) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM4_WRCTRL(9) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM5_RDCTRL(10) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM5_WRCTRL(11) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM6_RDCTRL(12) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM6_WRCTRL(13) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for AFI_FA(14) + dw_ss1_sel bits (11:10) + dw_ss0_sel bits (9:8) + 0x0 - 32-bit AXI data width + 0x1 - 64-bit AXI data width + 0x2 - 128-bit AXI data width + All other bits are 0 write ignored. + + for AFI_FA(15) selects for ss2AXI data width valid values + 0x000 - 32-bit AXI data width + 0x100 - 64-bit AXI data width + 0x200 - 128-bit AXI data width + minItems: 1 + maxItems: 15 + +required: + - compatible + - config-afi + +additionalProperties: false + +examples: + - | + firmware { + zynqmp_firmware: zynqmp-firmware { + compatible = "xlnx,zynqmp-firmware"; + method = "smc"; + afi0: afi { + compatible = "xlnx,afi-fpga"; + config-afi = <0 2>, <1 1>, <2 1>; + }; + }; + }; + +...
Signature · 1 line
2.18.0
Rob Herring
maintainerRe: [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driver
Quoted 9 lines · Nava kishore Manne
This patch adds the binding document for the zynqmp afi config driver.
Signed-off-by Nava kishore Manne <[email protected]>--- .../bindings/misc/xlnx,zynqmp-afi-fpga.yaml | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.example.dt.yaml:0:0: /example-0/firmware/zynqmp-firmware: failed to match any schema with compatible: ['xlnx,zynqmp-firmware'] Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.example.dt.yaml:0:0: /example-0/firmware/zynqmp-firmware/afi: failed to match any schema with compatible: ['xlnx,afi-fpga']
See https://patchwork.ozlabs.org/patch/1468230
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit.
RE: [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driver
Hi Rob,
Please find my response inline.
Quoted 26 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, April 20, 2021 7:29 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Tejas Patel <[email protected]>; Michal Simek <[email protected]>; Rajan Vaja <[email protected]>; linux-arm- [email protected]; Amit Sunil Dhamne <[email protected]>; Dragan Cvetic <[email protected]>; Derek Kiernan <[email protected]>; Jolly Shah <[email protected]>; git <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driverQuoted 9 lines · Nava kishore Manne
This patch adds the binding document for the zynqmp afi config driver.
Signed-off-by Nava kishore Manne <[email protected]>--- .../bindings/misc/xlnx,zynqmp-afi-fpga.yaml | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml
Quoted 4 lines
My bot found errors running 'make DT_CHECKER_FLAGS=-m
dt_binding_check'
on your patch (DT_CHECKER_FLAGSis new in v5.13):
Thanks for the providing the update on the new features
Quoted 15 lines
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.example.dt.yaml:0:0: /example-0/firmware/zynqmp-firmware: failed to match any schema with compatible: ['xlnx,zynqmp-firmware']Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.example.dt.yaml:0:0: /example-0/firmware/zynqmp-firmware/afi:
failed to match any schema with compatible: ['xlnx,afi-fpga']See https://patchwork.ozlabs.org/patch/1468230
This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.
Quoted 7 lines
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit.
Will fix in v2.
Regards,
Navakishore.
Rob Herring
maintainerRe: [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driver
In reply to Nava kishore ManneQuoted 2 lines · Nava kishore Manne
This patch adds the binding document for the zynqmp afi config driver.
Bindings are for h/w blocks, not drivers.
Quoted 31 lines
Signed-off-by Nava kishore Manne <[email protected]>--- .../bindings/misc/xlnx,zynqmp-afi-fpga.yaml | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yamlDocumentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml new file +18
-0@@ -0,0 +1,136 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/xlnx,zynqmp-afi-fpga.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx ZynqMP AFI interface Manager. + +maintainers: + - Nava kishore Manne <[email protected]> + +description: | + The Zynq UltraScale+ MPSoC Processing System core provides access from PL + masters to PS internal peripherals, and memory through AXI FIFO interface(AFI) + interfaces. + +properties: + compatible:
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml new file +10
-0+ items: + - enum: + - xlnx,zynqmp-afi-fpga + + config-afi: + $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + Pairs of <regid value > + The possible values of regid and values are + regid - Regids of the register to be written possible values
If we wanted sequences of register accesses in DT, we'd have a generic mechanism to do so.
Quoted 111 lines
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yaml new file +108
-0+ 0- AFIFM0_RDCTRL + 1- AFIFM0_WRCTRL + 2- AFIFM1_RDCTRL + 3- AFIFM1_WRCTRL + 4- AFIFM2_RDCTRL + 5- AFIFM2_WRCTRL + 6- AFIFM3_RDCTRL + 7- AFIFM3_WRCTRL + 8- AFIFM4_RDCTRL + 9- AFIFM4_WRCTRL + 10- AFIFM5_RDCTRL + 11- AFIFM5_WRCTRL + 12- AFIFM6_RDCTRL + 13- AFIFM6_WRCTRL + 14- AFIFS + 15- AFIFS_SS2 + value - Array of values to be written. + for FM0_RDCTRL(0) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM0_WRCTRL(1) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM1_RDCTRL(2) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM1_WRCTRL(3) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM2_RDCTRL(4) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM2_WRCTRL(5) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM3_RDCTRL(6) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM3_WRCTRL(7) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM4_RDCTRL(8) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM4_WRCTRL(9) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM5_RDCTRL(10) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM5_WRCTRL(11) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM6_RDCTRL(12) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for FM6_WRCTRL(13) the valid values-fabric width + 2 - 32-bit + 1 - 64-bit + 0 - 128-bit + for AFI_FA(14) + dw_ss1_sel bits (11:10) + dw_ss0_sel bits (9:8) + 0x0 - 32-bit AXI data width + 0x1 - 64-bit AXI data width + 0x2 - 128-bit AXI data width + All other bits are 0 write ignored. + + for AFI_FA(15) selects for ss2AXI data width valid values + 0x000 - 32-bit AXI data width + 0x100 - 64-bit AXI data width + 0x200 - 128-bit AXI data width + minItems: 1 + maxItems: 15 + +required: + - compatible + - config-afi + +additionalProperties: false + +examples: + - | + firmware { + zynqmp_firmware: zynqmp-firmware { + compatible = "xlnx,zynqmp-firmware"; + method = "smc"; + afi0: afi { + compatible = "xlnx,afi-fpga"; + config-afi = <0 2>, <1 1>, <2 1>; + }; + }; + }; + +...Signature · 1 line
2.18.0
RE: [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driver
Hi Rob,
Thanks for the review.
Please find my response inline.
Quoted 14 lines
-----Original Message-----
From: Rob Herring <[email protected]>
Sent: Tuesday, April 20, 2021 7:45 PM
To: Nava kishore Manne <[email protected]>
Cc: Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; [email protected]; linux- [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driver
Quoted 5 lines
Quoted 1 line · Nava kishore Manne
This patch adds the binding document for the zynqmp afi config driver.
Bindings are for h/w blocks, not drivers.
This Binding are for h/w blocks (PS-PL bus width configurations)
For more info please refer the below links.
https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf (Page No: 54)
https://www.xilinx.com/support/documentation/ip_documentation/zynq_ultra_ps_e/v3_2/pg201-zynq-ultrascale-plus-processing-system.pdf (Page No: 42).
Please let me know if you need more info..
Quoted 41 lines
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-
Quoted 15 lines
Signed-off-by Nava kishore Manne <[email protected]>--- .../bindings/misc/xlnx,zynqmp-afi-fpga.yaml | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yamldiff --git
a/Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yamlb/Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi-fpga.yamlnew file mode 100644
index 000000000000..3ae22096b22aDocumentation/devicetree/bindings/misc/xlnx,zynqmp-afi- new file +0
-0
fpga.yamlQuoted 25 lines
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi- new file +24
-0@@ -0,0 +1,136 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) %YAML 1.2 +--- +$id: http://devicetree.org/schemas/misc/xlnx,zynqmp-afi-fpga.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Xilinx ZynqMP AFI interface Manager. + +maintainers: + - Nava kishore Manne <[email protected]> + +description: | + The Zynq UltraScale+ MPSoC Processing System core provides access +from PL + masters to PS internal peripherals, and memory through AXI FIFO +interface(AFI) + interfaces. + +properties: + compatible: + items: + - enum: + - xlnx,zynqmp-afi-fpga + + config-afi:
Quoted 9 lines
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi- line 29
Quoted 5 lines
Documentation/devicetree/bindings/misc/xlnx,zynqmp-afi- new file +5
-0+ $ref: /schemas/types.yaml#/definitions/uint32-array + description: | + Pairs of <regid value > + The possible values of regid and values are + regid - Regids of the register to be written possible valuesIf we wanted sequences of register accesses in DT, we'd have a generic mechanism to do so.
I will try to find a better way, will get back you on this
Regards,
Navakishore.
PATCH 5/5 misc: zynqmp: Add afi config driver
In reply to Nava kishore ManneThis patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/misc/zynqmp-afi.c
drivers/misc/Kconfig +11 -0
@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values +config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
drivers/misc/Makefile +1 -0
@@ -57,3 +57,4 @@ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.o +obj-$(CONFIG_ZYNQMP_AFI) += zynqmp-afi.o
drivers/misc/zynqmp-afi.c new file +83 -0
83 lines not on this page · raw message
Signature · 1 line
2.18.0
Greg KH
maintainerRe: [PATCH 5/5] misc: zynqmp: Add afi config driver
Quoted 3 lines · Nava kishore Manne
This patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
Again, please spell out what those terms mean, as I have no idea :(
Quoted 17 lines
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/misc/zynqmp-afi.cdrivers/misc/Kconfig +0
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values
drivers/misc/Kconfig config ZYNQ_AFI · line 468
Quoted 10 lines
drivers/misc/Kconfig +10
-0+config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values
Please use tabs properly, you mix them above, checkpatch should have caught that.
thanks,
greg k-h
RE: [PATCH 5/5] misc: zynqmp: Add afi config driver
Hi Greg,
Please find my response inline.
Quoted 13 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:18 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 5/5] misc: zynqmp: Add afi config driver
Quoted 6 lines
Quoted 2 lines · Nava kishore Manne
This patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
Again, please spell out what those terms mean, as I have no idea :(
Will fix in v2
Quoted 18 lines
Quoted 18 lines
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/misc/zynqmp-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
877b43b3377d..d1ea1eeb3ac1100644drivers/misc/Kconfig +0
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values
Quoted 14 lines
drivers/misc/Kconfig config ZYNQ_AFI · line 468
Quoted 10 lines
drivers/misc/Kconfig +10
-0+config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width valuesPlease use tabs properly, you mix them above, checkpatch should have caught that.
Yes, Ideally check patch should report this issue but it's failed to report. Will fix this issue in v2.
Regards,
Navakishore.
Greg KH
maintainerRe: [PATCH 5/5] misc: zynqmp: Add afi config driver
In reply to Nava kishore ManneQuoted 103 lines · Nava kishore Manne
This patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/misc/zynqmp-afi.cdrivers/misc/Kconfig +11
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values +config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.o +obj-$(CONFIG_ZYNQMP_AFI) += zynqmp-afi.odrivers/misc/zynqmp-afi.c new file +54
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx FPGA AFI bridge. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/firmware/xlnx-zynqmp.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/of.h> +#include <linux/platform_device.h> +#include <linux/slab.h> + +/** +* struct zynqmp_afi_fpga - AFI register description +* @value: value to be written to the register +* @regid: Register id for the register to be written +*/ +struct zynqmp_afi_fpga { +u32 value; +u32 regid; +}; + +static int zynqmp_afi_fpga_probe (struct platform_device *pdev) +{ +struct zynqmp_afi_fpga *zynqmp_afi_fpga; +struct device_node *np = pdev->dev.of_node; +int i, entries, ret; +u32 reg, val; + + zynqmp_afi_fpga =devm_kzalloc (&pdev->dev, +sizeof (*zynqmp_afi_fpga),GFP_KERNEL ); +if (!zynqmp_afi_fpga) +return -ENOMEM ; +platform_set_drvdata (pdev, zynqmp_afi_fpga); + + entries =of_property_count_u32_elems (np,"config-afi" ); +if (!entries || (entries %2 )) { +dev_err (&pdev->dev,"Invalid number of registers\n" ); +return -EINVAL ; + } + +for (i =0 ; i < entries /2 ; i++) { + ret =of_property_read_u32_index (np,"config-afi" , i *2 , ®); +if (ret) { +dev_err (&pdev->dev,"failed to read register\n" ); +return -EINVAL ; + } + ret =of_property_read_u32_index (np,"config-afi" , i *2 +1 , + &val); +if (ret) { +dev_err (&pdev->dev,"failed to read value\n" ); +return -EINVAL ;
drivers/misc/zynqmp-afi.c line 64
Quoted 10 lines
drivers/misc/zynqmp-afi.c new file +10
-0+ } + ret =zynqmp_pm_afi (reg, val); +if (ret <0 ) { +dev_err (&pdev->dev,"AFI register write error %d\n" , + ret); +return ret; + } + } +return 0 ; +}
Again, why does this have to be in the kernel? All it does is make a single call to the hardware based on some values read from the device tree. Can't you do this from userspace?
thanks,
greg k-h
RE: [PATCH 5/5] misc: zynqmp: Add afi config driver
Hi Greg,
Please find my response inline.
Quoted 120 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:21 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 5/5] misc: zynqmp: Add afi config driverQuoted 80 lines · Nava kishore Manne
This patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/misc/zynqmp-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
877b43b3377d..d1ea1eeb3ac1100644drivers/misc/Kconfig +11
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values +config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile index renamed from drivers/misc/Makefile +0
-0
e9b03843100f..54bd0edc511e100644drivers/misc/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.o +obj-$(CONFIG_ZYNQMP_AFI) += zynqmp-afi.odrivers/misc/zynqmp-afi.c new renamed from drivers/misc/zynqmp-afi.c +0
-0file mode 100644 index 000000000000..a318652576d2
drivers/misc/zynqmp-afi.c new file +32
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx FPGA AFI bridge. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/firmware/xlnx-zynqmp.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include +<linux/platform_device.h> #include <linux/slab.h> + +/** +* struct zynqmp_afi_fpga - AFI register description +* @value: value to be written to the register +* @regid: Register id for the register to be written +*/ +struct zynqmp_afi_fpga { +u32 value; +u32 regid; +}; + +static int zynqmp_afi_fpga_probe (struct platform_device *pdev) +{ +struct zynqmp_afi_fpga *zynqmp_afi_fpga; +struct device_node *np = pdev->dev.of_node; +int i, entries, ret; +u32 reg, val; + + zynqmp_afi_fpga =devm_kzalloc (&pdev->dev, +sizeof (*zynqmp_afi_fpga),GFP_KERNEL ); +if (!zynqmp_afi_fpga) +return -ENOMEM ;drivers/misc/zynqmp-afi.c line 42
Quoted 10 lines
drivers/misc/zynqmp-afi.c new file +10
-0+platform_set_drvdata (pdev, zynqmp_afi_fpga); + + entries =of_property_count_u32_elems (np,"config-afi" ); +if (!entries || (entries %2 )) { +dev_err (&pdev->dev,"Invalid number of registers\n" ); +return -EINVAL ; + } + +for (i =0 ; i < entries /2 ; i++) { + ret = of_property_read_u32_index(np, "config-afi", i * 2,®);
Quoted 15 lines
drivers/misc/zynqmp-afi.c new file +15
-0+if (ret) { +dev_err (&pdev->dev,"failed to read register\n" ); +return -EINVAL ; + } + ret =of_property_read_u32_index (np,"config-afi" , i *2 +1 , + &val); +if (ret) { +dev_err (&pdev->dev,"failed to read value\n" ); +return -EINVAL ; + } + ret =zynqmp_pm_afi (reg, val); +if (ret <0 ) { +dev_err (&pdev->dev,"AFI register write error %d\n" , + ret); +return ret;
Quoted 9 lines
drivers/misc/zynqmp-afi.c line 64
Quoted 4 lines
drivers/misc/zynqmp-afi.c new file +4
-0+ } + } +return 0 ; +}Again, why does this have to be in the kernel? All it does is make a single call to the hardware based on some values read from the device tree. Can't you do this from userspace?
For every PL design has its own PS-PL configuration.
This driver will be used by the overlay framework for configuring the interface after programming the FPGA and before probing the drivers that are present in the PL.
Regards,
Navakishore.
Greg KH
maintainerRe: [PATCH 5/5] misc: zynqmp: Add afi config driver
Quoted 133 lines · Nava kishore Manne
Hi Greg,
Please find my response inline.
Quoted 120 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:21 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 5/5] misc: zynqmp: Add afi config driverQuoted 80 lines · Nava kishore Manne
This patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644 drivers/misc/zynqmp-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
877b43b3377d..d1ea1eeb3ac1100644drivers/misc/Kconfig +11
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values +config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile index renamed from drivers/misc/Makefile +0
-0
e9b03843100f..54bd0edc511e100644drivers/misc/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.o +obj-$(CONFIG_ZYNQMP_AFI) += zynqmp-afi.odrivers/misc/zynqmp-afi.c new renamed from drivers/misc/zynqmp-afi.c +0
-0file mode 100644 index 000000000000..a318652576d2
drivers/misc/zynqmp-afi.c new file +32
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx FPGA AFI bridge. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/firmware/xlnx-zynqmp.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include +<linux/platform_device.h> #include <linux/slab.h> + +/** +* struct zynqmp_afi_fpga - AFI register description +* @value: value to be written to the register +* @regid: Register id for the register to be written +*/ +struct zynqmp_afi_fpga { +u32 value; +u32 regid; +}; + +static int zynqmp_afi_fpga_probe (struct platform_device *pdev) +{ +struct zynqmp_afi_fpga *zynqmp_afi_fpga; +struct device_node *np = pdev->dev.of_node; +int i, entries, ret; +u32 reg, val; + + zynqmp_afi_fpga =devm_kzalloc (&pdev->dev, +sizeof (*zynqmp_afi_fpga),GFP_KERNEL ); +if (!zynqmp_afi_fpga) +return -ENOMEM ;drivers/misc/zynqmp-afi.c line 42
Quoted 10 lines
drivers/misc/zynqmp-afi.c new file +10
-0+platform_set_drvdata (pdev, zynqmp_afi_fpga); + + entries =of_property_count_u32_elems (np,"config-afi" ); +if (!entries || (entries %2 )) { +dev_err (&pdev->dev,"Invalid number of registers\n" ); +return -EINVAL ; + } + +for (i =0 ; i < entries /2 ; i++) { + ret = of_property_read_u32_index(np, "config-afi", i * 2,®);
Quoted 15 lines
drivers/misc/zynqmp-afi.c new file +15
-0+if (ret) { +dev_err (&pdev->dev,"failed to read register\n" ); +return -EINVAL ; + } + ret =of_property_read_u32_index (np,"config-afi" , i *2 +1 , + &val); +if (ret) { +dev_err (&pdev->dev,"failed to read value\n" ); +return -EINVAL ; + } + ret =zynqmp_pm_afi (reg, val); +if (ret <0 ) { +dev_err (&pdev->dev,"AFI register write error %d\n" , + ret); +return ret;Quoted 9 lines
drivers/misc/zynqmp-afi.c line 64
Quoted 4 lines
drivers/misc/zynqmp-afi.c new file +4
-0+ } + } +return 0 ; +}Again, why does this have to be in the kernel? All it does is make a single call to the hardware based on some values read from the device tree. Can't you do this from userspace?
Quoted 1 line
For every PL design has its own PS-PL configuration.
What is a "PL design", and what is a "PS-PL configuration"? :)
Quoted 1 line
This driver will be used by the overlay framework for configuring the interface after programming the FPGA and before probing the drivers that are present in the PL.
Again, I have no idea what this means at all.
And again, why does this have to be done in the kernel? All you are doing is sending some random values read in DT down to a hardware
device. What requires a kernel driver for this?
thanks,
greg k-h
RE: [PATCH 5/5] misc: zynqmp: Add afi config driver
Hi Greg,
Please find my response inline.
Quoted 151 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 8:58 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 5/5] misc: zynqmp: Add afi config driverQuoted 107 lines · Nava kishore Manne
Hi Greg,
Please find my response inline.
Quoted 103 lines
-----Original Message-----
From: Greg KH <[email protected]>
Sent: Tuesday, April 20, 2021 2:21 PM
To: Nava kishore Manne <[email protected]>
Cc: [email protected]; Michal Simek <[email protected]>; Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Rajan Vaja <[email protected]>; Jolly Shah <[email protected]>; Tejas Patel <[email protected]>; Amit Sunil Dhamne <[email protected]>; [email protected]; linux-arm- [email protected]; [email protected]; [email protected]; git <[email protected]>
Subject: Re: [PATCH 5/5] misc: zynqmp: Add afi config driverQuoted 78 lines · Nava kishore Manne
This patch adds zynqmp afi config driver.This is useful for the configuration of the PS-PL interface on Zynq US+ MPSoC platform.
Signed-off-by Nava kishore Manne <[email protected]>--- drivers/misc/Kconfig | 11 ++++++ drivers/misc/Makefile | 1 + drivers/misc/zynqmp-afi.c | 83 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+) create mode 100644
drivers/misc/zynqmp-afi.cdrivers/misc/Kconfig index renamed from drivers/misc/Kconfig +0
-0
877b43b3377d..d1ea1eeb3ac1100644drivers/misc/Kconfig +11
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values +config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for + configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"drivers/misc/Makefile index renamed from drivers/misc/Makefile +0
-0
e9b03843100f..54bd0edc511e100644drivers/misc/Makefile +1
-0@@ -57,3 +57,4 @@ obj-$(CONFIG_UACCE) += uacce/ obj-$(CONFIG_XILINX_SDFEC) += xilinx_sdfec.o obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o obj-$(CONFIG_ZYNQ_AFI) += zynq-afi.o +obj-$(CONFIG_ZYNQMP_AFI) += zynqmp-afi.odrivers/misc/zynqmp-afi.c new file +30
-0@@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Xilinx FPGA AFI bridge. +* Copyright (c) 2018-2021 Xilinx Inc. +*/ + +#include <linux/err.h> +#include <linux/firmware/xlnx-zynqmp.h> #include <linux/io.h> +#include <linux/module.h> #include <linux/of.h> #include +<linux/platform_device.h> #include <linux/slab.h> + +/** +* struct zynqmp_afi_fpga - AFI register description +* @value: value to be written to the register +* @regid: Register id for the register to be written */ struct +zynqmp_afi_fpga { +u32 value; +u32 regid; +}; + +static int zynqmp_afi_fpga_probe (struct platform_device *pdev) { +struct zynqmp_afi_fpga *zynqmp_afi_fpga; +struct device_node *np = pdev->dev.of_node; +int i, entries, ret; +u32 reg, val; + + zynqmp_afi_fpga =devm_kzalloc (&pdev->dev, +sizeof (*zynqmp_afi_fpga),GFP_KERNEL ); +if (!zynqmp_afi_fpga) +return -ENOMEM ;drivers/misc/zynqmp-afi.c line 40
Quoted 10 lines
drivers/misc/zynqmp-afi.c new file +10
-0+platform_set_drvdata (pdev, zynqmp_afi_fpga); + + entries =of_property_count_u32_elems (np,"config-afi" ); +if (!entries || (entries %2 )) { +dev_err (&pdev->dev,"Invalid number of registers\n" ); +return -EINVAL ; + } + +for (i =0 ; i < entries /2 ; i++) { + ret = of_property_read_u32_index(np, "config-afi", i * 2,®);
Quoted 13 lines
Quoted 5 lines
Quoted 5 lines
drivers/misc/zynqmp-afi.c new file +5
-0+if (ret) { +dev_err (&pdev->dev,"failed to read register\n" ); +return -EINVAL ; + } + ret = of_property_read_u32_index(np, "config-afi", i * 2 + 1,Quoted 8 lines
drivers/misc/zynqmp-afi.c
Quoted 8 lines
drivers/misc/zynqmp-afi.c new file +8
-0+ &val); +if (ret) { +dev_err (&pdev->dev,"failed to read value\n" ); +return -EINVAL ; + } + ret =zynqmp_pm_afi (reg, val); +if (ret <0 ) { + dev_err(&pdev->dev, "AFI register write error%d\n",
Quoted 11 lines
Quoted 11 lines
drivers/misc/zynqmp-afi.c line 64
Quoted 6 lines
drivers/misc/zynqmp-afi.c new file +6
-0+ ret); +return ret; + } + } +return 0 ; +}Again, why does this have to be in the kernel? All it does is make a single call to the hardware based on some values read from the device tree. Can't you do this from userspace?
Quoted 1 line
For every PL design has its own PS-PL configuration.
What is a "PL design", and what is a "PS-PL configuration"? :)
Quoted 1 line
This driver will be used by the overlay framework for configuring the
Quoted 9 lines
interface after programming the FPGA and before probing the drivers that are present in the PL.
Again, I have no idea what this means at all.
And again, why does this have to be done in the kernel? All you are doing is sending some random values read in DT down to a hardware
device. What requires a kernel driver for this?
The ZynqMP based processing system (PS) that contains ARM cores and Xilinx programmable logic (PL/FPGA) in a single device. The PS and PL can be tightly or loosely coupled using multiple interfaces and other signals. This enables the designer to effectively integrate user-created hardware accelerators and other functions in the PL logic that are accessible to the processors and can also access memory resources in the PS.
https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf (Page No: 1085)
To Program/Re-Program the PL at runtime in Linux we have a an FPGA Manger Framework and this frame work uses DT-Overlays to programming the FPGA and probing the relevant PL drivers. For more info please refer this link: https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/fpga/fpga-region.txt
Every Zynq/ZynqMP PL(FPGA) design has its own PS-PL configuration. So after programming the FPGA and before probing the relevant PL drivers these PS-PL configurations should be set.
Example DT-Overlay file to program the PL(FPGA) from Linux:
/dts-v1/;
/plugin/;
/ {
fragment@0 { /* fragment 0 contains Bitstream info */
target = <&fpga_full>;
overlay0: __overlay__ {
#address-cells = <2>;
#size-cells = <2>;
firmware-name = "Base_Zynq_MPSoC_wrapper.bit.bin";
resets = <&zynqmp_reset 116>;
};
};
fragment@1 { /* fragment 1 contains PS-PL configurations */
target = <&amba>;
overlay1: __overlay__ {
afi0: afi0 {
compatible = "xlnx,afi-fpga";
config-afi = < 0 0>, <1 0>, <2 0>, <3 0>, <4 0>, <5 0>, <6 0>, <7 0>, <8 0>, <9 0>, <10 0>, <11 0>, <12 0>, <13 0>, <14 0xa00>, <15 0x000>;
};
};
};
fragment@2 { /* Fragment 2 contains the relevant drivers for the IP's present in the FPGA design*/
target = <&amba>;
overlay2: __overlay__ {
axi_gpio_0: gpio@a0000000 {
#gpio-cells = <2>;
clock-names = "s_axi_aclk";
clocks = <&zynqmp_clk 71>;
compatible = "xlnx,xps-gpio-1.00.a";
gpio-controller ;
reg = <0x0 0xa0000000 0x0 0x1000>;
};
};
} ;
};In-order to support the PL(FPGA) programming and to configure the interface between PS and PL using FPGA Manager. This Driver is needed in the kernel space.
@Moritz Fischer: Can you please let us know your thoughts on this.
Regards,
Navakishore.
Re: [PATCH 5/5] misc: zynqmp: Add afi config driver
In reply to Nava kishore ManneQuoted 12 lines · Nava kishore Manne
drivers/misc/Kconfig +4
-0@@ -456,6 +456,17 @@ config ZYNQ_AFI between PS and PL, the AXI port data path should be configured with the proper Bus-width values +config ZYNQMP_AFI + tristate "Xilinx ZYNQMP AFI support" + help + ZynqMP AFI driver support for writing to the AFI registers for
drivers/misc/Kconfig config ZYNQ_AFI · line 472
Quoted 10 lines
drivers/misc/Kconfig +7
-0+ configuring PS_PL Bus-width. Xilinx Zynq US+ MPSoC connect the + PS to the programmable logic (PL) through the AXI port. This AXI + port helps to establish the data path between the PS and PL. + In-order to establish the proper communication path between + PS and PL, the AXI port data path should be configured with + the proper Bus-width values + source "drivers/misc/c2port/Kconfig" source "drivers/misc/eeprom/Kconfig" source "drivers/misc/cb710/Kconfig"
Hi,
from my notabot:
Please follow coding-style for Kconfig files:
from Documentation/process/coding-style.rst, section 10):
For all of the Kconfig* configuration files throughout the source tree, the indentation is somewhat different. Lines under a ``config`` definition are indented with one tab, while help text is indented an additional two spaces.
thanks.
Signature · 1 line
~Randy