Skip to contentSkip to conversation

net: phy: tja11xx: Add TJA11xx PHY driver

PATCH Superseded Marek Vasut 2 participants 3 messages Jan 4, 2019

Subsystems (4)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: phy: tja11xx: Add TJA11xx PHY driver

Add driver for the NXP TJA1100 and TJA1101 PHYs. These PHYs are special BroadRReach 100BaseT1 PHYs used in automotive.

Cc Andrew Lunn <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Jean Delvare <[email protected]>

---
V2: - Use phy_modify(), phy_{set,clear}_bits()
- Drop enable argument of tja11xx_enable_link_control()
- Use PHY_BASIC_T1_FEATURES and dont modify supported/advertised features in config_init callback
- Use genphy_soft_reset() instead of opencoding the reset sequence.
- Drop the aneg parts, since the PHY datasheet claims it does not support aneg
V3: - Replace clr with mask
- Add hwmon support
- Check commstat in tja11xx_read_status() only if link is up
- Use PHY_ID_MATCH_MODEL()
V4: - Use correct bit in tja11xx_hwmon_read() hwmon_temp_crit_alarm
- Use ENOMEM if devm_kstrdup() fails
- Check $type in tja11xx_hwmon_read() in addition to $attr

---
 drivers/net/phy/Kconfig       |   6 +
 drivers/net/phy/Makefile      |   1 +
 drivers/net/phy/nxp-tja11xx.c | 426 ++++++++++++++++++++++++++++++++++
 3 files changed, 433 insertions(+)
 create mode 100644 drivers/net/phy/nxp-tja11xx.c
drivers/net/phy/Kconfig +6 -0
index 3d187cd50eb0..88b462ef1274 100644
@@ -389,6 +389,12 @@ config NATIONAL_PHY
 	---help---
 	  Currently supports the DP83865 PHY.
 
+config NXP_TJA11XX_PHY
+	tristate "NXP TJA11xx PHYs support"
+	depends on HWMON
+	---help---
+	  Currently supports the NXP TJA1100 and TJA1101 PHY.
+
 config QSEMI_PHY
 	tristate "Quality Semiconductor PHYs"
 	---help---
drivers/net/phy/Makefile +1 -0
index 5805c0b7d60e..023e5db8c7cc 100644
@@ -76,6 +76,7 @@ obj-$(CONFIG_MICROCHIP_PHY)	+= microchip.o
 obj-$(CONFIG_MICROCHIP_T1_PHY)	+= microchip_t1.o
 obj-$(CONFIG_MICROSEMI_PHY)	+= mscc.o
 obj-$(CONFIG_NATIONAL_PHY)	+= national.o
+obj-$(CONFIG_NXP_TJA11XX_PHY)	+= nxp-tja11xx.o
 obj-$(CONFIG_QSEMI_PHY)		+= qsemi.o
 obj-$(CONFIG_REALTEK_PHY)	+= realtek.o
 obj-$(CONFIG_RENESAS_PHY)	+= uPD60620.o
drivers/net/phy/nxp-tja11xx.c new file +426 -0

426 lines not on this page · raw message

Signature · 1 line
2.19.2
#1 lore raw
Quoted 26 lines · Marek Vasut

Add driver for the NXP TJA1100 and TJA1101 PHYs. These PHYs are special BroadRReach 100BaseT1 PHYs used in automotive.

Cc Andrew Lunn <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Jean Delvare <[email protected]>

---
V2: - Use phy_modify(), phy_{set,clear}_bits()
- Drop enable argument of tja11xx_enable_link_control()
- Use PHY_BASIC_T1_FEATURES and dont modify supported/advertised features in config_init callback
- Use genphy_soft_reset() instead of opencoding the reset sequence.
- Drop the aneg parts, since the PHY datasheet claims it does not support aneg
V3: - Replace clr with mask
- Add hwmon support
- Check commstat in tja11xx_read_status() only if link is up
- Use PHY_ID_MATCH_MODEL()
V4: - Use correct bit in tja11xx_hwmon_read() hwmon_temp_crit_alarm
- Use ENOMEM if devm_kstrdup() fails
- Check $type in tja11xx_hwmon_read() in addition to $attr
---

[Snip]

drivers/net/phy/nxp-tja11xx.c line 178

Quoted 5 lines
drivers/net/phy/nxp-tja11xx.c new file +5 -0
+	ret = tja11xx_enable_reg_write(phydev);
+	if (ret)
+		return ret;
+
+	phydev->irq = PHY_POLL;

The PHY driver should not be imposing that, leave it up to the platform configuration to set that.

drivers/net/phy/nxp-tja11xx.c line 183

Quoted 5 lines
drivers/net/phy/nxp-tja11xx.c new file +5 -0
+	phydev->autoneg = AUTONEG_DISABLE;
+	phydev->speed = SPEED_100;
+	phydev->duplex = DUPLEX_FULL;
+	phydev->pause = 0;
+	phydev->asym_pause = 0;

Are any of those necessary if you set basic T1 features?

Everything else looks good to me. Thanks!

Signature · 1 line
Florian
#2 lore raw
Quoted 32 lines · Florian Fainelli
Quoted 26 lines · Marek Vasut

Add driver for the NXP TJA1100 and TJA1101 PHYs. These PHYs are special BroadRReach 100BaseT1 PHYs used in automotive.

Cc Andrew Lunn <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc Guenter Roeck <[email protected]>
Cc Heiner Kallweit <[email protected]>
Cc Jean Delvare <[email protected]>

---
V2: - Use phy_modify(), phy_{set,clear}_bits()
- Drop enable argument of tja11xx_enable_link_control()
- Use PHY_BASIC_T1_FEATURES and dont modify supported/advertised features in config_init callback
- Use genphy_soft_reset() instead of opencoding the reset sequence.
- Drop the aneg parts, since the PHY datasheet claims it does not support aneg
V3: - Replace clr with mask
- Add hwmon support
- Check commstat in tja11xx_read_status() only if link is up
- Use PHY_ID_MATCH_MODEL()
V4: - Use correct bit in tja11xx_hwmon_read() hwmon_temp_crit_alarm
- Use ENOMEM if devm_kstrdup() fails
- Check $type in tja11xx_hwmon_read() in addition to $attr
---

[Snip]

Quoted 7 lines

drivers/net/phy/nxp-tja11xx.c line 178

Quoted 5 lines
drivers/net/phy/nxp-tja11xx.c new file +5 -0
+	ret = tja11xx_enable_reg_write(phydev);
+	if (ret)
+		return ret;
+
+	phydev->irq = PHY_POLL;

The PHY driver should not be imposing that, leave it up to the platform configuration to set that.

OK

Quoted 7 lines

drivers/net/phy/nxp-tja11xx.c line 183

Quoted 5 lines
drivers/net/phy/nxp-tja11xx.c new file +5 -0
+	phydev->autoneg = AUTONEG_DISABLE;
+	phydev->speed = SPEED_100;
+	phydev->duplex = DUPLEX_FULL;
+	phydev->pause = 0;
+	phydev->asym_pause = 0;

Are any of those necessary if you set basic T1 features?

autoneg, speed and duplex need to be set, the rest can be left as defaults. Shall I drop those (pause, asym_pause) ?

Quoted 2 lines

Everything else looks good to me. Thanks!

Signature · 2 lines
Best regards,
Marek Vasut