From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6A89C4743E for ; Sun, 6 Jun 2021 10:33:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 82C3C613EF for ; Sun, 6 Jun 2021 10:33:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82C3C613EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=wTEQSryR9OwqAxP2DZGDOiN0SMiNzn+FYgu5TEYsXE4=; b=sncLg4M9bvne7I jBMBPbU3UC5r5eXPgnu/QffPfXeBNsxhC9lrYKkopNTQtbB2HFO6kz22wOv5RnVd8I5QNkEl6iTmU f+qf0lJWe1c5XzTczberAvRqcfGnOVD9X2d9MGzn0P7u7ee2yzGR/WZtOUounihGTjeMPUg4h4nEN c1rTpuq1kWgCfEkQIJ7h3Fgt1auGW/6RyCHoXp/X3bOw4p29wdLWxH40c9trRpfh/UrGeOkO3ppwX W/WzQsn1DLtDW4n3MteW566KB+bL4g1VSexPyK/vzwQnMuww2YaU3FKGigEJrpkzHmNJK/eKdeCB6 LhGyL0a3qwGCVEJWMnDw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lpq4M-0007p7-0o; Sun, 06 Jun 2021 10:31:50 +0000 Received: from mail-wm1-f51.google.com ([209.85.128.51]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lpq4I-0007oQ-C3 for linux-arm-kernel@lists.infradead.org; Sun, 06 Jun 2021 10:31:47 +0000 Received: by mail-wm1-f51.google.com with SMTP id 3-20020a05600c0243b029019f2f9b2b8aso8197524wmj.2 for ; Sun, 06 Jun 2021 03:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ikXJBehZXFSB5UrJ89OaYAcJZ+kIUikwdL83ZPiK/5Y=; b=FexVLV1F67sJ8VtLdcDCHjf+oX3RM8/jbrZGl69yu70d1Po34D5B/Jrfh1Wc0B2bFk M/bjGeAgCvUCDukHX0G0Ip8Z+gWnW+VBd2brgbMSDZ+wyNLrbujmvHYprvmVbquWavfS K0HvIgpQay8mLct9xagtW/7c63fHjfbBmjsJYR9s3p+lPqPlC/bN7ZgEhqWjF+Bj+8F/ TDom7Z+CS+qYtBchGiyn7gv/1Y3IHovBEmbSESqVqxiVehsOPrPamoIR9/ulqjfGIwL1 Irl8Rh97DtGYaT7wwXLkONEx4EVAo7Jz+WacxiH5ptE2GOUMt/BmZFtMu/ayRnViDXa2 7cZA== 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=ikXJBehZXFSB5UrJ89OaYAcJZ+kIUikwdL83ZPiK/5Y=; b=rlVKYbcKedDbmdal6aimBBMkEQHgc/ZZgRaxxgbzfWKLXRxi6V10/pH9iK8FhaB2tN +XaXoCLjJ/ZjoIM9oCM+cguxLJLYePLfoXS7juUTzGUdZuBsc9ByUr6dQsEoGBwdhszK zP+Q2C8UVFlhjvnf4YCEnSnqKtgM1wrOysXXBP9MiICiEZeteI6Va94Zr540LPPlQsHA UcE1sI4tK0GviS9pURpEWG8/gxMBk94/vCMtW56dkqoJw5knfRztT4qFBJLZkhiqXjNg o6qULFFT6xIpjEMY4AePFUY2O3ncLxTujmeYAQY1e40OknVRH0fQ5SJhILCQB0xgigZa HU+Q== X-Gm-Message-State: AOAM531lMkcFlFR8tsEQ+0JujpDj8OGmaEXvycSSKUVJ3RRd3Uy5utXn thGrMWs9RlTn5iVwGDrxWdw= X-Google-Smtp-Source: ABdhPJwWAiiWqtqihbUCZBiBb+hiCCGLYOEmHqUxvoIWanfLpsTPgU+VvFX0yTMsszDmE/6ByuoYAA== X-Received: by 2002:a1c:ed03:: with SMTP id l3mr12198750wmh.130.1622975444995; Sun, 06 Jun 2021 03:30:44 -0700 (PDT) Received: from cluster5 ([80.76.206.81]) by smtp.gmail.com with ESMTPSA id s62sm13926536wms.13.2021.06.06.03.30.44 (version=TLS1 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128); Sun, 06 Jun 2021 03:30:44 -0700 (PDT) From: Matthew Hagan To: Cc: bjorn.andersson@linaro.org, Matthew Hagan , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Maxime Coquelin , Philipp Zabel , Voon Weifeng , Ong Boon Leong , Wong Vee Khee , Tan Tee Min , "Wong, Vee Khee" , Mohammad Athari Bin Ismail , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] net: stmmac: explicitly deassert GMAC_AHB_RESET Date: Sun, 6 Jun 2021 11:30:13 +0100 Message-Id: <20210606103019.2807397-1-mnhagan88@gmail.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <3436f8f0-77dc-d4ff-4489-e9294c434a08@gmail.com> References: <3436f8f0-77dc-d4ff-4489-e9294c434a08@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210606_033146_453622_D7CF9146 X-CRM114-Status: GOOD ( 15.15 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We are currently assuming that GMAC_AHB_RESET will already be deasserted by the bootloader. However if this has not been done, probing of the GMAC will fail. To remedy this we must ensure GMAC_AHB_RESET has been deasserted prior to probing. v2 changes: - remove NULL condition check for stmmac_ahb_rst in stmmac_main.c - unwrap dev_err() message in stmmac_main.c - add PTR_ERR() around plat->stmmac_ahb_rst in stmmac_platform.c Signed-off-by: Matthew Hagan --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++ drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c | 7 +++++++ include/linux/stmmac.h | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6d41dd6f9f7a..0d4cb423cbbd 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6840,6 +6840,10 @@ int stmmac_dvr_probe(struct device *device, reset_control_reset(priv->plat->stmmac_rst); } + ret = reset_control_deassert(priv->plat->stmmac_ahb_rst); + if (ret == -ENOTSUPP) + dev_err(priv->device, "unable to bring out of ahb reset\n"); + /* Init MAC and get the capabilities */ ret = stmmac_hw_init(priv); if (ret) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 97a1fedcc9ac..a178181f6a24 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -600,6 +600,13 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) goto error_hw_init; } + plat->stmmac_ahb_rst = devm_reset_control_get_optional_shared( + &pdev->dev, "ahb"); + if (IS_ERR(plat->stmmac_ahb_rst)) { + ret = PTR_ERR(plat->stmmac_ahb_rst); + goto error_hw_init; + } + return plat; error_hw_init: diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index e55a4807e3ea..9b6a64f3e3dc 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -239,6 +239,7 @@ struct plat_stmmacenet_data { unsigned int mult_fact_100ns; s32 ptp_max_adj; struct reset_control *stmmac_rst; + struct reset_control *stmmac_ahb_rst; struct stmmac_axi *axi; int has_gmac4; bool has_sun8i; -- 2.26.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel