From patchwork Mon Nov 18 06:02:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacky Chou X-Patchwork-Id: 13878126 X-Patchwork-Delegate: kuba@kernel.org Received: from TWMBX01.aspeed.com (mail.aspeedtech.com [211.20.114.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E4BF14A099; Mon, 18 Nov 2024 06:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=211.20.114.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731909748; cv=none; b=si8gbcQM0U4j4YRdAvouzRK89OU8g7ofBgsnUxa2tON+k1pmUGtmlmIuqN/G0hNOlVRBCnW5pHsKBxmGLIVb7kQeq1dpGO7EM3sCD0XRNxhUzt1NowmguRm2Vap/Vv3+ISldBke/vMiPeua2U0XzC6UbsP1XsyB/GO2zkrC7vAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731909748; c=relaxed/simple; bh=rUbVC87+qBJbqfUjUNj6tUHnPS4oyc962Ejj0aBLm3Q=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=remUwoCAcgCgNQBYcusxyNx7YaAU6+ywqwuql310XxVcd63dINj3l6rJL0x6eurq5df6iHYhFMshCjBnU7l7TfNRZhwjXqxUca+KuHefYfJTUnWp8XuPcg/zDyZxYH2wN6jbbgG/fs6CvBQJ8RTMTEzHFhOjtC7j1mDVoMMpamc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com; spf=pass smtp.mailfrom=aspeedtech.com; arc=none smtp.client-ip=211.20.114.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=aspeedtech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aspeedtech.com Received: from TWMBX01.aspeed.com (192.168.0.62) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.12; Mon, 18 Nov 2024 14:02:07 +0800 Received: from mail.aspeedtech.com (192.168.10.10) by TWMBX01.aspeed.com (192.168.0.62) with Microsoft SMTP Server id 15.2.1258.12 via Frontend Transport; Mon, 18 Nov 2024 14:02:07 +0800 From: Jacky Chou To: , , , , , , , , , , , CC: Subject: [net-next v2 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs Date: Mon, 18 Nov 2024 14:02:03 +0800 Message-ID: <20241118060207.141048-4-jacky_chou@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20241118060207.141048-1-jacky_chou@aspeedtech.com> References: <20241118060207.141048-1-jacky_chou@aspeedtech.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Toggle the SCU reset before hardware initialization. Signed-off-by: Jacky Chou --- drivers/net/ethernet/faraday/ftgmac100.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c index 17ec35e75a65..cae23b712a6d 100644 --- a/drivers/net/ethernet/faraday/ftgmac100.c +++ b/drivers/net/ethernet/faraday/ftgmac100.c @@ -9,6 +9,7 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include #include #include #include @@ -98,6 +99,7 @@ struct ftgmac100 { struct work_struct reset_task; struct mii_bus *mii_bus; struct clk *clk; + struct reset_control *rst; /* AST2500/AST2600 RMII ref clock gate */ struct clk *rclk; @@ -1969,10 +1971,29 @@ static int ftgmac100_probe(struct platform_device *pdev) } if (priv->is_aspeed) { + struct reset_control *rst; + err = ftgmac100_setup_clk(priv); if (err) goto err_phy_connect; + rst = devm_reset_control_get_optional(priv->dev, NULL); + if (IS_ERR(rst)) + goto err_register_netdev; + priv->rst = rst; + + err = reset_control_assert(priv->rst); + if (err) { + dev_err(priv->dev, "Failed to reset mac (%d)\n", err); + goto err_register_netdev; + } + usleep_range(10000, 20000); + err = reset_control_deassert(priv->rst); + if (err) { + dev_err(priv->dev, "Failed to deassert mac reset (%d)\n", err); + goto err_register_netdev; + } + /* Disable ast2600 problematic HW arbitration */ if (of_device_is_compatible(np, "aspeed,ast2600-mac")) iowrite32(FTGMAC100_TM_DEFAULT,