Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1629292rwb; Sat, 19 Nov 2022 00:07:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7p1Vv9rKgqL6l8D2yOY/+koz6h5fy74Wg/Xz5n6HakRx+faMOQHj4w4K6szhwndEpcqGB7 X-Received: by 2002:a05:6a00:1310:b0:561:a494:b299 with SMTP id j16-20020a056a00131000b00561a494b299mr11109481pfu.34.1668845252795; Sat, 19 Nov 2022 00:07:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668845252; cv=none; d=google.com; s=arc-20160816; b=UHSdI9KiOgzJ5rR59MfT5qqtwyEOP4NItFvGVngtNuw2cqTCczs2OqLp/OuJZ/dlFz OI+A05ilcIOsPFf/inysY+feJhm9RXN6HSxodAsY0X3mqpzUjq5vtzZHf75YMif4GPDo cfz/vicJERQvl86BdZzsUZjg9+q4GT6tcjfZ3XO+qChc2/w8galrMKZwsbvTuhWDoHYb u+xWhZggrh6rOKO7ADDdYmJJIGrLkIwBRFc4TCJ2EClFeLbvuMC40ZAV8d84CDIhPQun afCyT6wWD6JJs3K8YvhEDL4aM/g9Jdr0zkyWMbzMtID47PgCPzno1gU+Hykxlo0rCNeS 2PAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:references:in-reply-to:user-agent:subject:cc:to:from :date:dkim-signature; bh=Ov0YYXmwqRVPJ8mk/jWh4VlTvRDF8RS9SB8/7u28NwE=; b=OEaAtmxcq0ebfIcm2/m+G1qLNraI/AEqOd6+uXT4DZnk1BkBTCnqe10s/rigOUXN5a mh05USj9woljPyJcCsc8GSML1Fxk6EjBefYzhtwjI4xv06XpXqvMqlSJrVUl/1ntgjqv 7MpaQqo/V6LwEQQe3ZM7F046bFARbTm2m1EboTiDNqOXOgjuZISAVBZP2MyiYu4hHXnw OTfrL6JlI6RoC52GTyaUJtb3XH3cbrIoo1dMLoB8+bZLLSzK2/TMRLwCyk1NV9IIby2e k6yh/PjeRQ8bSJdd/SMpz5PLOxanm5cgwy34QaTLKliqee/sgEkLE9aWagKMTQzQ2O6e HoDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b=LRCeCOrA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id on14-20020a17090b1d0e00b0021414ac5cc2si9172968pjb.131.2022.11.19.00.07.19; Sat, 19 Nov 2022 00:07:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mailerdienst.de header.s=20200217 header.b=LRCeCOrA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232246AbiKSHUB (ORCPT + 90 others); Sat, 19 Nov 2022 02:20:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiKSHT7 (ORCPT ); Sat, 19 Nov 2022 02:19:59 -0500 Received: from mxout3.routing.net (mxout3.routing.net [IPv6:2a03:2900:1:a::8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB7DE920BC; Fri, 18 Nov 2022 23:19:57 -0800 (PST) Received: from mxbox2.masterlogin.de (unknown [192.168.10.89]) by mxout3.routing.net (Postfix) with ESMTP id DD8B562608; Sat, 19 Nov 2022 07:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailerdienst.de; s=20200217; t=1668842396; 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=Ov0YYXmwqRVPJ8mk/jWh4VlTvRDF8RS9SB8/7u28NwE=; b=LRCeCOrA6CSrOStxeGORqIrn0AjDw/k9ShF4O9sMHRnqkKk5OQtv62vv6wA/ucBL6JncGh 3myF4/S+2aEFiKopUC4Bq0fOWRi8IMO0K1t+/nTgaXH0g6dr1mqZD/K8D4qtWI+CssdiXr QmMxwGHHrY88p7IJ1BbKM4VYHRLOxxI= Received: from [127.0.0.1] (fttx-pool-80.245.75.145.bambit.de [80.245.75.145]) by mxbox2.masterlogin.de (Postfix) with ESMTPSA id 88C511000CA; Sat, 19 Nov 2022 07:19:54 +0000 (UTC) Date: Sat, 19 Nov 2022 08:19:52 +0100 From: Frank Wunderlich To: Rob Herring , frank-w@public-files.de CC: linux-mediatek@lists.infradead.org, Ryder Lee , Jianjun Wang , Bjorn Helgaas , Krzysztof Kozlowski , Chunfeng Yun , Kishon Vijay Abraham I , Vinod Koul , Greg Kroah-Hartman , Matthias Brugger , Paolo Abeni , Lorenzo Bianconi , Bo Jiao , linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-usb@vger.kernel.org Subject: Re: [PATCH v6 11/11] arm64: dts: mt7986: add BPI-R3 nand/nor overlays User-Agent: K-9 Mail for Android In-Reply-To: References: <20221118190126.100895-1-linux@fw-web.de> <20221118190126.100895-12-linux@fw-web.de> <99114D73-22EF-43CD-848E-88A37B29B953@public-files.de> Message-ID: <192D4414-DC88-4321-BB2A-4345C48E3C12@fw-web.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mail-ID: 0ca9227a-4531-4695-b383-da3c235452f3 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 8=2E November 2022 15:45:49 MEZ schrieb Rob Herring : >On Fri, Nov 18, 2022 at 4:05 PM Frank Wunderlich > wrote: >> >> Am 18=2E November 2022 22:39:52 MEZ schrieb Rob Herring : >> >On Fri, Nov 18, 2022 at 1:01 PM Frank Wunderlich w= rote: >> >> >> >> From: Frank Wunderlich >> >> >> >> Add devicetree overlays for using nand and nor on BPI-R3=2E >> > >> >Can you not tell at runtime which one you booted from? If not, how >> >does one choose which overlay to apply? If you can, why not populate >> >both nodes and enable the right one? IMO, if all h/w is present, it >> >should all be in the DT=2E Selecting what h/w to use is a separate >> >problem and overlays aren't a great solution for that=2E >> >> It is not the decision about bootdevice,more available devices=2E >> >> Only 1 spi device (nand OR nor) is available >> at boottime as they share same spi bus and >> chipselect is set via hw jumper=2E >> Both nodes have reg 0,which is imho not >> supported in linux=2E > >As long as one is set to disabled, it should be fine=2E > > >> I choosed overlays to add the right spi >> device on the right mmc device where >> similar selection happens (see patch 10)=2E >> Either sd OR emmc can be used (1 mmc >> controller,first 4bits from bus switched by >> hardware jumper)=2EBut for mmc i use it as >> base fdt because i see mmc as primary >> device which holds rootfs too=2E Nand/nor is >> imho helping device for accessing emmc or >> like rescue system (only uboot)=2E > >No way to read the jumper state or know what you booted from I gues? > >> I probe in uboot if emmc is available (mmc >> partconf) and choose emmc else sd=2E For >> spi i try with sf command to check for nor,if >> this does not work i apply nand overlay=2E > >Instead of applying overlays, wouldn't just changing 'status' be easier? It will be easier,but requires dts for all combinations,we have have sd/emmc combination twice (once for nand enabling,once for nor) and we have then 4 full dts instead of smaller overlays in fit=2E So i should add spi subnodes both disabled in base dtsi and create 4 dts (sd-nand,sd-nor,emmc-nand,emmc-nor) with mmc node and enabling the right spi node? >> >> >> Signed-off-by: Frank Wunderlich >> >> --- >> >> maybe rename to dtso? >> >> >> >> "kbuild: Allow DTB overlays to built from =2Edtso named source files= " >> >> https://git=2Ekernel=2Eorg/pub/scm/linux/kernel/git/robh/linux=2Egit= /commit/?h=3Ddt/next&id=3D363547d2191cbc32ca954ba75d72908712398ff2 >> >> Should i do this? > >Yes=2E =2Edts -> =2Edtbo is going to be removed=2E Do this if still using overlays,will test new way=2E Maybe we can apply parts 1-9 first? >> >> more comments about the dt overlay-support: >> >> >> >> https://patchwork=2Ekernel=2Eorg/comment/25092116/ >> >> https://patchwork=2Ekernel=2Eorg/comment/25085681/ >> >> Daniel suggest define sd/emmc as overlay too=2E=2E=2Ewith way you menti= on below we could create 4 full fdt without applying overlays in uboot=2E > >Yes, but if you are going to do that, then you can just do all this >with includes=2E This is a third way if i understand correctly Make all of them as overlay (dtso?) but build dtb by combining them in makefile=2E This looks the best way because it avoids redundand code for mmc node and allows my current spi config (not the status way which may break due to same unit address)=2E I guess my base dtsi is then a dts too? Or should these overlays only duplicated and either include sd dts or emmc= dts (but this creates again redundant code)? >> >> --- a/arch/arm64/boot/dts/mediatek/Makefile >> >> +++ b/arch/arm64/boot/dts/mediatek/Makefile >> >> @@ -8,6 +8,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) +=3D mt6797-x20-dev=2Edt= b >> >> dtb-$(CONFIG_ARCH_MEDIATEK) +=3D mt7622-rfb1=2Edtb >> >> dtb-$(CONFIG_ARCH_MEDIATEK) +=3D mt7622-bananapi-bpi-r64=2Edtb >> >> dtb-$(CONFIG_ARCH_MEDIATEK) +=3D mt7986a-bananapi-bpi-r3-emmc=2Edtb >> >> +dtb-$(CONFIG_ARCH_MEDIATEK) +=3D mt7986a-bananapi-bpi-r3-nand=2Edtb= o >> >> +dtb-$(CONFIG_ARCH_MEDIATEK) +=3D mt7986a-bananapi-bpi-r3-nor=2Edtbo >> > >> >These need rules to apply them to the base dtb(s)=2E You just need: >> > >> >full=2Edtb :=3D base=2Edtb overlay=2Edtb >> >dtb-y +=3D full=2Edtb >> >> I would prefer to do this in bootloader to allow all 4 possible configu= rations: >> >> Sd+nand >> Sd+nor >> Emmc+nand >> Emmc+nor > >That's fine=2E The purpose here is to document what the overlays apply >to, check that they actually apply, and validate them when applied >(unless someone wants to figure out all the issues with validating >just an overlay and make that work)=2E You for example have an >undocumented compatible in yours (denx,fit)=2E Oh,need to check,copied partitions from my uboot dts=2E=2E=2Emaybe there is a linux version for marking it as fit partition,else i drop completely=2E So i i stay with current way i have to rename overlays to dtso and add info about base dtb (bpi-r3-sd/emmc) to commit message or into the overlay itself? >Rob regards Frank