m7621 i2c read failure

Peter Naulls peter at chocky.org
Wed Feb 15 10:31:55 PST 2023


I'm trying to track yet another vendor vs current OpenWrt driver mishandling.

In my vendor kernel:

[    2.243263] i2c-mt7621 1e000900.i2c: clock 100KHz, re-start not support

Which is this driver:


* drivers/i2c/busses/i2c-mt7621.c
*
* Copyright (C) 2013 Steven Liu <steven_liu at mediatek.com>
* Copyright (C) 2016 Michael Lee <igvtee at gmail.com>
*
* Improve driver for i2cdetect from i2c-tools to detect i2c devices on the bus.
* (C) 2014 Sittisak <sittisaks at hotmail.com>

This is kernel 4.14.131

Which of course works fine.

In 5.10 and 5.15 current OpenWrt kernels:


[    2.917685] i2c-mt7621 1e000900.i2c: clock 100 kHz


Writes work correctly. This for example sets LEDs via i2c (handled by the MCU 
and its GPIOs - I control this code too):


# i2ctransfer -y 0 w1 at 0x50 0x43 w3 3 2 1
Wed Feb 15 18:23:01 2023 kern.debug kernel: [  307.979880] i2c i2c-0: ioctl, 
cmd=0x705, arg=0x7fb736f0
Wed Feb 15 18:23:01 2023 kern.debug kernel: [  307.979927] i2c i2c-0: ioctl, 
cmd=0x703, arg=0x50
Wed Feb 15 18:23:01 2023 kern.debug kernel: [  307.979954] i2c i2c-0: ioctl, 
cmd=0x707, arg=0x7fb736f0


# i2ctransfer -y 0 w1 at 0x50 1 r1
Wed Feb 15 18:23:04 2023 kern.debug kernel: [  310.921389] i2c i2c-0: ioctl, 
cmd=0x705, arg=0x7febfd60
Wed Feb 15 18:23:04 2023 kern.debug kernel: [  310.921437] i2c i2c-0: ioctl, 
cmd=0x703, arg=0x50
Wed Feb 15 18:23:04 2023 kern.debug kernel: [  310.921463] i2c i2c-0: ioctl, 
cmd=0x707, arg=0x7febfd60
0x03
# i2ctransfer -y 0 w1 at 0x50 1 r1
Wed Feb 15 18:23:06 2023 kern.debug kernel: [  312.714856] i2c i2c-0: ioctl, 
cmd=0x705, arg=0x7feaf3e0
Wed Feb 15 18:23:06 2023 kern.debug kernel: [  312.714903] i2c i2c-0: ioctl, 
cmd=0x703, arg=0x50
Wed Feb 15 18:23:06 2023 kern.debug kernel: [  312.714928] i2c i2c-0: ioctl, 
cmd=0x707, arg=0x7feaf3e0
0x00

In particular, for the first read attempt, the value is always the first
value sent as part of the last write. i.e, 3 in this case. After, that,
it's always 0 (the correct answer ought to be 0xf).

Clues where to look please?











More information about the openwrt-devel mailing list