Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I2C issues with 5.4 + TC358743 #3602

Closed
mdevaev opened this issue May 6, 2020 · 115 comments
Closed

I2C issues with 5.4 + TC358743 #3602

mdevaev opened this issue May 6, 2020 · 115 comments

Comments

@mdevaev
Copy link
Contributor

mdevaev commented May 6, 2020

Describe the bug
After updating the kernel from version 4.19.118 to 5.4.35 an attempt to get an image from the tc358743 device twice in a row (reopen device file) results to I2C timeouts. In some cases, this leads to a hang (see log1), sometimes it causes errors when working with the MMC card and a reboot (see log2).

UPD: The first message was not entirely accurate. The problem occur when the first reading process is interrupted. That is, I run yavta, press Ctrl+C and immediately got a dead kernel. I played around with yavta a bit and found out that the problem occurs either when closing /dev/video0 or when executing ioctl VIDIOC_STREAMOFF. I think the tc358743 driver is trying to command something over I2C, and everything stops working.

/UPD

[   79.678547] ------------[ cut here ]------------
[   79.678554] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   79.678569] tc358743 10-000f: i2c_wr: writing register 0x4 from 0xf failed
[   79.683241] WARNING: CPU: 3 PID: 34 at drivers/firmware/raspberrypi.c:63 rpi_firmware_transaction+0xe8/0x124
[   79.705713] Firmware transaction timeout
[   79.705715] Modules linked in: usb_f_mass_storage usb_f_hid usb_f_acm u_serial btsdio bluetooth ecdh_generic ecc brcmfmac brcmutil cfg80211 raspberrypi_hwmon hwmon i2c_mux_pinctrl i2c_mux bcm2835_unicam i2c_bcm2835 iproc_rng200 rng_core bcm2835_codec(C) bcm2835_v4l2(C) bcm2835_isp(C) bcm2835_mmal_vchiq(C) v4l2_mem2mem videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops videobuf2_v4l2 videobuf2_common rpivid_mem uio_pdrv_genirq uio sch_fq_codel snd_bcm2835(C) snd_pcm snd_timer snd tc358743 v4l2_dv_timings v4l2_fwnode videodev mc cec libcomposite dwc2 udc_core drm drm_panel_orientation_quirks ip_tables x_tables ipv6 nf_defrag_ipv6
[   79.766074] CPU: 3 PID: 34 Comm: kworker/3:1 Tainted: G         C        5.4.35-1-ARCH #1
[   79.774292] Hardware name: BCM2711
[   79.777717] Workqueue: events dbs_work_handler
[   79.782192] [<c0211424>] (unwind_backtrace) from [<c020c6fc>] (show_stack+0x10/0x14)
[   79.789977] [<c020c6fc>] (show_stack) from [<c0ccc638>] (dump_stack+0x94/0xb4)
[   79.806238] [<c0ccc638>] (dump_stack) from [<c022ceb8>] (__warn+0xd0/0xf8)
[   79.817766] [<c022ceb8>] (__warn) from [<c022d29c>] (warn_slowpath_fmt+0x98/0xc4)
[   79.834301] [<c022d29c>] (warn_slowpath_fmt) from [<c0b36468>] (rpi_firmware_transaction+0xe8/0x124)
[   79.852463] [<c0b36468>] (rpi_firmware_transaction) from [<c0b36550>] (rpi_firmware_property_list+0xac/0x168)
[   79.871582] [<c0b36550>] (rpi_firmware_property_list) from [<c0b3666c>] (rpi_firmware_property+0x60/0x108)
[   79.890551] [<c0b3666c>] (rpi_firmware_property) from [<c0928494>] (raspberrypi_clock_property+0x48/0x78)
[   79.909488] [<c0928494>] (raspberrypi_clock_property) from [<c09285f8>] (raspberrypi_fw_set_rate+0x44/0xb8)
[   79.928821] [<c09285f8>] (raspberrypi_fw_set_rate) from [<c0921c94>] (clk_change_rate+0xe0/0x558)
[   79.947361] [<c0921c94>] (clk_change_rate) from [<c0922284>] (clk_core_set_rate_nolock+0x178/0x1a0)
[   79.966220] [<c0922284>] (clk_core_set_rate_nolock) from [<c09222dc>] (clk_set_rate+0x30/0x88)
[   79.984877] [<c09222dc>] (clk_set_rate) from [<c0b03da8>] (dev_pm_opp_set_rate+0x364/0x460)
[   80.003253] [<c0b03da8>] (dev_pm_opp_set_rate) from [<c0b0d0bc>] (set_target+0x2c/0x54)
[   80.021370] [<c0b0d0bc>] (set_target) from [<c0b07e08>] (__cpufreq_driver_target+0x220/0x534)
[   80.040342] [<c0b07e08>] (__cpufreq_driver_target) from [<c0b0b32c>] (od_dbs_update+0xb4/0x160)
[   80.059658] [<c0b0b32c>] (od_dbs_update) from [<c0b0c4c4>] (dbs_work_handler+0x2c/0x58)
[   80.078284] [<c0b0c4c4>] (dbs_work_handler) from [<c02489ec>] (process_one_work+0x1f0/0x588)
[   80.097449] [<c02489ec>] (process_one_work) from [<c0248dd0>] (worker_thread+0x4c/0x528)
[   80.116348] [<c0248dd0>] (worker_thread) from [<c024ec28>] (kthread+0x128/0x154)
[   80.134600] [<c024ec28>] (kthread) from [<c02010d8>] (ret_from_fork+0x14/0x3c)
[   80.152846] Exception stack(0xef2a9fb0 to 0xef2a9ff8)
[   80.163429] 9fa0:                                     00000000 00000000 00000000 00000000
[   80.182818] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   80.202646] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000
[   80.215376] ---[ end trace 91bfd0c131224965 ]---
[   80.226095] raspberrypi-clk firmware-clocks: Failed to change pllb frequency: -110
[   80.718577] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   80.730213] tc358743 10-000f: i2c_rd: reading register 0x2 from 0xf failed
[   81.758599] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   81.770193] tc358743 10-000f: i2c_wr: writing register 0x2 from 0xf failed
[   82.798624] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   82.810166] tc358743 10-000f: i2c_wr: writing register 0x2 from 0xf failed
[   83.838648] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   83.850108] tc358743 10-000f: i2c_wr: writing register 0x14c from 0xf failed
[   84.878670] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   84.890186] tc358743 10-000f: i2c_wr: writing register 0x150 from 0xf failed
[   85.918697] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   85.930211] tc358743 10-000f: i2c_wr: writing register 0x210 from 0xf failed
[   86.958710] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   86.970186] tc358743 10-000f: i2c_wr: writing register 0x214 from 0xf failed
[   87.998734] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   88.010264] tc358743 10-000f: i2c_wr: writing register 0x218 from 0xf failed
[   89.038749] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   89.050252] tc358743 10-000f: i2c_wr: writing register 0x21c from 0xf failed
[   90.078765] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   90.090261] tc358743 10-000f: i2c_wr: writing register 0x220 from 0xf failed
[   91.118779] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   91.130418] tc358743 10-000f: i2c_wr: writing register 0x224 from 0xf failed
[   92.158791] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   92.170372] tc358743 10-000f: i2c_wr: writing register 0x228 from 0xf failed
[   93.198809] i2c-bcm2835 fe205000.i2c: i2c transfer timed out
[   93.210184] tc358743 10-000f: i2c_wr: writing register 0x22c from 0xf failed

