Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp4275305ybh; Tue, 6 Aug 2019 09:00:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzVXZD4DkLDQQqhfFnlPWITNmOhpD8SKpqRaESKwBbXHt0s3JSIX0VwFsr6Hyx5DMAyAbk3 X-Received: by 2002:a62:5253:: with SMTP id g80mr4357060pfb.179.1565107233744; Tue, 06 Aug 2019 09:00:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565107233; cv=none; d=google.com; s=arc-20160816; b=gfi9J6SwNRzemrxHL2WQwOke5ZNIlVaCepNOXp8ieLLT0cnpVFffKainT5t9qdEtJh duUDfGk0l8YNEhabJDrKLkxOk8H/cV0TQ+YvS8COWdnm+GzNW7roqwWTei/wdzmf2jKs ltp4Xxsuv+pqpCgg34bJcjm2wf4En+KLTNDdGJiDSea+T6+cUDhEdxgntIkjitcNn8Je v9aWCXA9u0ptTRydrK8hlqR0pDkfJAlu0iS7qI0fI72j8KeVXPLKJZfS+V6iC7NF9GR+ IW9LngUwSCyaRoyg3TeICLkLFeH3w8/g/ak4YATxWxRJUbDLnXhJDYeYh3PjF+qtSbBU tA5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=bUglVIA1dgfPLSmEJjb024lT/1JjnDv+RucHIMxgAr0=; b=VVI6BGhzUjAkwCMcpBx3C0AYWRTo0Kld66V9M7Zw3BMXVqbFXq7074LzwQoPpYJpB6 aCRT7A2Mk/taKfZifk5JWO4UZp2cbVKv/dyJCAbCmywSWVrzz1hFFtN2LbndlX7KQnwh ASTv4FVe6Qr53ScS6DpXAU2UauPRPZBztIvojlxLdoumk+X6zCTIW7iDbdeXCiu4vjb3 6X2Ivb8wuuU8EBzP5txV9dzFIr3UW5Qx7y86M5hvDYYvvHp7NGCddXxjhr9h2kDpRj1d f0Ww4z5qdAwv7E8iRo3nlxyfwj/v76Kqc6uwUKgpyBHvjzDL/rsQwfF6Ws1+7C4G4zSJ T28g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=lnXlBBf+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e30si47848647pfm.78.2019.08.06.09.00.18; Tue, 06 Aug 2019 09:00:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=lnXlBBf+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387520AbfHFP5x (ORCPT + 99 others); Tue, 6 Aug 2019 11:57:53 -0400 Received: from vps.xff.cz ([195.181.215.36]:55380 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387490AbfHFP5x (ORCPT ); Tue, 6 Aug 2019 11:57:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1565107071; bh=eZIRAtXh9rUuple04Feis2vfaVq0NzLnMtCBPANF3QE=; h=From:To:Cc:Subject:Date:References:From; b=lnXlBBf+jstPnp1QJOMMwnWUm+zMG/CvoIbPiF0pcKmpju+6fTy+aqPWZsyCfb0Kl 6DYBcxnb7hWnMQ9VzTD5UwWJCdmMB9abijaiWUxEkoB+ErusmwSQQhNoNv4PRlS+Ze 9ehCkcxu/x7HwNQWJbIgwd9yVUY0aLXyDN5JdHcU= From: megous@megous.com To: linux-sunxi@googlegroups.com, Maxime Ripard , Chen-Yu Tsai , Rob Herring , =?UTF-8?q?Jernej=20=C5=A0krabec?= Cc: Ondrej Jirman , David Airlie , Daniel Vetter , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v8 1/4] arm64: dts: allwinner: orange-pi-3: Enable ethernet Date: Tue, 6 Aug 2019 17:57:40 +0200 Message-Id: <20190806155744.10263-2-megous@megous.com> In-Reply-To: <20190806155744.10263-1-megous@megous.com> References: <20190806155744.10263-1-megous@megous.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ondrej Jirman Orange Pi 3 has two regulators that power the Realtek RTL8211E. According to the phy datasheet, both regulators need to be enabled at the same time, but we can only specify a single phy-supply in the DT. This can be achieved by making one regulator depedning on the other via vin-supply. While it's not a technically correct description of the hardware, it achieves the purpose. All values of RX/TX delay were tested exhaustively and a middle one of the working values was chosen. Signed-off-by: Ondrej Jirman --- .../dts/allwinner/sun50i-h6-orangepi-3.dts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts index 17d496990108..2c6807b74ff6 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts @@ -15,6 +15,7 @@ aliases { serial0 = &uart0; + ethernet0 = &emac; }; chosen { @@ -44,6 +45,27 @@ regulator-max-microvolt = <5000000>; regulator-always-on; }; + + /* + * The board uses 2.5V RGMII signalling. Power sequence to enable + * the phy is to enable GMAC-2V5 and GMAC-3V (aldo2) power rails + * at the same time and to wait 100ms. + */ + reg_gmac_2v5: gmac-2v5 { + compatible = "regulator-fixed"; + regulator-name = "gmac-2v5"; + regulator-min-microvolt = <2500000>; + regulator-max-microvolt = <2500000>; + startup-delay-us = <100000>; + enable-active-high; + gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */ + + /* The real parent of gmac-2v5 is reg_vcc5v, but we need to + * enable two regulators to power the phy. This is one way + * to achieve that. + */ + vin-supply = <®_aldo2>; /* GMAC-3V */ + }; }; &cpu0 { @@ -58,6 +80,28 @@ status = "okay"; }; +&emac { + pinctrl-names = "default"; + pinctrl-0 = <&ext_rgmii_pins>; + phy-mode = "rgmii"; + phy-handle = <&ext_rgmii_phy>; + phy-supply = <®_gmac_2v5>; + allwinner,rx-delay-ps = <1500>; + allwinner,tx-delay-ps = <700>; + status = "okay"; +}; + +&mdio { + ext_rgmii_phy: ethernet-phy@1 { + compatible = "ethernet-phy-ieee802.3-c22"; + reg = <1>; + + reset-gpios = <&pio 3 14 GPIO_ACTIVE_LOW>; /* PD14 */ + reset-assert-us = <15000>; + reset-deassert-us = <40000>; + }; +}; + &mmc0 { vmmc-supply = <®_cldo1>; cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ -- 2.22.0