From patchwork Wed Apr 21 08:58:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 1468636 X-Patchwork-Delegate: narmstrong@baylibre.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=C7En6djE; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FQDwv3hP7z9t5G for ; Wed, 21 Apr 2021 18:58:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BD22F82B39; Wed, 21 Apr 2021 10:58:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.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=baylibre-com.20150623.gappssmtp.com header.i=@baylibre-com.20150623.gappssmtp.com header.b="C7En6djE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 02E5682B3A; Wed, 21 Apr 2021 10:58:09 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (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 B8CD382B36 for ; Wed, 21 Apr 2021 10:58:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=narmstrong@baylibre.com Received: by mail-wm1-x32b.google.com with SMTP id z6so3924410wmg.1 for ; Wed, 21 Apr 2021 01:58:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=YY4EKbPZ4X3TRNYd7ZaxnPwykoIyEAcm254c4mw5+/Q=; b=C7En6djEAA9MQGaAZjphYUZ+irg0F3TmXWfzZJTYUZhzkSZ59AQYrpPYIHkQKcyFQo EoOTF0nyjSGPTPiS/wbAKqkT2T6LVk1KemXRMtdZgJPOt6CZOGJJ1Hhm0pEQRaFJcHxk 2Zx+xjypbJRscru6WcJh2OM931tsCAtLlQnjmZH9itk2TSQyZsFO3459pUJcnNgyNllO VGdSo4C91lKxrAxyb4DBJucx3XPwJDOLbhPjBchhq+euSKngcqJXwCiy4boHw4rrtdbP +rvzj2iQYgynbofDIFtyPOzHJCEp8snjjYz/wJL+1bHO3TXINcWCg0Cq2JbMds91nvuF niug== 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:mime-version :content-transfer-encoding; bh=YY4EKbPZ4X3TRNYd7ZaxnPwykoIyEAcm254c4mw5+/Q=; b=nHrQI5IsRQYZBw/7cQZ11r4akBMu9RbjoWNvc4pf50yr77lPTpKTXtZ/wpXSmZAGKV Uwbak1/D8l55W+7X9sTt5RYcsnZpIUyQocslDVbYPAjbV4+C363hYkSZ7ZfnB95X4eox xgH7HnzIp8pYff7DgWRxK8FN8sQro5cFVQeAzHw4RAoYWMtEHrRElE7ogw9k61TBKHQI jwDSHnSqIe0qLgcr45V6gX99FMZE8tLeJaQzZ69Q6aLBB9p/Q05x1ZQy9exEmQjRHLM/ B1VJta275TQMw+YkQaui3nYSeqiLv9baO28ZFEyqN5d0j/rerncJuU/eFsMpK0vMIZfF ZxdQ== X-Gm-Message-State: AOAM531ZclZWA5hFh6mtem3gA4dHZHwnFRpSQkRqexS3cN10WZy4rEhG qaPivkJmD5LtQCo/n2+R7HR0MA== X-Google-Smtp-Source: ABdhPJwobNLDTsxzb0p/kR6C8MCOATU8JGjwM1sdJyvYgwASX57/tUh/muStVhdO9y/ZNxVkK+SdFQ== X-Received: by 2002:a05:600c:4e93:: with SMTP id f19mr7325461wmq.122.1618995484163; Wed, 21 Apr 2021 01:58:04 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:90c:e290:f781:73d5:3127:752d]) by smtp.gmail.com with ESMTPSA id g3sm2223689wrp.46.2021.04.21.01.58.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Apr 2021 01:58:03 -0700 (PDT) From: Neil Armstrong To: joe.hershberger@ni.com, rfried.dev@gmail.com Cc: u-boot@lists.denx.de, u-boot-amlogic@groups.io, Neil Armstrong , Mark Kettenis Subject: [PATCH] net: designware: fix PHY reset with DM_MDIO Date: Wed, 21 Apr 2021 10:58:01 +0200 Message-Id: <20210421085801.3100215-1-narmstrong@baylibre.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.4 at phobos.denx.de X-Virus-Status: Clean The dw_eth_pdata is not accessible from the mdio device, it gets the mdio bus plat leading to random sleeps (-10174464 on Odroid-HC4). This moves the dw_mdio_reset function to a common one taking the ethernet device as parameter and use it from the dw_mdio_reset and dm_mdio variant functions. Fixes: 5160b4567c net: designware: add DM_MDIO support Reported-by: Mark Kettenis Signed-off-by: Neil Armstrong Reviewed-by: Ramon Fried --- drivers/net/designware.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/net/designware.c b/drivers/net/designware.c index b8ba00b7c0..5d92257e74 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -91,9 +91,8 @@ static int dw_mdio_write(struct mii_dev *bus, int addr, int devad, int reg, } #if defined(CONFIG_DM_ETH) && CONFIG_IS_ENABLED(DM_GPIO) -static int dw_mdio_reset(struct mii_dev *bus) +static int __dw_mdio_reset(struct udevice *dev) { - struct udevice *dev = bus->priv; struct dw_eth_dev *priv = dev_get_priv(dev); struct dw_eth_pdata *pdata = dev_get_plat(dev); int ret; @@ -122,6 +121,13 @@ static int dw_mdio_reset(struct mii_dev *bus) return 0; } + +static int dw_mdio_reset(struct mii_dev *bus) +{ + struct udevice *dev = bus->priv; + + return __dw_mdio_reset(dev); +} #endif #if IS_ENABLED(CONFIG_DM_MDIO) @@ -142,9 +148,10 @@ int designware_eth_mdio_write(struct udevice *mdio_dev, int addr, int devad, int #if CONFIG_IS_ENABLED(DM_GPIO) int designware_eth_mdio_reset(struct udevice *mdio_dev) { - struct mdio_perdev_priv *pdata = dev_get_uclass_priv(mdio_dev); + struct mdio_perdev_priv *mdio_pdata = dev_get_uclass_priv(mdio_dev); + struct udevice *dev = mdio_pdata->mii_bus->priv; - return dw_mdio_reset(pdata->mii_bus); + return __dw_mdio_reset(dev->parent); } #endif