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 716EDC433F5 for ; Wed, 22 Dec 2021 14:05:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id D476E83493; Wed, 22 Dec 2021 15:04:46 +0100 (CET) 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="V0PqleQY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 686208309A; Wed, 22 Dec 2021 15:04:44 +0100 (CET) Received: from mail-io1-xd2a.google.com (mail-io1-xd2a.google.com [IPv6:2607:f8b0:4864:20::d2a]) (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 4AB10833B8 for ; Wed, 22 Dec 2021 15:04:40 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=aford173@gmail.com Received: by mail-io1-xd2a.google.com with SMTP id b187so2954149iof.11 for ; Wed, 22 Dec 2021 06:04:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sKMlS96pQFmEmVQsRm/2i0sPr9UcMNF+JFcd8QT6wkg=; b=V0PqleQYCQWzKmWRFwAAQ8cEutrES9tj4FFAAlp1ASPBD5gg2qXFhEQKYCCsVU5e/h Mvccu1MSeolbLMnXuz/oA2ZqKr1c2NAAGwGSWeJTu730rPXjy5cZtCE41B2TkYerJd+v PQ7R8fWkk7Mzp0iHmZzBTT/JXn1hete3X8MPGcibKkoGd4BODQQ2fB6/N3sclL2cDK9F xoNltIkXGrQaAoJIFYw8RZy6MgNj1oq13Rubk80mQBsBLMUcSLEFevtVBgWheKx21QPx Wkpoztxr4HWrCp+Vah1JBw2p4NuopT8hjm2d6CF1sM/iI0Cqb84R3NSZ6BTTUn/eoxr9 tEhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sKMlS96pQFmEmVQsRm/2i0sPr9UcMNF+JFcd8QT6wkg=; b=Un3zPELzJYH9WAd40IVLuui9k4EAeBCMHO+NB908ZqPR157sLoQFdi/dy834+2TVfP +mJe0Q1CnulZ86ZCFyw/bJogeMhbaRVGMKiishw7H6sd31ixWYbf8DabMiVTPOuzedJJ 68UYzRODqsrsokWAc8GfvvT8w1WymH3/D2pe8i7mLdah0ZtXoqXQy0ycnAF/wXr27j4J GrggtW7pBTWzpp4tnQ3wF/ZMKo9Xwf3wn1kgE2cctwKaMVf2NFxG73ISt5JO7SXatsWy ZmTrC5lqpe6W/UM0JAzFADFnhYweLFpiYwvSRF+OmY3WYCdHtu5ctVVRaTRBjGoNxrf1 X3tQ== X-Gm-Message-State: AOAM531+RRmbx0J04TET4IlppIHJM1AwyL3HC8VwHBqwrCkw9+Y0viuq UtvRF47zWowEu/0aqw9A98kRFXmcaKMwLw== X-Google-Smtp-Source: ABdhPJwST2frDyRLrRgOoo9PDj1wkLOtZmEB5C1tA3Gx6oYX4K+Zu8lsC0o3ud4yOL4OvNTYWhZQJQ== X-Received: by 2002:a05:6602:13c9:: with SMTP id o9mr1378008iov.40.1640181878335; Wed, 22 Dec 2021 06:04:38 -0800 (PST) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:1a9c:8b48:18a7:5add]) by smtp.gmail.com with ESMTPSA id f10sm1356030iob.7.2021.12.22.06.04.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Dec 2021 06:04:37 -0800 (PST) From: Adam Ford To: u-boot@lists.denx.de Cc: marex@denx.de, Adam Ford Subject: [PATCH] phy: nop-phy: Enable reset-gpios support Date: Wed, 22 Dec 2021 08:04:30 -0600 Message-Id: <20211222140430.166053-1-aford173@gmail.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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.2 at phobos.denx.de X-Virus-Status: Clean Some usb-nop-xceiv devices use a gpio to put them in and out of reset. Add a reset function to put them into that state. This is similar to how Linux handles the usb-nop-xceiv driver. Signed-off-by: Adam Ford diff --git a/drivers/phy/nop-phy.c b/drivers/phy/nop-phy.c index 9f12ebc062..be993a764f 100644 --- a/drivers/phy/nop-phy.c +++ b/drivers/phy/nop-phy.c @@ -10,11 +10,24 @@ #include #include #include +#include struct nop_phy_priv { struct clk_bulk bulk; + struct gpio_desc reset_gpio; }; +static int nop_phy_reset(struct phy *phy) +{ + struct nop_phy_priv *priv = dev_get_priv(phy->dev); + + /* Return if there is no gpio since it's optional */ + if (!dm_gpio_is_valid(&priv->reset_gpio)) + return 0; + + return dm_gpio_set_value(&priv->reset_gpio, false); +} + static int nop_phy_init(struct phy *phy) { struct nop_phy_priv *priv = dev_get_priv(phy->dev); @@ -22,7 +35,12 @@ static int nop_phy_init(struct phy *phy) if (CONFIG_IS_ENABLED(CLK)) return clk_enable_bulk(&priv->bulk); - return 0; + /* Return if there is no gpio since it's optional */ + if (!dm_gpio_is_valid(&priv->reset_gpio)) + return 0; + + /* If there is a reset gpio, take it out of reset */ + return dm_gpio_set_value(&priv->reset_gpio, true); } static int nop_phy_probe(struct udevice *dev) @@ -38,6 +56,12 @@ static int nop_phy_probe(struct udevice *dev) } } + ret = gpio_request_by_name(dev, "reset-gpios", 0, + &priv->reset_gpio, + GPIOD_IS_OUT); + if (ret != -ENOENT) + return ret; + return 0; } @@ -49,6 +73,7 @@ static const struct udevice_id nop_phy_ids[] = { static struct phy_ops nop_phy_ops = { .init = nop_phy_init, + .reset = nop_phy_reset, }; U_BOOT_DRIVER(nop_phy) = { -- 2.32.0