linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Nava kishore Manne <nava.manne@xilinx.com>
Cc: robh+dt@kernel.org, michal.simek@xilinx.com,
	derek.kiernan@xilinx.com, dragan.cvetic@xilinx.com,
	arnd@arndb.de, rajan.vaja@xilinx.com, jolly.shah@xilinx.com,
	tejas.patel@xilinx.com, amit.sunil.dhamne@xilinx.com,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, chinnikishore369@gmail.com,
	git@xilinx.com
Subject: Re: [PATCH 5/5] misc: zynqmp: Add afi config driver
Date: Tue, 20 Apr 2021 10:51:00 +0200	[thread overview]
Message-ID: <YH6V9Im3L/gJJ/CP@kroah.com> (raw)
In-Reply-To: <20210420081153.17020-6-nava.manne@xilinx.com>

On Tue, Apr 20, 2021 at 01:41:53PM +0530, Nava kishore Manne wrote:
> 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 <nava.manne@xilinx.com>
> ---
>  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
> 
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 877b43b3377d..d1ea1eeb3ac1 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -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"
> diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> index e9b03843100f..54bd0edc511e 100644
> --- a/drivers/misc/Makefile
> +++ b/drivers/misc/Makefile
> @@ -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
> diff --git a/drivers/misc/zynqmp-afi.c b/drivers/misc/zynqmp-afi.c
> new file mode 100644
> index 000000000000..a318652576d2
> --- /dev/null
> +++ b/drivers/misc/zynqmp-afi.c
> @@ -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, &reg);
> +		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;
> +		}
> +	}
> +	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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2021-04-20  8:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-20  8:11 [PATCH 0/5]misc: Add afi config drivers support Nava kishore Manne
2021-04-20  8:11 ` [PATCH 1/5] misc: doc: Add binding doc for the afi config driver Nava kishore Manne
2021-04-20  8:11 ` [PATCH 2/5] misc: zynq: Add " Nava kishore Manne
2021-04-20  8:46   ` Greg KH
2021-04-20 13:36     ` Nava kishore Manne
2021-04-20 15:27       ` Greg KH
2021-04-29  6:23         ` Nava kishore Manne
2021-04-20 18:17   ` Randy Dunlap
2021-04-20  8:11 ` [PATCH 3/5] firmware: xilinx: Add afi ioctl support Nava kishore Manne
2021-04-20  8:11 ` [PATCH 4/5] misc: doc: Add binding doc for the zynqmp afi config driver Nava kishore Manne
2021-04-20 13:58   ` Rob Herring
2021-04-29  4:56     ` Nava kishore Manne
2021-04-20 14:15   ` Rob Herring
2021-04-29  5:39     ` Nava kishore Manne
2021-04-20  8:11 ` [PATCH 5/5] misc: zynqmp: Add " Nava kishore Manne
2021-04-20  8:47   ` Greg KH
2021-04-20 13:45     ` Nava kishore Manne
2021-04-20  8:51   ` Greg KH [this message]
2021-04-20 13:47     ` Nava kishore Manne
2021-04-20 15:28       ` Greg KH
2021-04-29  6:01         ` Nava kishore Manne
2021-04-20 18:15   ` Randy Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YH6V9Im3L/gJJ/CP@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=amit.sunil.dhamne@xilinx.com \
    --cc=arnd@arndb.de \
    --cc=chinnikishore369@gmail.com \
    --cc=derek.kiernan@xilinx.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dragan.cvetic@xilinx.com \
    --cc=git@xilinx.com \
    --cc=jolly.shah@xilinx.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=nava.manne@xilinx.com \
    --cc=rajan.vaja@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=tejas.patel@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).