Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3162039pxb; Tue, 20 Apr 2021 01:51:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy51RxO0TyJ35Vy3nP/kNAmmoiPOZ0XE9VobYsvh2B87QaPb5Zjsa8ZVtjNzOF5d0WSGOyB X-Received: by 2002:a17:90a:854b:: with SMTP id a11mr3841174pjw.17.1618908717386; Tue, 20 Apr 2021 01:51:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618908717; cv=none; d=google.com; s=arc-20160816; b=vHHU0OqFV76O3Gi0u9VK4t7Wqpfr/eGPQRIjRtTCTCrwS4wMTY6BI/A47Zg8Dr0510 YTFNaRuIXbrSYPLvG7eVySZv+84PPwD/R71n6Bny0xngV9xai+dIceBt9nRWh1+LbyJ+ mfcabKs0q63Uucau5WX4V7ta0dXMvvk37P+g+tyFTfS0V4K+JphH+aO7aluM5YF6ngVT FsLurX2IsnMBgrH8MoNtOWYrtkg+RVaCDSDce5K+XmJcRN8iklUObWy7t/qshon7MT2v k2TSbBlU1QW4V2lB3dKpqFMH8uBj7qe7RCE842Bt4b2PeFNY2PqY/gEycR2IVAslaQv+ nIFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=o9vhyqE35jembbm9WEGs6oUn3x/5iOVl3Nt90ioRt8w=; b=cyU5zIr6jz2QoLdYgdLz0vcDkqn0v5zNX+kqYLMRjRWMi3HrKgKH/lupzaK6ZwoPRV qVhqRyEr3XcqC54lgliOpYcrsSbgukQ8scCRmMDGJKN4UL7DQUJAbDM6bm6Ap/RjcrlG I3+ugTdq1UCw15Ag4UpOzcsEQxDCq1PSJqw5xDNERhcpxYWnc23PsaGDbFuKnKEXgmpy CgnnGQFoqJE7h09gdm8Kys08codU2T7Yk5NRaNmZS/daKjYEIukSqvDbRqWY8hoU+BOh pniqMdHnq08yk1DfKoo1dy6l87pKFourAkv8NeEk1n8rBOLhnFezwWu+wlsV9dLwE+t/ uAyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f/f4Qt/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j11si18453461plj.168.2021.04.20.01.51.44; Tue, 20 Apr 2021 01:51:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="f/f4Qt/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231146AbhDTIvg (ORCPT + 99 others); Tue, 20 Apr 2021 04:51:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:50716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230018AbhDTIvf (ORCPT ); Tue, 20 Apr 2021 04:51:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B64E60FEE; Tue, 20 Apr 2021 08:51:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618908663; bh=Ze5OEi3gnNXMeI+Q5SkH0i1aFVUgqD2Gu+bwpAHmcNo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f/f4Qt/gTMk8hsaDZDyq+0+CqkGBUibJ1ZuG6sxUa2WHcGef6DQRK6E/7ecIJpcYh g/9HQNpGALT8ICrhsK5QdJUaSAQk1XE3pQwqtTTAn+WfNBsQXMsoRKtuseYAmvoHQE 1zCjutxE/+wCkwIjMUhu8NnPKfKoHkoE5dbpQc/A= Date: Tue, 20 Apr 2021 10:51:00 +0200 From: Greg KH To: Nava kishore Manne 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 Message-ID: References: <20210420081153.17020-1-nava.manne@xilinx.com> <20210420081153.17020-6-nava.manne@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210420081153.17020-6-nava.manne@xilinx.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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 > +#include > +#include > +#include > +#include > +#include > +#include > + > +/** > + * 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; > + } > + 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