From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Kyle Swenson <kyle.swenson@est.tech>
Cc: "kory.maincent@bootlin.com" <kory.maincent@bootlin.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"robh@kernel.org" <robh@kernel.org>,
"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
"conor+dt@kernel.org" <conor+dt@kernel.org>,
"thomas.petazzoni@bootlin.com" <thomas.petazzoni@bootlin.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>
Subject: Re: [PATCH net-next 2/2] net: pse-pd: tps23881: support reset-gpios
Date: Tue, 20 Aug 2024 08:23:58 +0200 [thread overview]
Message-ID: <ZsQ2fuqWkMYwq_kh@pengutronix.de> (raw)
In-Reply-To: <20240819190151.93253-3-kyle.swenson@est.tech>
Hi Kyle,
thank you for you patch.
On Mon, Aug 19, 2024 at 07:02:14PM +0000, Kyle Swenson wrote:
> The TPS23880/1 has an active-low reset pin that some boards connect to
> the SoC to control when the TPS23880 is pulled out of reset.
>
> Add support for this via a reset-gpios property in the DTS.
>
> Signed-off-by: Kyle Swenson <kyle.swenson@est.tech>
> ---
> drivers/net/pse-pd/tps23881.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/pse-pd/tps23881.c b/drivers/net/pse-pd/tps23881.c
> index 2ea75686a319..837e1a2119ee 100644
> --- a/drivers/net/pse-pd/tps23881.c
> +++ b/drivers/net/pse-pd/tps23881.c
> @@ -6,16 +6,16 @@
> */
>
> #include <linux/bitfield.h>
> #include <linux/delay.h>
> #include <linux/firmware.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/i2c.h>
> #include <linux/module.h>
> #include <linux/of.h>
> #include <linux/platform_device.h>
> #include <linux/pse-pd/pse.h>
> -
No need to remove space here.
> #define TPS23881_MAX_CHANS 8
>
> #define TPS23881_REG_PW_STATUS 0x10
> #define TPS23881_REG_OP_MODE 0x12
> #define TPS23881_OP_MODE_SEMIAUTO 0xaaaa
> @@ -735,10 +735,11 @@ static int tps23881_flash_sram_fw(struct i2c_client *client)
>
> static int tps23881_i2c_probe(struct i2c_client *client)
> {
> struct device *dev = &client->dev;
> struct tps23881_priv *priv;
> + struct gpio_desc *reset;
> int ret;
> u8 val;
>
> if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> dev_err(dev, "i2c check functionality failed\n");
> @@ -747,10 +748,20 @@ static int tps23881_i2c_probe(struct i2c_client *client)
>
> priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> if (!priv)
> return -ENOMEM;
>
> + reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> + if (IS_ERR(reset))
> + return dev_err_probe(&client->dev, PTR_ERR(reset), "Failed to get reset GPIO\n");
> +
> + if (reset) {
> + usleep_range(1000, 10000);
> + gpiod_set_value_cansleep(reset, 0); /* De-assert reset */
> + usleep_range(1000, 10000);
According to the datasheet, page 13:
https://www.ti.com/lit/ds/symlink/tps23880.pdf
Minimal reset time is 5 microseconds and the delay after power on reset should
be at least 20 milliseconds. Both sleep values should be corrected.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2024-08-20 6:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-19 19:02 [PATCH net-next 0/2] net: pse-pd: tps23881: Reset GPIO support Kyle Swenson
2024-08-19 19:02 ` [PATCH net-next 1/2] dt-bindings: net: pse-pd: tps23881: add reset-gpios Kyle Swenson
2024-08-20 7:50 ` Krzysztof Kozlowski
2024-08-19 19:02 ` [PATCH net-next 2/2] net: pse-pd: tps23881: support reset-gpios Kyle Swenson
2024-08-20 6:23 ` Oleksij Rempel [this message]
2024-08-20 21:06 ` Kyle Swenson
2024-08-20 21:11 ` Kyle Swenson
2024-08-21 4:45 ` Oleksij Rempel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZsQ2fuqWkMYwq_kh@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=kory.maincent@bootlin.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=kyle.swenson@est.tech \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).