Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1493897lqh; Mon, 6 May 2024 09:12:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXortdPJvVsMABAuYFn4mMSWejiKV7WRnm58Lg4f9sDrbgOi3ZXbiO3Gk7sTqQ4h4zodLLlEnskD5Cj1JpLpANxzHpGMzZRNi1qNyS2Iw== X-Google-Smtp-Source: AGHT+IHEbj1QDu3COylSCxvj3UgekttuDwWG67ii8ITcDUwDnzCeh9M/EmsKI0UernDqYAyhrPqQ X-Received: by 2002:a17:907:9195:b0:a59:9d4c:eb09 with SMTP id bp21-20020a170907919500b00a599d4ceb09mr5580683ejb.27.1715011969878; Mon, 06 May 2024 09:12:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715011969; cv=pass; d=google.com; s=arc-20160816; b=Ca4RAo9n9SC3RkTiS3zBhzocEt0k9VVqLwJqYi+qNX+hVVRFWpK2q9Ilbe+qJ8j6pY AGAK/RiZSR82fFp1PV4XxbOMl4ujeQtdC34S9CWM1frR+1SKhZ8znNwI5/h1aynJRLDx pFlxdzrFtwsQ19YhEa5WvwV8E2kO/y6QdyGRhMlRZCtQeUu6i0jF3E8erQn9t+Wycx5r uXdUCl0dpzbjr9XpluzxaZHOvKRaQC+Q2glKXcbTuo/4dzApH6s1R7YF5ZrOFAJWu58x n1FLXdgLSBYzuEI8TsMnzZVhAWAKm1hUjSCoJgj1xJAfcCaRNUk3fhq4tfWYs8CGkEsa pCAw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=eA/UY/1P8wH7wCZpII3bKvaurPH62xyfYmiWHuvGpMI=; fh=xKpMwo7PIL/R9Lfrah8cDko+HmY1EfARrKm2U85oQE0=; b=OOxkfBTIZVhUCr1B6aorzXcq22LMasRCV7gEZNApEuc7LFWomDh1iQiaBBBqMsO3he oLqfFh2SWfpNbidoZRBRqdK1VTKaE7A7GHvdszNoFutkY+338O26RYqtX/YX6mfShxlu FfAjjrpZwGwhyHFtRA2P7b8CNxdaAIztj2CKyHA0FWqspBVWLmTQGP4ksD0Dl1uFXfXt iC+AIcuYFts4VDxRRV3LNQ4Dtjq+Uvm6QoWxb6cNJAUbn2w8qyCXOYnusJijrrTQruRS ebY+hhVWMK4GXvyW4vPr1g42VRvJJM13wzgqr1gqtj+mfnjVKu7X3Ajiq25Q5fZbfxBr P1uQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-170127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170127-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b25-20020a170906195900b00a599adfd4a0si3775059eje.1012.2024.05.06.09.12.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 May 2024 09:12:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-170127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170127-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6AF431F22B23 for ; Mon, 6 May 2024 16:12:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4D7F156246; Mon, 6 May 2024 16:12:34 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9BF4E15575A; Mon, 6 May 2024 16:12:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715011953; cv=none; b=BO9+7slw7Cpr8Tyc1VixE2j/ruRTaRlpI+++05NwtGjIgbh2bW+PKtD4eFjGvbG1uX1RwJUC4/DlCar7nYMUeowzA7O7suDmG96XEtXueVPus3Mv1VpVqILUCBl4dxJLx4EWRL8Kwyasy8542fyn1y8GmfqfQhN38YtEQxq5avc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715011953; c=relaxed/simple; bh=dOVbZjy5Np+6iNe8Yn80HNEbgSSJFtmFE3mL7T3bEf8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=sRXVGcrqtCX81iMDEHAeej/R+fx6YTKjGsPCN4D8UuouAcE+/oc0P46diCfGitI9a4h90SO+HAn+J1ZCV4ui0ndCUJBfEDbipw7rjSfnI67OPwOur2BRUZCE6c5+FJhi878POOBCb7Ab8iyjZ9QvJhyESUqHi2/jMzPtXWcK4is= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.97.1) (envelope-from ) id 1s40wt-000000007Gd-1wsn; Mon, 06 May 2024 16:12:19 +0000 Date: Mon, 6 May 2024 17:12:15 +0100 From: Daniel Golle To: Frank Wunderlich Cc: AngeloGioacchino Del Regno , Frank Wunderlich , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Turquette , Stephen Boyd , Pavel Machek , Lee Jones , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , Eric Woudstra , Tianling Shen , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, linux-leds@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Tianling Shen Subject: Re: [RFC v1 5/5] arm64: dts: mediatek: Add mt7986 based Bananapi R3 Mini Message-ID: References: <20240505164549.65644-1-linux@fw-web.de> <20240505164549.65644-6-linux@fw-web.de> <3E013BA7-0264-4AC3-B677-BDD16B1F8D90@public-files.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3E013BA7-0264-4AC3-B677-BDD16B1F8D90@public-files.de> On Mon, May 06, 2024 at 06:00:30PM +0200, Frank Wunderlich wrote: > Hi > > Thanks for review. > > Am 6. Mai 2024 14:48:59 MESZ schrieb AngeloGioacchino Del Regno : > >Il 05/05/24 18:45, Frank Wunderlich ha scritto: > >> From: Frank Wunderlich > >> > >> Add device Tree for Bananapi R3 Mini SBC. > >> > >> Co-developed-by: Eric Woudstra > >> Signed-off-by: Eric Woudstra > >> Co-developed-by: Tianling Shen > >> Signed-off-by: Tianling Shen > >> Signed-off-by: Frank Wunderlich > >> --- > >> arch/arm64/boot/dts/mediatek/Makefile | 1 + > >> .../mediatek/mt7986a-bananapi-bpi-r3-mini.dts | 486 ++++++++++++++++++ > >> 2 files changed, 487 insertions(+) > >> create mode 100644 arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-mini.dts > >> > >> diff --git a/arch/arm64/boot/dts/mediatek/Makefile b/arch/arm64/boot/dts/mediatek/Makefile > >> index 37b4ca3a87c9..1763b001ab06 100644 > >> --- a/arch/arm64/boot/dts/mediatek/Makefile > >> +++ b/arch/arm64/boot/dts/mediatek/Makefile > >> @@ -11,6 +11,7 @@ dtb-$(CONFIG_ARCH_MEDIATEK) += mt7622-bananapi-bpi-r64.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7981b-xiaomi-ax3000t.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-acelink-ew-7886cax.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3.dtb > >> +dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-mini.dtb > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-emmc.dtbo > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nand.dtbo > >> dtb-$(CONFIG_ARCH_MEDIATEK) += mt7986a-bananapi-bpi-r3-nor.dtbo > >> diff --git a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-mini.dts b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-mini.dts > >> new file mode 100644 > >> index 000000000000..c764b4dc4752 > >> --- /dev/null > >> +++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3-mini.dts > >> @@ -0,0 +1,486 @@ > >> +// SPDX-License-Identifier: (GPL-2.0 OR MIT) > >> +/* > >> + * Copyright (C) 2021 MediaTek Inc. > >> + * Authors: Frank Wunderlich > >> + * Eric Woudstra > >> + * Tianling Shen > >> + */ > >> + > >> +/dts-v1/; > >> + > >> +#include > >> +#include > >> +#include > >> +#include > >> + > >> +#include "mt7986a.dtsi" > >> + > >> +/ { > >> + model = "Bananapi BPI-R3 Mini"; > >> + chassis-type = "embedded"; > >> + compatible = "bananapi,bpi-r3mini", "mediatek,mt7986a"; > >> + > >> + aliases { > >> + serial0 = &uart0; > >> + ethernet0 = &gmac0; > >> + ethernet1 = &gmac1; > >> + }; > >> + > >> + chosen { > >> + stdout-path = "serial0:115200n8"; > >> + }; > >> + > >> + dcin: regulator-12vd { > >> + compatible = "regulator-fixed"; > >> + regulator-name = "12vd"; > >> + regulator-min-microvolt = <12000000>; > >> + regulator-max-microvolt = <12000000>; > >> + regulator-boot-on; > >> + regulator-always-on; > >> + }; > >> + > >> + fan: pwm-fan { > >> + compatible = "pwm-fan"; > >> + #cooling-cells = <2>; > >> + /* cooling level (0, 1, 2) - pwm inverted */ > >> + cooling-levels = <255 96 0>; > > > >Did you try to actually invert the PWM? > > > >Look for PWM_POLARITY_INVERTED ;-) > > Mtk pwm driver does not support it > > https://elixir.bootlin.com/linux/latest/source/drivers/pwm/pwm-mediatek.c#L211 > > >> + pwms = <&pwm 0 10000>; > >> + status = "okay"; > >> + }; > >> + > >> + reg_1p8v: regulator-1p8v { > >> + compatible = "regulator-fixed"; > >> + regulator-name = "1.8vd"; > >> + regulator-min-microvolt = <1800000>; > >> + regulator-max-microvolt = <1800000>; > >> + regulator-boot-on; > >> + regulator-always-on; > >> + vin-supply = <&dcin>; > >> + }; > >> + > >> + reg_3p3v: regulator-3p3v { > >> + compatible = "regulator-fixed"; > >> + regulator-name = "3.3vd"; > >> + regulator-min-microvolt = <3300000>; > >> + regulator-max-microvolt = <3300000>; > >> + regulator-boot-on; > >> + regulator-always-on; > >> + vin-supply = <&dcin>; > >> + }; > >> + > >> + usb_vbus: regulator-usb-vbus { > >> + compatible = "regulator-fixed"; > >> + regulator-name = "usb_vbus"; > >> + regulator-min-microvolt = <5000000>; > >> + regulator-max-microvolt = <5000000>; > >> + gpios = <&pio 20 GPIO_ACTIVE_LOW>; > >> + regulator-boot-on; > >> + }; > >> + > >> + en8811_a: regulator-phy1 { > >> + compatible = "regulator-fixed"; > >> + regulator-name = "phy1"; > >> + regulator-min-microvolt = <3300000>; > >> + regulator-max-microvolt = <3300000>; > >> + gpio = <&pio 16 GPIO_ACTIVE_LOW>; > >> + regulator-always-on; > >> + }; > >> + > >> + en8811_b: regulator-phy2 { > >> + compatible = "regulator-fixed"; > >> + regulator-name = "phy2"; > >> + regulator-min-microvolt = <3300000>; > >> + regulator-max-microvolt = <3300000>; > >> + gpio = <&pio 17 GPIO_ACTIVE_LOW>; > >> + regulator-always-on; > >> + }; > >> + > >> + leds { > >> + compatible = "gpio-leds"; > >> + > >> + green_led: led-0 { > >> + color = ; > >> + function = LED_FUNCTION_POWER; > >> + gpios = <&pio 19 GPIO_ACTIVE_HIGH>; > >> + default-state = "on"; > >> + }; > >> + }; > >> + > >> + gpio-keys { > >> + compatible = "gpio-keys"; > >> + > >> + reset-key { > >> + label = "reset"; > >> + linux,code = ; > >> + gpios = <&pio 7 GPIO_ACTIVE_LOW>; > >> + }; > >> + }; > >> + > >> +}; > >> + > >> +&cpu_thermal { > >> + cooling-maps { > >> + map0 { > >> + /* active: set fan to cooling level 2 */ > >> + cooling-device = <&fan 2 2>; > >> + trip = <&cpu_trip_active_high>; > >> + }; > >> + > >> + map1 { > >> + /* active: set fan to cooling level 1 */ > >> + cooling-device = <&fan 1 1>; > >> + trip = <&cpu_trip_active_med>; > >> + }; > >> + > >> + map2 { > >> + /* active: set fan to cooling level 0 */ > >> + cooling-device = <&fan 0 0>; > >> + trip = <&cpu_trip_active_low>; > >> + }; > >> + }; > >> +}; > >> + > >> +&crypto { > >> + status = "okay"; > >> +}; > >> + > >> +ð { > >> + status = "okay"; > >> + > >> + gmac0: mac@0 { > >> + compatible = "mediatek,eth-mac"; > >> + reg = <0>; > >> + phy-mode = "2500base-x"; > >> + phy-handle = <&phy14>; > >> + }; > >> + > >> + gmac1: mac@1 { > >> + compatible = "mediatek,eth-mac"; > >> + reg = <1>; > >> + phy-mode = "2500base-x"; > >> + phy-handle = <&phy15>; > >> + }; > >> + > >> + mdio: mdio-bus { > >> + #address-cells = <1>; > >> + #size-cells = <0>; > >> + }; > >> +}; > >> + > >> +&mmc0 { > >> + pinctrl-names = "default", "state_uhs"; > >> + pinctrl-0 = <&mmc0_pins_default>; > >> + pinctrl-1 = <&mmc0_pins_uhs>; > >> + vmmc-supply = <®_3p3v>; > >> + vqmmc-supply = <®_1p8v>; > >> +}; > >> + > >> + > >> +&i2c0 { > >> + pinctrl-names = "default"; > >> + pinctrl-0 = <&i2c_pins>; > >> + status = "okay"; > >> + > >> + /* MAC Address EEPROM */ > >> + eeprom@50 { > >> + compatible = "atmel,24c02"; > >> + reg = <0x50>; > >> + > >> + address-width = <8>; > >> + pagesize = <8>; > >> + size = <256>; > >> + }; > >> +}; > >> + > >> +&mdio { > > > >You can just move all this stuff to where you declare the mdio-bus.... > > Ok,see these 2 lines are already above,so can be dropped here. > > >> + #address-cells = <1>; > >> + #size-cells = <0>; > >> + > >> + phy14: ethernet-phy@14 { > > > >I say that this is `phy0: ethernet-phy@14` - because this is the first PHY on this > >board. > > Ok,i change this and phy15 > > >> + reg = <14>; > > > >Uhm.. doesn't this require the ethernet-phy-id03a2.a411 compatible? > > I can add it,but worked without it. > > There was a discussion about that and result was we don't need it in board dts,maybe add compatible in binding example. > > https://patchwork.kernel.org/project/netdevbpf/patch/20240206194751.1901802-2-ericwouds@gmail.com/#25703356 I confirm that setting the PHY ID in DT is **not** needed. The PHY probes fine and it's possible to read the PHY ID even before firmware has been loaded. > > >> + interrupts-extended = <&pio 48 IRQ_TYPE_EDGE_FALLING>; > >> + reset-gpios = <&pio 49 GPIO_ACTIVE_LOW>; > >> + reset-assert-us = <10000>; > >> + reset-deassert-us = <20000>; > >> + phy-mode = "2500base-x"; > >> + full-duplex; > >> + pause; > >> + airoha,pnswap-rx; > >> + > >> + leds { > >> + #address-cells = <1>; > >> + #size-cells = <0>; > >> + > >> + led@0 { /* en8811_a_gpio5 */ > >> + reg = <0>; > >> + color = ; > >> + function = LED_FUNCTION_LAN; > >> + function-enumerator = <1>; > > > >Why aren't you simply using a label? > > You mean the comment? I can add it of course like for regulators. > > >> + default-state = "keep"; > >> + linux,default-trigger = "netdev"; Using linux,default-trigger = "netdev" will NOT work as intended, see also the reply to your other patch where you are adding netdev trigger to dt-bindings. If you do this, it will seemingly work, but if you check /sys/class/leds/foo/hw_control it will always be 0, and hardware offloading will hence never be used. Please just set the LED trigger in userspace for now. > >> + }; > >> + led@1 { /* en8811_a_gpio4 */ > >> + reg = <1>; > >> + color = ; > >> + function = LED_FUNCTION_LAN; > >> + function-enumerator = <2>; > >> + default-state = "keep"; > >> + linux,default-trigger = "netdev"; > >> + }; > >> + }; > >> + }; > >> + > >> + phy15: ethernet-phy@15 { > >> + reg = <15>; > > > >Same here. > > > >Cheers, > >Angelo > > > > > regards Frank >