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 9B0ABC61DA3 for ; Tue, 21 Feb 2023 16:01:46 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9DBE1859FF; Tue, 21 Feb 2023 17:01:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; secure) header.d=walle.cc header.i=@walle.cc header.b="BrpZHTql"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D97A085A51; Tue, 21 Feb 2023 17:01:42 +0100 (CET) Received: from mail.3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9E7C9859FF for ; Tue, 21 Feb 2023 17:01:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=walle.cc Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=michael@walle.cc Received: from 3ffe.de (0001.3ffe.de [IPv6:2a01:4f8:c0c:9d57::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.3ffe.de (Postfix) with ESMTPSA id AE0FF124; Tue, 21 Feb 2023 17:01:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2022082101; t=1676995298; 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=3Y3nYKQJe1i0huuZ5mLY6tVnvlCLHi/JlGwd5/MY9mg=; b=BrpZHTql360oVVh/ZURSH/RasL5WkJRe1TZtuB2WKA5bY+LVmX2mFYH5r6KVKlWAAQh9M8 GlaHaBEcWo55OSfP8Ce0g5/vux4k4ZuK4m34AgXMdCDojTeaQosOs60ab9As+f8Rj61Gtq eNDByLvFdWnxTjeegEfB7rs0NzBkuxVMSG8QYQATCLnLe/WFqt1Dp7ZYH/wljJwyC1DOza eX3mFQArI9VlJcYZZ/Wz6aUUJX7SX+DFBhJh5D2RttrmlLRjYmQOXSXmKBWnjz2JGV4bh7 9BO/4Vo+x5iprFlxhHzBWQ6jzT6rtSYOvfpYJLx2Yj7iTmrCgMF5bL+RIAvJyw== MIME-Version: 1.0 Date: Tue, 21 Feb 2023 17:01:38 +0100 From: Michael Walle To: Ulf Samuelsson Cc: ulf@emagii.com, marex@denx.de, miquel.raynal@bootlin.com, monstr@monstr.eu, sjg@chromium.org, u-boot@lists.denx.de Subject: Re: [PATCH 3/4] mtd/fpga: add fpga directory to mtd (with Cyclone 10) In-Reply-To: <3e0eb0bc-f8b2-142f-9d42-3ed116d1f75c@emagii.com> References: <20230221090816.3913072-1-michael@walle.cc> <1bd42930274456ce40480126c251b070@walle.cc> <3e0eb0bc-f8b2-142f-9d42-3ed116d1f75c@emagii.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <20eb0ff9c8961ea8b681ee11f74dc1e3@walle.cc> X-Sender: michael@walle.cc Content-Type: text/plain; charset=US-ASCII; 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 > If the use of MTD is restricted to passive serial, this is OK with me. Yeah, but that is not how upstream things work. You need to also think of any other use cases. > These are the things I want to achieve. > > * transfer data using the SPI driver and not use board files. > For that, the FPGA should be under the SPI in the device tree. So to me it sounds like you actually want a "altera passive spi" driver which uses the spi subsytem (and not the MTD layer). > * The size of the FPGA bitstream should be specified in the device > tree. I'm not experienced with the fpga bindings, but maybe they have something like that. Or you can deduce it from the compatible string. What's your usecase here? It sounds like a u-boot limitation to me (if you don't use files). > * The FPGA should be accessed as a device, not an address. > * I want a list of the FPGAs connected in the system > * Minimize code. > * Simplify user interface. agreed. > From the CPU point of view, the FPGA is just a RAM location on the SPI > bus. It cannot be read, but it can be written. > > This is not surprising, because it is simply a RAM. > It happens to have side effects, but that is not important. Can't follow you here. How can the FPGA be a location in RAM if it's behind an SPI bus? Thats not how SPI works. > The MTD subsystem supplies everything I need, and adding the driver > there is much less work than anything else. Yeah but just because it has everything you need, doesn't mean it is a good fit for your use case. Again. I think you want to have a passive serial driver which represents your fpga as a device which then can be configured. There is already an empty (sigh) FPGA_UCLASS. That should probably be extended. Ideally, this should be probed by the linux fpga bindings. >>> The additional features of MTD simplifies the user interaction by >>> exposing a device and >>> providing info on the device. >> >> Which would that be? What are the features of MTD which you need >> here? You've mentioned MTD partitions, but I'm not sure these really >> apply to partial reconfigurations. I know that Linux has a different >> device tree binding for it. So making u-boot use mtd partitions (if >> thats possible at all) and not the linux bindings means they'll >> diverge, which is something we want to avoid. > > You cannot do partial reconfiguration on passive serial, > so it is only of interest if someone feels a need to expand > the MTD to other configuration methods. So.. what MTD features are then used by your approach? > Here is how an FPGA region looks in Linux. > If I understand things correctly, you have one memory region per > partial configuration. This looks quite a lot like partitions. > > &fpga_region0 { > #address-cells = <1>; > #size-cells = <1>; > > firmware-name = "soc_system.rbf"; > fpga-bridges = <&fpga_bridge1>; > ranges = <0x20000 0xff200000 0x100000>, > <0x0 0xc0000000 0x20000000>; > > gpio@10040 { > compatible = "altr,pio-1.0"; > reg = <0x10040 0x20>; > altr,ngpio = <4>; > #gpio-cells = <2>; > clocks = <2>; > gpio-controller; > }; > > onchip-memory { > device_type = "memory"; > compatible = "altr,onchipmem-15.1"; > reg = <0x0 0x10000>; > }; > }; > >> >>> The only difference the MTD subsystem would see is >>> that there is a new subdirectory "fpga" with drivers >>> and the Kconfig + Makefile changes to support the directory. >>> Otherwise it plugs right in. >> >> From a user point of view this is really confusing. Why would >> you sometimes configure an fpga with the mtd command and sometimes >> with the fpga command depening whether it is using this passive >> programming thingy. > > I think that most board designers would select one method of > configuring > the FPGA and they would only have either the FPGA or the MTD command > set. I would be surprised if an engineer would be confused by this. As a user I'd expect one command for any similar devices. As a board integrator, the fpga would be loaded by the board file anyway if needed during u-boot/bootup. Just my two cents as a spi-nor reviewer in linux. You'd have to convince the u-boot maintainers. There is already an FPGA subsystem in linux so I doubt your approach would make it into linux. -michael