Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1392325rdb; Sat, 3 Feb 2024 04:45:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWlZ2pK5SlzWPJVGQVpE4bUN2pp69j5nqz2lm3BwNAQKOREhtsXNffrbyfvWMUSvcXhgs7 X-Received: by 2002:a05:6402:180a:b0:560:cf3:d314 with SMTP id g10-20020a056402180a00b005600cf3d314mr1583973edy.31.1706964339815; Sat, 03 Feb 2024 04:45:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706964339; cv=pass; d=google.com; s=arc-20160816; b=QoIAkhwS0VkTG3rmKSs0zrUf4kx//S2UsWLXgirwl/YsndMTcJoHAArxR0d+dE8mSC FIL+rqhyBJ5DqQoNS53cif8/4JVis/kCVDhHzamjOTeRjq6F4noeIkNV5KT30MEPJ1fr 82cZurZ9002tdWIFzV3Ry1W+C8NERIawZ/1PZ4CsQQv1mYTHolBXPuxGXV9LwKl5rp4H Fv6mFTLr6VVwIg51TLSLdEpGQlSWC5TCOEvPBzkpAASGLwQ6x3uuIZ1v/S1kHr08QcET xxq0BI4fRP80aJ4ac4BMh8DPteih1LejBNPLePa2YalSYUS4QjD+C5u2Y7uLH1IOkY+B KEpg== 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:dkim-signature; bh=vua9NRGZKcyoxZN/iElarNY/kii55spU+gnMD7Igfyo=; fh=koRI3pk7c/sMSXZYLw9oxG7nyA0nYWsTeGycqFccLhs=; b=IQGElSL8cfDduvEpQtq4ONtYqMFKQXxCFd1VWPV3b26REK4n9ZZgj1r04M84gPZDdK WLvwiiPB6IEXlhCBbH5R3Pou0TXIUr7ZFAh+UK6T6I5ZstsmHCjw57kwB77iBAD/ZFFG eQTedEUN3Pisu+vx9lhNkBG1xknmGTosYl55TEodn82dxilJmUyJ+CaqhXN0vh9KvT/w 8x7sPS6JH4aFVMIuy8Xsq70CtnR+Elcjlzt7x8Xn13dRGQ7eLfsZFvyWjoMwNr1QxlZR gvXugPj2rONC+9IhZJ2XycU8OGo7cnH/Xrn3sS4OBWnKOdQ1wMExoOplisBImZRav7IS ig8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rvV/mmdr"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51085-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCVB6B8VI9sUA+kg/6mXxzrlKo/h5RZYAef+XhbMI76TjMatRy2j3gtsNAJmFoV6gxEhV/5lLehM1vRjPwsBM1GBJxNssdbvH+OrvysBlg== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id t1-20020a05640203c100b0055ff9c2cecesi1417548edw.369.2024.02.03.04.45.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 04:45:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51085-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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="rvV/mmdr"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51085-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51085-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 67F6D1F266C9 for ; Sat, 3 Feb 2024 12:45:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E956D5DF0E; Sat, 3 Feb 2024 12:42:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rvV/mmdr" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A2C215EE8D; Sat, 3 Feb 2024 12:42:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706964170; cv=none; b=O1qoS/21flLYU+tWkGcz7MgYS1FcdrT9grLDcoPmZmiTn7eV2xNeQDHWHOIFVU4GoAIgf8W7zGhzGnzQTMkRsPa/O6Q7tKF8WJ8HDVFafScZJpst48yfjzneQmvoiJZzoN5l2x10h1YZxGe3YFZGq6afMEQYzrSx25ip+vdCtv8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706964170; c=relaxed/simple; bh=7oLPSmtkoQ6P6DMyuvMBZlynlRHiIMrkvLypxFHFXsM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g+rkioOzAY6qEW2P4Wc9Rof8HuXb4HaxcuEy3+rytH5YlDPp/zcwSDbnkwZok7NIHyUVu54sWw8k+Osc0rmxNbFOrKIhzS/hU5YmcZQOTv7ryB25B3iJUWWZPIEmlvWezffIIm6ktDZNW3m3HBWaCTpHN46LEMfmENCQpMEhyFw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rvV/mmdr; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C621EC433C7; Sat, 3 Feb 2024 12:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706964170; bh=7oLPSmtkoQ6P6DMyuvMBZlynlRHiIMrkvLypxFHFXsM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rvV/mmdrZrc9wOV8dJDmbjI+v5JeeO6rBVdVXumirmroXv4hKTscBEPvL7HchSltX lp4p0GqV1bh4NH7Rp6bK6CsJXHhpgjswWSpNTPolIQfsGZGp+B4pju3lvUpIN2VKmp drXF3ruTK6Q0jGJBWOy1cZ8D2GwSEjT+AwV2DhSez0D648OghGfBlLwdB4ix2R8sux ja9WIpoVkagl0k9CZHSBnih6MGkoDOjuJ7qgghImGYmihJci6ZEhYN9P6/9z65IYkO mEpmX7z2yDcrRloKEx0qq9BKoM+9mOe59P1u8aUt3+Hi052k18LE+m6UJ8wO9I4o/m nBn8KYblt7tuA== Date: Sat, 3 Feb 2024 20:29:46 +0800 From: Jisheng Zhang To: Andre Przywara Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Icenowy Zheng , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] arm64: dts: allwinner: h616: Add Sipeed Longan SoM 3H and Pi 3H board support Message-ID: References: <20231228145647.1470-1-jszhang@kernel.org> <20231228145647.1470-3-jszhang@kernel.org> <20231229235543.7548cafa@minigeek.lan> 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=utf-8 Content-Disposition: inline In-Reply-To: <20231229235543.7548cafa@minigeek.lan> On Fri, Dec 29, 2023 at 11:55:43PM +0000, Andre Przywara wrote: > On Thu, 28 Dec 2023 22:56:47 +0800 > Jisheng Zhang wrote: > > Hi, > > > The Sipeed Longan SoM 3H is a system on module based on the Allwinner > > H618 SoC. The SoM features: > > > > - Four ARM Cortex-A53 cores, Mali-G31 MP2 GPU > > - 2/4 GiB LPDDR4 DRAM SoMs > > - AXP313a PMIC > > - eMMC > > > > The Sipeed Longan PI 3H is a development board based on the above SoM. > > The board features: > > - Longan SoM 3H > > - Raspberry-Pi-1 compatible GPIO header > > - 2 USB 2.0 host port > > - 1 USB 2.0 type C port (power supply + OTG) > > - MicroSD slot > > - 1Gbps Ethernet port (via RTL8211 PHY) > > - HDMI port > > - WiFi/BT chip > > > > Add the devicetree file describing the currently supported features, > > namely PMIC, LEDs, UART, SD card, eMMC, USB and Ethernet. > > > > Signed-off-by: Jisheng Zhang > > --- > > arch/arm64/boot/dts/allwinner/Makefile | 1 + > > .../sun50i-h618-longan-module-3h.dtsi | 82 +++++++++++ > > .../dts/allwinner/sun50i-h618-longanpi-3h.dts | 133 ++++++++++++++++++ > > 3 files changed, 216 insertions(+) > > create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-longan-module-3h.dtsi > > create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h618-longanpi-3h.dts > > > > diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile > > index 3aca6787a167..00db504a9b8c 100644 > > --- a/arch/arm64/boot/dts/allwinner/Makefile > > +++ b/arch/arm64/boot/dts/allwinner/Makefile > > @@ -42,4 +42,5 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-bigtreetech-cb1-manta.dtb > > dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-bigtreetech-pi.dtb > > dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-orangepi-zero2.dtb > > dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h616-x96-mate.dtb > > +dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-longanpi-3h.dtb > > dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h618-orangepi-zero3.dtb > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h618-longan-module-3h.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h618-longan-module-3h.dtsi > > new file mode 100644 > > index 000000000000..88a7d287b73c > > --- /dev/null > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h618-longan-module-3h.dtsi > > @@ -0,0 +1,82 @@ > > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) > > +/* > > + * Copyright (C) Jisheng Zhang > > + */ > > + > > +/dts-v1/; > > I don't see how the SoM could be used on its own, without a hosting > board. So we don't need the dts version tag in the .dtsi, that would > just be double when we are going to compile any actual .dtb. > > > + > > +#include "sun50i-h616.dtsi" > > + > > +/ { > > + model = "Sipeed Longan Module 3H"; > > + compatible = "sipeed,longan-module-3h", "allwinner,sun50i-h618"; > > Same here, any model or compatible string would only be overwritten by > the board versions, so you don't need those two in the SoM .dtsi. > Compare the SoPine and BTT CB1 .dtsi files. > > > +}; > > + > > +&mmc2 { > > + pinctrl-names = "default"; > > + pinctrl-0 = <&mmc2_pins>; > > Can you please add the DS pin here? At the moment the sunxi Linux > driver doesn't support HS-400, but that can a) change and b) doesn't > affect the DT anyway, since that describes the hardware. The connection > is definitely there, according to the schematics. Hi Andre, Thank you so much for the review and comments, could you please review? Except DS pin, other comments are adopted and updated in v2. DS pin is already there, IIUC, PC0 is emmc DS pin Thanks > > > + vmmc-supply = <®_dldo1>; > > + vqmmc-supply = <®_aldo1>; > > + bus-width = <8>; > > + non-removable; > > + cap-mmc-hw-reset; > > + mmc-ddr-1_8v; > > + mmc-hs200-1_8v; > > + status = "okay"; > > +}; > > + > > +&r_i2c { > > + status = "okay"; > > + > > + axp313: pmic@36 { > > + compatible = "x-powers,axp313a"; > > According to the bindings you need: > > interrupt-controller; > #interrupt-cells = <1>; > > Even without the IRQ line connected. dt-validate complains about that. > > Actually, do you know of any reason why it is not connected? I see it on > the SoM pins, is the idea that any *board* could dedicate a GPIO pin for > it, if needed? > > > + reg = <0x36>; > > + > > + regulators { > > + /* Supplies VCC-PLL, so needs to be always on. */ > > + reg_aldo1: aldo1 { > > + regulator-always-on; > > + regulator-min-microvolt = <1800000>; > > + regulator-max-microvolt = <1800000>; > > + regulator-name = "vcc1v8"; > > Can you please use "vcc-1v8-pll" instead? Then you don't need the > comment. > > > + }; > > + > > + /* Supplies VCC-IO, so needs to be always on. */ > > + reg_dldo1: dldo1 { > > + regulator-always-on; > > + regulator-min-microvolt = <3300000>; > > + regulator-max-microvolt = <3300000>; > > + regulator-name = "vcc3v3"; > > Same here, "vcc-3v3-io" is the name we used lately, to avoid the > comment. > > > + }; > > + > > + reg_dcdc1: dcdc1 { > > + regulator-always-on; > > + regulator-min-microvolt = <810000>; > > + regulator-max-microvolt = <990000>; > > + regulator-name = "vdd-gpu-sys"; > > + }; > > + > > + reg_dcdc2: dcdc2 { > > + regulator-always-on; > > + regulator-min-microvolt = <810000>; > > + regulator-max-microvolt = <1100000>; > > + regulator-name = "vdd-cpu"; > > + }; > > + > > + reg_dcdc3: dcdc3 { > > + regulator-always-on; > > + regulator-min-microvolt = <1100000>; > > + regulator-max-microvolt = <1100000>; > > + regulator-name = "vdd-dram"; > > + }; > > + }; > > + }; > > +}; > > + > > +&pio { > > + vcc-pc-supply = <®_dldo1>; > > + vcc-pf-supply = <®_dldo1>; > > + vcc-pg-supply = <®_aldo1>; > > + vcc-ph-supply = <®_dldo1>; > > + vcc-pi-supply = <®_dldo1>; > > +}; > > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h618-longanpi-3h.dts b/arch/arm64/boot/dts/allwinner/sun50i-h618-longanpi-3h.dts > > new file mode 100644 > > index 000000000000..245583881549 > > --- /dev/null > > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h618-longanpi-3h.dts > > @@ -0,0 +1,133 @@ > > +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) > > +/* > > + * Copyright (C) Jisheng Zhang > > + */ > > + > > +/dts-v1/; > > + > > +#include "sun50i-h618-longan-module-3h.dtsi" > > + > > +#include > > +#include > > +#include > > + > > +/ { > > + model = "Sipeed Longan Pi 3H"; > > + compatible = "sipeed,longan-pi-3h", "sipeed,longan-module-3h", "allwinner,sun50i-h618"; > > + > > + aliases { > > + ethernet0 = &emac0; > > + serial0 = &uart0; > > + }; > > + > > + chosen { > > + stdout-path = "serial0:115200n8"; > > + }; > > + > > + leds { > > + compatible = "gpio-leds"; > > + > > + led-0 { > > + color = ; > > + function = LED_FUNCTION_INDICATOR; > > + function-enumerator = <0>; > > + gpios = <&pio 6 2 GPIO_ACTIVE_LOW>; /* PG2 */ > > + }; > > + > > + led-1 { > > + color = ; > > + function = LED_FUNCTION_INDICATOR; > > + function-enumerator = <1>; > > + gpios = <&pio 6 4 GPIO_ACTIVE_LOW>; /* PG4 */ > > + }; > > + }; > > + > > + reg_vcc5v: vcc5v { > > + /* board wide 5V supply directly from the USB-C socket */ > > + compatible = "regulator-fixed"; > > + regulator-name = "vcc-5v"; > > + regulator-min-microvolt = <5000000>; > > + regulator-max-microvolt = <5000000>; > > + regulator-always-on; > > + }; > > According to the schematic, there is a discrete 5V->3.3V regulator, can > you please describe this here as well? > > > +}; > > + > > +&axp313 { > > + vin1-supply = <®_vcc5v>; > > + vin2-supply = <®_vcc5v>; > > + vin3-supply = <®_vcc5v>; > > +}; > > + > > +&ehci1 { > > + status = "okay"; > > +}; > > + > > +&ohci1 { > > + status = "okay"; > > +}; > > + > > +&ehci2 { > > + status = "okay"; > > +}; > > + > > +&ohci2 { > > + status = "okay"; > > +}; > > + > > Maybe worth adding a comment here that there is a USB WiFi chip > connected to those pins. > > > +&ehci3 { > > + status = "okay"; > > +}; > > + > > +&ohci3 { > > + status = "okay"; > > +}; > > + > > +&emac0 { > > + pinctrl-names = "default"; > > + pinctrl-0 = <&ext_rgmii_pins>; > > + phy-mode = "rgmii"; > > + phy-handle = <&ext_rgmii_phy>; > > + allwinner,rx-delay-ps = <3100>; > > + allwinner,tx-delay-ps = <700>; > > + phy-supply = <®_dldo1>; > > If I get the schematic correctly, the PHY is powered from the discrete > 3.3V regulator? In fact, the 3V3-DLDO-OUT/1V8-ALDO-OUT pins on the SoM > do not seem to be connected, so anything using 3.3V or 1.8V on the > board needs to be fed from this regulator, and everything on the SoM is > supplied by the AXP? > > > + status = "okay"; > > +}; > > + > > +&mdio0 { > > + ext_rgmii_phy: ethernet-phy@1 { > > + compatible = "ethernet-phy-ieee802.3-c22"; > > + reg = <1>; > > + }; > > +}; > > + > > +&mmc0 { > > + bus-width = <4>; > > + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */ > > + vmmc-supply = <®_dldo1>; > > According to the schematic, the SD card is supplied by the discrete > 3.3V regulator on the board. > > > + status = "okay"; > > +}; > > + > > +&uart0 { > > + status = "okay"; > > +}; > > + > > +&usbotg { > > + /* > > + * PHY0 pins are connected to a USB-C socket, but a role switch > > + * is not implemented: both CC pins are pulled to GND. > > + * The VBUS pins power the device, so a fixed peripheral mode > > + * is the best choice. > > + * The board can be powered via GPIOs, in this case port0 *can* > > + * act as a host (with a cable/adapter ignoring CC), as VBUS is > > + * then provided by the GPIOs. Any user of this setup would > > + * need to adjust the DT accordingly: dr_mode set to "host", > > + * enabling OHCI0 and EHCI0. > > + */ > > + dr_mode = "peripheral"; > > + status = "okay"; > > +}; > > + > > +&usbphy { > > + usb1_vbus-supply = <®_vcc5v>; > > The same seems to be true for USB2 as well, and the WiFi chip on USB3 is > powered by the discrete 3.3V regulator. But I think we don't need these > properties at all if it's directly connected to the input and so always > powered. Or maybe we should do this anyway, and be it to make it clear > where the bus power is coming from? > > Cheers, > Andre > > P.S. I saw some U-Boot patches on some github. Most of them are > merged, but feel free to post the DT (same ones as here) and the > defconfig to the U-Boot list as well. You can use "make savedefconfig" > when you have configured the board, this will create a file "defconfig" > in the build directory that contains the minimal items, this can be > directly used as a defconfig. > > > + status = "okay"; > > +}; >