Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp593742pxb; Wed, 27 Jan 2021 16:08:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJztyJFvK3Ya4rsHxqJMVcVyYll6jXxBqXLyMzj9SChPBQuRUexjQFcA3xGpiO27/LKs2IWa X-Received: by 2002:aa7:d919:: with SMTP id a25mr11496577edr.243.1611792525133; Wed, 27 Jan 2021 16:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611792525; cv=none; d=google.com; s=arc-20160816; b=ucD5FpjS+RqAT2AsF8VBZzkK1zAkpc5sMKWabv710ibcpkVXTpCVas1gncQt+RVtad xTb45ampJt9nymCvs5V2TKk8pb2z7hs/n+zM+Gtth12dxbrFw81AuN6iqEebVA30gVDb rvvfyB3mCz6LZhx4sOj/ZFcCOyP37q9bfox3vhKMyHSbHloFQCMHwX+6DaEAoYcih4u/ r+qdIyP5WCExMOdPV7dEFzw/4Z+a9J/8OAw0foQ+aV4N9ZXf4Lpr0zgEpbh1OwxNCqMW KKO+URncd5NAkbecotuK/xscQNWssaN9i0+tPEayibWuXiNpzNjhP697UlZHAhwVU+5i YxqQ== 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=Bys5qGOMllgDyPTC91Ccgk+RVTdG4MVDXukY0BKOjx8=; b=vMC3PlAaLOR6aNKMY/L6Vw2WW7SQ2sWIsJneMOUqAZIi7c4HgShW5leaVkNalPJ0ub a8nvCqhOkJ+VEwCgCMfb/Z3cLgAXasH2+BkvhpCYZq2wArPwlozo5hSlPBDehBJCGUCv ABeFhbSVgS+PLWjcJJqydayF8u3V8dA0DtakBMfVMhITByT90+n8BBkEWxkrEh/198kf hh6UXX8J5lF/p6veWj1pJGwz5f7/qjdfhKuFG38Msoc9IRjK7JIE6D6TGN5qWw5DeoY/ UyDZ5diSGH2Fk5YrjoFO3iGzwOpTVQMkPPQOOK+VFpZgU71oKgh3SWzM5nDL5zPhDAoK qTyg== 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 l22si1751371edr.554.2021.01.27.16.08.21; Wed, 27 Jan 2021 16:08:45 -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 S1343925AbhA0Rdd (ORCPT + 99 others); Wed, 27 Jan 2021 12:33:33 -0500 Received: from foss.arm.com ([217.140.110.172]:56862 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbhA0R3A (ORCPT ); Wed, 27 Jan 2021 12:29:00 -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 E93DA14F6; Wed, 27 Jan 2021 09:26:26 -0800 (PST) Received: from localhost.localdomain (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 598BD3F66E; Wed, 27 Jan 2021 09:26:24 -0800 (PST) From: Andre Przywara To: Maxime Ripard , Chen-Yu Tsai Cc: Jernej Skrabec , Samuel Holland , Icenowy Zheng , 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, Alexandre Torgue , "David S . Miller" , Giuseppe Cavallaro , Jakub Kicinski , Jose Abreu , netdev@vger.kernel.org Subject: [PATCH v5 16/20] net: stmmac: dwmac-sun8i: Prepare for second EMAC clock register Date: Wed, 27 Jan 2021 17:24:56 +0000 Message-Id: <20210127172500.13356-17-andre.przywara@arm.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20210127172500.13356-1-andre.przywara@arm.com> References: <20210127172500.13356-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..c7951790ed98 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -1124,11 +1124,13 @@ static int sun8i_dwmac_probe(struct platform_device *pdev) struct stmmac_resources stmmac_res; struct sunxi_priv_data *gmac; struct device *dev = &pdev->dev; + struct reg_field syscon_field; phy_interface_t interface; int ret; struct stmmac_priv *priv; struct net_device *ndev; struct regmap *regmap; + 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