Skip to content

Commit

Permalink
eepflash.sh: Use i2c bus 10 to avoid clash on Pi 4
Browse files Browse the repository at this point in the history
This script used to create a bit-bashed I2C interface in the event
that I2C0 was not already enabled. Because the kernel knew of three
I2C interfaces already the soft interface appeared as i2c-3. On Pi
4 the highest numbered I2C interface is i2c-6, which causes the
soft interface to appear as i2c-7.

Work around the issue by giving the soft interface an explicit
bus number of 10, guaranteeing that it won't clash on any known
system.

See: #65

Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  • Loading branch information
Phil Elwell committed Sep 4, 2019
1 parent e8066da commit 42c532f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions eepromutils/eepflash.sh
Expand Up @@ -105,19 +105,19 @@ modprobe i2c_dev
if [ "$BUS" = "NOT_SET" ]; then
if [ -e "/dev/i2c-0" ]; then
BUS=0
elif [ -e "/dev/i2c-3" ]; then
BUS=3
elif [ -e "/dev/i2c-10" ]; then
BUS=10
else
dtoverlay i2c-gpio i2c_gpio_sda=0 i2c_gpio_scl=1
dtoverlay i2c-gpio i2c_gpio_sda=0 i2c_gpio_scl=1 bus=10
rc=$?
if [ $rc != 0 ]; then
echo "Loading of i2c-gpio dtoverlay failed. Do an rpi-update (and maybe apt-get update; apt-get upgrade)."
exit $rc
fi
if [ -e "/dev/i2c-3" ]; then
BUS=3
if [ -e "/dev/i2c-10" ]; then
BUS=10
else
echo "Expected I2C bus (i2c-3) not found."
echo "Expected I2C bus (i2c-10) not found."
fi
fi
fi
Expand Down

2 comments on commit 42c532f

@6by9
Copy link

@6by9 6by9 commented on 42c532f Oct 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pelwell Just noticed this commit whilst looking for the official HAT programming instructions for a forum post.

I guess I've just broken this again on >=5.4 when I introduced i2c-10 for the camera/display I2C pinmuxing of BSC0. Sorry.

You've potentially got 3 currently "floating numbering" I2C busses on Pi4 with the parent for BSC0, and the two HDMI I2C controllers when in full KMS mode. Those shouldn't cause grief though.

@pelwell
Copy link
Contributor

@pelwell pelwell commented on 42c532f Oct 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be fixed now - bus 9 is its new home.

Please sign in to comment.