Skip to content

Commit 73b22ba

Browse files
committed
Merge branch 'net-pse-pd-tps23881-reset-gpio-support'
Kyle Swenson says: ==================== net: pse-pd: tps23881: Reset GPIO support On some boards, the TPS2388x's reset line (active low) is pulled low to keep the chip in reset until the SoC pulls the device out of reset. This series updates the device-tree binding for the tps23881 and then adds support for the reset gpio handling in the tps23881 driver. v1: https://lore.kernel.org/[email protected] ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents d2ab3bb + 69f47ca commit 73b22ba

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Documentation/devicetree/bindings/net/pse-pd/ti,tps23881.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ properties:
2323
'#pse-cells':
2424
const: 1
2525

26+
reset-gpios:
27+
maxItems: 1
28+
2629
channels:
2730
description: each set of 8 ports can be assigned to one physical
2831
channels or two for PoE4. This parameter describes the configuration

drivers/net/pse-pd/tps23881.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <linux/bitfield.h>
99
#include <linux/delay.h>
1010
#include <linux/firmware.h>
11+
#include <linux/gpio/consumer.h>
1112
#include <linux/i2c.h>
1213
#include <linux/module.h>
1314
#include <linux/of.h>
@@ -737,6 +738,7 @@ static int tps23881_i2c_probe(struct i2c_client *client)
737738
{
738739
struct device *dev = &client->dev;
739740
struct tps23881_priv *priv;
741+
struct gpio_desc *reset;
740742
int ret;
741743
u8 val;
742744

@@ -749,6 +751,25 @@ static int tps23881_i2c_probe(struct i2c_client *client)
749751
if (!priv)
750752
return -ENOMEM;
751753

754+
reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
755+
if (IS_ERR(reset))
756+
return dev_err_probe(&client->dev, PTR_ERR(reset), "Failed to get reset GPIO\n");
757+
758+
if (reset) {
759+
/* TPS23880 datasheet (Rev G) indicates minimum reset pulse is 5us */
760+
usleep_range(5, 10);
761+
gpiod_set_value_cansleep(reset, 0); /* De-assert reset */
762+
763+
/* TPS23880 datasheet indicates the minimum time after power on reset
764+
* should be 20ms, but the document describing how to load SRAM ("How
765+
* to Load TPS2388x SRAM and Parity Code over I2C" (Rev E))
766+
* indicates we should delay that programming by at least 50ms. So
767+
* we'll wait the entire 50ms here to ensure we're safe to go to the
768+
* SRAM loading proceedure.
769+
*/
770+
msleep(50);
771+
}
772+
752773
ret = i2c_smbus_read_byte_data(client, TPS23881_REG_DEVID);
753774
if (ret < 0)
754775
return ret;

0 commit comments

Comments
 (0)