i2c: cadence: Fix regression with bus recovery
authorCarsten Haitzler <carsten.haitzler@arm.com>
Mon, 28 Nov 2022 10:51:58 +0000 (10:51 +0000)
committerWolfram Sang <wsa@kernel.org>
Thu, 1 Dec 2022 22:55:12 +0000 (23:55 +0100)
commit8bfd4ec726945cec35ee5cafebc1c55b83d5a9fb
tree3c5f384a8830a4ab2ff4951130543e1dea366927
parent79ece9b292af6b0edcfb4d67a00711d25507640b
i2c: cadence: Fix regression with bus recovery

Commit "i2c: cadence: Add standard bus recovery support" breaks for i2c
devices that have no pinctrl defined. There is no requirement for this
to exist in the DT. This has worked perfectly well without this before in
at least 1 real usage case on hardware (Mali Komeda DPU, Cadence i2c to
talk to a tda99xx phy). Adding the requirement to have pinctrl set up in
the device tree (or otherwise be found) is a regression where the whole
i2c device is lost entirely (in this case dropping entire devices which
then leads to the drm display stack unable to find the phy for display
output, thus having no drm display device and so on down the chain).

This converts the above commit to an enhancement if pinctrl can be found
for the i2c device, providing a timeout on read with recovery, but if not,
do what used to be done rather than a fatal loss of a device.

This restores the mentioned display devices to their working state again.

Fixes: 58b924241d0a ("i2c: cadence: Add standard bus recovery support")
Signed-off-by: Carsten Haitzler <carsten.haitzler@arm.com>
Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Reviewed-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Acked-by: Michal Simek <michal.simek@amd.com>
[wsa: added braces to else-branch]
Signed-off-by: Wolfram Sang <wsa@kernel.org>
drivers/i2c/busses/i2c-cadence.c