arm: mvebu: theadorable_debug_defconfig: Enable DM_I2C
Subsystems (3)
PATCH 1/9 arm: mvebu: theadorable_debug_defconfig: Enable DM_I2C
Move to the DM I2C version, so that this board will not get dropped from mainline.
--- configs/theadorable_debug_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
configs/theadorable_debug_defconfig +1 -3
@@ -58,10 +58,8 @@ CONFIG_SATA_MV=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_BOOTCOUNT_RAM=y CONFIG_FPGA_ALTERA=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_SF_DEFAULT_SPEED=27777777 CONFIG_SPI_FLASH_MACRONIX=y
Signature · 1 line
2.34.0
PATCH 2/9 arm: mvebu: db-mv784mp-gp_defconfig: Enable DM_I2C
Move to the DM I2C version, so that this board will not get dropped from mainline.
--- configs/db-mv784mp-gp_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
configs/db-mv784mp-gp_defconfig +1 -3
@@ -50,10 +50,8 @@ CONFIG_ENV_SPI_MAX_HZ=50000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y CONFIG_SATA_MV=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y
Signature · 1 line
2.34.0
Re: [PATCH 2/9] arm: mvebu: db-mv784mp-gp_defconfig: Enable DM_I2C
Quoted 4 lines · Stefan Roese
Move to the DM I2C version, so that this board will not get dropped from mainline.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 11 lines
--- configs/db-mv784mp-gp_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)configs/db-mv784mp-gp_defconfig +0
-0@@ -50,10 +50,8 @@ CONFIG_ENV_SPI_MAX_HZ=50000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
configs/db-mv784mp-gp_defconfig CONFIG_ENV_SPI_MAX_HZ=50000000 · line 57
Quoted 10 lines
configs/db-mv784mp-gp_defconfig +1
-3CONFIG_SPL_OF_TRANSLATE=y CONFIG_SATA_MV=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_MTD_RAW_NAND=y
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 3/9 arm: mvebu: ds414_defconfig: Enable DM_I2C
In reply to Stefan RoeseMove to the DM I2C version, so that this board will not get dropped from mainline.
--- configs/ds414_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
configs/ds414_defconfig +1 -3
@@ -53,10 +53,8 @@ CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=50000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_SPI_FLASH_STMICRO=y
Signature · 1 line
2.34.0
Re: [PATCH 3/9] arm: mvebu: ds414_defconfig: Enable DM_I2C
Quoted 5 lines · Stefan Roese
Move to the DM I2C version, so that this board will not get dropped from mainline.
Signed-off-by Stefan Roese <[email protected]>Cc Phil Sutter <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 11 lines
--- configs/ds414_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)configs/ds414_defconfig +0
-0@@ -53,10 +53,8 @@ CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=50000000
configs/ds414_defconfig CONFIG_USE_ENV_SPI_MAX_HZ=y · line 60
Quoted 10 lines
configs/ds414_defconfig +1
-3CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_MTD=y CONFIG_SPI_FLASH_STMICRO=y
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 4/9 arm: mvebu: maxbcm_defconfig: Enable DM_I2C
In reply to Stefan RoeseMove to the DM I2C version, so that this board will not get dropped from mainline.
--- configs/maxbcm_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
configs/maxbcm_defconfig +1 -3
@@ -37,10 +37,8 @@ CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=50000000 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y
Signature · 1 line
2.34.0
Re: [PATCH 4/9] arm: mvebu: maxbcm_defconfig: Enable DM_I2C
Quoted 4 lines · Stefan Roese
Move to the DM I2C version, so that this board will not get dropped from mainline.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 11 lines
--- configs/maxbcm_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)configs/maxbcm_defconfig +0
-0@@ -37,10 +37,8 @@ CONFIG_USE_ENV_SPI_MAX_HZ=y CONFIG_ENV_SPI_MAX_HZ=50000000
configs/maxbcm_defconfig CONFIG_USE_ENV_SPI_MAX_HZ=y · line 44
Quoted 10 lines
configs/maxbcm_defconfig +1
-3CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SPL_OF_TRANSLATE=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 5/9 arm: mvebu: theadorable: Switch to using DM I2C API
In reply to Stefan RoeseNo functional change intended. This patch switches from the legacy I2C API to the DM I2C API, so that this code can be used with DM I2C enabled.
--- board/theadorable/theadorable.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
board/theadorable/theadorable.c +12 -3
@@ -298,10 +298,19 @@ int board_late_init(void)bootcount_inc ();if (bootcount >PEX_SWITCH_NOT_FOUNT_LIMIT ) { -printf ("Issuing power-switch via uC!\n" ); +struct udevice *dev;printf ("Issuing power-switch via uC!\n" ); -i2c_set_bus_num (STM_I2C_BUS ); + ret =i2c_get_chip_for_busnum (STM_I2C_BUS ,STM_I2C_ADDR , +1 , &dev); +if (ret) { +printf ("Error selecting STM on I2C bus (ret=%d)\n" , + ret); +printf ("Issuing soft-reset...\n" ); +/* default handling: SOFT reset */ +do_reset (NULL ,0 ,0 ,NULL ); + } + i2c_buf[0 ] =STM_I2C_ADDR <<1 ; i2c_buf[1 ] =0xc5 ;/* cmd */ i2c_buf[2 ] =0x01 ;/* enable */
@@ -313,7 +322,7 @@ int board_late_init(void) i2c_buf[6 ] =0x00 ; i2c_buf[7 ] =crc8 (0x72 , &i2c_buf[0 ],7 ); - ret =i2c_write (STM_I2C_ADDR ,0 ,0 , &i2c_buf[1 ],7 ); + ret =dm_i2c_write (dev,0 , &i2c_buf[1 ],7 );if (ret) {printf ("I2C write error (ret=%d)\n" , ret);printf ("Issuing soft-reset...\n" );
Signature · 1 line
2.34.0
Re: [PATCH 5/9] arm: mvebu: theadorable: Switch to using DM I2C API
Quoted 5 lines · Stefan Roese
No functional change intended. This patch switches from the legacy I2C API to the DM I2C API, so that this code can be used with DM I2C enabled.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 32 lines
--- board/theadorable/theadorable.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)board/theadorable/theadorable.c +11
-2@@ -298,10 +298,19 @@ int board_late_init(void)bootcount_inc ();if (bootcount >PEX_SWITCH_NOT_FOUNT_LIMIT ) { -printf ("Issuing power-switch via uC!\n" ); +struct udevice *dev;printf ("Issuing power-switch via uC!\n" ); -i2c_set_bus_num (STM_I2C_BUS ); + ret =i2c_get_chip_for_busnum (STM_I2C_BUS ,STM_I2C_ADDR , +1 , &dev); +if (ret) { +printf ("Error selecting STM on I2C bus (ret=%d)\n" , + ret); +printf ("Issuing soft-reset...\n" ); +/* default handling: SOFT reset */ +do_reset (NULL ,0 ,0 ,NULL ); + } + i2c_buf[0 ] =STM_I2C_ADDR <<1 ; i2c_buf[1 ] =0xc5 ;/* cmd */ i2c_buf[2 ] =0x01 ;/* enable */
board/theadorable/theadorable.c int board_late_init(void) · line 328
Quoted 8 lines
board/theadorable/theadorable.c +1
-1@@ -313,7 +322,7 @@ int board_late_init(void) i2c_buf[6 ] =0x00 ; i2c_buf[7 ] =crc8 (0x72 , &i2c_buf[0 ],7 ); - ret =i2c_write (STM_I2C_ADDR ,0 ,0 , &i2c_buf[1 ],7 ); + ret =dm_i2c_write (dev,0 , &i2c_buf[1 ],7 );if (ret) {printf ("I2C write error (ret=%d)\n" , ret);printf ("Issuing soft-reset...\n" );
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 6/9 arm: mvebu: axp/high_speed_env_lib: Switch to DM_I2C API
In reply to Stefan RoeseAfter all Armada XP boards have been switched over from legacy I2C support to DM I2C, let's now also convert this serdes code to use the DM I2C API.
--- .../mach-mvebu/serdes/axp/high_speed_env_lib.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +13 -4
@@ -77,6 +77,7 @@ static u32 board_id_get(void)__weak u8 board_sat_r_get (u8 dev_num,u8 reg) { +struct udevice *udev;u8 data;u8 *dev;u32 board_id =board_id_get ();
@@ -107,8 +108,11 @@ __weak u8 board_sat_r_get(u8 dev_num, u8 reg) }/* Read MPP module ID */ -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); - ret =i2c_read (dev[dev_num],0 ,1 , (u8 *)&data,1 ); + ret =i2c_get_chip_for_busnum (0 , dev[dev_num],1 , &udev); +if (ret) +return MV_ERROR ; + + ret =dm_i2c_read (udev,0 , &data,1 );if (ret)return MV_ERROR ;
@@ -124,13 +128,18 @@ static int board_modules_scan(void)/* Perform scan only for DB board */ if ((board_id ==DB_88F78XX0_BP_ID ) || (board_id ==DB_88F78XX0_BP_REV2_ID )) { +struct udevice *udev; +/* reset modules flags */ config_module =0 ; -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); + ret =i2c_get_chip_for_busnum (0 ,MV_BOARD_PEX_MODULE_ADDR , +1 , &udev); +if (ret) +return MV_ERROR ;/* SERDES module (only PEX model is supported now) */ - ret =i2c_read (MV_BOARD_PEX_MODULE_ADDR ,0 ,1 , (u8 *)&val,1 ); + ret =dm_i2c_read (udev,0 , &val,1 );if (ret)return MV_ERROR ;
Signature · 1 line
2.34.0
Re: [PATCH 6/9] arm: mvebu: axp/high_speed_env_lib: Switch to DM_I2C API
Quoted 5 lines · Stefan Roese
After all Armada XP boards have been switched over from legacy I2C support to DM I2C, let's now also convert this serdes code to use the DM I2C API.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 42 lines
--- .../mach-mvebu/serdes/axp/high_speed_env_lib.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +9
-3@@ -77,6 +77,7 @@ static u32 board_id_get(void)__weak u8 board_sat_r_get (u8 dev_num,u8 reg) { +struct udevice *udev;u8 data;u8 *dev;u32 board_id =board_id_get ();@@ -107,8 +108,11 @@ __weak u8 board_sat_r_get(u8 dev_num, u8 reg) }/* Read MPP module ID */ -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); - ret =i2c_read (dev[dev_num],0 ,1 , (u8 *)&data,1 ); + ret =i2c_get_chip_for_busnum (0 , dev[dev_num],1 , &udev); +if (ret) +return MV_ERROR ; + + ret =dm_i2c_read (udev,0 , &data,1 );if (ret)return MV_ERROR ;@@ -124,13 +128,18 @@ static int board_modules_scan(void)/* Perform scan only for DB board */ if ((board_id ==DB_88F78XX0_BP_ID ) || (board_id ==DB_88F78XX0_BP_REV2_ID )) { +struct udevice *udev; +/* reset modules flags */ config_module =0 ; -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); + ret = i2c_get_chip_for_busnum(0, MV_BOARD_PEX_MODULE_ADDR,
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c static int board_modules_scan(void) · line 145
Quoted 10 lines
arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c +4
-1+ 1, &udev); +if (ret) +return MV_ERROR ;/* SERDES module (only PEX model is supported now) */ - ret =i2c_read (MV_BOARD_PEX_MODULE_ADDR ,0 ,1 , (u8 *)&val,1 ); + ret =dm_i2c_read (udev,0 , &val,1 );if (ret)return MV_ERROR ;
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 7/9 arm: mvebu: axp: Remove unreferenced ddr3_get_eprom_fabric() function
In reply to Stefan RoeseThis function is not referenced in mainline U-Boot. Let's remove now.
--- drivers/ddr/marvell/axp/ddr3_hw_training.h | 1 - drivers/ddr/marvell/axp/ddr3_init.c | 24 ---------------------- drivers/ddr/marvell/axp/ddr3_init.h | 1 - 3 files changed, 26 deletions(-)
drivers/ddr/marvell/axp/ddr3_hw_training.h +0 -1
@@ -373,7 +373,6 @@ int ddr3_load_dqs_patterns(MV_DRAM_INFO *dram_info);void ddr3_static_training_init (void ); -u8 ddr3_get_eprom_fabric (void );void ddr3_set_performance_params (MV_DRAM_INFO *dram_info);int ddr3_dram_sram_burst (u32 src,u32 dst,u32 len);void ddr3_save_training (MV_DRAM_INFO *dram_info);
drivers/ddr/marvell/axp/ddr3_init.c +0 -24
@@ -943,30 +943,6 @@ int ddr3_check_config(u32 twsi_addr, MV_CONFIG_TYPE config_type)return 0 ; } -#if defined(DB_88F78X60_REV2 ) -/* -* Name: ddr3_get_eprom_fabric - Get Fabric configuration from EPROM -* Desc: -* Args: twsi Address -* Notes: Only Available for ArmadaXP DB Rev2 boards -* Returns: None. -*/ -u8 ddr3_get_eprom_fabric (void ) -{ -#ifdef AUTO_DETECTION_SUPPORT -u8 data =0 ; -int ret; - - ret =i2c_read (NEW_FABRIC_TWSI_ADDR ,1 ,1 , (u8 *)&data,1 ); -if (!ret) -return data &0x1F ; -#endif - -return 0 ; -} - -#endif -/* * Name: ddr3_cl_to_valid_cl - this return register matching CL value * Desc:
drivers/ddr/marvell/axp/ddr3_init.h +0 -1
@@ -98,7 +98,6 @@ int ddr3_hw_training(u32 target_freq, u32 ddr_width,void ddr3_print_version (void );void fix_pll_val (u8 target_fab); -u8 ddr3_get_eprom_fabric (void );u32 ddr3_get_fab_opt (void );u32 ddr3_get_cpu_freq (void );u32 ddr3_get_vco_freq (void );
Signature · 1 line
2.34.0
Re: [PATCH 7/9] arm: mvebu: axp: Remove unreferenced ddr3_get_eprom_fabric() function
Quoted 3 lines · Stefan Roese
This function is not referenced in mainline U-Boot. Let's remove now.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 59 lines
--- drivers/ddr/marvell/axp/ddr3_hw_training.h | 1 - drivers/ddr/marvell/axp/ddr3_init.c | 24 ---------------------- drivers/ddr/marvell/axp/ddr3_init.h | 1 - 3 files changed, 26 deletions(-)drivers/ddr/marvell/axp/ddr3_hw_training.h +0
-1@@ -373,7 +373,6 @@ int ddr3_load_dqs_patterns(MV_DRAM_INFO *dram_info);void ddr3_static_training_init (void ); -u8 ddr3_get_eprom_fabric (void );void ddr3_set_performance_params (MV_DRAM_INFO *dram_info);int ddr3_dram_sram_burst (u32 src,u32 dst,u32 len);void ddr3_save_training (MV_DRAM_INFO *dram_info);drivers/ddr/marvell/axp/ddr3_init.c +0
-24@@ -943,30 +943,6 @@ int ddr3_check_config(u32 twsi_addr, MV_CONFIG_TYPE config_type)return 0 ; } -#if defined(DB_88F78X60_REV2 ) -/* -* Name: ddr3_get_eprom_fabric - Get Fabric configuration from EPROM -* Desc: -* Args: twsi Address -* Notes: Only Available for ArmadaXP DB Rev2 boards -* Returns: None. -*/ -u8 ddr3_get_eprom_fabric (void ) -{ -#ifdef AUTO_DETECTION_SUPPORT -u8 data =0 ; -int ret; - - ret =i2c_read (NEW_FABRIC_TWSI_ADDR ,1 ,1 , (u8 *)&data,1 ); -if (!ret) -return data &0x1F ; -#endif - -return 0 ; -} - -#endif -/* * Name: ddr3_cl_to_valid_cl - this return register matching CL value * Desc: drivers/ddr/marvell/axp/ddr3_init.h +0
-0
drivers/ddr/marvell/axp/ddr3_init.h int ddr3_hw_training(u32 target_freq, u32 ddr_width, · line 103
Quoted 7 lines
drivers/ddr/marvell/axp/ddr3_init.h +0
-1@@ -98,7 +98,6 @@ int ddr3_hw_training(u32 target_freq, u32 ddr_width,void ddr3_print_version (void );void fix_pll_val (u8 target_fab); -u8 ddr3_get_eprom_fabric (void );u32 ddr3_get_fab_opt (void );u32 ddr3_get_cpu_freq (void );u32 ddr3_get_vco_freq (void );
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 8/9 arm: mvebu: axp: ddr: Switch to using DM I2C API
In reply to Stefan RoeseNo functional change intended. This patch switches from the legacy I2C API to the DM I2C API, so that this code can be used with DM I2C enabled.
--- drivers/ddr/marvell/axp/ddr3_init.c | 16 +++++++++++----- drivers/ddr/marvell/axp/ddr3_init.h | 2 +- drivers/ddr/marvell/axp/ddr3_spd.c | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-)
drivers/ddr/marvell/axp/ddr3_init.c +11 -5
@@ -361,12 +361,18 @@ static u32 ddr3_init_main(void)__maybe_unused u32 ddr_width =BUS_WIDTH ;__maybe_unused int status;__maybe_unused u32 win_backup[16 ]; +__maybe_unused struct udevice *udev; +__maybe_unused int ret;/* SoC/Board special Initializtions */ fab_opt =ddr3_get_fab_opt ();#ifdef CONFIG_SPD_EEPROM -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); + ret =i2c_get_chip_for_busnum (0 ,BUS_WIDTH_ECC_TWSI_ADDR ,1 , &udev); +if (ret) { +printf ("Cannot find SPD EEPROM\n" ); +return MV_DDR3_TRAINING_ERR_BAD_DIMM_SETUP ; + }#endif ddr3_print_version ();
@@ -438,7 +444,7 @@ static u32 ddr3_init_main(void)#if defined(ECC_SUPPORT ) && defined(AUTO_DETECTION_SUPPORT ) ecc =0 ; -if (ddr3_check_config (BUS_WIDTH_ECC_TWSI_ADDR ,CONFIG_ECC )) +if (ddr3_check_config (udev,CONFIG_ECC )) ecc =1 ;#endif
@@ -483,7 +489,7 @@ static u32 ddr3_init_main(void)* Dynamically Set 32Bit and ECC for AXP (Relevant only for * Marvell DB boards) */ -if (ddr3_check_config (BUS_WIDTH_ECC_TWSI_ADDR ,CONFIG_BUS_WIDTH )) { +if (ddr3_check_config (udev,CONFIG_BUS_WIDTH )) { ddr_width =32 ;DEBUG_INIT_S ("DDR3 Training Sequence - DRAM bus width 32Bit\n" ); }
@@ -904,7 +910,7 @@ void ddr3_static_mc_init(void)* Notes: Only Available for ArmadaXP/Armada 370 DB boards * Returns: None. */ -int ddr3_check_config (u32 twsi_addr,MV_CONFIG_TYPE config_type) +int ddr3_check_config (struct udevice *udev,MV_CONFIG_TYPE config_type) {#ifdef AUTO_DETECTION_SUPPORT u8 data =0 ;
@@ -916,7 +922,7 @@ int ddr3_check_config(u32 twsi_addr, MV_CONFIG_TYPE config_type)else offset =0 ; - ret =i2c_read (twsi_addr, offset,1 , (u8 *)&data,1 ); + ret =dm_i2c_read (udev, offset, &data,1 );if (!ret) {switch (config_type) {case CONFIG_ECC :
drivers/ddr/marvell/axp/ddr3_init.h +1 -1
@@ -101,7 +101,7 @@ void fix_pll_val(u8 target_fab);u32 ddr3_get_fab_opt (void );u32 ddr3_get_cpu_freq (void );u32 ddr3_get_vco_freq (void ); -int ddr3_check_config (u32 addr,MV_CONFIG_TYPE config_type); +int ddr3_check_config (struct udevice *udev,MV_CONFIG_TYPE config_type);u32 ddr3_get_static_mc_value (u32 reg_addr,u32 offset1,u32 mask1,u32 offset2,u32 mask2);u32 ddr3_cl_to_valid_cl (u32 cl);
drivers/ddr/marvell/axp/ddr3_spd.c +14 -2
@@ -209,13 +209,19 @@ static u32 ddr3_get_dimm_num(u32 *dimm_addr)/* Read the dimm eeprom */ for (dimm_cur_addr =MAX_DIMM_ADDR ; dimm_cur_addr >MIN_DIMM_ADDR ; dimm_cur_addr--) { +struct udevice *udev; + data[SPD_DEV_TYPE_BYTE ] =0 ;/* Far-End DIMM must be connected */ if ((dimm_num ==0 ) && (dimm_cur_addr <FAR_END_DIMM_ADDR ))return 0 ; - ret =i2c_read (dimm_cur_addr,0 ,1 , (uchar *)data,3 ); + ret =i2c_get_chip_for_busnum (0 , dimm_cur_addr,1 , &udev); +if (ret) +continue ; + + ret =dm_i2c_read (udev,0 , data,3 );if (!ret) {if (data[SPD_DEV_TYPE_BYTE ] ==SPD_MEM_TYPE_DDR3 ) { dimm_addr[dimm_num] = dimm_cur_addr;
@@ -245,9 +251,15 @@ int ddr3_spd_init(MV_DIMM_INFO *info, u32 dimm_addr, u32 dimm_width)__maybe_unused u8 vendor_high, vendor_low;if (dimm_addr !=0 ) { +struct udevice *udev; +memset (spd_data,0 ,SPD_SIZE *sizeof (u8)); - ret =i2c_read (dimm_addr,0 ,1 , (uchar *)spd_data,SPD_SIZE ); + ret =i2c_get_chip_for_busnum (0 , dimm_addr,1 , &udev); +if (ret) +return MV_DDR3_TRAINING_ERR_TWSI_FAIL ; + + ret =dm_i2c_read (udev,0 , spd_data,SPD_SIZE );if (ret)return MV_DDR3_TRAINING_ERR_TWSI_FAIL ; }
Signature · 1 line
2.34.0
Re: [PATCH 8/9] arm: mvebu: axp: ddr: Switch to using DM I2C API
Quoted 5 lines · Stefan Roese
No functional change intended. This patch switches from the legacy I2C API to the DM I2C API, so that this code can be used with DM I2C enabled.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 112 lines
--- drivers/ddr/marvell/axp/ddr3_init.c | 16 +++++++++++----- drivers/ddr/marvell/axp/ddr3_init.h | 2 +- drivers/ddr/marvell/axp/ddr3_spd.c | 16 ++++++++++++++-- 3 files changed, 26 insertions(+), 8 deletions(-)drivers/ddr/marvell/axp/ddr3_init.c +11
-5@@ -361,12 +361,18 @@ static u32 ddr3_init_main(void)__maybe_unused u32 ddr_width =BUS_WIDTH ;__maybe_unused int status;__maybe_unused u32 win_backup[16 ]; +__maybe_unused struct udevice *udev; +__maybe_unused int ret;/* SoC/Board special Initializtions */ fab_opt =ddr3_get_fab_opt ();#ifdef CONFIG_SPD_EEPROM -i2c_init (CONFIG_SYS_I2C_SPEED ,CONFIG_SYS_I2C_SLAVE ); + ret =i2c_get_chip_for_busnum (0 ,BUS_WIDTH_ECC_TWSI_ADDR ,1 , &udev); +if (ret) { +printf ("Cannot find SPD EEPROM\n" ); +return MV_DDR3_TRAINING_ERR_BAD_DIMM_SETUP ; + }#endif ddr3_print_version ();@@ -438,7 +444,7 @@ static u32 ddr3_init_main(void)#if defined(ECC_SUPPORT ) && defined(AUTO_DETECTION_SUPPORT ) ecc =0 ; -if (ddr3_check_config (BUS_WIDTH_ECC_TWSI_ADDR ,CONFIG_ECC )) +if (ddr3_check_config (udev,CONFIG_ECC )) ecc =1 ;#endif @@ -483,7 +489,7 @@ static u32 ddr3_init_main(void)* Dynamically Set 32Bit and ECC for AXP (Relevant only for * Marvell DB boards) */ -if (ddr3_check_config (BUS_WIDTH_ECC_TWSI_ADDR ,CONFIG_BUS_WIDTH )) { +if (ddr3_check_config (udev,CONFIG_BUS_WIDTH )) { ddr_width =32 ;DEBUG_INIT_S ("DDR3 Training Sequence - DRAM bus width 32Bit\n" ); }@@ -904,7 +910,7 @@ void ddr3_static_mc_init(void)* Notes: Only Available for ArmadaXP/Armada 370 DB boards * Returns: None. */ -int ddr3_check_config (u32 twsi_addr,MV_CONFIG_TYPE config_type) +int ddr3_check_config (struct udevice *udev,MV_CONFIG_TYPE config_type) {#ifdef AUTO_DETECTION_SUPPORT u8 data =0 ;@@ -916,7 +922,7 @@ int ddr3_check_config(u32 twsi_addr, MV_CONFIG_TYPE config_type)else offset =0 ; - ret =i2c_read (twsi_addr, offset,1 , (u8 *)&data,1 ); + ret =dm_i2c_read (udev, offset, &data,1 );if (!ret) {switch (config_type) {case CONFIG_ECC :drivers/ddr/marvell/axp/ddr3_init.h +1
-1@@ -101,7 +101,7 @@ void fix_pll_val(u8 target_fab);u32 ddr3_get_fab_opt (void );u32 ddr3_get_cpu_freq (void );u32 ddr3_get_vco_freq (void ); -int ddr3_check_config (u32 addr,MV_CONFIG_TYPE config_type); +int ddr3_check_config (struct udevice *udev,MV_CONFIG_TYPE config_type);u32 ddr3_get_static_mc_value (u32 reg_addr,u32 offset1,u32 mask1,u32 offset2,u32 mask2);u32 ddr3_cl_to_valid_cl (u32 cl);drivers/ddr/marvell/axp/ddr3_spd.c +9
-1@@ -209,13 +209,19 @@ static u32 ddr3_get_dimm_num(u32 *dimm_addr)/* Read the dimm eeprom */ for (dimm_cur_addr =MAX_DIMM_ADDR ; dimm_cur_addr >MIN_DIMM_ADDR ; dimm_cur_addr--) { +struct udevice *udev; + data[SPD_DEV_TYPE_BYTE ] =0 ;/* Far-End DIMM must be connected */ if ((dimm_num ==0 ) && (dimm_cur_addr <FAR_END_DIMM_ADDR ))return 0 ; - ret =i2c_read (dimm_cur_addr,0 ,1 , (uchar *)data,3 ); + ret =i2c_get_chip_for_busnum (0 , dimm_cur_addr,1 , &udev); +if (ret) +continue ; + + ret =dm_i2c_read (udev,0 , data,3 );if (!ret) {if (data[SPD_DEV_TYPE_BYTE ] ==SPD_MEM_TYPE_DDR3 ) { dimm_addr[dimm_num] = dimm_cur_addr;@@ -245,9 +251,15 @@ int ddr3_spd_init(MV_DIMM_INFO *info, u32 dimm_addr, u32 dimm_width)__maybe_unused u8 vendor_high, vendor_low;if (dimm_addr !=0 ) { +struct udevice *udev; +memset (spd_data,0 ,SPD_SIZE *sizeof (u8));
drivers/ddr/marvell/axp/ddr3_spd.c int ddr3_spd_init(MV_DIMM_INFO *info, u32 dimm_addr, u32 dimm_width) · line 265
Quoted 10 lines
drivers/ddr/marvell/axp/ddr3_spd.c +5
-1- ret =i2c_read (dimm_addr,0 ,1 , (uchar *)spd_data,SPD_SIZE ); + ret =i2c_get_chip_for_busnum (0 , dimm_addr,1 , &udev); +if (ret) +return MV_DDR3_TRAINING_ERR_TWSI_FAIL ; + + ret =dm_i2c_read (udev,0 , spd_data,SPD_SIZE );if (ret)return MV_DDR3_TRAINING_ERR_TWSI_FAIL ; }
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
PATCH 9/9 arm: mvebu: armada-xp-theadorable.dts: Add I2C DT nodes
In reply to Stefan RoeseNow with DM I2C support enabled we need to describe the I2C busses and devices in the DT.
--- arch/arm/dts/armada-xp-theadorable.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/dts/armada-xp-theadorable.dts +12 -0
@@ -71,6 +71,8 @@ spi0 = &spi0; spi1 = &spi1; ethernet0 = ð0; + i2c0 = &i2c0; + i2c1 = &i2c1; }; memory {
@@ -156,6 +158,16 @@ }; }; +&i2c0 { + status = "okay"; + clock-frequency = <100000>; +}; + +&i2c1 { + status = "okay"; + clock-frequency = <100000>; +}; + &spi0 { status = "okay"; u-boot,dm-pre-reloc;
Signature · 1 line
2.34.0
Re: [PATCH 9/9] arm: mvebu: armada-xp-theadorable.dts: Add I2C DT nodes
Quoted 4 lines · Stefan Roese
Now with DM I2C support enabled we need to describe the I2C busses and devices in the DT.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 25 lines
--- arch/arm/dts/armada-xp-theadorable.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+)arch/arm/dts/armada-xp-theadorable.dts +5
-0@@ -71,6 +71,8 @@ spi0 = &spi0; spi1 = &spi1; ethernet0 = ð0; + i2c0 = &i2c0; + i2c1 = &i2c1; }; memory {@@ -156,6 +158,16 @@ }; }; +&i2c0 { + status = "okay"; + clock-frequency = <100000>;
arch/arm/dts/armada-xp-theadorable.dts line 173
Quoted 10 lines
arch/arm/dts/armada-xp-theadorable.dts +7
-0+}; + +&i2c1 { + status = "okay"; + clock-frequency = <100000>; +}; + &spi0 { status = "okay"; u-boot,dm-pre-reloc;
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Quoted 4 lines · Stefan Roese
Move to the DM I2C version, so that this board will not get dropped from mainline.
Signed-off-by Stefan Roese <[email protected]>
Applied to u-boot-marvell/next
Thanks,
Stefan
Quoted 11 lines
--- configs/theadorable_debug_defconfig | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)configs/theadorable_debug_defconfig +0
-0@@ -58,10 +58,8 @@ CONFIG_SATA_MV=y CONFIG_BOOTCOUNT_LIMIT=y
configs/theadorable_debug_defconfig CONFIG_SATA_MV=y · line 65
Quoted 10 lines
configs/theadorable_debug_defconfig +1
-3CONFIG_BOOTCOUNT_RAM=y CONFIG_FPGA_ALTERA=y -CONFIG_SYS_I2C_LEGACY=y -CONFIG_SPL_SYS_I2C_LEGACY=y +CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y -CONFIG_SYS_I2C_SLAVE=0x0 # CONFIG_MMC is not set CONFIG_SF_DEFAULT_SPEED=27777777 CONFIG_SPI_FLASH_MACRONIX=y
Viele Grüße,
Stefan Roese
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]