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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23D88C433F5 for ; Mon, 4 Oct 2021 00:24:44 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 39BCD61351 for ; Mon, 4 Oct 2021 00:24:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 39BCD61351 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B01DD83461; Mon, 4 Oct 2021 02:24:34 +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="hZW/mYko"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 442F2834AD; Mon, 4 Oct 2021 02:24:29 +0200 (CEST) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) (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 5DAF183461 for ; Mon, 4 Oct 2021 02:24:18 +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=aford173@gmail.com Received: by mail-io1-xd29.google.com with SMTP id b78so18349075iof.2 for ; Sun, 03 Oct 2021 17:24:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aREXnez48iQqouj/ta133d3qe5obmfVzJRPNGSlbWsQ=; b=hZW/mYkoErMK1/y7sF8X5MoNuy3il+N5lyjigQcpYDFqgfQGuhFIQWBMV8wd6iDgCn iFNofpbcK5AV1nkFC1/C1K05kM8gGZqytTXUevXVslTCMnUnXkS1xpYcIeXiL/8SJByq WIDWtvf7k/CcqMBfBrWjPGbrJU6Hl8jCjTKquFBH7ZnYYo/gJTr9/l9PDUTmlIM63MYo p9l+BXZKow5baeaB8TR552X17BEFUJSRmdmo00IcWBJvhOWqxZ/Ni+h4VL7kkB61BQYW rokWF/5yCPDhvZafivSGMIhrzzQZAUIWNzwZ3P1rEppFBKYWRTq84BQqqwqP3CylM/YH MnyA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=aREXnez48iQqouj/ta133d3qe5obmfVzJRPNGSlbWsQ=; b=hab4qSmQJsKKRniVtfUK7mFb+gqVcopzZSFMQeDra2EBdgVtpCjhSerUq61a+lBWYi oaR7/o4yPDuDYRw/Do0Pl4/cHD9X5Nyv6Xb8dxBa/C2S4rOgsIjxwSDWWAI2KUQ12Hwv tc9AzGzMMx1FDzqM9HtQMc+Y3VaVG/hAXKzoAVD4th7R6vkPdnSwPpid0YBriSPLOsZ3 xE5TSpVRbX8e3y3+Lt0ZZWag6v/bsSgVywI7WMuwwZClswC5DjnStuK4p5s31cZubbxh ejnSQpEtY9E085QlUs+6ZiMNyM+vOq65BK9b/cI2+HUwfP6uTO7XCQbrWC2qK7w50xXe C2bg== X-Gm-Message-State: AOAM530PRrbO2LGFk6s4HzK99GpFofKySBvhAt9326NxTpEWGIl3qRf1 hWDm1An+SvbplRQBt1ayub6Vx7DAoZg= X-Google-Smtp-Source: ABdhPJz5PJCzoRjey9s7H9wHUxwbrfqtlGHTIp2uPgBQBPhsl9o8hXOQKKCS4/iso0t2l9B/tK0SOg== X-Received: by 2002:a05:6638:2654:: with SMTP id n20mr8530924jat.6.1633307056565; Sun, 03 Oct 2021 17:24:16 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan ([2601:448:8400:9e8:cc4e:ab52:cc12:32be]) by smtp.gmail.com with ESMTPSA id v14sm4687236iln.23.2021.10.03.17.24.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 17:24:16 -0700 (PDT) From: Adam Ford To: u-boot@lists.denx.de Cc: lokeshvutla@ti.com, marex@denx.de, sjg@chromium.org, woods.technical@gmail.com, Adam Ford Subject: [RFC 2/3] phy: nop-phy: Enable reset-gpios support Date: Sun, 3 Oct 2021 19:24:06 -0500 Message-Id: <20211004002407.464910-2-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211004002407.464910-1-aford173@gmail.com> References: <20211004002407.464910-1-aford173@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.103.2 at phobos.denx.de X-Virus-Status: Clean Some usb-nop-xceiv devices use a gpio to put them in reset. Add a reset function to put them into that state, and have the init function take them out of reset 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.25.1