Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0A5F6C636D6 for ; Mon, 20 Feb 2023 22:34:30 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 983DC85905; Mon, 20 Feb 2023 23:34:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1676932468; bh=IY200vleyi/V6CIH/vxnGF7sbj27tn8ZU4PExYSsTss=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=T4d+biDX0xoIjTUbgqfMlUmd4jyqkpL0oInizukIYdpDqSOoXjkx5bLYgXCRC7if1 bq5fNPwbj48XktJm/vpp9eqSzimih9mWHTyO9ECzRSP3hsbUVUnQePOdlwquH4P2HT stNL8zIWbi384r9OTrw7pGxOGttHPD61ESSm/9utqV1cqBiUkfLuZCD5JIcUn7zhiw b34zZwBfTXrCC1SSHYuWGGGk/8110/xveuZaquqzxe5VxKU2yO9RAzpkmhneGv4kQb Y1vYnr33V+gsekIt6PfS8U0lCZdyzUMDpUgYG9XLXLxWxMMOQVns3Ggz//TOERGa0m 2DijkCrc0Wj7g== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id A35BD8338B; Mon, 20 Feb 2023 23:34:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1676932467; bh=IY200vleyi/V6CIH/vxnGF7sbj27tn8ZU4PExYSsTss=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=MdEq8iKxfjE5DjztQ88VYdNXDT1W9dQFmLjbAA576jAvusgeyBSACQeMydeD2acMk xH3gjZHPuGH1V+hKSy8yfv/AA/oMoMG1AoiAzJWGYYKDKaxsess+BTobCojnUtqXL/ 2nVs5CFDb4W9p4ZGKuCP0h23S/OmHyjXtPhOHpBJnxtoKRSMb5wz8pXFlvrcOWAqEE BIOKkkIfDygqPZtAjDo9+Y9Ewv9BbKom6yE6JzdSgXCLZbsrwFf51SwNwea9LBKsKy EXCJPvW5mbm1p+D06cUTGjJsRZcI34Wnk3voaw5lmxpPBJ0ZrzwNLm8AldeHw/iQxU 3AljKjY907P9g== Message-ID: Date: Mon, 20 Feb 2023 23:34:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 3/4] mtd/fpga: add fpga directory to mtd (with Cyclone 10) To: Ulf Samuelsson , u-boot@lists.denx.de Cc: monstr@monstr.eu, sjg@chromium.org, Ulf Samuelsson , Miquel Raynal References: <20230211100743.12087-1-u-boot@emagii.com> <20230211100743.12087-4-u-boot@emagii.com> <0a7c186e-8372-8ace-9491-1b952801bd6e@denx.de> <4407e740-9017-b21e-243a-0e1321ac1075@denx.de> <46d7ce9f-3759-57db-588e-ac61f4cb6a0c@emagii.com> <398fe6e0-8dd0-4147-e8c1-5202812bb6eb@emagii.com> <812a0806-0ae6-ceda-bca6-d794e86c1fed@emagii.com> Content-Language: en-US From: Marek Vasut In-Reply-To: <812a0806-0ae6-ceda-bca6-d794e86c1fed@emagii.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On 2/20/23 22:29, Ulf Samuelsson wrote: [...] >> To sum it up: >> - The only part of the MTD subsystem that is in use by this driver is >> the write callback, everything else is unused. That does not make MTD >> subsystem the right tool. > > No, the MTD subsystem is compatible with the device tree. That does not justify overloading the subsystem with unrelated hardware support for which there is an existing subsystem with existing drivers for the functionality you would duplicate in the MTD subsystem. There are existing DT bindings for FPGAs, see Linux Documentation/devicetree/bindings/fpga/ , use those and add support for them into the FPGA subsystem if needed . > You can also get information about the FPGA when you list the mtd devices. No, you cannot, because the information you may get out of the FPGA in some cases does not map to MTD devices . > It allows you to support partial reconfiguration through the partition > feature. You can write any size block to any part of the MTD, and you > can express that in a device tree. That is what is needed. I am afraid it is not as simple as that, see Linux Documentation/devicetree/bindings/fpga/fpga-region.txt . Furthermore, those DT bindings are already part of Linux and Linux expects the DT to contain exactly those bindings, U-Boot tries not to diverge from what Linux does in DT. >> - There is existing FPGA subsystem both in U-Boot and Linux, extend it >> if necessary. That also covers the usecases which go past a simple >> full bitstream upload. > > And for use, that introduces a command set, which we do not need > and adds 50-100kB to the image. If you were to turn everything that needs read/write callback into an MTD device, you would be able to save even more space, but that does not make it right. You could try and reduce the FPGA command size if there is code which is unused for some usecases, that can be selected via Kconfig at build time. >>> Obviously, someone would have to take the time to do it, but it is >>> certainly possible. >> >> You could make the exact same argument about making the FPGA driver a >> MISC device, CHAR device, BLOCK device, they all have the write >> callback, but that does not mean it is the right fit. >> > That is because you see the "write" as the only function. Yes, because that is the only callback this patch implements, the rest are empty. >> [...] > > What would work is to keep the driver as is, replacing > the MTD stuff internally with an fpga_add after generating a struct > based on the device tree. > > Then it would be part of the FPGA subsystem. > To add this as an Altera passive serial is high risk, > since it cannot be tested on boards using that. > It would simplify things a lot to add it as another driver. No, that would make things MUCH worse, because we would have a one-off driver used by one system, therefore poorly tested, which duplicates functionality of existing driver used by multiple systems and better tested. This also increases maintenance burden. One single driver for this common functionality is always better as it gets more testing. > The result would of course be something which adds both complexity and > code size for us, without any benefit. Please also consider the MTD maintainer point of view. [...]