Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1319287rwb; Fri, 18 Nov 2022 16:39:52 -0800 (PST) X-Google-Smtp-Source: AA0mqf52jJBlAunqKjf0X6fKjzHl2QNzBwY20XcPBqMLQX3ZirEy+nctvvC66Vmwznu0z957lKZS X-Received: by 2002:a17:906:7215:b0:78d:a7f0:e232 with SMTP id m21-20020a170906721500b0078da7f0e232mr7923114ejk.9.1668818391977; Fri, 18 Nov 2022 16:39:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668818391; cv=none; d=google.com; s=arc-20160816; b=b77WgPJA+UdEvtKBtElyY5BDZuehO0MDqzonr/j2d21l6wrJy3T06RzUQA/f8ogMBW BTpj35KFlWnbJZZ01e8J1/Am9ONehImdAGnkMs9jsuCCbPekwS5qwJgdfdCF1hQpa91V 2kJvbIUYWM/ShP16yVymQpQs4iS0p6t6vuvVln1dRGPNs0Ki2Pgzd7Qzvey0LyEczyLa 1cOajoA5b/wYu7ixHjbeKWIk+g1iq6iQuZKn3fD7JSkLLF7PyAiyXUCIxJQ+4SkRxqa/ pm1zC/q9iin1UWpual1oMLv0ZEe/G1UCby6+3fPFbi4bIGZ2eKtcdcdbLQVfHsOq98Uh GLEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=MZ6hdqwUQaYK66H/IIV2YsM8zaSVYrloCQf90JTpj3A=; b=pXjDoc40R3+OqlRUQqPF/BTZgsmeB1R7yDJZBljYdsUUI6AHswetdEsC/kT+YZRJLY JclGSWbbBEz/HybhQhSx6PRlGHCsUiAdRU3ym3jMuBJdZ1s137DMJoWs+MCOnQ7iZhLR +I3R0rQ2EHFEHyfeZCHXzalnhDEt5R2im5VQSi+cLgLgqpWOHq+Z3NXXEgtB7NARSFqc 2Xc7Pl7/Dtf9EHUhKx+GEHodr32X7Y9lzAyKjhXNXJPubskcUIJedyE1xtbHiJFj2WJh KveXZmgVD9zHZRIgZ0S7q9yPRUtYpQFtNJuAsuipYbloFd0cFVoCv12s9D5ciEK7ANNg I4Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uUiNErb6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs8-20020a1709072d0800b007ad8218ad7fsi4285665ejc.379.2022.11.18.16.39.29; Fri, 18 Nov 2022 16:39:51 -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=@kernel.org header.s=k20201202 header.b=uUiNErb6; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234152AbiKRX2W (ORCPT + 90 others); Fri, 18 Nov 2022 18:28:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235747AbiKRX1l (ORCPT ); Fri, 18 Nov 2022 18:27:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4AF02BEB55; Fri, 18 Nov 2022 15:15:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F468B825A6; Fri, 18 Nov 2022 23:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4275BC43146; Fri, 18 Nov 2022 23:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668813326; bh=WZ8PKekF+dncjbvSjEZDmCUz4Gtb/LLsdxmayfMcHhY=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=uUiNErb6Tgnfb5oEusUI+JFCYQV1AQQE05w7FhzIsK2QfXqv5WsrIBGnaJv18JYvC US6ufr5tGWw4TNPSFjoVvPs7U73mqwT1Iif0fsS9HXuEbFaQoIp9RziFSIfk2BPtoE 8l5WjmxXsF7+ApkuRNUWknyBnVBp4pvUXVu8CxIOSuojIfmmxBescMXFY6IZVe1blp AJJ8nA9+lDruS2WhwLVsVCcGwMAA7v822zB/DmdeFXNSPcHARY4PQoJnUkiOA7XuZE ddwQAvFkqqhmpHMN9HEF3cuyJhmo7NkpzDNBR0yjGLXO1VC2dp/SMfJS5h2xPCjZfo 8tIBa4wckr4xg== Received: by mail-lf1-f52.google.com with SMTP id bp15so10541638lfb.13; Fri, 18 Nov 2022 15:15:26 -0800 (PST) X-Gm-Message-State: ANoB5pk03BMWnt68Eu6iKHesJ7pILzzmNNtc8Ev2I1DvHdIKt6CiRULP YenaMt0ae2YeAgbs2Xp5S0OYCuxAn+mjCaVZoQ== X-Received: by 2002:ac2:442f:0:b0:4a2:8d76:abaa with SMTP id w15-20020ac2442f000000b004a28d76abaamr3212413lfl.74.1668813323939; Fri, 18 Nov 2022 15:15:23 -0800 (PST) MIME-Version: 1.0 References: <20221118190126.100895-1-linux@fw-web.de> <20221118190126.100895-12-linux@fw-web.de> <99114D73-22EF-43CD-848E-88A37B29B953@public-files.de> In-Reply-To: <99114D73-22EF-43CD-848E-88A37B29B953@public-files.de> From: Rob Herring Date: Tue, 8 Nov 2022 08:45:49 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v6 11/11] arm64: dts: mt7986: add BPI-R3 nand/nor overlays To: frank-w@public-files.de Cc: Frank Wunderlich , 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DATE_IN_PAST_96_XX, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_HI,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 On Fri, Nov 18, 2022 at 4:05 PM Frank Wunderlich wrote: > > Am 18. November 2022 22:39:52 MEZ schrieb Rob Herring : > >On Fri, Nov 18, 2022 at 1:01 PM Frank Wunderlich wrote: > >> > >> From: Frank Wunderlich > >> > >> Add devicetree overlays for using nand and nor on BPI-R3. > > > >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. Selecting what h/w to use is a separate > >problem and overlays aren't a great solution for that. > > It is not the decision about bootdevice,more available devices. > > Only 1 spi device (nand OR nor) is available > at boottime as they share same spi bus and > chipselect is set via hw jumper. > Both nodes have reg 0,which is imho not > supported in linux. As long as one is set to disabled, it should be fine. > I choosed overlays to add the right spi > device on the right mmc device where > similar selection happens (see patch 10). > Either sd OR emmc can be used (1 mmc > controller,first 4bits from bus switched by > hardware jumper).But for mmc i use it as > base fdt because i see mmc as primary > device which holds rootfs too. Nand/nor is > imho helping device for accessing emmc or > like rescue system (only uboot). 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. For > spi i try with sf command to check for nor,if > this does not work i apply nand overlay. Instead of applying overlays, wouldn't just changing 'status' be easier? > > >> Signed-off-by: Frank Wunderlich > >> --- > >> maybe rename to dtso? > >> > >> "kbuild: Allow DTB overlays to built from .dtso named source files" > >> https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/commit/?h=dt/next&id=363547d2191cbc32ca954ba75d72908712398ff2 > > Should i do this? Yes. .dts -> .dtbo is going to be removed. > >> more comments about the dt overlay-support: > >> > >> https://patchwork.kernel.org/comment/25092116/ > >> https://patchwork.kernel.org/comment/25085681/ > > Daniel suggest define sd/emmc as overlay too...with way you mention below we could create 4 full fdt without applying overlays in uboot. Yes, but if you are going to do that, then you can just do all this with includes. > >> --- a/arch/arm64/boot/dts/mediatek/Makefile > >> +++ b/arch/arm64/boot/dts/mediatek/Makefile > >> @@ -8,6 +8,8 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt6797-x20-dev.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-rfb1.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-bananapi-bpi-r64.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtb > >> +dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo > >> +dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo > > > >These need rules to apply them to the base dtb(s). You just need: > > > >full.dtb := base.dtb overlay.dtb > >dtb-y += full.dtb > > I would prefer to do this in bootloader to allow all 4 possible configurations: > > Sd+nand > Sd+nor > Emmc+nand > Emmc+nor That's fine. 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). You for example have an undocumented compatible in yours (denx,fit). Rob