"Das U-Boot" Source Tree

board: keymile: convert to CONFIG_DM_I2C

The conversion to DM_I2C is mandatory, rework to remove
use of legacy I2C API.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Aleksandar Gerasimovski <aleksandar.gerasimovski@hitachienergy.com>
Cc: Holger Brunck <holger.brunck@hitachienergy.com>
Cc: Tomas Alvarez Vanoli <tomas.alvarez-vanoli@hitachienergy.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heiko Schocher <hs@denx.de>

authored by

Anatolij Gustschin and committed by
Tom Rini
4beca134 c5de0714

+30 -59
-3
board/keymile/Kconfig
··· 11 11 12 12 menu "KM Board Setup" 13 13 14 - config SYS_I2C_INIT_BOARD 15 - def_bool y if ARM 16 - 17 14 config HUSH_INIT_VAR 18 15 def_bool y 19 16
-12
board/keymile/common/common.c
··· 129 129 } 130 130 #endif 131 131 132 - #if defined(CONFIG_SYS_I2C_INIT_BOARD) 133 132 static void i2c_write_start_seq(void) 134 133 { 135 134 set_sda(1); ··· 186 185 187 186 return ret; 188 187 } 189 - 190 - /** 191 - * i2c_init_board - reset i2c bus. When the board is powercycled during a 192 - * bus transfer it might hang; for details see doc/I2C_Edge_Conditions. 193 - */ 194 - void i2c_init_board(void) 195 - { 196 - /* Now run the AbortSequence() */ 197 - i2c_make_abort(); 198 - } 199 - #endif 200 188 201 189 #if defined(CONFIG_KM_COMMON_ETH_INIT) 202 190 int board_eth_init(struct bd_info *bis)
+1 -2
board/keymile/common/common.h
··· 138 138 void check_for_uboot_update(void); 139 139 140 140 #define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */ 141 - #define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000)) 141 + #define DELAY_HALF_PERIOD (500 / (I2C_SPEED_STANDARD_RATE / 1000)) 142 142 143 143 void set_sda(int state); 144 144 void set_scl(int state); 145 145 int get_sda(void); 146 146 int get_scl(void); 147 147 148 - int i2c_soft_read_pin(void); 149 148 int i2c_make_abort(void); 150 149 #endif /* __KEYMILE_COMMON_H */
+6 -12
board/keymile/common/ivm.c
··· 342 342 343 343 int ivm_read_eeprom(unsigned char *buf, int len, int mac_address_offset) 344 344 { 345 + struct udevice *eedev = NULL; 345 346 int ret; 346 - #if CONFIG_IS_ENABLED(DM_I2C) 347 - struct udevice *eedev = NULL; 348 347 349 348 ret = i2c_get_chip_for_busnum(CONFIG_KM_IVM_BUS, 350 349 CONFIG_SYS_IVM_EEPROM_ADR, 1, &eedev); ··· 354 353 return 1; 355 354 } 356 355 356 + #if CONFIG_IS_ENABLED(ARCH_LS1021A) 357 + /* add deblocking here */ 358 + i2c_make_abort(); 359 + #endif 360 + 357 361 ret = dm_i2c_read(eedev, 0, buf, len); 358 362 if (ret != 0) { 359 363 printf("Error: Unable to read from I2C EEPROM at address %02X:%02X\n", 360 364 CONFIG_SYS_IVM_EEPROM_ADR, 0); 361 365 return 1; 362 366 } 363 - #else 364 - i2c_set_bus_num(CONFIG_KM_IVM_BUS); 365 - /* add deblocking here */ 366 - i2c_make_abort(); 367 367 368 - ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, buf, len); 369 - if (ret != 0) { 370 - printf("Error reading EEprom\n"); 371 - return -2; 372 - } 373 - #endif 374 368 return ivm_populate_env(buf, len, mac_address_offset); 375 369 }
+7 -1
board/keymile/pg-wcom-ls102xa/pg-wcom-ls102xa.c
··· 5 5 6 6 #include <config.h> 7 7 #include <event.h> 8 - #include <i2c.h> 9 8 #include <asm/io.h> 10 9 #include <asm/arch/immap_ls102xa.h> 11 10 #include <asm/arch/clock.h> ··· 106 105 qrio_enable_app_buffer(); 107 106 108 107 arch_soc_init(); 108 + 109 + /* 110 + * Reset I2C bus. When the board is powercycled during a bus 111 + * transfer it might hang; for details see doc/I2C_Edge_Conditions. 112 + * Now run the AbortSequence() 113 + */ 114 + i2c_make_abort(); 109 115 110 116 return 0; 111 117 }
+4 -4
configs/pg_wcom_expu1_defconfig
··· 8 8 CONFIG_ENV_SOURCE_FILE="pg-wcom-expu1" 9 9 CONFIG_ENV_SIZE=0x4000 10 10 CONFIG_ENV_SECT_SIZE=0x20000 11 - CONFIG_SYS_I2C_MXC_I2C1=y 12 - CONFIG_SYS_I2C_MXC_I2C2=y 13 - CONFIG_SYS_I2C_MXC_I2C3=y 11 + CONFIG_DM_GPIO=y 14 12 CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-expu1" 15 13 CONFIG_SYS_MONITOR_LEN=1048576 16 14 CONFIG_BOOTCOUNT_BOOTLIMIT=3 ··· 78 76 CONFIG_SYS_BOOTCOUNT_BE=y 79 77 CONFIG_DDR_CLK_FREQ=50000000 80 78 CONFIG_SYS_FSL_DDR3=y 81 - CONFIG_SYS_I2C_LEGACY=y 79 + CONFIG_DM_I2C=y 80 + CONFIG_I2C_MUX=y 81 + CONFIG_I2C_MUX_PCA954x=y 82 82 # CONFIG_MMC is not set 83 83 CONFIG_MTD=y 84 84 CONFIG_MTD_NOR_FLASH=y
+4 -4
configs/pg_wcom_expu1_update_defconfig
··· 8 8 CONFIG_ENV_SOURCE_FILE="pg-wcom-expu1" 9 9 CONFIG_ENV_SIZE=0x4000 10 10 CONFIG_ENV_SECT_SIZE=0x20000 11 - CONFIG_SYS_I2C_MXC_I2C1=y 12 - CONFIG_SYS_I2C_MXC_I2C2=y 13 - CONFIG_SYS_I2C_MXC_I2C3=y 11 + CONFIG_DM_GPIO=y 14 12 CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-expu1" 15 13 CONFIG_SYS_MONITOR_LEN=1048576 16 14 CONFIG_BOOTCOUNT_BOOTLIMIT=3 ··· 76 74 CONFIG_SYS_BOOTCOUNT_BE=y 77 75 CONFIG_DDR_CLK_FREQ=50000000 78 76 CONFIG_SYS_FSL_DDR3=y 79 - CONFIG_SYS_I2C_LEGACY=y 77 + CONFIG_DM_I2C=y 78 + CONFIG_I2C_MUX=y 79 + CONFIG_I2C_MUX_PCA954x=y 80 80 # CONFIG_MMC is not set 81 81 CONFIG_MTD=y 82 82 CONFIG_MTD_NOR_FLASH=y
+4 -4
configs/pg_wcom_seli8_defconfig
··· 8 8 CONFIG_ENV_SOURCE_FILE="pg-wcom-seli8" 9 9 CONFIG_ENV_SIZE=0x4000 10 10 CONFIG_ENV_SECT_SIZE=0x20000 11 - CONFIG_SYS_I2C_MXC_I2C1=y 12 - CONFIG_SYS_I2C_MXC_I2C2=y 13 - CONFIG_SYS_I2C_MXC_I2C3=y 11 + CONFIG_DM_GPIO=y 14 12 CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-seli8" 15 13 CONFIG_SYS_MONITOR_LEN=1048576 16 14 CONFIG_BOOTCOUNT_BOOTLIMIT=3 ··· 78 76 CONFIG_SYS_BOOTCOUNT_BE=y 79 77 CONFIG_DDR_CLK_FREQ=50000000 80 78 CONFIG_SYS_FSL_DDR3=y 81 - CONFIG_SYS_I2C_LEGACY=y 79 + CONFIG_DM_I2C=y 80 + CONFIG_I2C_MUX=y 81 + CONFIG_I2C_MUX_PCA954x=y 82 82 # CONFIG_MMC is not set 83 83 CONFIG_MTD=y 84 84 CONFIG_MTD_NOR_FLASH=y
+4 -4
configs/pg_wcom_seli8_update_defconfig
··· 8 8 CONFIG_ENV_SOURCE_FILE="pg-wcom-seli8" 9 9 CONFIG_ENV_SIZE=0x4000 10 10 CONFIG_ENV_SECT_SIZE=0x20000 11 - CONFIG_SYS_I2C_MXC_I2C1=y 12 - CONFIG_SYS_I2C_MXC_I2C2=y 13 - CONFIG_SYS_I2C_MXC_I2C3=y 11 + CONFIG_DM_GPIO=y 14 12 CONFIG_DEFAULT_DEVICE_TREE="ls1021a-pg-wcom-seli8" 15 13 CONFIG_SYS_MONITOR_LEN=1048576 16 14 CONFIG_BOOTCOUNT_BOOTLIMIT=3 ··· 76 74 CONFIG_SYS_BOOTCOUNT_BE=y 77 75 CONFIG_DDR_CLK_FREQ=50000000 78 76 CONFIG_SYS_FSL_DDR3=y 79 - CONFIG_SYS_I2C_LEGACY=y 77 + CONFIG_DM_I2C=y 78 + CONFIG_I2C_MUX=y 79 + CONFIG_I2C_MUX_PCA954x=y 80 80 # CONFIG_MMC is not set 81 81 CONFIG_MTD=y 82 82 CONFIG_MTD_NOR_FLASH=y
-13
include/configs/km/pg-wcom-ls102xa.h
··· 145 145 */ 146 146 #define CFG_SYS_NS16550_CLK get_serial_clock() 147 147 148 - /* 149 - * I2C 150 - */ 151 - 152 - #define CFG_SYS_I2C_MAX_HOPS 1 153 - #define CFG_SYS_NUM_I2C_BUSES 3 154 - #define I2C_MUX_PCA_ADDR 0x70 155 - #define I2C_MUX_CH_DEFAULT 0x0 156 - #define CFG_SYS_I2C_BUSES { {0, {I2C_NULL_HOP} }, \ 157 - {0, {{I2C_MUX_PCA9547, 0x70, 1 } } }, \ 158 - {1, {I2C_NULL_HOP} }, \ 159 - } 160 - 161 148 #define CFG_SMP_PEN_ADDR 0x01ee0200 162 149 163 150 #define HWCONFIG_BUFFER_SIZE 256