From patchwork Sun Nov 21 19:53:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12693247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7A819C433EF for ; Sun, 21 Nov 2021 19:55:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ViDIZhCSRGidaHep/8pwVWu3bKItP2lOLr90ii6rplg=; b=Q4+9bEZqdKoew6 ++CzcxbnOwUEUXgn5+W396E8yyjiKnRIAvoYcCWjBK6zxHcxsheEGmAdPGscER/TUVdC5CoQLxMas srLS0i2CAdoSQChBpu4gUw4s+owkUE/aWMa+QyPT/EEBV0gAKRyJPuttqobHvNyKSn5F1ct5dVjDs /CepViSWl+WKMuj53QbVeCV/5VXZk5PJV02cyw9z9G9hte/kxOAqA1taHn1c6I1E/dZ/lKnd6my3E xad8OTc6WJNtbh7+2UwvcgwWqF/xwken9SU+6nd6r52qN35BAUkeFSXHKvjkqMhy9BIe9owVroGjc nUPrqIrGVt4pDq0ZKt7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mosuv-00EGN7-Lk; Sun, 21 Nov 2021 19:54:25 +0000 Received: from mail-lf1-x133.google.com ([2a00:1450:4864:20::133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mosub-00EGJT-Qt for linux-arm-kernel@lists.infradead.org; Sun, 21 Nov 2021 19:54:07 +0000 Received: by mail-lf1-x133.google.com with SMTP id k37so70769711lfv.3 for ; Sun, 21 Nov 2021 11:54:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nQP1NjnROxOP2uUy2qYpkLLRNOS1H+2WMTMotJrpSCw=; b=6nmLl4db9aEDbKdFkJJ6+dSghC5PwZb/o9t6251/zT4OmGX2ZRX8H6Ay75EzOFwV6Y bap2Egm54SWuhvp6vktnaYBnX7sWg2ZHiL4Ju4K5pRB03MBIsJWF4E8UJtBayl8Ns+IT JZqyrCETcPkY0dTbLMPXNBTGq+lWC06lJHoHRlIqrfSeTRe9EzrDE0Fmr9qlsiB3jaJA yLY/I5aOtASEYnmeNw82D23k4e7PPTEKRKvp7IC4GN2iJGBGrV/r9ThZ853aoToyi/ge hPgTOJQHqyOGh6o3GHBZysie8Um4XEpegugHCo72iu2e9RvfCmQK0vgyuv2B9JNtqOIt 56dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nQP1NjnROxOP2uUy2qYpkLLRNOS1H+2WMTMotJrpSCw=; b=F2/3BGBBWogK0vIAOAKnGQEjw05m1uYwoR88QkQav9T8VSmJkMl3pY4ihRqFseBNEd esB0GSMhUrX8WS2WjY4c0MDY0NKDgDedSfQtNW34MzbyA4IChVqFbMUo63j0R/Mi6NJr PsQrcO4AxbvLqdrFiLYd98j/rNtAcH6uTLAcAqV7Gmy6fdwXHX8/yFYNu4Vn7vf+OQP+ k+Rsod6+FJxGemU5NhwdOYfjiA6IIo2bQidLIjFXCpJqws1ftPBgTTWNAoauNi9ajnGj Lh63lSPtZx0C0Mm+MYQxpv40abFnoDSX76FDrOzQIMh0gJRRbcaC/mUSu+JhQHMchLLY tdiA== X-Gm-Message-State: AOAM530wLl46wPxK+WJzPgZX/Sq+uR2aIKiOe2+1Mp/I4hfaOPjH3DQh brEB3vTGLdtcJkbm2wg5NRam+A== X-Google-Smtp-Source: ABdhPJxifYrrCmCT6QRgl2SG0RtsCFdGwUTA6xje0y+r42KUO/VE9Rp5aGnPezZjfiSYKUblUCXLew== X-Received: by 2002:a2e:86da:: with SMTP id n26mr46096926ljj.522.1637524439998; Sun, 21 Nov 2021 11:53:59 -0800 (PST) Received: from boger-laptop.lan (81.5.99.121.dhcp.mipt-telecom.ru. [81.5.99.121]) by smtp.gmail.com with ESMTPSA id a24sm768987ljq.18.2021.11.21.11.53.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 11:53:59 -0800 (PST) From: Evgeny Boger To: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Cc: Evgeny Boger , devicetree@vger.kernel.org, Rob Herring , linux-sunxi@lists.linux.dev Subject: [PATCH v3 1/3] net: allwinner: reset control support Date: Sun, 21 Nov 2021 22:53:35 +0300 Message-Id: <20211121195337.230475-2-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211121195337.230475-1-boger@wirenboard.com> References: <20211121195337.230475-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211121_115405_899199_52622DAC X-CRM114-Status: GOOD ( 17.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org R40 (aka V40/A40i/T3) and A10/A20 share the same EMAC IP. However, on R40 the EMAC is gated by default. Signed-off-by: Evgeny Boger --- drivers/net/ethernet/allwinner/sun4i-emac.c | 64 +++++++++++++++++++-- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c index 800ee022388f..16039784f2c6 100644 --- a/drivers/net/ethernet/allwinner/sun4i-emac.c +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "sun4i-emac.h" @@ -68,6 +69,15 @@ MODULE_PARM_DESC(watchdog, "transmit timeout in milliseconds"); * devices, EMACA and EMACB. */ +/** + * struct emac_quirks - Differences between SoC variants. + * + * @has_reset: SoC needs reset deasserted. + */ +struct emac_quirks { + bool has_reset; +}; + struct emac_board_info { struct clk *clk; struct device *dev; @@ -85,6 +95,7 @@ struct emac_board_info { unsigned int link; unsigned int speed; unsigned int duplex; + struct reset_control *reset; phy_interface_t phy_interface; }; @@ -790,6 +801,7 @@ static int emac_probe(struct platform_device *pdev) struct emac_board_info *db; struct net_device *ndev; int ret = 0; + const struct emac_quirks *quirks; ndev = alloc_etherdev(sizeof(struct emac_board_info)); if (!ndev) { @@ -808,6 +820,13 @@ static int emac_probe(struct platform_device *pdev) spin_lock_init(&db->lock); + quirks = of_device_get_match_data(&pdev->dev); + if (!quirks) { + dev_err(&pdev->dev, "Failed to determine the quirks to use\n"); + ret = -ENODEV; + goto out; + } + db->membase = of_iomap(np, 0); if (!db->membase) { dev_err(&pdev->dev, "failed to remap registers\n"); @@ -824,16 +843,31 @@ static int emac_probe(struct platform_device *pdev) goto out_iounmap; } + if (quirks->has_reset) { + db->reset = devm_reset_control_get_exclusive(&pdev->dev, NULL); + if (IS_ERR(db->reset)) { + dev_err(&pdev->dev, "unable to request reset\n"); + ret = PTR_ERR(db->reset); + goto out_dispose_mapping; + } + + ret = reset_control_deassert(db->reset); + if (ret) { + dev_err(&pdev->dev, "could not deassert EMAC reset\n"); + goto out_dispose_mapping; + } + } + db->clk = devm_clk_get(&pdev->dev, NULL); if (IS_ERR(db->clk)) { ret = PTR_ERR(db->clk); - goto out_dispose_mapping; + goto out_assert_reset; } ret = clk_prepare_enable(db->clk); if (ret) { dev_err(&pdev->dev, "Error couldn't enable clock (%d)\n", ret); - goto out_dispose_mapping; + goto out_assert_reset; } ret = sunxi_sram_claim(&pdev->dev); @@ -889,6 +923,8 @@ static int emac_probe(struct platform_device *pdev) sunxi_sram_release(&pdev->dev); out_clk_disable_unprepare: clk_disable_unprepare(db->clk); +out_assert_reset: + reset_control_assert(db->reset); out_dispose_mapping: irq_dispose_mapping(ndev->irq); out_iounmap: @@ -909,6 +945,7 @@ static int emac_remove(struct platform_device *pdev) unregister_netdev(ndev); sunxi_sram_release(&pdev->dev); clk_disable_unprepare(db->clk); + reset_control_assert(db->reset); irq_dispose_mapping(ndev->irq); iounmap(db->membase); free_netdev(ndev); @@ -940,11 +977,28 @@ static int emac_resume(struct platform_device *dev) return 0; } -static const struct of_device_id emac_of_match[] = { - {.compatible = "allwinner,sun4i-a10-emac",}, +static const struct emac_quirks sun4i_a10_emac_quirks = { + .has_reset = false, +}; + +static const struct emac_quirks sun4i_r40_emac_quirks = { + .has_reset = true, +}; +static const struct of_device_id emac_of_match[] = { + { + .compatible = "allwinner,sun4i-a10-emac", + .data = &sun4i_a10_emac_quirks + }, + { + .compatible = "allwinner,sun4i-r40-emac", + .data = &sun4i_r40_emac_quirks + }, /* Deprecated */ - {.compatible = "allwinner,sun4i-emac",}, + { + .compatible = "allwinner,sun4i-emac", + .data = &sun4i_a10_emac_quirks + }, {}, }; From patchwork Sun Nov 21 19:53:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12693248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3552CC433FE for ; Sun, 21 Nov 2021 19:56:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/NVFiiKw3i7uT5TVDejpdoawQAQFWxu8iaqk8b2iecs=; b=Rz5pJw+/zFAcZ+ 5QMfq7xIRiOzlTST7RFE3urzQNMJuWLqh6tLaML0zrKt2cA7I/mGtH5RUcFr0YPY9yDfziyCwf4Wy /ae6mSWXhChm3J4zD0oMS6IT2BOIscS/qdKhUerJdz6g2Ro5NxhLXYizB4XnRSKt0UCjkK7lUVhVx OmhGDHfVQGt3LYO0WytmUu2PCSZ+MxSdXRIF5GdbyhMeJJt74QH4lssmYjsE4mJcYUYgpMiBC4pXZ TEYX7cVveV0HYbg2uBbeIAljJRHa0WiHFjxxa8HCjHo+dxJT835bssrdzh7T404SGrfS1O0ETPt+T m5oZrLfoNw1AUbwqPGwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mosv7-00EGOY-H6; Sun, 21 Nov 2021 19:54:37 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mosuc-00EGJn-1n for linux-arm-kernel@lists.infradead.org; Sun, 21 Nov 2021 19:54:08 +0000 Received: by mail-lf1-x129.google.com with SMTP id b1so70229744lfs.13 for ; Sun, 21 Nov 2021 11:54:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=alj45tjzXeDfJ+7cslBZpCEeF9lcTvjC9KNxaxcnO9E=; b=1qZOxMA0fSJ7ozLQEbF8wX2dMGDkXUKzVIRteiG/npVKNS4C8tfWPDWEGmcHfx8gXz 8enTc2tv8DeYMmBU03pg0FjlL7hbmxhpU4COs7EM5dNP8AL5xPfCRgt/Qq1XxgBFwnop c0niKq5r7lMiv43OriZkDmvYzwp4ozLE4gVC8dFXWJUmjjguxnVEOygKo6x+XdwY/VzE PhjuOwm3teHdkt6yrJs4fOIiFIwe1lnyzgcF7Vrii8R3cFRnOp24hPE35Xca4Olsg5UV yyeoKHjP9InhFpBQfIOH3DJXnD/iKi3h9NhZfABMNybxZW4mxGmwmrdEDKAZTZv/oIk0 fsUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=alj45tjzXeDfJ+7cslBZpCEeF9lcTvjC9KNxaxcnO9E=; b=NjDcQ7Lae9659LTo7kDHx+qSUOYFloy/1tWy+RJxPXclLu+TsUhOok0htFEwmEdlZG Jl9noImMRPX4FbabpXL9xiX1drRuMHPDL5HSTmgAiLck29gZJyOoW5GkGNZgIj3TaiIe C8Ae6YxJRjYKvUYzAg02ohLAQG0Qk0rtShfCbVRuq5vSHEWzSMoF6ziS8TIsnVi6v68S xQHb0cF5J+byOb+Jw5jgPugH5HYxLLMr9tFZ4NOW4V9j6zmmtuABAj5RBlHsJhE/lpG/ Vd/8CGhthJ4EGVpokdVDlcKey/tNrD8PjxTq+7wfeTNr4m/a2GJu5fK/Q6sY5VFNfxVk naLA== X-Gm-Message-State: AOAM5339eQwm39xH1MmC9YgV6yoD3bRENKvc2NBzmtzUoU5dHXFRFWhx xZo4NBOVwH0uWkLy8ioRuAnkAQ== X-Google-Smtp-Source: ABdhPJyErcj/LDk+DJUfMBNW1gxvSi2lolzFq6sZthh1OnsHxTynUFegI7y5Nw5wlm11RsMwq3vr1A== X-Received: by 2002:a05:6512:16a8:: with SMTP id bu40mr23795710lfb.483.1637524441671; Sun, 21 Nov 2021 11:54:01 -0800 (PST) Received: from boger-laptop.lan (81.5.99.121.dhcp.mipt-telecom.ru. [81.5.99.121]) by smtp.gmail.com with ESMTPSA id a24sm768987ljq.18.2021.11.21.11.54.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 11:54:01 -0800 (PST) From: Evgeny Boger To: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Cc: Evgeny Boger , devicetree@vger.kernel.org, Rob Herring , linux-sunxi@lists.linux.dev Subject: [PATCH v3 2/3] dt-bindings: net: support for Allwinner R40 EMAC controller Date: Sun, 21 Nov 2021 22:53:36 +0300 Message-Id: <20211121195337.230475-3-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211121195337.230475-1-boger@wirenboard.com> References: <20211121195337.230475-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211121_115406_136904_4FB87C96 X-CRM114-Status: GOOD ( 10.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org R40 and A10/A20 share the same EMAC IP. However, on R40 the EMAC is gated by default, so reset property is required. Signed-off-by: Evgeny Boger Reviewed-by: Rob Herring --- .../net/allwinner,sun4i-a10-emac.yaml | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/net/allwinner,sun4i-a10-emac.yaml b/Documentation/devicetree/bindings/net/allwinner,sun4i-a10-emac.yaml index 8d8560a67abf..cbb297c38daa 100644 --- a/Documentation/devicetree/bindings/net/allwinner,sun4i-a10-emac.yaml +++ b/Documentation/devicetree/bindings/net/allwinner,sun4i-a10-emac.yaml @@ -15,7 +15,9 @@ maintainers: properties: compatible: - const: allwinner,sun4i-a10-emac + enum: + - allwinner,sun4i-a10-emac + - allwinner,sun4i-r40-emac reg: maxItems: 1 @@ -30,6 +32,19 @@ properties: description: Phandle to the device SRAM $ref: /schemas/types.yaml#/definitions/phandle-array + resets: + maxItems: 1 + +if: + properties: + compatible: + contains: + const: allwinner,sun4i-r40-emac + +then: + required: + - resets + required: - compatible - reg @@ -42,11 +57,14 @@ unevaluatedProperties: false examples: - | + #define RST_BUS_EMAC 14 + emac: ethernet@1c0b000 { compatible = "allwinner,sun4i-a10-emac"; reg = <0x01c0b000 0x1000>; interrupts = <55>; clocks = <&ahb_gates 17>; + resets = <&ccu RST_BUS_EMAC>; phy-handle = <&phy0>; allwinner,sram = <&emac_sram 1>; }; From patchwork Sun Nov 21 19:53:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12693246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D491C433F5 for ; Sun, 21 Nov 2021 19:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=S7H+BFLJk6wqwGBctWxiPOC0tP584HMYVd0HWm6ljEk=; b=Y+zTulYJZtWwnz PafxguySWjj2rl/IILTb/eUDKubEt5hWJoxn+ZbaulbODmGghF7MD8klalNmceWyswjBuDP+oPz5Y sqhIzCQLUsbHtalOGpsT4OhAAuyhCRnULe44uGlWNCqOr8illuHD06rEUM+tpo4tM0kMt4XtiDk6M 6ZWdaXkSxakaA6jx9TeVnvoQKxE9fjKApRKomUZgnSCmrBSr9x8H6mEfen4/dBhlDZMZWygyCmWM4 lwsmNZpT2m1UD8CriYaaXXP48J3kT/pEG0gsZ0THea/Ke/C3OltAngI8zXf08P4FkU6GxWKTCveAZ D+c/Y226A0PoRrRLgpzQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mosul-00EGLj-Em; Sun, 21 Nov 2021 19:54:15 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mosub-00EGK2-NT for linux-arm-kernel@lists.infradead.org; Sun, 21 Nov 2021 19:54:07 +0000 Received: by mail-lf1-x12f.google.com with SMTP id n12so70724231lfe.1 for ; Sun, 21 Nov 2021 11:54:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wirenboard-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gkETZgyxLCY3o9a3tZ61sgO6O+YAt+suAi+pGxqWqDY=; b=BNZUjnnWTCnm7u8qVG8rdE9BXMaJkjKRsu/8h1GipaXuzMyM+toqh9JM0mZoqHWQBo H4jLvJxOmViIK/bqBnWgu0yh+OqFQfWE/OKviXxf3sM8Rk+N2JH3Hnrcn3mqQem5nkGn 9xm9kGvi1AD5c8Ja1x808ULKAo6LRMsERl2VosX/4GM/rw4ijMyaeoBLK0mQ0zoHfM16 riqW3COY1nT3tG9x46cau0DOzeoo45eFmi23OaSW4bAUmaaT/4ExlBGhfk60xQP4niSS gL/PAh0V1Ond6fadi7IQtX+Rmm1/N+TTQptMgvn36D64O+mu3jWQQ4Ju/BZgXxZMHI59 vjmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gkETZgyxLCY3o9a3tZ61sgO6O+YAt+suAi+pGxqWqDY=; b=KA+ysfRFP9ThmJlO4JhX5DZLC90pxy8H0CUBbq9QRyf1saKH1NEsSYwqHV7SeYCp/e rrZeC/uDvTcBq5qJtVUi2bGmw8O6uo4Yf53WqrAgmi5ZVZvVH4Efi86G8lLtHM37NMW6 4Ym1BWxUlubc4k0MwkUut/D+27LcTBNxewJkRaNlAcIq4KUXmTcTesG61nPsK2HLItIH WSHDvQEkuXWitDxHiMAfo++qkldOelZK4aTu0OjG5AtQeCJQ3Yu1lOJwAL6FMhEkvWzJ cOd53C8ZAabjJg/vszsZ6rndziMMMtM+WalHqyu3qOpwYb9h8a08zd9sM5r8AJSkqUpc Xtyw== X-Gm-Message-State: AOAM530jMN20I4v0LErUhMLyTuLS6rsNBxdqBTUxiWJk0JnIyGfhNQc8 WSFfb5U4AMTD8kwbDlyu6ze6xg== X-Google-Smtp-Source: ABdhPJzQCCzuisHdFb2CLsfbM7uHhh84OKJ7As3BTkdw/n6nTZGoeg07+LPbdUJFkpE+GRJ7m1USJQ== X-Received: by 2002:a05:6512:12c4:: with SMTP id p4mr50559707lfg.274.1637524443033; Sun, 21 Nov 2021 11:54:03 -0800 (PST) Received: from boger-laptop.lan (81.5.99.121.dhcp.mipt-telecom.ru. [81.5.99.121]) by smtp.gmail.com with ESMTPSA id a24sm768987ljq.18.2021.11.21.11.54.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 11:54:02 -0800 (PST) From: Evgeny Boger To: Maxime Ripard , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Cc: Evgeny Boger , devicetree@vger.kernel.org, Rob Herring , linux-sunxi@lists.linux.dev Subject: [PATCH v3 3/3] dts: r40: add second ethernet support Date: Sun, 21 Nov 2021 22:53:37 +0300 Message-Id: <20211121195337.230475-4-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211121195337.230475-1-boger@wirenboard.com> References: <20211121195337.230475-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211121_115405_795641_65CEE480 X-CRM114-Status: GOOD ( 12.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org R40 (aka V40, A40i, T3) has two different Ethernet IP called EMAC and GMAC. EMAC only support 10/100 Mbit in MII mode, while GMAC support both 10/100 (MII) and 10/100/1000 (RGMII). In contrast to A10/A20 where GMAC and EMAC share the same pins making EMAC somewhat pointless, on R40 EMAC can be routed to port H. Both EMAC (on port H) and GMAC (on port A) can be then enabled at the same time, allowing for two ethernet ports. Signed-off-by: Evgeny Boger --- arch/arm/boot/dts/sun8i-r40.dtsi | 50 ++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index 1d87fc0c24ee..19ea33421c63 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -217,6 +217,20 @@ syscon: system-control@1c00000 { #size-cells = <1>; ranges; + sram_a: sram@0 { + compatible = "mmio-sram"; + reg = <0x00000000 0xc000>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0 0x00000000 0xc000>; + + emac_sram: sram-section@8000 { + compatible = "allwinner,sun4i-a10-sram-a3-a4"; + reg = <0x8000 0x4000>; + status = "okay"; + }; + }; + sram_c: sram@1d00000 { compatible = "mmio-sram"; reg = <0x01d00000 0xd0000>; @@ -543,6 +557,24 @@ gmac_rgmii_pins: gmac-rgmii-pins { drive-strength = <40>; }; + emac_pa_pins: emac-pa-pins { + pins = "PA0", "PA1", "PA2", + "PA3", "PA4", "PA5", "PA6", + "PA7", "PA8", "PA9", "PA10", + "PA11", "PA12", "PA13", "PA14", + "PA15", "PA16"; + function = "emac"; + }; + + emac_ph_pins: emac-ph-pins { + pins = "PH8", "PH9", "PH10", "PH11", + "PH14", "PH15", "PH16", "PH17", + "PH18","PH19", "PH20", "PH21", + "PH22", "PH23", "PH24", "PH25", + "PH26", "PH27"; + function = "emac"; + }; + i2c0_pins: i2c0-pins { pins = "PB0", "PB1"; function = "i2c0"; @@ -980,6 +1012,24 @@ gmac_mdio: mdio { }; }; + emac: ethernet@1c0b000 { + compatible = "allwinner,sun4i-r40-emac"; + reg = <0x01c0b000 0x1000>; + interrupts = ; + clocks = <&ccu CLK_BUS_EMAC>; + resets = <&ccu RST_BUS_EMAC>; + allwinner,sram = <&emac_sram 1>; + status = "disabled"; + }; + + emac_mdio: mdio@1c0b080 { + compatible = "allwinner,sun4i-a10-mdio"; + reg = <0x01c0b080 0x14>; + status = "disabled"; + #address-cells = <1>; + #size-cells = <0>; + }; + mbus: dram-controller@1c62000 { compatible = "allwinner,sun8i-r40-mbus"; reg = <0x01c62000 0x1000>;