Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AEDCC001DC for ; Thu, 27 Jul 2023 14:35:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 54C8C8688F; Thu, 27 Jul 2023 16:34:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="c8bsGge0"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9B83686373; Thu, 27 Jul 2023 03:58:24 +0200 (CEST) Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 083F785BBE for ; Thu, 27 Jul 2023 03:58:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kobedylan@gmail.com Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1b9c5e07c1bso3586785ad.2 for ; Wed, 26 Jul 2023 18:58:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690423100; x=1691027900; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=U1IBamb78FnH0p9AcJPvWk7v2pkXMYu16rbXkSWBH4U=; b=c8bsGge0mnx50HBkbjOsm9+h35R5M2UjKMu9GVW2Lgmobw3aelfuWybnofbcLuRZlN ifw1+F5u72tKGeyj7370A52Xr0F36eSbnXgC+h4RuMQHe/Yc8rhBtXptbkOeuPJ3c9Lo Lpos505pKIn1fnphZO1gMJfWCIjo5PIf7KtXzecMmZNvXWMLugqR6+i/zYy3nJfP39+d jtmmiMAJjnl2trUrMHmHUOvyj+YNKKy5Z+SybHUgugwhJ++DMBUHfSbtVP0CxhAsAHYC WKjznfOyLrOAHkkNMp75C0Ngyon+MNGiyldGBxRMNeCuENLy2FFXwpkThAct18+/Bk5c YfiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690423100; x=1691027900; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=U1IBamb78FnH0p9AcJPvWk7v2pkXMYu16rbXkSWBH4U=; b=HL4opGGxIOJPSCdz5Ia54EcoGcvTTzoj5pADXrSYDAvXf7btD50sY6FYU69C1BJgm/ 6kNPurX8pmFoRO/etLmAttf3WSgbZVuNvhPf8d0WodEQLpA0kVmKww3jl844mCjhagaV ChmBz2GU65A5MM9lHwHUxWArZ6WTWIjprKK92EQh7rKMv++XqZz/CVzimJLlpPSo4Ozd yPVNuUfB0owNkdU18XBQttBaGL4mFUW7UlTL4XtG0a1Ie3A2ZGxrDspJqb2gD81JTM/P n8dwuxgzTl2tummL30xn9q57yGtNOE9uDKKYFad+YLByzshHsHeK/EnVQaw6Y8TrNkde uL+w== X-Gm-Message-State: ABy/qLZuKlDDAXLkkreRNgbciqKJSdSyC3JRdjZc+0ARRwyH5RQRLQpb aiMToRQ9VcB0yLY8EKo/Xhw= X-Google-Smtp-Source: APBJJlFqX+j2th6azWEvBx/HLO0vSH0pAgWmDga9tBclIeftqdBL3fNQMzxSNmPhBVcjbJb9S7QYCQ== X-Received: by 2002:a17:902:ea04:b0:1b6:6e3a:77fb with SMTP id s4-20020a170902ea0400b001b66e3a77fbmr4906853plg.2.1690423099795; Wed, 26 Jul 2023 18:58:19 -0700 (PDT) Received: from localhost.localdomain (211-20-114-70.hinet-ip.hinet.net. [211.20.114.70]) by smtp.gmail.com with ESMTPSA id y18-20020a170902ed5200b001993a1fce7bsm214952plb.196.2023.07.26.18.58.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 18:58:19 -0700 (PDT) From: Dylan Hung X-Google-Original-From: Dylan Hung To: ryan_chen@aspeedtech.com, chiawei_wang@aspeedtech.com, BMC-SW@aspeedtech.com, joel@jms.id.au, joe.hershberger@ni.com, rfried.dev@gmail.com, u-boot@lists.denx.de Cc: kobedylan@gmail.com, Dylan Hung Subject: [PATCH] net: ftgmac100: Add reset control Date: Thu, 27 Jul 2023 09:58:14 +0800 Message-Id: <20230727015814.3459990-1-dylan_hung@aspeedtech.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 27 Jul 2023 16:32:47 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Add optional reset control, especially for the Aspeed SOC. For the hardware without a reset line, the reset assertion/deassertion will be skipped. Signed-off-by: Dylan Hung --- drivers/net/ftgmac100.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index a50cde338a..886b97119d 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -13,6 +13,7 @@ #include #include +#include #include #include #include @@ -90,6 +91,7 @@ struct ftgmac100_data { u32 max_speed; struct clk_bulk clks; + struct reset_ctl *reset_ctl; /* End of RX/TX ring buffer bits. Depend on model */ u32 rxdes0_edorr_mask; @@ -568,6 +570,8 @@ static int ftgmac100_of_to_plat(struct udevice *dev) priv->txdes0_edotr_mask = BIT(15); } + priv->reset_ctl = devm_reset_control_get_optional(dev, NULL); + return clk_get_bulk(dev, &priv->clks); } @@ -593,6 +597,12 @@ static int ftgmac100_probe(struct udevice *dev) if (ret) goto out; + if (priv->reset_ctl) { + ret = reset_deassert(priv->reset_ctl); + if (ret) + goto out; + } + /* * If DM MDIO is enabled, the MDIO bus will be initialized later in * dm_eth_phy_connect @@ -628,6 +638,8 @@ static int ftgmac100_remove(struct udevice *dev) free(priv->phydev); mdio_unregister(priv->bus); mdio_free(priv->bus); + if (priv->reset_ctl) + reset_assert(priv->reset_ctl); clk_release_bulk(&priv->clks); return 0; -- 2.25.1