[PATCH v6 2/2] phy: add basic support for NXPs TJA1145 CAN transceiver
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Jun 2 01:38:56 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] If setting the CAN operating mode fails during `tja1145_phy_power_on`, the PHY hardware is left in normal operating mode without rolling back to standby mode.
--
commit 4b999361552fc4af356fbf9fbd3b1ca5f2dd59bf
Author: Dimitri Fedrau <dimitri.fedrau at liebherr.com>
phy: add basic support for NXPs TJA1145 CAN transceiver
This commit adds basic driver support for the NXP TJA1145 CAN transceiver.
It enables bringing the PHY up or down by switching between normal and
standby modes using SPI commands.
> diff --git a/drivers/phy/phy-nxp-tja1145.c b/drivers/phy/phy-nxp-tja1145.c
> new file mode 100644
> index 0000000000000..1e8bd169743ab
> --- /dev/null
> +++ b/drivers/phy/phy-nxp-tja1145.c
[ ... ]
> +static int tja1145_phy_power_on(struct phy *phy)
> +{
> + struct regmap *map = phy_get_drvdata(phy);
> + int ret;
> +
> + /*
> + * Switch operating mode to normal which is the active operating mode.
> + * In this mode, the device is fully operational.
> + */
> + ret = regmap_update_bits(map, TJA1145_MODE_CTRL, TJA1145_MODE_CTRL_MC,
> + TJA1145_MODE_CTRL_NORMAL);
> + if (ret)
> + return ret;
> +
> + /*
> + * Switch to CAN operating mode active where the PHY can transmit and
> + * receive data.
> + */
> + return regmap_update_bits(map, TJA1145_CAN_CTRL, TJA1145_CAN_CTRL_CMC,
> + TJA1145_CAN_CTRL_ACTIVE);
> +}
[Severity: Medium]
If the second regmap_update_bits call fails to set TJA1145_CAN_CTRL, does
this leave the hardware in normal mode without reverting to standby?
Because tja1145_phy_power_on would return an error here, the PHY framework
will not consider the PHY powered on and will not invoke
tja1145_phy_power_off later. Could this result in the hardware being
permanently left in a higher-power state?
Should the driver intercept this error and attempt to roll back
TJA1145_MODE_CTRL to TJA1145_MODE_CTRL_STBY before returning?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260602-tja1145-support-v6-0-0e0ffc8ee63d@liebherr.com?part=2
More information about the linux-phy
mailing list