Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp343974rwd; Wed, 17 May 2023 19:53:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6I34t+KHA/x469nIA81dYClNNVl65FwmfKt70P1InISvCMKWkUY5BYT6X+Of7VzUhCqTBl X-Received: by 2002:a05:6a20:a10c:b0:107:6f3:71d with SMTP id q12-20020a056a20a10c00b0010706f3071dmr628380pzk.14.1684378397451; Wed, 17 May 2023 19:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684378397; cv=none; d=google.com; s=arc-20160816; b=IzL7CbCSmLIKRsGL1KRxpndro8Xgf0PpaosjUROoZ3Fa5gDIUb0O4A9cePxtf7yxPc OqnOvngiratfmZiJK2VNtE7MlKv7Roi169MlNFZFKtkX7nXmG0YFscfo14KjSZfI8rmW Pm2RKKYJ9WkYR/vm+Y7V/QrH0+fLgeEj+jZof0rDSIrUNJvojjWyEncomx2AQ7lvaXCS 2457Svv67o6k1E/f01KFQE3NMT4qEQ08Kl+6rWy/zWeDEsmv9KR0lk+OKYOOVzFSnYIj G3Ef1bc0kV9eun25GMhmCitco1iYUL+S7FHvlNK3O/7FQ0cz7jZQaoJNUM+ZEty6wk9c S4uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=b6oE0/Jd5Jg+7mnXMgxF5xYu6KHQ8W7zxmYTjpvX+9k=; b=0cizB34s1GviCyYSTkvuKdGBvCcB9rL8/jImUo0tp8RfBERnDHc7iucE6Ajtrjhj3O cEQ5TTQs0TArWqDso40gWkbvk97SkaIMeLOlW5Dbcjki4RKzPaSCRE8c+/pxS631uWta gb4MPV1QX/h54MYC/b5ukQ+M8PkzWPVUPgMtq+1E7VGQWVQMzmMOCnLPbYFlLzG0iZme 0jnIIPxAKWf+3H1NCsVMI0SjHCmsm1ww8QnpBCklD1Uj2Nd/0VG160eCS+v58T5ZTuXl 1QNS85zMFquZnbZlhOZGRSkiVfLXcYyzAw4tZ0vFDgDLgerTTE29eQ7nhbDTvS3hAcWq G0MA== ARC-Authentication-Results: i=1; mx.google.com; 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 t62-20020a638141000000b0053071bc4978si361303pgd.111.2023.05.17.19.53.05; Wed, 17 May 2023 19:53:17 -0700 (PDT) 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; 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 S229527AbjERCpJ (ORCPT + 99 others); Wed, 17 May 2023 22:45:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjERCpI (ORCPT ); Wed, 17 May 2023 22:45:08 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BF5A135; Wed, 17 May 2023 19:45:05 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1pzTdR-0006Qg-2S; Thu, 18 May 2023 02:44:57 +0000 Date: Thu, 18 May 2023 03:44:45 +0100 From: Daniel Golle To: Krzysztof Kozlowski Cc: Andrew Lunn , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , AngeloGioacchino Del Regno , Qingfang Deng , SkyLake Huang , Simon Horman Subject: Re: [PATCH net-next v4 1/2] dt-bindings: arm: mediatek: add mediatek,boottrap binding Message-ID: References: <55f8ac31-d81d-43de-8877-6a7fac2d37b4@lunn.ch> <7e8d0945-dfa9-7f61-b075-679e8a89ded9@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7e8d0945-dfa9-7f61-b075-679e8a89ded9@linaro.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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, May 12, 2023 at 08:54:36AM +0200, Krzysztof Kozlowski wrote: > On 11/05/2023 17:53, Andrew Lunn wrote: > > On Thu, May 11, 2023 at 04:10:20PM +0200, Daniel Golle wrote: > >> The boottrap is used to read implementation details from the SoC, such > >> as the polarity of LED pins. Add bindings for it as we are going to use > >> it for the LEDs connected to MediaTek built-in 1GE PHYs. > > > > What exactly is it? Fuses? Is it memory mapped, or does it need a > > driver to access it? How is it shared between its different users? > > Yes, looks like some efuse/OTP/nvmem, so it should probably use nvmem > bindings and do not look different than other in such class. I've asked MediaTek and they have replied with an elaborate definition. Summary: The boottrap is a single 32-bit wide register at 0x1001f6f0 which can be used to read back the bias of bootstrap pins from the SoC as follows: * bit[8]: Reference CLK source && gphy port0's LED If bit[8] == 0: - Reference clock source is XTRL && gphy port0's LED is pulled low on board side If bit[8] == 1: - Reference clock source is Oscillator && gphy port0's LED is pulled high on board side * bit[9]: DDR type && gphy port1's LED If bit[9] == 0: - DDR type is DDRx16b x2 && gphy port1's LED is pulled low on board side If bit[9] == 1: - DDR type is DDRx16b x1 && gphy port1's LED is pulled high on board side * bit[10]: gphy port2's LED If bit[10] == 0: - phy port2's LED is pulled low on board side If bit[10] == 1: - gphy port2's LED is pulled high on board side * bit[11]: gphy port3's LED If bit[11] == 0: - phy port3's LED is pulled low on board side If bit[11] == 1: - gphy port3's LED is pulled high on board side If bit[10] == 0 && bit[11] == 0: - BROM will boot from SPIM-NOR If bit[10] == 1 && bit[11] == 0: - BROM will boot from SPIM-NAND If bit[10] == 0 && bit[11] == 1: - BROM will boot from eMMC If bit[10] == 1 && bit[11] == 1: - BROM will boot from SNFI-NAND The boottrap is present in many MediaTek SoCs, however, support for reading it is only really needed on MT7988 due to the dual-use of some bootstrap pins as PHY LEDs. We could say this is some kind of read-only 'syscon' node (and hence use regmap driver to access it), that would make it easy but it's not very accurate. Also efuse/OTP/nvmem doesn't seem accurate, though in terms of software it could work just as well. I will update DT bindings to contain the gained insights. Please advise if any existing driver (syscon/regmap or efuse/OTP/nvmem) should be used or if it's ok to just use plain mmio in the PHY driver. Best regards Daniel