Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp312629pxu; Fri, 11 Dec 2020 03:01:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9TzKrjs1y8ntBJTn7V6pEasseMgFVtIpSK/IhIr8/J2xgSbumWqUaR3VyN7LVtlIRukFk X-Received: by 2002:a05:6402:1045:: with SMTP id e5mr11476929edu.40.1607684499377; Fri, 11 Dec 2020 03:01:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607684499; cv=none; d=google.com; s=arc-20160816; b=aAQQWvl/ig2Tm/SJhnD5tzxaZMqI8sh0uvLlNkhGgWFr8PKncA6DGWN7LxLJaycVkl 74b8yLRcJg8SwTHrCfKpMfvsx21W5VO4kqryZUyNmATgzZpfvnMbQ68l09hFbGHvC6mC iOpHk3qTGleVR4x9vIHz93ro5YA1D80OePs7QuwgfdhpTI9+jKX9jhuZJfpQ6nuDf0kW mCYDa3L4zOnbDNm28YM123qVf/g485EuaoeB+55AIPBbC/16jzzbCd6LC9KP+XZN7fRi PnCWHSbaqXrBPxfm3LEfTB0HMZTJpb+dJgCqrUMdFieVSXJZGra4amgRNLINCGUXCayz iItg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=NeME8iI8si1tc8UGTa/JXbIAwd7hyKYvX+1QGuq7ib0=; b=NoC+IauD3TacGCA+EvUmt2GyigaUMy2l7xEhzGpE4tjcJhtKeN3s0ayPVtCleqCifm +Umc41QBjJTrMTzwK+P+7MKRX2shvQ7pTzUEg8VcN3BbV4HVAMcIe1uAEZ/BpYRLnFda w4LvzDfKf5xQl1HBm0AbrbYYlm2pVd13nJKc2VpJkFGqvo1TidZvEbhzLyG9UkcphWHX 23iitkAgu5yfLI8oNXTO5hwPi3ijjRmHCD2m1COHw6y67Z5ylEhuApQZ983ZYES0f5xA zhWbqiHpWMLYl5nOGN7aV53liMltvVsGqjOey5C9d/nIjDbHl0MKyj2bPCkbKlOnjyb/ 3Zuw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q23si4756872edg.55.2020.12.11.03.01.16; Fri, 11 Dec 2020 03:01:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394933AbgLKBYI (ORCPT + 99 others); Thu, 10 Dec 2020 20:24:08 -0500 Received: from foss.arm.com ([217.140.110.172]:49834 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394754AbgLKBVg (ORCPT ); Thu, 10 Dec 2020 20:21:36 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5DE0B1516; Thu, 10 Dec 2020 17:20:25 -0800 (PST) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BD07D3F66B; Thu, 10 Dec 2020 17:20:22 -0800 (PST) From: Andre Przywara To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec Cc: Icenowy Zheng , Linus Walleij , Rob Herring , =?UTF-8?q?Cl=C3=A9ment=20P=C3=A9ron?= , Shuosheng Huang , Yangtao Li , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org Subject: [PATCH v2 13/21] net: stmmac: dwmac-sun8i: Prepare for second EMAC clock register Date: Fri, 11 Dec 2020 01:19:26 +0000 Message-Id: <20201211011934.6171-14-andre.przywara@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20201211011934.6171-1-andre.przywara@arm.com> References: <20201211011934.6171-1-andre.przywara@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The Allwinner H616 SoC has two EMAC controllers, with the second one being tied to the internal PHY, but also using a separate EMAC clock register. To tell the driver about which clock register to use, we add a parameter to our syscon phandle. The driver will use this value as an index into the regmap, so that we can address more than the first register, if needed. Signed-off-by: Andre Przywara --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 58e0511badba..00c10ec7b693 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -1129,6 +1129,8 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) struct stmmac_priv *priv; struct net_device *ndev; struct regmap *regmap; + struct reg_field syscon_field; + u32 syscon_idx = 0; ret = stmmac_get_platform_resources(pdev, &stmmac_res); if (ret) @@ -1190,8 +1192,12 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) return ret; } - gmac->regmap_field = devm_regmap_field_alloc(dev, regmap, - *gmac->variant->syscon_field); + syscon_field = *gmac->variant->syscon_field; + ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, + &syscon_idx); + if (!ret) + syscon_field.reg += syscon_idx * sizeof(u32); + gmac->regmap_field = devm_regmap_field_alloc(dev, regmap, syscon_field); if (IS_ERR(gmac->regmap_field)) { ret = PTR_ERR(gmac->regmap_field); dev_err(dev, "Unable to map syscon register: %d\n", ret); @@ -1263,6 +1269,8 @@ static const struct of_device_id sun8i_dwmac_match[] = { .data = &emac_variant_a64 }, { .compatible = "allwinner,sun50i-h6-emac", .data = &emac_variant_h6 }, + { .compatible = "allwinner,sun50i-h616-emac", + .data = &emac_variant_h6 }, { } }; MODULE_DEVICE_TABLE(of, sun8i_dwmac_match); -- 2.17.5