From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42002C433B4 for ; Tue, 20 Apr 2021 15:30:36 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 851A4613B2 for ; Tue, 20 Apr 2021 15:30:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 851A4613B2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=g+kVWZBEXGsOwIJuMpwoM+HFA9LftTm+RKOE8MCe39E=; b=Apjmw8DYamu2gjseVN5rdiJX4 InCQAHdOWe6AIqHBDa2C6jOP2+fdIURN6UlAmEal3WeTO+lTr5x+45YAftmNZgp5ckMCug2j60RW2 GA6q43SCEP/G59Ghd1vsDTbCfp7BTk8M/Yxtbem6k1hWXYHhe6yK2dGjO1x1E/JEIqaGXVisYJO9n zGGh904vAcon6zVxQhAv08cqywHWdIa5TgZmiEbnmnuMZa97sHSIYuQ5ZJDmmAn1Z9Qyts4CvlIcd v9JmnxVj3bviOhh01Rgt20oVpsnEMsoLQDzkjOq+0ekqOvKT7zmAQRooFnxvmR/zpu++rBnmb3/qd 38QOZyREg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYsHt-00CTrH-JD; Tue, 20 Apr 2021 15:27:41 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYsHf-00CTmc-0r for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 15:27:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=bqJ3OAM1JW8YLoZYArv9PWLIBkHuqJkFBWcruBQfyDE=; b=LU6NNFmrq9U0e3JckPZRGcsQdM Kv+zxc55S+Vr/r08mG5grgSNfPZqyPY2SIMQt6N4NKQ4QsI7tP9hNSH4rya/OgM2hAOAbg93qEkNI 9oDFhL1D8p3mD+30UzwJN3yxeOrN8fYvl6KgmJKyPOvRoqITakwWvXJBU14RVjxlfWwh/nVIbcWJg rjZ7qknJhkUg+v4ZmZtkmbTv+KYR2aUmPyfElDAnwp1fd1+w7VQTjLJUKh/3HT1d4VpblDObPs25+ Vr5TZdDcVP7AaMNGaoKrezmhxD6w7/4tnbJJgK6g5p4+8zl049X0scBz3p8AeLYEaev4sceMzJr4m tA7JTCRA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYsHb-00CEZj-Bd for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 15:27:25 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C6D7613AB; Tue, 20 Apr 2021 15:27:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618932439; bh=k1PcTef2uV3umw9k22yDoPu0zzuRh7oj4H4rZUPiAa0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YGMLSPlKvPl0PErItDUm7+DVCYfpGV7v+uUrrpR7jAKPdbBTn9yp3vdlmrfeiFGhZ FHauSi4VFNZ9NUVVAaC8dy2xAv10D7Dwrd1dIbBFOQtMvU/haiFQdIeSCIuBCacvHM D/gaLL/TGnI0ukXAiOKI/prr4o3rwkWcZ4RIkIjw= Date: Tue, 20 Apr 2021 17:27:16 +0200 From: Greg KH To: Nava kishore Manne Cc: "robh+dt@kernel.org" , Michal Simek , Derek Kiernan , Dragan Cvetic , "arnd@arndb.de" , Rajan Vaja , Jolly Shah , Tejas Patel , Amit Sunil Dhamne , "devicetree@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "chinnikishore369@gmail.com" , git Subject: Re: [PATCH 2/5] misc: zynq: Add afi config driver Message-ID: References: <20210420081153.17020-1-nava.manne@xilinx.com> <20210420081153.17020-3-nava.manne@xilinx.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_082723_510979_FC4E4594 X-CRM114-Status: GOOD ( 40.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 20, 2021 at 01:36:51PM +0000, Nava kishore Manne wrote: > Hi Greg, > > Please find my response inline. > > > -----Original Message----- > > From: Greg KH > > Sent: Tuesday, April 20, 2021 2:17 PM > > To: Nava kishore Manne > > Cc: robh+dt@kernel.org; Michal Simek ; Derek Kiernan > > ; Dragan Cvetic ; > > arnd@arndb.de; Rajan Vaja ; Jolly Shah > > ; Tejas Patel ; Amit Sunil > > Dhamne ; devicetree@vger.kernel.org; linux-arm- > > kernel@lists.infradead.org; linux-kernel@vger.kernel.org; > > chinnikishore369@gmail.com; git > > Subject: Re: [PATCH 2/5] misc: zynq: Add afi config driver > > > > On Tue, Apr 20, 2021 at 01:41:50PM +0530, Nava kishore Manne wrote: > > > 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. > > > > > > > Signed-off-by: Nava kishore Manne > > > --- > > > 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 > > > > > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index > > > f532c59bb59b..877b43b3377d 100644 > > > --- a/drivers/misc/Kconfig > > > +++ b/drivers/misc/Kconfig > > > @@ -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" > > > diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index > > > 99b6f15a3c70..e9b03843100f 100644 > > > --- a/drivers/misc/Makefile > > > +++ b/drivers/misc/Makefile > > > @@ -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 > > > diff --git a/drivers/misc/zynq-afi.c b/drivers/misc/zynq-afi.c new > > > file mode 100644 index 000000000000..04317d1bdb98 > > > --- /dev/null > > > +++ b/drivers/misc/zynq-afi.c > > > @@ -0,0 +1,81 @@ > > > +// SPDX-License-Identifier: GPL-2.0 > > > +/* > > > + * Xilinx ZYNQ AFI driver. > > > + * Copyright (c) 2018-2021 Xilinx Inc. > > > + */ > > > + > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +/* 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); > > > + 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? > > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel