Roy Bieda

Example on how to access I2C devices on the PCA9547 I2C mux on the LS2085A/LS2088AQDS under U-boot

Discussion created by Roy Bieda Employee on Oct 19, 2017

Many development systems use the NXP I2C mux to increase the number of devices on a I2C channel.  To access the I2C devices on one of the eight channels of the mux you must first set the mux to the needed channel.

 

The LS2088A device has four I2C controllers and on the LS2088AQDS development system, the PCA9547 mux is connected to I2C1 at address 0x77.  U-boot maps I2C1 of the LS2088A as I2C0.  For example, to access the XFI Ethernet re-timer I2C devices on channel 5 of the mux, you need to first set the mux to channel 5.

 

U-boot commands to work with I2C

See what I2C buses are available (the LS2088A has four I2C controllers)

=> i2c bus
Bus 0:  mxc0
Bus 1:  mxc1
Bus 2:  mxc2
Bus 3:  mxc3

 

Select I2C bus 0 which is the LS2088A I2C1 controller
=> i2c dev 0
Setting bus to 0

 

Now that we've selected the first I2C controller, list what device addresses are there
=> i2c probe
Valid chip addresses: 19 1B 1D 36 37 50 51 53 55 57 66 67 68 77 

 

From the schematics we know that 0x77 is the address of the mux and that the re-timers are connected to channel five of the mux.  Set the mux to channel five

 

=> i2c mw 0x77 0x00 0x0d

 

Now probe for devices on the mux's channel five
=> i2c probe
Valid chip addresses: 18 19 1A 1B 66 67 77
=>

 

In the above example "i2c mw 0x77 0x00 0x0d" selects the mux at I2C address 0x77 and writes 0x0d to the Control Register which in turn selects channel 5.  Here address 0x00 was chosen but any value can be used to select the mux's only register, its Control Register.  The 0x0d is channel five: 0b1101...from the mux's data sheet, this sets the B3 enable bit and the B2-B0 channel number.  Please refer to the PCA9547's datasheet.

 

Read the first 16 registers values of the I2C device at hardware address 0x18 on channel five

=> i2c md 0x18 0x00 0x10
0000: 00 d0 00 00 01 0f 00 05 00 00 00 00 00 00 00 00    ................
=>

 

In the above in register 0x01, the 0xd0 value is the correct device version and device ID code of the re-timer IC.

Outcomes