Commit c209a65e9eed69aebf48938f8a68a1eadcd6b1e5

Authored by Aditya Prayoga
Committed by Stefan Roese
1 parent a134d680ea

arm: mvebu: helios4: Enable I2C and IO Expander

Enable Marvell I2C driver and I2C IO expander. Set default bus to
external I2C bus. Define I2C aliases in device tree so it can be
recognized by the driver.

Signed-off-by: Aditya Prayoga <aditya@kobol.io>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-By: Dennis Gilmore <dgilmore@redhat.com>
Reviewed-By: Dennis Gilmore <dgilmore@redhat.com>
Signed-off-by: Stefan Roese <sr@denx.de>

Showing 3 changed files with 12 additions and 32 deletions Side-by-side Diff

arch/arm/dts/armada-388-helios4-u-boot.dtsi
  1 +// SPDX-License-Identifier: GPL-2.0+
  2 +
  3 +/ {
  4 + aliases {
  5 + i2c0 = &i2c0;
  6 + i2c1 = &i2c1;
  7 + };
  8 +};
board/kobol/helios4/helios4.c
... ... @@ -33,18 +33,6 @@
33 33 #define BOARD_GPP_POL_LOW 0x0
34 34 #define BOARD_GPP_POL_MID 0x0
35 35  
36   -/* IO expander on Marvell GP board includes e.g. fan enabling */
37   -struct marvell_io_exp {
38   - u8 addr;
39   - u8 val;
40   -};
41   -
42   -static struct marvell_io_exp io_exp[] = {
43   - {6, 0xf9},
44   - {2, 0x46}, /* Assert reset signals and enable USB3 current limiter */
45   - {6, 0xb9}
46   -};
47   -
48 36 static struct serdes_map board_serdes_map[] = {
49 37 {SATA0, SERDES_SPEED_6_GBPS, SERDES_DEFAULT_MODE, 0, 0},
50 38 {USB3_HOST0, SERDES_SPEED_5_GBPS, SERDES_DEFAULT_MODE, 0, 0},
51 39  
... ... @@ -123,28 +111,8 @@
123 111  
124 112 int board_init(void)
125 113 {
126   - int i;
127   -
128 114 /* Address of boot parameters */
129 115 gd->bd->bi_boot_params = mvebu_sdram_bar(0) + 0x100;
130   -
131   - /* Init I2C IO expanders */
132   - for (i = 0; i < ARRAY_SIZE(io_exp); i++) {
133   - struct udevice *dev;
134   - int ret;
135   -
136   - ret = i2c_get_chip_for_busnum(0, io_exp[i].addr, 1, &dev);
137   - if (ret) {
138   - printf("Cannot find I2C: %d\n", ret);
139   - return 0;
140   - }
141   -
142   - ret = dm_i2c_write(dev, io_exp[i].val, &io_exp[i].val, 1);
143   - if (ret) {
144   - printf("Failed to set IO expander via I2C\n");
145   - return -EIO;
146   - }
147   - }
148 116  
149 117 return 0;
150 118 }
configs/helios4_defconfig
... ... @@ -38,7 +38,11 @@
38 38 CONFIG_NET_RANDOM_ETHADDR=y
39 39 CONFIG_SPL_OF_TRANSLATE=y
40 40 CONFIG_SCSI_AHCI=y
  41 +CONFIG_DM_PCA953X=y
41 42 CONFIG_DM_I2C=y
  43 +CONFIG_SYS_I2C_MVTWSI=y
  44 +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y
  45 +CONFIG_I2C_DEFAULT_BUS_NUMBER=0x1
42 46 CONFIG_MMC_SDHCI=y
43 47 CONFIG_MMC_SDHCI_SDMA=y
44 48 CONFIG_MMC_SDHCI_MV=y