From patchwork Tue Jan 11 16:05:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12709993 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 4BEA8C433EF for ; Tue, 11 Jan 2022 16:07:54 +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=AmgVvtoO5eWJAarr84EEBhCz+JqtyII+vNY7BNXiSk4=; b=IrWrbjyPQ8YImY EABuHdpOILsjQpOay8LhuAT0QvT08Bibnx99C7qBPoJBD0Rpy9QMbG1b7w2+8FVpyDLftwz254b9Q dlDKEinLPJn39ywUO4O0sAl02trxQJBcjaunoq8n8QT67WlhAXf6MX5kAW7AFBUExG5z9NcNx/dFM uM9p8jhr7zux2n5XipcbimY5Ad1Jowpu/vOJTmGo05+X3t6QQQNBVjazHoj9BlltAqx7B7M8YYeir ZCedI/emlGzj6/30f3r0vhYJoDGJZKCMZ9nOwEMXIgTFl3kIDVUk+kOvttpXWNVyEG1QiDE5E4kOP afkJ2K2Tw9FF0iK78z5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7JfH-00Gr7P-Ru; Tue, 11 Jan 2022 16:06:28 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7Jf2-00Gr2X-3t for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 16:06:13 +0000 Received: by mail-lf1-x131.google.com with SMTP id h2so58017190lfv.9 for ; Tue, 11 Jan 2022 08:06:12 -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=V1d1hWvVycjkagHoYZGryo2W04Ierj/dRC0TMT4n6OY=; b=y8rp1KIPOzsnlGCTA0GxIEGQUtw3C0MU6ec2BVfyvtz8PUNPf5J9wUwE8FLMGk4sXx oG0fqVTD6dCRvYbdcOzAqwl3VOYK83IT/+UASzUmfs/cPfNjm2/u0B3DBKd827npRWmz 9Iu5RB+/iL/gJAt/+VX3Szxh21hTIevdOA4oOTwyzEPLZXiRrALax9c6/FZOBSeBxuOn xlvSx2y/VbvpwamZ1s2tyNt0n/tt5nse0lhZZxUKWLUOMEuLb68JalA/dW5TrVeq1cZe 9bpcefN0b3btLsY7G5PQzJALWRghHgxS1YflynDsCJX27FOusnqIELPZHx/GqFcVrqsc LGPA== 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=V1d1hWvVycjkagHoYZGryo2W04Ierj/dRC0TMT4n6OY=; b=ESklqnhz9jutxW4JbqiE2Zv/cZq8r6XHG3odeXNJ2Cc1v1d9Eb5/2qYlqgHFKxUWqL b/oEAz6cLoGwQ+eFss1EQGlwus0NACDMcTHTAsuUotWH5vYHcCiLk6vMjo+okobNB7Eh XRFuia7SA8X0qt4jrXykmA5kNIZMz5WFbWS4ulz9iPHYM/jqAg5glMvETendpKx5q03t yi/1yGlupPK/FJ9iLzN1ytWxzwRBJPbVBTtYOLgucnYxNY8NCD/5c7ktW1zjubN/WD+0 YpcBocsa17t9wcnTO1wkn6ukZV28MRg63scDAolrZHLxLuvww+qGII8W4h8PoT4BUr39 S8Fg== X-Gm-Message-State: AOAM5337RIC3GfaECps09t9nO4gU+z/BDBIrYXChYGwHdO9JHDYr1CdZ GxGyihxSiOI4hj/sKHcuIxoDIg== X-Google-Smtp-Source: ABdhPJzMZl2hD6yFwcvk58x69BcZXAdbh4ZgLJ5ZHt4M39q5O8Y6ZjhYRGJAXB6S+k7Qbz7VSS2vsw== X-Received: by 2002:a05:651c:8a:: with SMTP id 10mr2113109ljq.491.1641917170723; Tue, 11 Jan 2022 08:06:10 -0800 (PST) Received: from boger-laptop.lan (81.5.110.253.dhcp.mipt-telecom.ru. [81.5.110.253]) by smtp.gmail.com with ESMTPSA id k39sm564803lfv.150.2022.01.11.08.06.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 08:06:10 -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 v4 1/3] net: allwinner: reset control support Date: Tue, 11 Jan 2022 19:05:58 +0300 Message-Id: <20220111160600.58384-2-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220111160600.58384-1-boger@wirenboard.com> References: <20220111160600.58384-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_080612_184591_F58D5960 X-CRM114-Status: GOOD ( 17.86 ) 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 reset needs to be deasserted. 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..368597f0ff76 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 sun8i_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,sun8i-r40-emac", + .data = &sun8i_r40_emac_quirks + }, /* Deprecated */ - {.compatible = "allwinner,sun4i-emac",}, + { + .compatible = "allwinner,sun4i-emac", + .data = &sun4i_a10_emac_quirks + }, {}, }; From patchwork Tue Jan 11 16:05:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12709994 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 66F57C433F5 for ; Tue, 11 Jan 2022 16:07: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=qq/OXbr50AxWTOYCyIB5+rW8V3mrSSw6cPseujkibQ8=; b=uxBzeFZ1CcUR15 TCx4cpkl5rLQkgSTYq+8ZSTXJoDGEgq1O4nPuGXy36oc9UscvbED/RQ8H2e64MRgwvI5v1VE5d66j j1FNgED/2Q8lB6V1ApSarDiJgL/diQPtQNij0Oa38aKEajNkg7cI95v9nvo6r4yWPzmirM5PEa3Fj lDISMyrmp2E+vCemq8zRRRX2vip3JPJkA/4T6irPFH7Hgj5baDTlwDO4/eiQLADCTDyK+4FcNdSkB Wm2YPxOkg5tI3QdwEM0HfDO0DfDBL2sGiBTsqOlhw/clw0XSWS+0IOa09fIx2YX9yb+teA4bjOSu4 dKmkuyHj52/SmYjKSuDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7JfU-00GrCQ-B8; Tue, 11 Jan 2022 16:06:40 +0000 Received: from mail-lf1-x136.google.com ([2a00:1450:4864:20::136]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7Jf3-00Gr31-8s for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 16:06:15 +0000 Received: by mail-lf1-x136.google.com with SMTP id u13so57905262lff.12 for ; Tue, 11 Jan 2022 08:06:13 -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=870eFOoZ0Fa1c614sBVDWlzu1xI6Oxw/buGlrAvGuc8=; b=O4dnc68PcYexc81xffY36nJmPSYyhU6oqtmFTBO563Py6RrT/h3Ujk9C9N6g7ljw7S 1G5J/xfd6dlM1LMIHnedEjDz9pkjd4Oyz218Gm2roG5tQRuFw1LGTZMsiR9TsG3IMiny U2RSCD3uBjFH5EXIaBPezgsC5eUHW41yWjuOZfhmPMgAW4T2Cl1wNeJba3YbEdBVfEw0 AMbSYI2X9EiUKJCVOYQkG2TeGeGvFQgbIA09ul9BaBK0bcNIcM3V715qpFUIzFQsn0qf Xh7Gw/ljyWShy+4NRkexB0yKPdutDo9q3VFHmch1BAC+LK5QDiSau7HZVPFEvtxuBSNG 0w/A== 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=870eFOoZ0Fa1c614sBVDWlzu1xI6Oxw/buGlrAvGuc8=; b=ZPmQsVdLxJAEtE/qc30w130gDI2eif9N7LACx1tY8C9L5o1NWqndKZAek5dermCFpx 7kDAEg5PprTvR4Eu+S1OpJFmJ9RiVx4wcM26y8os4efUw2X+UTTWQenbHup++4Qf4DQQ 74m9h5AmQ5MjQVMvyhRmYKQktnozNpRbI2+IJUFwp+tP5+MhHOuQu39HayTcoW9FrZtv Ir1wRNIMw4rAj86K/QxZnY+Pxt4c3UeZ89Z9glVk+etkqHUFoEEaA6ziBlAWSB87TGwM ZqF7uZESCSY+8uYOgzDa0QgFpyMKlLDZvWGKjgTphETvFVDiJIRAQHOcm9d2/q6BUL8m 2N3A== X-Gm-Message-State: AOAM531Hce35cY/0GlHeIjWLb9d3xnxuw5ou+jYTnb+SpMB7PnEJ1zij dMPf3z5pwDVYzgNdFZN7rC9UXQ== X-Google-Smtp-Source: ABdhPJyOwUv704liXlDnm4OvuF5plvIFbBwx4/3ze9uLYbh0RH0iLKEOO1GauxurTZLTw0rxDBRAww== X-Received: by 2002:ac2:5599:: with SMTP id v25mr4002074lfg.662.1641917171778; Tue, 11 Jan 2022 08:06:11 -0800 (PST) Received: from boger-laptop.lan (81.5.110.253.dhcp.mipt-telecom.ru. [81.5.110.253]) by smtp.gmail.com with ESMTPSA id k39sm564803lfv.150.2022.01.11.08.06.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 08:06:11 -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 v4 2/3] dt-bindings: net: support for Allwinner R40 EMAC controller Date: Tue, 11 Jan 2022 19:05:59 +0300 Message-Id: <20220111160600.58384-3-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220111160600.58384-1-boger@wirenboard.com> References: <20220111160600.58384-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_080613_369324_73E7D461 X-CRM114-Status: GOOD ( 10.84 ) 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 reset needs to be deasserted first, so resets property is required. Signed-off-by: Evgeny Boger --- .../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..8b38b4e981fe 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,sun8i-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,sun8i-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 Tue Jan 11 16:06:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12709995 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 BB951C433F5 for ; Tue, 11 Jan 2022 16:08:11 +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=EZ1rdu8/lCq9rTjYD1r4AZtnN1NDAPnepk1TTt/Cwfk=; b=V/pEw2zRDpoj0p F0zhHdroNufznpPr6UZOgTR91cldHjdo4s828CAeTBt2TfTf/IK7dUWQrSsfxZrwlzEPH0hGFeg1j 4jx3xu7LBTMACMEVcHQwzAiB46NoqAA9vnuUQN5YUmmX8aTJNAkIbrOouSOG3duEDdZ6nCYIpO2Z/ FNZf5AkTrK9OcuFh8Nisy74EY7YgBy41cbsXS2b/0SpPmWJw/bRgELe8vabjEHAYFAPTlk/geebuH GHcx3cV3OHU2dwzJXJXcIKfs3HepcOON6zK6rAbXEsk0d7LWoYhY45NkxNA/eZYTTCY6XxQj8w+3c Wwo3Ua90Il9TJVYN17Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7Jff-00GrGi-DJ; Tue, 11 Jan 2022 16:06:51 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7Jf4-00Gr3Q-VT for linux-arm-kernel@lists.infradead.org; Tue, 11 Jan 2022 16:06:16 +0000 Received: by mail-lf1-x134.google.com with SMTP id k21so58125896lfu.0 for ; Tue, 11 Jan 2022 08:06:14 -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=bYtvX5HQuAitP08saJOKuYpfCeQXY0Sh6iR2sKKOOhE=; b=V4oNrihpl0g5rusObHEQEingCrDHv8fatmD3Y2N3UezjRfOG+xsixWcPyd4ogqlcQv +kBeeusRXKF9jK7XBJaXRKt4flnFEnR5iuFn8X6hyxsAqtD+IXZiTGNJ5F8XmtP8ChDU sTHtq7Kj6BLr+sZ4ppr2YXuaokIntn9n1frZjk8rVZK/ok/mSknoOz6hh83PJcewecVK ZFhFaLGnORQmGzxBEzxZsqzb4o6MA2VgMTJNM4FJyB1wrd4rBSdusHFOue/Ncom1YPtw G6SCL1f3+Nl7gzmnTCbSraOtN1rs4++/LyUjw5q1pGxFGI55dxRn5YNzQRwn1+43vUog eghA== 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=bYtvX5HQuAitP08saJOKuYpfCeQXY0Sh6iR2sKKOOhE=; b=1CVe9QqzYFxpXpeGXcPxAsMnT0o98pJxyr4Px/iCciz6dwBebm/3eOpo4pitTfVocv zd0Y0vU7BD6mrSDoU6Axs2F+y8fAuG6DStgWd0+6Y6boqKL4II0qfs8NjXcPFBXLQ43F fFojd6jltbb8FSo8yF12UddcEbUJMaW4VXXRGClswKeQ2O8P92kmNPzzGRga00Rdkp2M a/cb15WW1ea1AF/7oiHlzxzTD1N9r3CYLY02Y9vJbXnWSOsoMWwR/M2py5eDfbIEqxaq MN2EqQaJjAgopHd67Pv8UuTm7e8sNiJJUaekwyt7LoZrU5sjvfDsyC7G48k+d39wl+Pk MhVA== X-Gm-Message-State: AOAM531kpM6Av4LmrmMQK7pIm58zd9wj3+je8rkQnVEAhdmJcfGZU/Mb BflqqAH6X9n0alSXd0rBOZRUgg== X-Google-Smtp-Source: ABdhPJzAwnKImXksiAJ5zwd4qBZpNZQNCRyuGjzKiGyUZnZRo1yV5WOyyr85RAkC++U3vMrTVSJi6Q== X-Received: by 2002:ac2:4d36:: with SMTP id h22mr3740700lfk.560.1641917172789; Tue, 11 Jan 2022 08:06:12 -0800 (PST) Received: from boger-laptop.lan (81.5.110.253.dhcp.mipt-telecom.ru. [81.5.110.253]) by smtp.gmail.com with ESMTPSA id k39sm564803lfv.150.2022.01.11.08.06.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jan 2022 08:06:12 -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 v4 3/3] ARM: dts: sun8i: r40: add second ethernet support Date: Tue, 11 Jan 2022 19:06:00 +0300 Message-Id: <20220111160600.58384-4-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220111160600.58384-1-boger@wirenboard.com> References: <20220111160600.58384-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220111_080615_047849_30076C5E X-CRM114-Status: GOOD ( 13.22 ) 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 IPs 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 | 49 ++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index 1d87fc0c24ee..870d63fae1fc 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -217,6 +217,19 @@ 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>; + }; + }; + sram_c: sram@1d00000 { compatible = "mmio-sram"; reg = <0x01d00000 0xd0000>; @@ -543,6 +556,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 +1011,24 @@ gmac_mdio: mdio { }; }; + emac: ethernet@1c0b000 { + compatible = "allwinner,sun8i-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>;