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=-16.7 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,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 A9347C07E96 for ; Tue, 6 Jul 2021 21:36:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 63B6661C3C for ; Tue, 6 Jul 2021 21:36:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 63B6661C3C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com 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=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=1UV8ardBEuWbcz2DEx/6EEVEOJH8rHIRirHhrTH5q24=; b=n+MQlW2Bqcf2lg7YgRvXtltepI C7rNZTBM8er22HKoY2sNVJdG44M+Tii0K0kJVexMvFDhJ86sF4dy4W18VEfjBLZ0g9vgrOjOgM9m6 6epF9H1z5LDfN5jhONngXB0ady5+x8InM1AkzvuYfEDXIOCPuFmWuRk99qCGP230nf0+Dx/dl9f4J 4hUIMSuFNQXGuGEsPIllZ5xjA2loQX8c8RGLRLZZadVQEq55CcYtYd6A4gX7k5Pfy+oyZtsrw73A0 vWVddJ70ZAa6NhXladkt+0eEPO0oZryBgHTzYKFyIPn1vn07Neu6CHlHKqTcv142g/7ucx30PfOlP Qu+vPkjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0si8-00Cs9N-Fg; Tue, 06 Jul 2021 21:34:32 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m0si5-00Cs8p-36 for linux-arm-kernel@lists.infradead.org; Tue, 06 Jul 2021 21:34:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625607268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hy6kcB3MWGmQBDSvkn9YWzp9imXowxOywbrwsmGu+rk=; b=TKgmGNA0paJrcjd2IdJQfQaG5LS/pOLEMBL5tyCj7yU3PnvIyIexjiqhCzloQJQ7c7OCHM 3gQJjDvNcrrLydhhPEejJx1qPwFxlC4j3ViYxa7wUwg89Nu9qMJkK3vGp3yGSDb7AuQnun InAOhX3ivHpjaG6RfXlyrNQzq1kQ+Eo= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-435-BceV9hZLMIC_zgPZ2PKaaA-1; Tue, 06 Jul 2021 17:34:24 -0400 X-MC-Unique: BceV9hZLMIC_zgPZ2PKaaA-1 Received: by mail-oi1-f197.google.com with SMTP id r3-20020aca44030000b02902241b7398a8so455196oia.19 for ; Tue, 06 Jul 2021 14:34:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=Hy6kcB3MWGmQBDSvkn9YWzp9imXowxOywbrwsmGu+rk=; b=afjce/6+p8ylWDC396oZ/M8i0ejJQjRqoHT2aModGfszAlyRq0+27iE2xpG+6egRCU aBTNXD4aosNVFr5T9/Pf2p8j0EA2imLRL5PLCgqnamQdHBs0ThmQR/BEu6HHWdP/JGck nX2JCsZxi7bLu5aIbVhNojlSSbclfB25hr5D4oxvvY+lWLjDCzItpYbjeEtyAdJhkO0a x8+OIP4EbWSOl1MM1MZkFo66eJWN7N5qE44ZsLGD6hifeMbCSM4mZ9Gm9z0kxB6+cPlX /cmezS4F590vnsAbcec1IaR/BuA6MRJw5QFYYDC2VGvHHIfD6cmhAIkZcfTrRf2Ao2sU hmvA== X-Gm-Message-State: AOAM532wE8fIPXrLE9r3CgI0+3EOlId8jqQ4nhleWm+RAr30L3dtwmj6 9C3pDZ5G47lRe/Vs0xtZAIgW7rJ2Uzoo2WqVmM+vM2rs09ZLxdz/hfx1dym//rrjDV8dwuQQqfH qlSz8nhr94IezK8hvCFHx/6iNZSEHAITbpKI= X-Received: by 2002:a05:6830:4039:: with SMTP id i25mr7708067ots.187.1625607264266; Tue, 06 Jul 2021 14:34:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOPGU1f+ioZoUD9Gk09GX58M3FzDXJit2VBvWEDVdm0mrij5IOIC0yKFhYZIkQYwfMFoijGw== X-Received: by 2002:a05:6830:4039:: with SMTP id i25mr7708058ots.187.1625607264072; Tue, 06 Jul 2021 14:34:24 -0700 (PDT) Received: from localhost.localdomain (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id s2sm3082387ook.24.2021.07.06.14.34.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 14:34:23 -0700 (PDT) Subject: Re: [PATCH v8 5/5] fpga: versal-fpga: Add versal fpga manager driver To: Nava kishore Manne , robh+dt@kernel.org, michal.simek@xilinx.com, mdf@kernel.org, arnd@arndb.de, rajan.vaja@xilinx.com, gregkh@linuxfoundation.org, amit.sunil.dhamne@xilinx.com, tejas.patel@xilinx.com, zou_wei@huawei.com, lakshmi.sai.krishna.potthuri@xilinx.com, ravi.patel@xilinx.com, iwamatsu@nigauri.org, wendy.liang@xilinx.com, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org, git@xilinx.com, chinnikishore369@gmail.com Cc: Appana Durga Kedareswara rao References: <20210626155248.5004-1-nava.manne@xilinx.com> <20210626155248.5004-6-nava.manne@xilinx.com> From: Tom Rix Message-ID: <4429c722-52f3-2e16-3a53-910345507d3e@redhat.com> Date: Tue, 6 Jul 2021 14:34:20 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210626155248.5004-6-nava.manne@xilinx.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210706_143429_281256_DC3C9612 X-CRM114-Status: GOOD ( 32.60 ) 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/26/21 8:52 AM, Nava kishore Manne wrote: > Add support for Xilinx Versal FPGA manager. > > PDI source type can be DDR, OCM, QSPI flash etc.. > But driver allocates memory always from DDR, Since driver supports only > DDR source type. > > Signed-off-by: Appana Durga Kedareswara rao > Signed-off-by: Nava kishore Manne > Reviewed-by: Moritz Fischer > --- > Changes for v2: > -Updated the Fpga Mgr registrations call's > to 5.11 > -Fixed some minor coding issues as suggested by > Moritz. > > Changes for v3: > -Rewritten the Versal fpga Kconfig contents. > > Changes for v4: > -Rebased the changes on linux-next. > No functional changes. > > Changes for v5: > -None. > > Changes for v6: > -None. > > Changes for v7: > -Updated driver to remove unwated priv struct dependency. > > Changes for v8: > -None. > > drivers/fpga/Kconfig | 9 ++++ > drivers/fpga/Makefile | 1 + > drivers/fpga/versal-fpga.c | 96 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 106 insertions(+) > create mode 100644 drivers/fpga/versal-fpga.c > > diff --git a/drivers/fpga/Kconfig b/drivers/fpga/Kconfig > index 8cd454ee20c0..16793bfc2bb4 100644 > --- a/drivers/fpga/Kconfig > +++ b/drivers/fpga/Kconfig > @@ -234,4 +234,13 @@ config FPGA_MGR_ZYNQMP_FPGA > to configure the programmable logic(PL) through PS > on ZynqMP SoC. > > +config FPGA_MGR_VERSAL_FPGA > + tristate "Xilinx Versal FPGA" > + depends on ARCH_ZYNQMP || COMPILE_TEST Shouldn't this depend on ZYNQMP_FIRMWARE ? > + help > + Select this option to enable FPGA manager driver support for > + Xilinx Versal SoC. This driver uses the firmware interface to > + configure the programmable logic(PL). > + > + To compile this as a module, choose M here. > endif # FPGA > diff --git a/drivers/fpga/Makefile b/drivers/fpga/Makefile > index 18dc9885883a..0bff783d1b61 100644 > --- a/drivers/fpga/Makefile > +++ b/drivers/fpga/Makefile > @@ -18,6 +18,7 @@ obj-$(CONFIG_FPGA_MGR_TS73XX) += ts73xx-fpga.o > obj-$(CONFIG_FPGA_MGR_XILINX_SPI) += xilinx-spi.o > obj-$(CONFIG_FPGA_MGR_ZYNQ_FPGA) += zynq-fpga.o > obj-$(CONFIG_FPGA_MGR_ZYNQMP_FPGA) += zynqmp-fpga.o > +obj-$(CONFIG_FPGA_MGR_VERSAL_FPGA) += versal-fpga.o The other CONFIG_FPGA_MGR* configs are alphabetical, versal should follow. > obj-$(CONFIG_ALTERA_PR_IP_CORE) += altera-pr-ip-core.o > obj-$(CONFIG_ALTERA_PR_IP_CORE_PLAT) += altera-pr-ip-core-plat.o > > diff --git a/drivers/fpga/versal-fpga.c b/drivers/fpga/versal-fpga.c > new file mode 100644 > index 000000000000..1bd312a31b23 > --- /dev/null > +++ b/drivers/fpga/versal-fpga.c > @@ -0,0 +1,96 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2019-2021 Xilinx, Inc. > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +static int versal_fpga_ops_write_init(struct fpga_manager *mgr, > + struct fpga_image_info *info, > + const char *buf, size_t size) > +{ > + return 0; > +} > + These empty ops should go away with my wrappers patchset > +static int versal_fpga_ops_write(struct fpga_manager *mgr, > + const char *buf, size_t size) > +{ > + dma_addr_t dma_addr = 0; > + char *kbuf; > + int ret; > + > + kbuf = dma_alloc_coherent(mgr->dev.parent, size, &dma_addr, GFP_KERNEL); > + if (!kbuf) > + return -ENOMEM; > + > + memcpy(kbuf, buf, size); > + ret = zynqmp_pm_load_pdi(PDI_SRC_DDR, dma_addr); why isn't the size passed ? > + dma_free_coherent(mgr->dev.parent, size, kbuf, dma_addr); > + > + return ret; > +} > + > +static int versal_fpga_ops_write_complete(struct fpga_manager *mgr, > + struct fpga_image_info *info) > +{ > + return 0; > +} > + > +static enum fpga_mgr_states versal_fpga_ops_state(struct fpga_manager *mgr) > +{ > + return FPGA_MGR_STATE_UNKNOWN; > +} > + > +static const struct fpga_manager_ops versal_fpga_ops = { > + .state = versal_fpga_ops_state, > + .write_init = versal_fpga_ops_write_init, > + .write = versal_fpga_ops_write, > + .write_complete = versal_fpga_ops_write_complete, > +}; > + > +static int versal_fpga_probe(struct platform_device *pdev) > +{ > + struct device *dev = &pdev->dev; > + struct fpga_manager *mgr; > + int ret; > + > + ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); > + if (ret < 0) { > + dev_err(dev, "no usable DMA configuration\n"); > + return ret; > + } > + > + mgr = devm_fpga_mgr_create(dev, "Xilinx Versal FPGA Manager", > + &versal_fpga_ops, NULL); > + if (!mgr) > + return -ENOMEM; > + > + return devm_fpga_mgr_register(dev, mgr); > +} > + > +static const struct of_device_id versal_fpga_of_match[] = { > + { .compatible = "xlnx,versal-fpga", }, > + {}, > +}; > +MODULE_DEVICE_TABLE(of, versal_fpga_of_match); needs #if defined(CONFIG_OF) wrapper > + > +static struct platform_driver versal_fpga_driver = { > + .probe = versal_fpga_probe, > + .driver = { > + .name = "versal_fpga_manager", > + .of_match_table = of_match_ptr(versal_fpga_of_match), > + }, > +}; > +module_platform_driver(versal_fpga_driver); > + > +MODULE_AUTHOR("Nava kishore Manne "); > +MODULE_AUTHOR("Appana Durga Kedareswara rao "); Rao - needs to be capitalized ? Tom > +MODULE_DESCRIPTION("Xilinx Versal FPGA Manager"); > +MODULE_LICENSE("GPL"); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel