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-mux and i2c-pwm overlay updates for alternate i2c buses #5443
Conversation
The i2c-mux overlay was fixed to i2c-1. Add overrides to allow it to be assigned to alternate buses. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
The i2c-pwm-pca9685a overlay was fixed to i2c-1. Add overrides to allow it to be assigned to alternate buses. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
kernel: media: i2c: imx219: Scale the pixel clock rate for the 640x480 mode See: raspberrypi/linux#5439 kernel: hwmon: emc2305: Add calls to initialise of cooling maps See: raspberrypi/linux#5440 kernel: Create driver for Waveshare DSI screens See: raspberrypi/linux#5433 kernel: arm/boot/dts/overlays/mipi-dbi-spi: fix default brightness See: raspberrypi/linux#5442 kernel: i2c-mux and i2c-pwm overlay updates for alternate i2c buses See: raspberrypi/linux#5443 kernel: Further EMC2305 tweaks See: raspberrypi/linux#5441 kernel: drm/vc4: Limit max_bpc to 8 on Pi0-3 See: raspberrypi/linux#5444 kernel: Revert: amba_pl011: Round input clock up firmware: arm_loader: Set local-bd-address if 6 zeroes found firmware: arm_loader: Really check for a zero local-bd-address See: raspberrypi/linux#5437 firmware: arm_dt: Don't overwrite existing i2c aliases See: raspberrypi/linux#5428 firmware: arm_loader: Reduce CMA warning severity See: #1807 userland: dtoverlay: Use os_prefix if set
kernel: media: i2c: imx219: Scale the pixel clock rate for the 640x480 mode See: raspberrypi/linux#5439 kernel: hwmon: emc2305: Add calls to initialise of cooling maps See: raspberrypi/linux#5440 kernel: Create driver for Waveshare DSI screens See: raspberrypi/linux#5433 kernel: arm/boot/dts/overlays/mipi-dbi-spi: fix default brightness See: raspberrypi/linux#5442 kernel: i2c-mux and i2c-pwm overlay updates for alternate i2c buses See: raspberrypi/linux#5443 kernel: Further EMC2305 tweaks See: raspberrypi/linux#5441 kernel: drm/vc4: Limit max_bpc to 8 on Pi0-3 See: raspberrypi/linux#5444 kernel: Revert: amba_pl011: Round input clock up firmware: arm_loader: Set local-bd-address if 6 zeroes found firmware: arm_loader: Really check for a zero local-bd-address See: raspberrypi/linux#5437 firmware: arm_dt: Don't overwrite existing i2c aliases See: raspberrypi/linux#5428 firmware: arm_loader: Reduce CMA warning severity See: raspberrypi/firmware#1807 userland: dtoverlay: Use os_prefix if set
Wondering if it would be possible to include support for defining multiple i2c multiplexers? I have had a few situations where this was required due to bus speed limitations. |
What makes you think it doesn't work? You'll need to provide different addresses for the muxes (obviously), but it looks like it should work (but I haven't tried it). |
You can create as many instances as you fancy as long as they have unique address and bus properties.
would give you 2 muxes with addresses 0x70 and 0x71 on i2c-1, 1 with address 0x70 on i2c3, and 1 with address 0x71 on i2c-4. I haven't tried it recently, but have in the past. If you wish to craft your own overlay then the mux framework will allow cascading muxes to give a tree structure hanging off one parent I2C bus too, eg
using 9 pca9548's would give you 64 buses with only 2 addresses having been used on any of them. You can achieve the same number of buses with 8 pca9548's if you can afford to lose 8 addresses from all of them. That approach is also slightly more efficient on switching as there are fewer commands to send to the muxes. |
Perhaps I am misunderstanding: I have 2 pca9548, 1 connected to i2c1 and 1 connected to i2c3. I was expecting to see 16 i2c devices in /dev but I am only seeing 8 which are picked up on the multiplexer on i2c1. I can set this to any i2cX and it works, but only for the first 8 devices. Do I need to handle the descriptors? /boot/config.txt |
Look in the kernel log for error messages. You should get messages along the lines of |
Thanks for the reply. I did notice the unnecessary lines and removed them. These are my findings so far, but still fiddling with it. 1.) With multiplexers on i2c-1 and i2c-3 I end up with 8 additional i2c devs. These are all attached to i2c-1 |
What are they?! It's hard to debug an issue with no information. |
Ugh, sorry I meant "no errors in log"... config.txtdtoverlay=i2c-mux,pca9548,i2c1 unameLinux RPI 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux kern.logMay 8 00:27:00 MINER-NODE-0016 kernel: [ 6.922864] brcmstb-i2c fef04500.i2c: @97500hz registered in polling mode May 8 00:27:00 MINER-NODE-0016 kernel: [ 7.897204] i2c i2c-1: Added multiplexed i2c bus 22 /dev entries:i2c-1 i2cdetect -y 100: -- -- -- -- -- -- -- -- i2cdetect -y 400: -- -- -- -- -- -- -- -- |
I guess my question is - if you have two multiplexers on two distinct i2c bus, would the expected result be 16 i2c devices created as /dev/i2c-X? |
Yes, there should be 16 additional buses. I have 2 Adafruit TCA9548A muxes here in the office, on addresses 0x70 and 0x71. These muxes have the benefit of 10k pull up resistors on SDA and SCL (a stronger pull resistor is a smaller value). Connected both to i2c1 and added
to /boot/config.txt
So they work. Change to
and rewire to GPIOs 4&5 for the second board. Add
and i2cdetect -y 3 runs at a sensible speed, and I also get
So there is a fragment missing from these overlays for enabling i2c3-6 that assigns a pinctrl node to them. Doing so is a pain as you end up adding in the same set of overrides for GPIO selection as the i2c3-6 overlays. @pelwell Can we add a default pinctrl assignment for i2c3-6 to the base 2711 DT, eg
or does that have issues? |
There is no
I can't see why not. I may do the same for the extra SPI and UART nodes as well. |
Ta. It's the equivalent of https://github.com/raspberrypi/linux/blob/rpi-6.1.y/arch/arm/boot/dts/bcm2711-rpi-4-b.dts#L464-L468 that I'm thinking of but for i2c3-6. |
Yup |
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: raspberrypi#5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: raspberrypi#5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
See #5461 for a potential fix. |
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: raspberrypi#5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: raspberrypi#5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
kernel: i2c-mux and i2c-pwm overlay updates for alternate i2c buses See: raspberrypi/linux#5443 kernel: drm/v3d: New debugfs end-points to query GPU usage stats See: raspberrypi/linux#5456 kernel: pinctrl: bcm2835: Workaround for edge IRQ loss See: raspberrypi/linux#5457 kernel: Set default pins for the extra I/O interfaces See: raspberrypi/linux#5461 kernel: btusb: ATS2851 back-ports See: raspberrypi/linux#5465
kernel: i2c-mux and i2c-pwm overlay updates for alternate i2c buses See: raspberrypi/linux#5443 kernel: drm/v3d: New debugfs end-points to query GPU usage stats See: raspberrypi/linux#5456 kernel: pinctrl: bcm2835: Workaround for edge IRQ loss See: raspberrypi/linux#5457 kernel: Set default pins for the extra I/O interfaces See: raspberrypi/linux#5461 kernel: btusb: ATS2851 back-ports See: raspberrypi/linux#5465
I must still be doing something wrong. I finally have i2cdetect seeing both multiplexers, however on i2c-3 I can never get the additional busses to appear. Completely removing i2c-1 from /boot/config.txt and trying to enable only i2c-3 as the multiplexer to use, it uses i2c-1. i2c-1 is working. TCA9548 is detected and 8 busses are added to /dev i2c-3 is not working, but I can see the multiplexer available at 0x70. /boot/config.txt Will keep looking into this. It clearly works for others. |
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Give all the extended I/O interfaces - I2C3-6, SPI3-6 and UART2-5 - sensible default pinctrl references. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
Now that the base bcm2711 base dts files give the added I/O interfaces references to the default pinctrl nodes, remove the same from their respective overlays. See: #5443 Signed-off-by: Phil Elwell <phil@raspberrypi.com>
No description provided.