From patchwork Thu Jan 13 05:37:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12712306 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 91FAFC433EF for ; Thu, 13 Jan 2022 05:39:18 +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=uRiXblWDokF0rlGUhX7lEMc6y+onkeH/Vo6fblIWEyI=; b=xN4yANdrX6HHaY ExKmT70Dh8XofC2iDKjbrYfZdsj/LqqYVrbi93MipHwhx8EbnX3jBLcyR/hpgbDnIBNG+YWdTDA9S EmJrsoB0HXnQBj3SAeVMqqqIMg49uSgdUyESSPOPAhG4GlLP/ugylv1BRCfHFMcq/bB5jM6iWaLML 7V/eVXzr1pmPVFJqpHWphhwaiXM7iG4LlBDXKo+deFdWNnLEukkoAbvMdgOkz6QsDyxJ3ImXEjGCx rNYeERPB2KOfSX+LpWMmPCQ7CmzCZ/cSiJ42gAN/2PH4h9gUrW43FVyuDkCc7wM+H5qEif2HkHKM5 XcOsC1oVCmQMOajhawZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7soG-004i9T-KN; Thu, 13 Jan 2022 05:38:04 +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 1n7so3-004i6w-1A for linux-arm-kernel@lists.infradead.org; Thu, 13 Jan 2022 05:37:52 +0000 Received: by mail-lf1-x134.google.com with SMTP id x7so15707621lfu.8 for ; Wed, 12 Jan 2022 21:37:48 -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=zBzA73wq9oOMpx3FI1zX9gp2UPEJRhF+NPSKH1ogVho=; b=SEnKc/gLMBioN6fye2cmioS4ebyT6q+aeLcbhlB4kWyv6oXfdpgdiWRLGraVVGWe6B 5w94DB//artSLJoMUV8v8mzBR5VTLObyXbMT2WTa5FlkY0QsXBRNlXFFMBg2HVvYD3GY nmYex8Bc/b5PwBfgz78JQXcNyyr5ra1Ko3Sqk7rUQte8jtkJ7IOsdOlmkCWpDP3o6bRx QgcIRM+tG7BED5mlljwHR2TDJlGoDZxVUdZKe6Mo39Q2CvXdrewLWx3jjMtii2GmLy/F 68TRCJvdl6PpVK732TisgcfeMfkMrj1ORBRphoaERfb4FZvXdVindJ4khi6eBbQ6v0RS RP/Q== 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=zBzA73wq9oOMpx3FI1zX9gp2UPEJRhF+NPSKH1ogVho=; b=kdTSX9/boYVW2XrrBDL2bFGQoXCy4Z9Hn6nCcFLrlWBNpLHMdyAtve1S0PSgltoIBp oZkiP2ZG+YeAkpS+MDx0OPzE47zJQ0+idRs82SdzSvHJaNxX4SzkhUgtlOzfScfSwbqz 53iFw6hE/OMLx8jP+n1ysdByxFzhSWiCF/A3GavQOlfccXN995mmrHYHvtwRO7ye36KN fHGKDt242C5O3z8vvssqJyu/s6nA6oWZukwQozqHpLMTSvMkbwFzStf9sZnbFX5pFK+h UXcDPkT0+Gf1i6Fa/g6h+ZAZ24ZCZ8EJbXiYFDxKV9dUVFTM/GG0eDOuuP/X48xecCUw zMsg== X-Gm-Message-State: AOAM533o17kbtnL9KifszkyvSKYOJz2gnhQAO1ZrtCn580sGiZS4nbaK V9l6X2OBBVDK6aMdHvv+/2+Tqw== X-Google-Smtp-Source: ABdhPJz9k9Ee9CEB/YQ3Yz5frlIL7T2skG1hoRvDFCasbGaOiUfO029IjfCKW+F1oyf8fN0qFgQJ/w== X-Received: by 2002:a05:6512:220b:: with SMTP id h11mr2128913lfu.443.1642052266745; Wed, 12 Jan 2022 21:37:46 -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 x21sm180212lfa.296.2022.01.12.21.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 21:37:46 -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 v5 1/3] net: allwinner: reset control support Date: Thu, 13 Jan 2022 08:37:32 +0300 Message-Id: <20220113053734.105813-2-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220113053734.105813-1-boger@wirenboard.com> References: <20220113053734.105813-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220112_213751_106735_6E0E820D X-CRM114-Status: GOOD ( 17.63 ) 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 Acked-by: Maxime Ripard --- 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 74635a6fa8ca..56e811b0a279 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 @@ -69,6 +70,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; struct dma_chan *rx_chan; @@ -968,6 +979,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) { @@ -986,6 +998,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"); @@ -1002,19 +1021,34 @@ 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; + } + } + if (emac_configure_dma(db)) netdev_info(ndev, "configure dma failed. disable dma.\n"); 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); @@ -1070,6 +1104,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: @@ -1095,6 +1131,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); @@ -1126,11 +1163,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 Thu Jan 13 05:37:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12712308 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 BF924C433EF for ; Thu, 13 Jan 2022 05:39:28 +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=jpPED48LqkkkOr0SUpPe6+nQVEhZ3+C3sRAOCamVYx0=; b=IV620QYItkGwUT 5IYDe2zvs8aZOlEonCVaMVLJRgeaLsKnTHO/DzN9Un0TlFgLA8k5ChM/+ABkavyWK8vcyEHPZX1d4 Z/DftOOUERgr/ok6OCfWdFdDhN3/ox9wKxw/wWriYwQ7Dxx+cUxLKABVgK1VT0dvZwieGZKO154cy Qhpk/YduaTXEOjTEVSSGuqdifyTB1HXNhcwsPr1aYwHFEM150pA/tppIDnmdzBkPj/6Kln0pDC6KR rIX39AdB81eH9qtOxZBcMiEMSM85HbcKlvSJK9pjASE8nJQnYkEsB7d8pPMEWFSzO6wlEsdOFnJ8w KC2cs2n4YcXjixGky44g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7soZ-004iCj-Tu; Thu, 13 Jan 2022 05:38:24 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7so3-004i70-JG for linux-arm-kernel@lists.infradead.org; Thu, 13 Jan 2022 05:37:54 +0000 Received: by mail-lf1-x12e.google.com with SMTP id g11so15802309lfu.2 for ; Wed, 12 Jan 2022 21:37:48 -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=LMVIf6eidCZlhuBpwEpwVRF+pP+2nKVMi7BQpp34us4=; b=Bvsb1h0AIb14iTaT86yWwrvNGz0PAr7ClUuU3fvGQU2XxheDeP9LJblRniC6xYjsvW lrKsPV03aO2q8coFCQcLlkAcYArJ4/ZW0xeI2VE2+s7Dxs6Y3EspdKgrMwm/u56iAM8M HVD+AtmXg0zZ8ctBSU8ER6sZ7Ro4xu7kVi/eyEV/0HamYpCPTaUeKS4QAlnFQCPeXAQs Eu8Mmt3G2MFQ1fxOpqwKRpvUKOyLiG/mjkVPT1PsiLCqcgf5+DIpKmMSKb+J7oHazjy9 3+LcSq7KB+nLlwkMwmphPyc2vLQqmHZQ58JrVrm30fHjuHuqtGaFDp+OJjbw6hTPE5UB wZlg== 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=LMVIf6eidCZlhuBpwEpwVRF+pP+2nKVMi7BQpp34us4=; b=aE/1AoHfWoBJBLpDFChFw+ZLTMb40SiHCN7urI6aAICmBVzu8KfQH9YLv4v4h0B4iG 6uE28N69HYEFxIpvq839Xx3RMspDVrO6ZwMH5yDyTp2PKzW0vJy6zlGDc8vww61a58DW /Xo/aJrSy25sTrLlFDD7iaN4uAQWedarmKbas+Y0OXq56ecGuvtkufH6FopDhecU3rz9 e9UbrHVrcabW4ThFbiMjnRx+OXrfkZGbx5QMZZjNfNPy9sLWtAEVnzS05y33OidQpgLC rMg55DqS+xXCX171MKMGCzqcjpnuy3oBCnohFJE2j/+aVSBgU135PWLQjzAGFfTHJ78b N3ag== X-Gm-Message-State: AOAM532MiBRC5q9jDKHqGBwO4JjNREDD9auPK3OXqKHZa+Iw2ORyYxcV 3Vlj2DO7rb0ayCZafFJT5w7Gdw== X-Google-Smtp-Source: ABdhPJxVtxlA4bWuEqA2uFn9Wd95Jc9arVr0nXuJXUGhs2wGi+qnEcxMcnypYqKX6crSvaItGv3kqA== X-Received: by 2002:a05:6512:b01:: with SMTP id w1mr2194009lfu.301.1642052267729; Wed, 12 Jan 2022 21:37:47 -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 x21sm180212lfa.296.2022.01.12.21.37.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 21:37:47 -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 v5 2/3] dt-bindings: net: support for Allwinner R40 EMAC controller Date: Thu, 13 Jan 2022 08:37:33 +0300 Message-Id: <20220113053734.105813-3-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220113053734.105813-1-boger@wirenboard.com> References: <20220113053734.105813-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220112_213751_654526_F4213320 X-CRM114-Status: UNSURE ( 9.91 ) X-CRM114-Notice: Please train this message. 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 Acked-by: Maxime Ripard Reviewed-by: Rob Herring --- .../bindings/net/allwinner,sun4i-a10-emac.yaml | 17 ++++++++++++++++- 1 file changed, 16 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..d9ed7b547af3 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 From patchwork Thu Jan 13 05:37:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Evgeny Boger X-Patchwork-Id: 12712307 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 D0957C433FE for ; Thu, 13 Jan 2022 05:39:19 +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=dykPlaOK3yHRUIePJrSD8YMUAXycS1vU58dv6wv0/Wk=; b=DuxAFgNXDFwkry lFhQrcKuDnqT1WTnfz0r0YzOgHBos6GTkOmMYXNxK8JubYkW7g/KlTpfjnGEvN3ZiVsTv+uu5Zvn2 5v837D3vM//YzxMHd8Ehh63l7PrVMGhlrz7nBhXIva1BjzGVMvblP4aM1QGb/BH2K5of+FtO6fnqT RaQBmjb2GFqAi9MTA1KyPZDz9FchSPxAMzjQoavLiLbNyur+E+s+Z7ZbpW/M6D8eL3CllqtTskMsQ lEmCuDm9e6z1TVNDfdWOwRPbWvQe/HHI8g/N8Yg947j/hAmYhOb5Og3pzoNt/Ra+piJ0ovB4P6TJW bc4C7CGxVQMLJkHVSMCQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n7soQ-004iAr-3S; Thu, 13 Jan 2022 05:38:14 +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 1n7so3-004i71-3J for linux-arm-kernel@lists.infradead.org; Thu, 13 Jan 2022 05:37:54 +0000 Received: by mail-lf1-x131.google.com with SMTP id e3so12951904lfc.9 for ; Wed, 12 Jan 2022 21:37:50 -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=vIhVOFoEFO3ge9QX7EEmaWp+M7MlXRkxdj6Ox9QmAu4=; b=bs5njQm/d7lRUNLXwg+jL7bjAJsuyx82JmChSb3YKsmIG7tQc0srQdbl6ga+Q2LPnO ld9HhOOwtBQ3kzmSNeelAFtRv1OfaGnd4BOcEPuJl9Sw4S4n7Ciq68EuiWmVmu+ZXw/7 TsLjZi+jKF9kEfSnE0x75x8D9eeUHu56OYA+4LD1htPw7gM63Y4xGPb85i+dZavV8b8O iYbuBoYoUhnkqpKvWLaxW70JbjcmnpN82ODPDkI66FP9o20fl/KZ7ApKOBiPLNAFBlZD pO5EyJONm9l5L8FYQW70bj1QhdCSrh7aYkvmDcUDED51BOjKtPfzIE4y0B+/sZxrrlwC EIBw== 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=vIhVOFoEFO3ge9QX7EEmaWp+M7MlXRkxdj6Ox9QmAu4=; b=HqQmzZ5IoYAPPUzJZFDiLd8qE+isvj7MmfrLIvV2ofB15kcSGxMojkZW6iAqqqMOU1 I/Ln0frCzGEtJ7+M5UbMvGDCxrnQyUXzgiOydd4auj9K112I07p/OZDiz/3FtQAqEsUr ZSI0J0ysKvZe2HVnPD9Q5b9Haj51QPy1MEjRFO2BXaqnX9xZ7HAUzw3wnDVG4pJscaAz UIOGYXfBuV9mtQdK4qT0yXug/lOsp+1/cVtY0biyThz3MyKws1XgawA9yh8seIgslnY0 CSLsmmhyKEvyBkNa8oy4mAp/FJxN2haXt+sCCXqz3L4CulWUvxnhBAUT2c1ZXEu97B6E Fnxg== X-Gm-Message-State: AOAM532uNPNgKOqW7X7i7Z5xVXLear8NE+4YMNK4bk0hcFSDheiiopa6 Rq3X91CfUErmerW5PapDh4lj8FSLk/cxxw== X-Google-Smtp-Source: ABdhPJyVV0NrO6DO+IvlzUdJgBUhS30P0tshAoYYNF1cPgGBE0bBQQt+qKLDR4dI3UMvJgGkR3jo9Q== X-Received: by 2002:a2e:a88a:: with SMTP id m10mr1989969ljq.506.1642052268785; Wed, 12 Jan 2022 21:37:48 -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 x21sm180212lfa.296.2022.01.12.21.37.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jan 2022 21:37:48 -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 v5 3/3] ARM: dts: sun8i: r40: add second ethernet support Date: Thu, 13 Jan 2022 08:37:34 +0300 Message-Id: <20220113053734.105813-4-boger@wirenboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220113053734.105813-1-boger@wirenboard.com> References: <20220113053734.105813-1-boger@wirenboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220112_213751_192300_5A1CCA73 X-CRM114-Status: GOOD ( 12.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 (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 03d3e5f45a09..8770b105f86e 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>; @@ -553,6 +566,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"; @@ -999,6 +1030,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>;