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 5B542C43460 for ; Tue, 20 Apr 2021 15:31:06 +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 AB39D613AB for ; Tue, 20 Apr 2021 15:31:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AB39D613AB 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=oU8k+03fyOA+pOLCptSvGECxV4ausjUf0HhcZPEyaA0=; b=iOUwUZudlD+TqVumrZCHhXaeS 0VTZQ/N5BV41QAaVOTth9AmP7u1NBfViyJWTx+w861Tsnxgyds2zRv8gx5HdXcQo/BZBOeTtjbmNE EFEfzLBlztOvUMRKBz04/UdtMK8aJKdImlDuRplAPuVlfFPE/a6EHVy1fLP0pv6fuzHExKz8B4zc2 7wLvcXigFba8Tjw+eT53W8XsF9M3LScARqp8kBBYV7flU4pSxrD6lS4aWlGf1tjEehvMIgOpkxVjC ou1GSRQ4cIKJeVPAqQW3C5yN6tDYwbp2bR/6ICUoJWE/SFlSSmwV9XNU6dsL3vNaMSt7gMC2Z6JYJ CGKm3L7FQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lYsIk-00CU27-Eb; Tue, 20 Apr 2021 15:28:34 +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 1lYsIi-00CU1b-1A for linux-arm-kernel@desiato.infradead.org; Tue, 20 Apr 2021 15:28:32 +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=qnKhnybmoIVwwVnYhmjs+oXpM45iXZKjlxHLCFjLyGs=; b=1oUD9VOdNZvdEAiLXBkgaIkkKE 35tdRExfGrmOeTYoU4dBXULbr3JKM/Uu+3F9bABLzpPEBGVTm/CuGMugKUZbch0evw39ejkrMMut9 VlexWQcqYpV2nYKqSE1va82uIm797j9UekMzZmyDa89ptBhvTWoB1n+Kk0hcJRsmFYYzsS8PgJUm6 mQUHEnUdx2y9oirmcMs+VkQturEIDWbDcERS9z/4i0dOjuIbDo1TLPAk4UnsKHrdcZMPLQSslthgv MpPDtEeIs6cnYOzW/U5qKVvPXfSLdfo1fg/Cq5Cs+eyj0Vdgimiq62ZwJKFZgM/HWF++UazfqcRE0 1vRGXJyg==; Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lYsIf-00CEeI-4m for linux-arm-kernel@lists.infradead.org; Tue, 20 Apr 2021 15:28:30 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id B1540613AB; Tue, 20 Apr 2021 15:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1618932508; bh=Alypod0I+kUabfejeO7uWU4e1wf53VKZIKSlCvlTQDE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aAsz+KUb4fD1wtwgDFKbiojfSeUJ827cHUPpe9aB8j+AZlk/vapL8u1lSpokpdsTv 4468kvn4Rfn5Hj4jOj5OBM/Qgp+M6Buj0pJD76DHiJrPgy/Bl4QW+maPhwrq7NFO18 PDhqx/MePHNODaT5g0d0K8Y1JYtMpYQvPrCoVQ78= Date: Tue, 20 Apr 2021 17:28:25 +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 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210420_082829_296940_1C216ADB X-CRM114-Status: GOOD ( 41.26 ) 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:47:17PM +0000, Nava kishore Manne wrote: > Hi Greg, > > Please find my response inline. > > > -----Original Message----- > > From: Greg KH > > Sent: Tuesday, April 20, 2021 2:21 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 5/5] misc: zynqmp: Add afi config driver > > > > 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? > > > For every PL design has its own PS-PL configuration. What is a "PL design", and what is a "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. 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel