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=-15.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 2EC40C433B4 for ; Tue, 20 Apr 2021 08:47:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E067760FEE for ; Tue, 20 Apr 2021 08:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231182AbhDTIr3 (ORCPT ); Tue, 20 Apr 2021 04:47:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:49910 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230494AbhDTIr1 (ORCPT ); Tue, 20 Apr 2021 04:47:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 233996101D; Tue, 20 Apr 2021 08:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618908415; bh=+GoZ6LFlTXqNBpDSWl8fPtmk2irS0pAzQW2Uz6GETHU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H2S3STF8SuvoVe1E/kGnqk4D5AsfTUoe6P6XCKUbBRp2EwfLQB0wsqc0quLtnCu0X 0LgNTO+K8JW4sUnVrslk33CKUoUapigAHV95eIr1WALBEZV/WdwTQtWxpusrd7xsTO zzm4gwbBmL5Dm1aSyhn94FdwQ/6alQdeMOgyua8o= Date: Tue, 20 Apr 2021 10:46:52 +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 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-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210420081153.17020-3-nava.manne@xilinx.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > > 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? thanks, greg k-h 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 13111C433B4 for ; Tue, 20 Apr 2021 08:50: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 6F85560FEE for ; Tue, 20 Apr 2021 08:50:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6F85560FEE 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=DEsDxHoF+pNcFN8Pl5sz5p3itAMXXKVDR6EjkoQ/lC0=; b=hntx5KCy7RXQi44mBKARSIRyF k1RzR3igW80gh0CdgaMtXUBSkonseuYuAnfUcjhg+GbqfPv16IlN3EfH2F1goEKrUqepIRNO1DEiJ D6MNA7+q4ru5BWQg5WJJxkau9fC+5VBbQ7UC+68pJPMfNcozbLdRa5xD6FX0oBNpO9S5pLxGgBTfK yzCJV6l53Bkrjj5Ti9pX1+TZGNhkSpW3gT/JmnOHjEiPMrRr4GeBnSo3nLnFaYFiI8DBgxOP/PoXS tzFJyBF6M3hkUOGiEnE+0dBgWK7Vdz6YSlI+FsWjpNrZM5ttJE2xaFGzQ/7Tf5TH66WBIrJMd8Cvf 1YfoD9iWQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYm2E-00Bd8I-RT; Tue, 20 Apr 2021 08:47:07 +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 1lYm28-00Bd7H-II for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 08:47:00 +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=lCBxY/GfxhUmcz6roj6dA+aD5PAPvFm9HFbCRtroyNk=; b=tGDauAzKzqTxSV0Ghd8FoLjkCp ROvyO+ZfelPm7rfN5rRpvt3Hg6UNOEZrjyy3/tZnyXfn7PiJErU42XJYsP6/RHS8fFw3Taw4lZHt4 6XAsvrkxxF47Xg7JKeLF0N4Vu3DeUv8I3q7P1osHLCdd32qhTD9GD1sJGwI86yxof23GbHsTha9wR nBqf3PUZdfTqKFiwge69LCZlc6gTOxCUMgSR4+D2CTcPNMhRDXNTjWfCDlAHDKrgQJm+7WMqDSQpt pk0Xm5zhUnq755FWJmvFz2jDF6ea+UiavGGTBn0l+mcYeGc9OjJgxdbk8TblDQhsI3IZpnvMII7RO LGYDFVBA==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYm24-00BwGD-Hk for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 08:46:58 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 233996101D; Tue, 20 Apr 2021 08:46:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618908415; bh=+GoZ6LFlTXqNBpDSWl8fPtmk2irS0pAzQW2Uz6GETHU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H2S3STF8SuvoVe1E/kGnqk4D5AsfTUoe6P6XCKUbBRp2EwfLQB0wsqc0quLtnCu0X 0LgNTO+K8JW4sUnVrslk33CKUoUapigAHV95eIr1WALBEZV/WdwTQtWxpusrd7xsTO zzm4gwbBmL5Dm1aSyhn94FdwQ/6alQdeMOgyua8o= Date: Tue, 20 Apr 2021 10:46:52 +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 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: <20210420081153.17020-3-nava.manne@xilinx.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_014656_682827_B3A5A53E X-CRM114-Status: GOOD ( 28.86 ) 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: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? > > 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? thanks, greg k-h _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel