Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2609468pxb; Sun, 15 Nov 2020 10:57:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS14B1sUAlxSIBJ/2XSp5gI+9z8Kob/aQG8qQD/JFB0KC5hLhoBoUs3bQ2g5qZuxNW85F6 X-Received: by 2002:a50:b584:: with SMTP id a4mr12637533ede.301.1605466640084; Sun, 15 Nov 2020 10:57:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605466640; cv=none; d=google.com; s=arc-20160816; b=Q03l2Kb36wWIYu2TXN0zUbRfJNZ9qGtIprtYBuDkH4o02NP7n5u8Zl+2A8P8+k2Jje 9gkK9zq7OdkCMEwCtZu7RCmcUlV7r4g4O+n9iZ8TcI8lYQNLdL3zx/FS3onxWbe9NrDe JEf3EqlSYYBPd1pt2b11gKLVlpGJf+waa0t8Ey2U3LBfmmK694+4GZhIMeSOAjrU/10p ygEh2JOSTniZ51D5upArGALs9lqHp1D8zC33upQJ/aMDgZfOUs/a9IA3CiFX4/bNzfMr NnB/tRFwba4obVOZyO/dZsqiCbYrMiWwUTs/+NBIUQniDXfnhXn6DmxepqDMDlAZ5HKP MQ2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tHdUr6fpSlLoSsUqR0Zir33G0bTUJp5jRkYS8g8PmZ4=; b=tixeZd90GiiinBhPR9gTa8NGQX6pCWtrxZbbWH3X33GG3uHC8NF9XBm1jnyDTdIKmE ugp0wrnjAkpAzbEwkSKW0uJWgb4odl2M8ZHNROEeu5AWtDbFegyltbVv2EXKsZRg/ZHN aSkYCTfCtrk7mCJFF3ZwCiGisfrpExNQEz9ct2ernFE1dDplOUXtwW16E2Fhwn7OXru3 k9B39qKtBOPaREi5BunpQ3GScBM4LzYymRVng8+gz3MAW4FZFS6rdVeMdriXI85d0Ali AoKBEERg63F8rbRPxOy1fhEaOxr/7RV9xxuZoEKnuy/NO9r880xEcGbOioXW+Ptbxrxn DKhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="gpxkUd9/"; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t12si10244159ejx.621.2020.11.15.10.56.57; Sun, 15 Nov 2020 10:57:20 -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; dkim=pass header.i=@googlemail.com header.s=20161025 header.b="gpxkUd9/"; 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=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727610AbgKOSwu (ORCPT + 99 others); Sun, 15 Nov 2020 13:52:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727527AbgKOSwr (ORCPT ); Sun, 15 Nov 2020 13:52:47 -0500 Received: from mail-ej1-x641.google.com (mail-ej1-x641.google.com [IPv6:2a00:1450:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88524C0613D1; Sun, 15 Nov 2020 10:52:47 -0800 (PST) Received: by mail-ej1-x641.google.com with SMTP id o21so21333153ejb.3; Sun, 15 Nov 2020 10:52:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tHdUr6fpSlLoSsUqR0Zir33G0bTUJp5jRkYS8g8PmZ4=; b=gpxkUd9/dkkmdPKleMJPJB7kz4sRjVV2Kbrn5gknEKHMn5AUENOqWfDyjgSVW8Znyc nXym0OOIPPzhN+2yD13xZml484CFC78x3EUny6jl/158IHyggecUVTPEtAwQ2WQJmL9a XmeLMZaU05WLhq7T0Eom23BgZVFiHc5gceEI9bivE+NG8mMFC73VDZJjKh3NLO/bNhyV XEY9SKuMwQ+uNGrb7pZunyOqsx2c0dWM6Va3N999+t7ydLkiT1hUSoI0KcEiKPXPc0Yx VvNhq4ZW9kVFAzfbSBx5xQPsZUCaWxWANma6xEdGXcNzPwKJErf0JhhGh6mUZQXFj1pg ImZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tHdUr6fpSlLoSsUqR0Zir33G0bTUJp5jRkYS8g8PmZ4=; b=EHfpAwiqhrfjt5ggBsVsRzi7e12Mf0Rtr6Bdd+9OU80fNlxKNRzI9csK/CrNtW5ljq B+L6wmkxbeEkH6hxHwEIXfb0Vz3mMXTXGakJmeczptKu1gjqzMJK1Trxp+5hec3cRqdQ cIXWVNF5JR0+aJwniJnxXuz9e8FahXGznEXLvmMZkGoSx7aqb7off12ByGqhX2mvWRhR sAHZPUeFYviW4xNNde5FXXBqYfw/v7S3UPbksJnrtMsFbZnLA/3mxBGK9/KV5hyvkWSN ZG4BSDtvdxvP5VIr4EjVH0xhhdgNt7vY7BmQIAO++HsAZCAjlPKmyGCeOv0nOsckBDS6 RSVQ== X-Gm-Message-State: AOAM530NbBOxCZqGvJPcjel7WSiA61bDQgP4p4B5c5dj1JJFoCluoMvS ECYO92I2zO+gIQgyOoP54DU= X-Received: by 2002:a17:906:a88:: with SMTP id y8mr12421672ejf.469.1605466366301; Sun, 15 Nov 2020 10:52:46 -0800 (PST) Received: from localhost.localdomain (p4fc3ea77.dip0.t-ipconnect.de. [79.195.234.119]) by smtp.googlemail.com with ESMTPSA id i13sm9233520ejv.84.2020.11.15.10.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Nov 2020 10:52:45 -0800 (PST) From: Martin Blumenstingl To: davem@davemloft.net, kuba@kernel.org, linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, robh+dt@kernel.org, netdev@vger.kernel.org Cc: jianxin.pan@amlogic.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, khilman@baylibre.com, narmstrong@baylibre.com, jbrunet@baylibre.com, andrew@lunn.ch, f.fainelli@gmail.com, Martin Blumenstingl Subject: [PATCH RFC v2 4/5] net: stmmac: dwmac-meson8b: move RGMII delays into a separate function Date: Sun, 15 Nov 2020 19:52:09 +0100 Message-Id: <20201115185210.573739-5-martin.blumenstingl@googlemail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201115185210.573739-1-martin.blumenstingl@googlemail.com> References: <20201115185210.573739-1-martin.blumenstingl@googlemail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Newer SoCs starting with the Amlogic Meson G12A have more a precise RGMII RX delay configuration register. This means more complexity in the code. Extract the existing RGMII delay configuration code into a separate function to make it easier to read/understand even when adding more logic in the future. Signed-off-by: Martin Blumenstingl --- drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c index 03fce678b9f5..353fe0f53620 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson8b.c @@ -268,7 +268,7 @@ static int meson8b_devm_clk_prepare_enable(struct meson8b_dwmac *dwmac, return 0; } -static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) +static int meson8b_init_rgmii_delays(struct meson8b_dwmac *dwmac) { u32 tx_dly_config, rx_dly_config, delay_config; int ret; @@ -323,6 +323,13 @@ static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) PRG_ETH0_ADJ_DELAY | PRG_ETH0_ADJ_SKEW, delay_config); + return 0; +} + +static int meson8b_init_prg_eth(struct meson8b_dwmac *dwmac) +{ + int ret; + if (phy_interface_mode_is_rgmii(dwmac->phy_mode)) { /* only relevant for RMII mode -> disable in RGMII mode */ meson8b_dwmac_mask_bits(dwmac, PRG_ETH0, @@ -431,6 +438,10 @@ static int meson8b_dwmac_probe(struct platform_device *pdev) goto err_remove_config_dt; } + ret = meson8b_init_rgmii_delays(dwmac); + if (ret) + goto err_remove_config_dt; + ret = meson8b_init_rgmii_tx_clk(dwmac); if (ret) goto err_remove_config_dt; -- 2.29.2