To reproduce
Set up Auvidea B101 with kernel 4.4.35, run any capture software that supports DV-timings (https://github.com/pikvm/ustreamer, yavta, etc) and stop it.

Expected behaviour
No crashes when closing the device file

Actual behaviour
Subj

System

  • Which model of Raspberry Pi? e.g. Pi3B+, PiZeroW
    4B 1Gb
  • Which OS and version (cat /etc/rpi-issue)?
    Arch Linux ARM (uses the kernel from this repo).
  • Which firmware version (vcgencmd version)?
May  1 2020 17:56:42
Copyright (c) 2012 Broadcom
version 688a8f8f3d84e788f07f53c93693e1705f68c407 (clean) (release) (start_x)
  • Which kernel version (uname -a)?
Linux pikvm 5.4.35-1-ARCH #1 SMP PREEMPT Sun May 3 21:53:42 UTC 2020 armv7l GNU/Linux

Logs
Attached kernel log from tty.
Just I2C errors: log1.txt

MMC crash: log2.txt

@mdevaev
Copy link
Contributor Author

mdevaev commented May 6, 2020

@6by9 I'm sorry to call you directly, but you may be interested in this issue. However, I'm not sure if this is related to the tc358743 driver, because somehow it affected the MMC card driver as well. If you need more logs, I will try to provide them to you as soon as possible.

@6by9
Copy link
Contributor

6by9 commented May 6, 2020

Please provide your full configuration from config.txt.

5.4 has reworked i2c-0 to use the i2c-mux-pinctrl module to switch it between GPIOs 0&1, and whichever GPIOs the display/camera connector are attached to (either 28&29, or 44&45 dependent on variant). Any userspace messing with pinmuxing for i2c-0 should be avoided. i2c-0 is always GPIOs 0&1. i2c-10 is the camera/display.

We've also had a fairly significant update to the bcm2835-unicam driver as part of the work for libcamera, but that seems sound.

I'll have a look to see if there is anything obvious using standard v4l2-ctl commands.

MMC and the firmware blocked warnings generally mean you've managed to kill the firmware, typically a memory trample somehow.

@6by9
Copy link
Contributor

6by9 commented May 6, 2020

It looks like my B101 board has died - it is recognised fine, set EDID and timings fine, but it doesn't produce any output data with either 5.4.38 or 4.19.118.
I'll see if I can get a B102 working on a CM as I don't think I have another B101 around.

@6by9
Copy link
Contributor

6by9 commented May 6, 2020

OK, working fine with v4l2-ctl and yavta on a CM3L with B102, with kernel 5.4.35 and firmware 688a8f8f3d84e788f07f53c93693e1705f68c407 (rpi-update 8d64ec70 - top of tree today).
Source is 720p60 from a Pi3. Works in either RGB3 or UYVY.

More information required, particularly the source resolution and frame rate, format chosen from the B101, and what processing you're doing.

I have a suspicion that it may be a firmware change that is the problem, not the kernel. There were a few changes to the video_encoder and ISP components relatively recently.
Can you do rpi-update to get the latest kernel and firmware, and then sudo SKIP_KERNEL=1 rpi-update e5d3320 to revert the firmware to that hash (28 Feb in this case). If that works, work forward in commits to https://github.com/Hexxeh/rpi-firmware/commits/master until it fails.

@mdevaev
Copy link
Contributor Author

mdevaev commented May 6, 2020

config.txt:

initramfs initramfs-linux.img followkernel

hdmi_force_hotplug=1
gpu_mem=256
start_x=1
enable_uart=1
dtoverlay=tc358743
dtoverlay=pi3-disable-bt
dtoverlay=dwc2
dtparam=i2c_arm=on

The last line does not affect the presence of the problem, I added it out of desperation when trying to understand what is happening. If you delete it, the problem persists.

More information required, particularly the source resolution and frame rate, format chosen from the B101, and what processing you're doing.

I tried to simplify the way to reproduce the problem. The initial info about the launch of two times in a row, quite correct, the error appears upon termination of the read stream. I used yavta with EDID from your repository. Tried 720p/60Hz and 1080p/60Hz with UYVY - both resulted in a hang when pressing Ctrl+C.

./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0
...
Ctrl+C
// Kernel crash

It looks like my B101 board has died - it is recognised fine, set EDID and timings fine, but it doesn't produce any output data with either 5.4.38 or 4.19.118.

By the way. This is not relevant, but as my users have found out, the B101 may burn due to an accidentally flown CSI cable.

Both 4.x and 5.x kernels used firmware 688a8f8. I am using Arch Linux and using rpi-update will completely break the system. So I installed minimal Raspbian and used same config.txt exclude initramfs and i2c_arm lines. I also updated the system and executed rpi-update 8d64ec70. The problem was successfully reproduced wih yavta:

pi@raspberrypi:~ $ vcgencmd version
May  1 2020 17:56:42
Copyright (c) 2012 Broadcom
version 688a8f8f3d84e788f07f53c93693e1705f68c407 (clean) (release) (start_x)
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.4.35-v7l+ #1314 SMP Fri May 1 17:47:34 BST 2020 armv7l GNU/Linux

Then I started moving through the firmware versions, as you said.

pi@raspberrypi:~ $ sudo SKIP_KERNEL=1 rpi-update e5d3320
<reboot>
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 5.4.35-v7l+ #1314 SMP Fri May 1 17:47:34 BST 2020 armv7l GNU/Linux
pi@raspberrypi:~ $ vcgencmd version
Feb 28 2020 18:45:36
Copyright (c) 2012 Broadcom
version 9520663ed4fa4ca8c2a6923a522bff85fcdedef5 (clean) (release) (start_x)

The problem was successfully reproduced again.

I assume you failed to reproduce it because you used CM3, not RPi4. Perhaps the model of the video capture board has some significance (but they seem to differ slightly from each other).

@6by9
Copy link
Contributor

6by9 commented May 7, 2020

1080p60 can't be supported using a B101.

The B101 and B102 only differ in the number of CSI2 lanes that they present on the output connector, and the physical connector itself.
CM3 vs Pi4 have very few differences in the hardware blocks involved here. We're using the Unicam driver heavily for the recent libcamera work, so know that is sound over multiple runs.

I currently have no way to reproduce, so can't actually help.
Things to try (all after having provided an EDID):

  • provide the output from raspigpio get after the first run of yavta, and again after the second run has failed to start streaming (ideally when the second run is progress too).
  • v4l2-ctl --set-dv-bt-timings query v4l2-ctl --stream-mmap=3 --stream-to=/dev/null --stream-count=1000 and run the stream command for second time. That is the simplest V4L2 setup going.
  • drop out the --encode-to=file.h264 from yavta. If that works then it points to an issue with H264 encode.
  • use rpi-update e1050e9482 to drop back the kernel to the last 4.19 kernel and nearly latest firmware.

@mdevaev
Copy link
Contributor Author

mdevaev commented May 7, 2020

1080p60 can't be supported using a B101.

Sorry, probably the KDE dialog is deceiving me and we are talking about 50 Hz. I forgot about this feature.

CM3 vs Pi4 have very few differences in the hardware blocks involved here.

I found a 3B+ board and tried. The problem is not reproduced on it even without --encode-to=file.h264. I believe that the problem is still directly related to RPi4.

provide the output from raspigpio get after the first run of yavta, and again after the second run has failed to start streaming (ideally when the second run is progress too).

I can't. I made a mistake in the initial diagnostics; immediately when the yavta process is interrupted, the core becomes inoperable.

drop out the --encode-to=file.h264 from yavta. If that works then it points to an issue with H264 encode.

Reproduced.

v4l2-ctl --stream-mmap=3 --stream-to=/dev/null --stream-count=1000
It doesn't do anything, just returns New timings found. Are some parameters missing?

rpi-update e1050e9482

Not reproduced.


Given the fact that I also tested on RPi 3B+ and the problem did not reproduce there, it seems that the problem is reproduced exactly and only on 5.4 and RPi4. The problem exists on two different B101 boards and several RPi4 users I contacted.

What else could I do to help you debug this?

@6by9
Copy link
Contributor

6by9 commented May 7, 2020

You can try adding core_freq_min=250 to /boot/config.txt, although I'd expect that to impact both kernel versions.

v4l2-ctl --stream-mmap=3 --stream-to=/dev/null --stream-count=1000
should print out a '>' for every frame received, and print an fps value each second.

You've got me fairly stumped if rpi-update e1050e9482 (4.19) works but 8d64ec7 (5.4) doesn't, and only on a Pi4.

I'll have a dig through my parts boxes to see if I have another B101. Unfortunately there isn't a way to attach a B102 to a standard Pi - the 15pin to 22pin adapters are not reversible. The FFC cable on the one that was working is fairly kinked, so if nothing else I can try swapping the cables. It'd be nice to know what the cause of the failure was, but probably just static onto the CSI lines (shame it's that sensitive).

