armv8: ls1012ardb: clean up definitions for I2C IO expanders
PATCH v4 1/3 armv8: ls1012ardb: clean up definitions for I2C IO expanders
This patch is to clean up definitions for I2C IO expanders. The value 0x10 of __SW_BOOT_EMU is wrong. It should be 0x2. Fixed it in this patch.
---
Changes for v4:
- Added this patch.
--- board/freescale/ls1012ardb/ls1012ardb.c | 14 +++++++------- include/configs/ls1012ardb.h | 18 ++++++++++-------- 2 files changed, 17 insertions(+), 15 deletions(-)
board/freescale/ls1012ardb/ls1012ardb.c +7 -7
@@ -35,25 +35,25 @@ int checkboard(void)/* Initialize i2c early for Serial flash bank information */ i2c_set_bus_num (0 ); -if (i2c_read (I2C_MUX_IO1_ADDR ,1 ,1 , &in1,1 ) <0 ) { +if (i2c_read (I2C_MUX_IO_ADDR ,I2C_MUX_IO_1 ,1 , &in1,1 ) <0 ) {printf ("Error reading i2c boot information!\n" );return 0 ;/* Don't want to hang() on this error */ }puts ("Version" ); -if ((in1 & (~__SW_REV_MASK)) == __SW_REV_A) +if ((in1 &SW_REV_MASK ) ==SW_REV_A )puts (": RevA" ); -else if ((in1 & (~__SW_REV_MASK)) == __SW_REV_B) +else if ((in1 &SW_REV_MASK ) ==SW_REV_B )puts (": RevB" );else puts (": unknown" );printf (", boot from QSPI" ); -if ((in1 & (~__SW_BOOT_MASK)) == __SW_BOOT_EMU) +if ((in1 &SW_BOOT_MASK ) ==SW_BOOT_EMU )puts (": emu\n" ); -else if ((in1 & (~__SW_BOOT_MASK)) == __SW_BOOT_BANK1) +else if ((in1 &SW_BOOT_MASK ) ==SW_BOOT_BANK1 )puts (": bank1\n" ); -else if ((in1 & (~__SW_BOOT_MASK)) == __SW_BOOT_BANK2) +else if ((in1 &SW_BOOT_MASK ) ==SW_BOOT_BANK2 )puts (": bank2\n" );else puts ("unknown\n" );
@@ -152,7 +152,7 @@ int esdhc_status_fixup(void *blob, const char *compat)* 10 - eMMC Memory * 11 - SPI */ -if (i2c_read (I2C_MUX_IO1_ADDR ,0 ,1 , &io,1 ) <0 ) { +if (i2c_read (I2C_MUX_IO_ADDR ,I2C_MUX_IO_0 ,1 , &io,1 ) <0 ) {printf ("Error reading i2c boot information!\n" );return 0 ;/* Don't want to hang() on this error */ }
include/configs/ls1012ardb.h +10 -8
@@ -24,14 +24,16 @@* I2C IO expander */ -#define I2C_MUX_IO1_ADDR 0x24 -#define __SW_BOOT_MASK 0xFC -#define __SW_BOOT_EMU 0x10 -#define __SW_BOOT_BANK1 0x00 -#define __SW_BOOT_BANK2 0x01 -#define __SW_REV_MASK 0x07 -#define __SW_REV_A 0xF8 -#define __SW_REV_B 0xF0 +#define I2C_MUX_IO_ADDR 0x24 +#define I2C_MUX_IO_0 0 +#define I2C_MUX_IO_1 1 +#define SW_BOOT_MASK 0x03 +#define SW_BOOT_EMU 0x02 +#define SW_BOOT_BANK1 0x00 +#define SW_BOOT_BANK2 0x01 +#define SW_REV_MASK 0xF8 +#define SW_REV_A 0xF8 +#define SW_REV_B 0xF0/* MMC */ #ifdef CONFIG_MMC
Signature · 1 line
2.14.1
PATCH v4 2/3 armv8: ls1012ardb: add more board version information
Add LS1012ARDB RevC/RevC1/RevC2/RevD/RevE information and detect it when u-boot starts up.
---
Changes for v4:
- Added this patch.
--- board/freescale/ls1012ardb/ls1012ardb.c | 26 +++++++++++++++++++++++--- include/configs/ls1012ardb.h | 5 +++++ 2 files changed, 28 insertions(+), 3 deletions(-)
board/freescale/ls1012ardb/ls1012ardb.c +23 -3
@@ -41,12 +41,32 @@ int checkboard(void) }puts ("Version" ); -if ((in1 &SW_REV_MASK ) ==SW_REV_A ) +switch (in1 &SW_REV_MASK ) { +case SW_REV_A :puts (": RevA" ); -else if ((in1 &SW_REV_MASK ) ==SW_REV_B ) +break ; +case SW_REV_B :puts (": RevB" ); -else +break ; +case SW_REV_C : +puts (": RevC" ); +break ; +case SW_REV_C1 : +puts (": RevC1" ); +break ; +case SW_REV_C2 : +puts (": RevC2" ); +break ; +case SW_REV_D : +puts (": RevD" ); +break ; +case SW_REV_E : +puts (": RevE" ); +break ; +default :puts (": unknown" ); +break ; + }printf (", boot from QSPI" );if ((in1 &SW_BOOT_MASK ) ==SW_BOOT_EMU )
include/configs/ls1012ardb.h +5 -0
@@ -34,6 +34,11 @@#define SW_REV_MASK 0xF8#define SW_REV_A 0xF8#define SW_REV_B 0xF0 +#define SW_REV_C 0xE8 +#define SW_REV_C1 0xE0 +#define SW_REV_C2 0xD8 +#define SW_REV_D 0xD0 +#define SW_REV_E 0xC8/* MMC */ #ifdef CONFIG_MMC
Signature · 1 line
2.14.1
York Sun
AppliedPATCH v4 2/3 armv8: ls1012ardb: add more board version information
Quoted 7 lines · Yangbo Lu
Add LS1012ARDB RevC/RevC1/RevC2/RevD/RevE information and detect it when u-boot starts up.
Signed-off-by Yangbo Lu <[email protected]>---
Changes for v4:
- Added this patch.
Applied to fsl-qoriq master. Thanks.
York
PATCH v4 3/3 armv8: ls1012ardb: support hwconfig for eSDHC1 enabling
In reply to Yangbo LuI2C reading for DIP switch setting is not reliable for LS1012ARDB RevD and later versions. This patch is to add hwconfig support to enable/disable eSDHC1 manually for these boards. Also drop 'status' fix-up for eSDHC0 and leave it as it is. It shouldn't always be fixed up with 'okay'.
---
Changes for v2:
- Just used hwconfig() instead of getenv() and hwconfig_f().
Changes for v3:
- only applied hwconfig support for RevD and later versions.
Changes for v4:
- Modified commit message.
- reused io variable.
- checked CONFIG_HWCONFIG before use it.
--- board/freescale/ls1012ardb/ls1012ardb.c | 55 +++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-)
board/freescale/ls1012ardb/ls1012ardb.c +35 -20
@@ -152,34 +152,49 @@ int board_init(void)int esdhc_status_fixup (void *blob,const char *compat) { -char esdhc0_path[] ="/soc/esdhc at 1560000" ;char esdhc1_path[] ="/soc/esdhc at 1580000" ; -u8 io =0 ; +bool sdhc2_en = false;u8 mux_sdhc2; - -do_fixup_by_path (blob, esdhc0_path,"status" ,"okay" , -sizeof ("okay" ),1 ); +u8 io =0 ;i2c_set_bus_num (0 ); -/* -* The I2C IO-expander for mux select is used to control the muxing -* of various onboard interfaces. -* -* IO1[3:2] indicates SDHC2 interface demultiplexer select lines. -* 00 - SDIO wifi -* 01 - GPIO (to Arduino) -* 10 - eMMC Memory -* 11 - SPI -*/ -if (i2c_read (I2C_MUX_IO_ADDR ,I2C_MUX_IO_0 ,1 , &io,1 ) <0 ) { +/* IO1[7:3] is the field of board revision info. */ +if (i2c_read (I2C_MUX_IO_ADDR ,I2C_MUX_IO_1 ,1 , &io,1 ) <0 ) {printf ("Error reading i2c boot information!\n" ); -return 0 ;/* Don't want to hang() on this error */ +return 0 ; + } + +/* hwconfig method is used for RevD and later versions. */ +if ((io &SW_REV_MASK ) <=SW_REV_D ) { +#ifdef CONFIG_HWCONFIG +if (hwconfig ("esdhc1" )) + sdhc2_en = true; +#endif + }else { +/* +* The I2C IO-expander for mux select is used to control +* the muxing of various onboard interfaces. +* +* IO0[3:2] indicates SDHC2 interface demultiplexer +* select lines. +* 00 - SDIO wifi +* 01 - GPIO (to Arduino) +* 10 - eMMC Memory +* 11 - SPI +*/ +if (i2c_read (I2C_MUX_IO_ADDR ,I2C_MUX_IO_0 ,1 , &io,1 ) <0 ) { +printf ("Error reading i2c boot information!\n" ); +return 0 ; + } + + mux_sdhc2 = (io &0x0c ) >>2 ; +/* Enable SDHC2 only when use SDIO wifi and eMMC */ +if (mux_sdhc2 ==2 || mux_sdhc2 ==0 ) + sdhc2_en = true; } - mux_sdhc2 = (io &0x0c ) >>2 ; -/* Enable SDHC2 only when use SDIO wifi and eMMC */ -if (mux_sdhc2 ==2 || mux_sdhc2 ==0 ) +if (sdhc2_en)do_fixup_by_path (blob, esdhc1_path,"status" ,"okay" ,sizeof ("okay" ),1 );else
Signature · 1 line
2.14.1
York Sun
AppliedPATCH v4 3/3 armv8: ls1012ardb: support hwconfig for eSDHC1 enabling
Quoted 7 lines · Yangbo Lu
I2C reading for DIP switch setting is not reliable for LS1012ARDB RevD and later versions. This patch is to add hwconfig support to enable/disable eSDHC1 manually for these boards. Also drop 'status' fix-up for eSDHC0 and leave it as it is. It shouldn't always be fixed up with 'okay'.
Signed-off-by Yangbo Lu <[email protected]>
Quoted 9 lines
---
Changes for v2:
- Just usedhwconfig()instead ofgetenv()andhwconfig_f().
Changes for v3:
- only applied hwconfig support for RevD and later versions.
Changes for v4:
- Modified commit message.
- reused io variable.
- checkedCONFIG_HWCONFIGbefore use it.
Applied to fsl-qoriq master. Thanks.
York
York Sun
AppliedPATCH v4 1/3 armv8: ls1012ardb: clean up definitions for I2C IO expanders
In reply to Yangbo LuQuoted 8 lines · Yangbo Lu
This patch is to clean up definitions for I2C IO expanders. The value
0x10of__SW_BOOT_EMUis wrong. It should be0x2. Fixed it in this patch.Signed-off-by Yangbo Lu <[email protected]>---
Changes for v4:
- Added this patch.
Applied to fsl-qoriq master. Thanks.
York