Skip to contentSkip to conversation

net: pse-pd: tps23881: Fix the device ID check

PATCH In review Kyle Swenson 5 participants 6 messages Jul 31, 2024 – Aug 14, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: pse-pd: tps23881: Fix the device ID check

The DEVID register contains two pieces of information: the device ID in the upper nibble, and the silicon revision number in the lower nibble. The driver should work fine with any silicon revision, so let's mask that out in the device ID check.

Fixes 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")

---
v2:
- Use FIELD_GET and defines instead of raw numbers

v1: https://lore.kernel.org/netdev/[email protected]/

 drivers/net/pse-pd/tps23881.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/pse-pd/tps23881.c +3 -1
index 61f6ad9c1934..f90db758554b 100644
@@ -27,10 +27,12 @@
 #define TPS23881_REG_PORT_POWER	0x29
 #define TPS23881_REG_POEPLUS	0x40
 #define TPS23881_REG_TPON	BIT(0)
 #define TPS23881_REG_FWREV	0x41
 #define TPS23881_REG_DEVID	0x43
+#define TPS23881_REG_DEVID_MASK	0xF0
+#define TPS23881_DEVICE_ID	0x02
 #define TPS23881_REG_SRAM_CTRL	0x60
 #define TPS23881_REG_SRAM_DATA	0x61
 
 struct tps23881_port_desc {
 	u8 chan[2];
@@ -748,11 +750,11 @@ static int tps23881_i2c_probe(struct i2c_client *client)
 
 	ret = i2c_smbus_read_byte_data(client, TPS23881_REG_DEVID);
 	if (ret < 0)
 		return ret;
 
-	if (ret != 0x22) {
+	if (FIELD_GET(TPS23881_REG_DEVID_MASK, ret) != TPS23881_DEVICE_ID) {
 		dev_err(dev, "Wrong device ID\n");
 		return -ENXIO;
 	}
 
 	ret = tps23881_flash_sram_fw(client);
Signature · 1 line
2.43.0
Reviewed-by on v2 1/1
#1 lore raw
Quoted 7 lines · On Wed, 31 Jul 2024 15:42:14 +0000 Kyle Swenson <[email protected]> wrote:

The DEVID register contains two pieces of information: the device ID in the upper nibble, and the silicon revision number in the lower nibble. The driver should work fine with any silicon revision, so let's mask that out in the device ID check.

Fixes 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")

Thanks for the change!

Signature · 3 lines
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
maintainer Acked-by on v2 1/1
#2 lore raw
In reply to Kyle Swenson
Quoted 7 lines · Kyle Swenson

The DEVID register contains two pieces of information: the device ID in the upper nibble, and the silicon revision number in the lower nibble. The driver should work fine with any silicon revision, so let's mask that out in the device ID check.

Fixes 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")

Thank you!

Signature · 4 lines
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 |
maintainer Reviewed-by on v2 1/1
#3 lore raw
In reply to Kyle Swenson
Quoted 7 lines · On Wed, 31 Jul 2024 15:42:14 +0000 Kyle Swenson <[email protected]> wrote:

The DEVID register contains two pieces of information: the device ID in the upper nibble, and the silicon revision number in the lower nibble. The driver should work fine with any silicon revision, so let's mask that out in the device ID check.

Fixes 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")

Hello Kyle,

In net subsystem when you send a fix you should use net prefix instead of net-next. Jakub, does Kyle have to send a new patch or can you deal with it?

Thanks for your fix!

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
maintainer
#4 lore raw
Quoted 10 lines · On Sat, 10 Aug 2024 23:45:56 +0200 Kory Maincent wrote:
Quoted 7 lines

The DEVID register contains two pieces of information: the device ID in the upper nibble, and the silicon revision number in the lower nibble. The driver should work fine with any silicon revision, so let's mask that out in the device ID check.

Fixes 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")

Hello Kyle,

Quoted 7 lines

In net subsystem when you send a fix you should use net prefix instead of net-next. Jakub, does Kyle have to send a new patch or can you deal with it?

Thanks for your fix!

Ah, I'm pretty sure I already applied this. kernel.org infra has been quite unreliable lately. Commit 89108cb5c285 ("net: pse-pd: tps23881:
Fix the device ID check"), indeed in net.

maintainer
#5 lore raw
Quoted 15 lines · On Mon, 12 Aug 2024 08:41:59 -0700 Jakub Kicinski <[email protected]> wrote:
Quoted 14 lines · On Sat, 10 Aug 2024 23:45:56 +0200 Kory Maincent wrote:
Quoted 7 lines

The DEVID register contains two pieces of information: the device ID in the upper nibble, and the silicon revision number in the lower nibble. The driver should work fine with any silicon revision, so let's mask that out in the device ID check.

Fixes 20e6d190ffe1 ("net: pse-pd: Add TI TPS23881 PSE controller driver")

Hello Kyle,

In net subsystem when you send a fix you should use net prefix instead of net-next. Jakub, does Kyle have to send a new patch or can you deal with it?

Quoted 7 lines
Quoted 3 lines

Thanks for your fix!

Ah, I'm pretty sure I already applied this. kernel.org infra has been quite unreliable lately. Commit 89108cb5c285 ("net: pse-pd: tps23881:
Fix the device ID check"), indeed in net.

Ah right, thanks! I didn't received the merged notification email. Sorry for the useless noise!

Regards,

Signature · 3 lines
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com