@6by9
Copy link
Contributor

6by9 commented May 7, 2020

@pelwell Any thoughts as to any setup that has changed only on Pi4 between 4.19 and 5.4 that would trip I2C this up?
We have got Maxime's updated clock driver, but that applies to both Pi3 and Pi4.

@pelwell
Copy link
Contributor

pelwell commented May 7, 2020

Any thoughts as to any setup that has changed only on Pi4 between 4.19 and 5.4 that would trip I2C this up?

There's nothing specific to Pi 4 that I'm aware of that only affects I2C. It's probably worth making sure the EEPROM is up-to-date:

$ sudo rpi-eeprom-update

@mdevaev
Copy link
Contributor Author

mdevaev commented May 7, 2020

@6by9

You can try adding core_freq_min=250 to /boot/config.txt, although I'd expect that to impact both kernel versions.

Made with both kernels. It didn't affect anything.

@pelwell

BCM2711 detected
BOOTLOADER: up-to-date
CURRENT: Thu 16 Apr 17:11:26 UTC 2020 (1587057086)
 LATEST: Thu 16 Apr 17:11:26 UTC 2020 (1587057086)
 FW DIR: /lib/firmware/raspberrypi/bootloader/critical
VL805: up-to-date
CURRENT: 000137ad
 LATEST: 000137ad

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

