lpc32xx: ea-lpc3250devkitv2: enable i2c (DM)

Enable a DMed i2c driver for the ea-lpc3250devkitv2 board.
Include some sample commands/output for testing.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
This commit is contained in:
Trevor Woerner 2021-06-10 22:37:09 -04:00 committed by Tom Rini
parent 0705556bc4
commit ba621fe3a9
3 changed files with 61 additions and 0 deletions

View file

@ -4,6 +4,7 @@ ToC:
- Introduction
- Booting
- Debugging
- i2c
Introduction
@ -130,3 +131,56 @@ dongle from Olimex successfully as follows:
# openocd \
-f interface/ftdi/olimex-arm-usb-ocd-h.cfg \
-f board/phytec_lpc3250.cfg
i2c
===
Some of the LEDs on the board are connected via an I/O Expander (PCA9532) that
is attached to the i2c1 bus. Here is a sample session of toggling some of
these LEDs via i2c in U-Boot:
show the existing i2c busses:
EA-LPC3250v2=> i2c bus
Bus 0: i2c@300
Bus 1: i2c@400a0000
Bus 2: i2c@400a8000
set i2c1 as the current bus:
EA-LPC3250v2=> i2c dev 1
Setting bus to 1
see what potential devices are found with rudimentary probing on i2c1:
EA-LPC3250v2=> i2c probe
Valid chip addresses: 1A 1D 48 50 57 60 66 6E
According to the schematics the i2c slave address of the PCA9532 is 0x60.
dump all of the 10 registers from the I/O Expander; NOTE that the 0x10 in the
command specifies the self-incrementing mode of the PCA9532; also NOTE that
the values repeat themseves to fill out a full 16 bytes:
EA-LPC3250v2=> i2c md 0x60 0x10 10
0010: 00 ff 00 80 00 80 00 00 00 00 4f ff 00 80 00 80 ..........O.....
turn on LEDs 23, 25, 27, and 29 (green):
EA-LPC3250v2=> i2c mw 0x60 9 0x55
turn on LEDs 22, 24, 26, and 28 (red):
EA-LPC3250v2=> i2c mw 0x60 8 0x55
dim the green LEDs (23, 25, 27, 29):
EA-LPC3250v2=> i2c mw 0x60 3 0x20
EA-LPC3250v2=> i2c mw 0x60 9 0xaa
turn off all LEDs (23-29):
EA-LPC3250v2=> i2c mw 0x60 8 0
EA-LPC3250v2=> i2c mw 0x60 9 0
read value of switches (input):
EA-LPC3250v2=> i2c md 0x60 0 1
0000: 4f O
[none are pressed]
press and hold SW2 while running the following:
EA-LPC3250v2=> i2c md 0x60 0 1
0000: 4e N
[SW2 is pressed]

View file

@ -19,6 +19,10 @@ int
board_early_init_f(void)
{
lpc32xx_uart_init(CONFIG_CONS_INDEX);
if (IS_ENABLED(CONFIG_SYS_I2C_LPC32XX)) {
lpc32xx_i2c_init(1);
lpc32xx_i2c_init(2);
}
return 0;
}

View file

@ -14,9 +14,12 @@ CONFIG_DISTRO_DEFAULTS=y
CONFIG_BOARD_EARLY_INIT_F=y
CONFIG_SYS_PROMPT="EA-LPC3250v2=> "
CONFIG_CMD_GPIO=y
CONFIG_CMD_I2C=y
CONFIG_OF_CONTROL=y
# CONFIG_NET is not set
CONFIG_LPC32XX_GPIO=y
CONFIG_DM_I2C=y
CONFIG_SYS_I2C_LPC32XX=y
CONFIG_SPECIFY_CONSOLE_INDEX=y
CONFIG_CONS_INDEX=5
CONFIG_SYS_NS16550=y