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 8DB69C433F5 for ; Fri, 14 Jan 2022 19:36:49 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EC5DA83478; Fri, 14 Jan 2022 20:36:46 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="iHtPUu8v"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 21C9583496; Fri, 14 Jan 2022 20:36:45 +0100 (CET) Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) (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 3133083478 for ; Fri, 14 Jan 2022 20:36:42 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x732.google.com with SMTP id o135so995806qke.8 for ; Fri, 14 Jan 2022 11:36:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=E58Kaq2HWh3jUHE3wMGPnb/u5yHWqq0NgqBKT1lhbXE=; b=iHtPUu8vlxIMPSDjncBt6Do6BORhox0o2A9sFhRH2Jl9MRs0itw9HA4Rc6Hqc3kJUH kl4V+0esElKD4GDjbAYRGWYZzJyLxuMofHbIXRTYJw5B5Y+azcuagYDAcpXUE235iuLd GEsWxrCpo/Y03c5slphNpvP3zLWyaONdhk7O0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=E58Kaq2HWh3jUHE3wMGPnb/u5yHWqq0NgqBKT1lhbXE=; b=caBGEb6391X8U0kMm+riHUrDdLpuVcX2vFiqpHcGq0PTkcTrYcLLcAnC4n/YAFRh6R XJ6+KYLFhkHiYliLVGfXVgs4DMRkKfKyDwgKoza+iSqtNTdrfrSSsfB4vIBCkvFzbpLi reDaZ9mLCWuraOFDCxihJ0hSUzeBFOHLZ6rRkeP0e5atlL9UkxIzHH/9AePgb7H6l/Z4 hzgiFFsjd4jiU0Cw7cDgBfX7XhWU1ExUKMtXw8VYHJmq8fPB6UD83an8OlaHw8nrRit/ 2qMCuDctpWZeEP9V1cbqi9E5UbGA8bM+pQTf6pEXmP6b4mk073hR3xZWV48wOBf6RQ5u kwfA== X-Gm-Message-State: AOAM530fWByzkq6SoIFIUiCLRvhb93xSvR3j/TyK5ONfbHU0iuH4pMYO W9ONKgfJK+2hPh4DiKGngxhbbw== X-Google-Smtp-Source: ABdhPJwzR7ZyXN1fBb20GbP/Sh3/C2GxUjf8qeN19gp4Oz785lQmnoYEZ11PnCzOg9EP/UAYMLSsfw== X-Received: by 2002:a05:620a:454b:: with SMTP id u11mr7335305qkp.554.1642189000700; Fri, 14 Jan 2022 11:36:40 -0800 (PST) Received: from bill-the-cat (2603-6081-7b01-cbda-9533-0c51-a891-732b.res6.spectrum.com. [2603:6081:7b01:cbda:9533:c51:a891:732b]) by smtp.gmail.com with ESMTPSA id l1sm2021481qtp.21.2022.01.14.11.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jan 2022 11:36:40 -0800 (PST) Date: Fri, 14 Jan 2022 14:36:38 -0500 From: Tom Rini To: Adam Ford Cc: u-boot@lists.denx.de, marex@denx.de Subject: Re: [PATCH] phy: nop-phy: Enable reset-gpios support Message-ID: <20220114193638.GA1834160@bill-the-cat> References: <20211222140430.166053-1-aford173@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="IJpNTDwzlM2Ie8A6" Content-Disposition: inline In-Reply-To: <20211222140430.166053-1-aford173@gmail.com> X-Clacks-Overhead: GNU Terry Pratchett 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.2 at phobos.denx.de X-Virus-Status: Clean --IJpNTDwzlM2Ie8A6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Dec 22, 2021 at 08:04:30AM -0600, Adam Ford wrote: > 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. >=20 > Signed-off-by: Adam Ford >=20 > 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 > =20 > struct nop_phy_priv { > struct clk_bulk bulk; > + struct gpio_desc reset_gpio; > }; > =20 > +static int nop_phy_reset(struct phy *phy) > +{ > + struct nop_phy_priv *priv =3D 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 =3D 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); > =20 > - 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); > } > =20 > static int nop_phy_probe(struct udevice *dev) > @@ -38,6 +56,12 @@ static int nop_phy_probe(struct udevice *dev) > } > } > =20 > + ret =3D gpio_request_by_name(dev, "reset-gpios", 0, > + &priv->reset_gpio, > + GPIOD_IS_OUT); > + if (ret !=3D -ENOENT) > + return ret; > + > return 0; > } > =20 > @@ -49,6 +73,7 @@ static const struct udevice_id nop_phy_ids[] =3D { > =20 > static struct phy_ops nop_phy_ops =3D { > .init =3D nop_phy_init, > + .reset =3D nop_phy_reset, > }; > =20 > U_BOOT_DRIVER(nop_phy) =3D { This breaks: k2e_evm k2e_hs_evm k2g_evm k2g_hs_evm k2hk_evm k2hk_hs_evm k2l_evm k2l_hs_evm with: arm: + k2g_hs_evm +(k2g_hs_evm) arm-linux-gnueabi-ld.bfd: drivers/phy/nop-phy.o: in function = `nop_phy_reset': +(k2g_hs_evm) drivers/phy/nop-phy.c:28: undefined reference to `dm_gpio_set= _value' +(k2g_hs_evm) arm-linux-gnueabi-ld.bfd: drivers/phy/nop-phy.o: in function = `nop_phy_init': +(k2g_hs_evm) drivers/phy/nop-phy.c:43: undefined reference to `dm_gpio_set= _value' +(k2g_hs_evm) arm-linux-gnueabi-ld.bfd: drivers/phy/nop-phy.o: in function = `nop_phy_probe': +(k2g_hs_evm) drivers/phy/nop-phy.c:59: undefined reference to `gpio_reques= t_by_name' +(k2g_hs_evm) make[1]: *** [Makefile:1799: u-boot] Error 1 +(k2g_hs_evm) make: *** [Makefile:177: sub-make] Error 2 And yes, DM_GPIO is not set on these boards, so likely some of the above needs to be #ifdef'd. Thanks! --=20 Tom --IJpNTDwzlM2Ie8A6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmHh0MMACgkQFHw5/5Y0 tyyYbAv/bE0FebfouJjKwKSfIhrGZA12O/VOZiMKZQAZ91c0wWzMvieaR0iX0jPb hFGUDZzw54UgwdcsIqbqUFAxrU0hwn0a+nSbyJWEoGIpZosrITAzcetZrpc+LlNI tjdL9AxRsNLVxP2+w3yiZErELod+g2Ll8VFrPCsN5GVGzuBpiY1/n/uL+eVOvsrh +X2MTf7rkSk9vjtYMJlhSQAEtBIX9KkKSv7ludpR2ISz+WUQSHhMPJi+3R0wJcd1 Xc6SImZBvo6wdow4IUuTKC1sr7+bgdpEF840yarWPXJNNh4+/LBnuKZmzaKMo8MQ AdEKlaD/3VTKSVls6kap0l6PB3+V1KL0q3327nwjd0AUh/3+yZaEAjWKHwy8+Aml q8ePmk81Eeh5pZdPDqrOZ0Ftpuo1DsEepdkwaTIYRL2rzfwueEBHF2wMLuL1bttB vE2/vEQNqhxvDOQWACIPKuId9RuZxOOXQlRRSouTYevn/1Yj2DxstUNZoieVHXSD p4AJdY1l =j1gf -----END PGP SIGNATURE----- --IJpNTDwzlM2Ie8A6--