There are a lot of under-voltage warnings in your "i2c" log above. Either you are using a bad power supply or you are trying to power too much from your Pi.

The Pi 4 includes under-voltage detection logic because there is a real possibility your Pi will malfunction in some way or other. Every silicon die is unique in its analogue electrical properties, causing the voltage tolerance to vary between devices, but as you reduce the voltage gradually eventually the weakest link in the chain will break. If you're lucky, one of the ARM cores will panic immediately, but the failure could be memory corruption that has time to propagate and perhaps even make it to persistent storage.

You won't get support here until the under-voltage is resolved - it's not in your best interests.

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

(Sorry for the deleted message, I attached the wrong log)

@pelwell Okay, good point. I changed the power supply to a more powerful one and again successfully reproduced the problem, but this time without a single report of power problems.

The terminal log is attached. Messages may differ slightly from launch to launch (as I've shown before), but it always starts with I2C messages.

screenlog.txt

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

I understand that the problem looks strange. But it really exists not only for me, but for five other users that I know. All of them updated the kernel to 5.4 on RPi4 and all of them started having problems with B101 by I2C.

I have excluded all previous assumptions about the nature of this bug. How else can I help fix it?

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

I'm starting to think that I2C is just collateral damage caused by a firmware lockup.

Your original reports says "an attempt to get an image from the tc358743 device twice in a row (reopen device file) results [in] I2C timeouts." Let's see if we can narrow down the cause of the failure by breaking the process down into a sequence of smaller steps.

  1. Disable the initial loading of the driver by commenting out the dtoverlay line in config.txt.
  2. Boot the Pi and use i2cdetect, i2cget, etc. to see if I2C seems to be working.
  3. Apply the overlay manually from the command line - "sudo dtoverlay tc358743".
  4. More i2cdetect, i2cget, etc.
  5. Try to get one image from the device.
  6. i2cdetect.
  7. Try to get another image from the device.
  8. i2cdetect.

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

The first message was not entirely accurate, I wrote. The problem does not occur on the second start, but when the first reading process is interrupted. That is, I run yavta, press Ctrl+C and immediately got a dead kernel. I played around with yavta a bit and found out that the problem occurs either when closing /dev/video0 or when executing ioctl VIDIOC_STREAMOFF. I think the tc358743 driver is trying to command something over I2C, and everything stops working.

So I tried to follow your instructions:

  1. Done.
  2. I didn't see any i2c devices in /dev and added in i2c_arm=on in config.txt. After that, I saw the i2c-1, but there were no devices in it. If I don't disable the overlay, I can execute and get the following:
pi@raspberrypi:~ $ i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- UU
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $ dmesg | grep tc3
[    6.492908] tc358743 10-000f: tc358743 found @ 0x1e (i2c-11-mux (chan_id 1))
pi@raspberrypi:~ $ sudo i2cget 10 0x1e
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will read from device file /dev/i2c-10, chip address 0x1e, current data
address, using read byte.
Continue? [Y/n]
Error: Read failed
  1. Disabling the overlay and trying to load it manually:
pi@raspberrypi:~ $ sudo dtoverlay tc358743
* Failed to apply overlay '0_tc358743' (kernel)
pi@raspberrypi:~ $ dmesg | tail -n 20
... // Nothing related
[   93.592265] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2c0mux/i2c@1/status
[   93.592364] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/csi@7e801000/status
[   93.592388] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/csi@7e801000/port/endpoint/remote-endpoint
[   93.592448] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2c@7e205000/status
[   93.592466] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2c0mux/status
[   93.592490] OF: overlay: ERROR: multiple fragments add and/or delete node /soc/i2c0mux/i2c@1/tc358743@0f
[   93.592631] OF: overlay: ERROR: multiple fragments add, update, and/or delete property /soc/i2c0mux/i2c@1/tc358743@0f/name
[   93.592724] OF: overlay: ERROR: multiple fragments add and/or delete node /soc/i2c0mux/i2c@1/tc358743@0f/port
[   93.592742] OF: overlay: ERROR: multiple fragments add, update, and/or delete property /soc/i2c0mux/i2c@1/tc358743@0f/port/name
[   93.592763] OF: overlay: ERROR: multiple fragments add and/or delete node /soc/i2c0mux/i2c@1/tc358743@0f/port/endpoint
[   93.593019] OF: overlay: ERROR: multiple fragments add, update, and/or delete property /soc/i2c0mux/i2c@1/tc358743@0f/port/endpoint/name

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

The errors in 3 suggest that you have failed to disable the overlay in config.txt. You can verify that the overlay isn't present by looking in /proc/device-tree/soc/i2c0mux/i2c@1.

@6by9
Copy link
Contributor

6by9 commented May 11, 2020

You'll need dtparam=i2c_vc=on as we're looking for the camera/display i2c, not the one on GPIOs 2&3.
Addr 0x0f showing up as UU also denotes that there is a kernel driver already loaded and using that address, which stops userspace access (unless you add a force flag - -f in i2cget).

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

@pelwell I clarified that. The driver is not loaded and the overlay is missing:

pi@raspberrypi:~ $ cat /boot/config.txt
hdmi_force_hotplug=1
gpu_mem=256
start_x=1
enable_uart=1
#dtoverlay=tc358743
dtoverlay=pi3-disable-bt
#dtoverlay=dwc2
#core_freq_min=250
#dtparam=i2c_arm=on
pi@raspberrypi:~ $ dmesg | grep tc3
pi@raspberrypi:~ $ ls /proc/device-tree/soc/i2c0mux/i2c@1
'#address-cells'   name   phandle   reg  '#size-cells'
pi@raspberrypi:~ $ find /proc/device-tree/soc/i2c0mux/
/proc/device-tree/soc/i2c0mux/
/proc/device-tree/soc/i2c0mux/i2c@0
/proc/device-tree/soc/i2c0mux/i2c@0/#address-cells
/proc/device-tree/soc/i2c0mux/i2c@0/#size-cells
/proc/device-tree/soc/i2c0mux/i2c@0/phandle
/proc/device-tree/soc/i2c0mux/i2c@0/reg
/proc/device-tree/soc/i2c0mux/i2c@0/name
/proc/device-tree/soc/i2c0mux/compatible
/proc/device-tree/soc/i2c0mux/pinctrl-1
/proc/device-tree/soc/i2c0mux/status
/proc/device-tree/soc/i2c0mux/i2c@1
/proc/device-tree/soc/i2c0mux/i2c@1/#address-cells
/proc/device-tree/soc/i2c0mux/i2c@1/#size-cells
/proc/device-tree/soc/i2c0mux/i2c@1/phandle
/proc/device-tree/soc/i2c0mux/i2c@1/reg
/proc/device-tree/soc/i2c0mux/i2c@1/name
/proc/device-tree/soc/i2c0mux/#address-cells
/proc/device-tree/soc/i2c0mux/i2c-parent
/proc/device-tree/soc/i2c0mux/#size-cells
/proc/device-tree/soc/i2c0mux/phandle
/proc/device-tree/soc/i2c0mux/pinctrl-0
/proc/device-tree/soc/i2c0mux/name
/proc/device-tree/soc/i2c0mux/pinctrl-names
pi@raspberrypi:~ $

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

You're right - the overlay was written in a time when overlays modifying their own fragments was a bad idea, for which there is a workaround with an unfortunate side effect where you can't apply the overlay at runtime. You should be on a recent firmware with a 5.4 kernel, so I'll tweak the overlay to make it work in both scenarios.

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

@6by9 Thanks! Correct me if I'm doing something wrong. I have never worked with I2C.

pi@raspberrypi:~ $ cat /boot/config.txt 
hdmi_force_hotplug=1
gpu_mem=256
start_x=1
enable_uart=1
#dtoverlay=tc358743
dtoverlay=pi3-disable-bt
dtparam=i2c_vc=on
#dtoverlay=dwc2
#core_freq_min=250
#dtparam=i2c_arm=on
pi@raspberrypi:~ $ ls /dev/i2c-*
/dev/i2c-0  /dev/i2c-10  /dev/i2c-11
pi@raspberrypi:~ $ i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $ i2cdetect -y 10
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- 0f
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $ i2cdetect -y 11
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- 0f
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi:~ $ dmesg | grep tc3

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

@pelwell I didn't quite understand - are you going to make some kind of fix now and I will need to download it via rpi-update? Or is something else required of me?

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

Can you test this updated overlay for me? It applies for me without any errors:

// SPDX-License-Identifier: GPL-2.0-only
// Definitions for Toshiba TC358743 HDMI to CSI2 bridge on VC I2C bus
/dts-v1/;
/plugin/;

/{
	compatible = "brcm,bcm2835";

	fragment@0 {
		target = <&i2c_csi_dsi>;
		__overlay__ {
			#address-cells = <1>;
			#size-cells = <0>;
			status = "okay";

			tc358743@0f {
				compatible = "toshiba,tc358743";
				reg = <0x0f>;
				status = "okay";

				clocks = <&tc358743_clk>;
				clock-names = "refclk";

				tc358743_clk: bridge-clk {
					compatible = "fixed-clock";
					#clock-cells = <0>;
					clock-frequency = <27000000>;
				};

				port {
					tc358743: endpoint {
						remote-endpoint = <&csi1_ep>;
						clock-lanes = <0>;
						clock-noncontinuous;
						link-frequencies =
							/bits/ 64 <486000000>;
					};
				};
			};
		};
	};

	fragment@1 {
		target = <&csi1>;
		__overlay__ {
			status = "okay";

			port {
				csi1_ep: endpoint {
					remote-endpoint = <&tc358743>;
				};
			};
		};
	};

	fragment@2 {
		target = <&tc358743>;
		__overlay__ {
			data-lanes = <1 2>;
		};
	};

	fragment@3 {
		target = <&tc358743>;
		__dormant__ {
			data-lanes = <1 2 3 4>;
		};
	};

	fragment@4 {
		target = <&i2c0if>;
		__overlay__ {
			status = "okay";
		};
	};

	fragment@5 {
		target = <&i2c0mux>;
		__overlay__ {
			status = "okay";
		};
	};

	__overrides__ {
		4lane = <0>, "-2+3";
		link-frequency = <&tc358743>,"link-frequencies#0";
	};
};

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

@pelwell Sure. How do I do this?

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

Save the code to a file - tc358743-overlay.dts is the usual name. Then run:

$ dtc -@ -I dts -O dtb -o tc358743.dtbo tc358743-overlay.dts
$ sudo cp tc358743.dtbo /boot/overlays

@6by9
Copy link
Contributor

6by9 commented May 11, 2020

/dev/i2c-0 is GPIOs 0&1 (pins 28&29)
/dev/i2c-10 is the camera/display I2C
/dev/i2c-11 is an anomally, and is whichever of the above was last selected :-/

pi@raspberrypi:~ $ dmesg | grep tc3
[    6.492908] tc358743 10-000f: tc358743 found @ 0x1e (i2c-11-mux (chan_id 1))

would imply that you did still have the overlay loaded from config.txt, but we're beyond that now.

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

[ corrected typo in the cp line above ]

@mdevaev
Copy link
Contributor Author

mdevaev commented May 11, 2020

@6by9 I have only pi3-disable-bt to access to UART. The rest is disabled, it can be seen from config.txt. I don't know where it came from.

@pelwell Okay give me 5 minutes.

@pelwell
Copy link
Contributor

pelwell commented May 11, 2020

Use sudo vcdbg log msg to read diagnostic messages from the firmware - you should see overlays being processed (or not).

popcornmix pushed a commit that referenced this issue Nov 25, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Nov 25, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 7, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 9, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 10, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 16, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 16, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Dec 20, 2024
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 2, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 2, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 6, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 10, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 13, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 17, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 20, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Jan 24, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 3, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 3, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
6by9 added a commit to 6by9/linux that referenced this issue Feb 6, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

raspberrypi#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 10, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 10, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 10, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 17, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 17, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 17, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 19, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 24, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 24, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 24, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
popcornmix pushed a commit that referenced this issue Feb 28, 2025
From when bringing up the driver, there was a check in the isr
to ignore interrupts (claiming them handled) should the driver
not be streaming.

The VPU now will not register a camera driver if it finds a
CSI2 node enabled in device tree, therefore this flawed check is
redundant.

#3602

Signed-off-by: Dave Stevenson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants