mmc: fsl_esdhc: move 'status' property fixup into a weak function
PATCH v4 1/3 mmc: fsl_esdhc: move 'status' property fixup into a weak function
Move fdt fixup of 'status' property into a weak function. This allows board to define 'status' fdt fixup by themselves.
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
--- drivers/mmc/fsl_esdhc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
drivers/mmc/fsl_esdhc.c +14 -7
@@ -911,17 +911,26 @@ void mmc_adapter_card_type_ident(void)#endif #ifdef CONFIG_OF_LIBFDT -void fdt_fixup_esdhc (void *blob,bd_t *bd) +__weak int esdhc_status_fixup (void *blob,const char *compat) { -const char *compat ="fsl,esdhc" ; -#ifdef CONFIG_FSL_ESDHC_PIN_MUX if (!hwconfig ("esdhc" )) {do_fixup_by_compat (blob, compat,"status" ,"disabled" , -8 +1 ,1 ); -return ; +sizeof ("disabled" ),1 ); +return 1 ; }#endif +do_fixup_by_compat (blob, compat,"status" ,"okay" , +sizeof ("okay" ),1 ); +return 0 ; +} + +void fdt_fixup_esdhc (void *blob,bd_t *bd) +{ +const char *compat ="fsl,esdhc" ; + +if (esdhc_status_fixup (blob, compat)) +return ;#ifdef CONFIG_FSL_ESDHC_USE_PERIPHERAL_CLK do_fixup_by_compat_u32(blob, compat, "peripheral-frequency",
@@ -934,8 +943,6 @@ void fdt_fixup_esdhc(void *blob, bd_t *bd)do_fixup_by_compat_u32 (blob, compat,"adapter-type" , (u32)(gd->arch.sdhc_adapter),1 ); #endif -do_fixup_by_compat (blob, compat,"status" ,"okay" , - 4 + 1, 1); }#endif
Signature · 1 line
2.1.0.27.g96db324
PATCH v4 2/3 armv8: ls1012a: define esdhc_status_fixup for QDS board
The LS1012AQDS board has a hardware issue. When there is no eMMC adapter card inserted in SDHC2 adapter slot, the command inhibit bits of eSDHC2_PRSSTAT register will never release. This would cause below continious error messages in linux since it uses polling mode to detect card.
"mmc1: Controller never released inhibit bit(s)."
"mmc1: Controller never released inhibit bit(s)."
"mmc1: Controller never released inhibit bit(s)."
This patch is to define esdhc_status_fixup function for QDS to disable SDHC2 status if no eMMC adapter card is detected.
---
Changes for v2:
- Added annotation in code
- Added return value
- Modified commit message
Changes for v3:
- None
Changes for v4:
- None
--- board/freescale/ls1012aqds/ls1012aqds.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
board/freescale/ls1012aqds/ls1012aqds.c +28 -0
@@ -121,6 +121,34 @@ int board_eth_init(bd_t *bis)return pci_eth_init (bis); } +int esdhc_status_fixup (void *blob,const char *compat) +{ +char esdhc0_path[] ="/soc/esdhc at 1560000" ; +char esdhc1_path[] ="/soc/esdhc at 1580000" ; +u8 card_id; + +do_fixup_by_path (blob, esdhc0_path,"status" ,"okay" , +sizeof ("okay" ),1 ); + +/* +* The Presence Detect 2 register detects the installation +* of cards in various PCI Express or SGMII slots. +* +* STAT_PRS2[7:5]: Specifies the type of card installed in the +* SDHC2 Adapter slot. 0b111 indicates no adapter is installed. +*/ + card_id = (QIXIS_READ (present2) &0xe0 ) >>5 ; + +/* If no adapter is installed in SDHC2, disable SDHC2 */ +if (card_id ==0x7 ) +do_fixup_by_path (blob, esdhc1_path,"status" ,"disabled" , +sizeof ("disabled" ),1 ); +else +do_fixup_by_path (blob, esdhc1_path,"status" ,"okay" , +sizeof ("okay" ),1 ); +return 0 ; +} +#ifdef CONFIG_OF_BOARD_SETUP int ft_board_setup (void *blob,bd_t *bd) {
Signature · 1 line
2.1.0.27.g96db324
PATCH v4 3/3 armv8: ls1012a: define esdhc_status_fixup for RDB board
In reply to Yangbo LuOn LS1012ARDB board, three dual 1:4 mux/demux devices drive the SDHC2 signals to eMMC, SDIO wifi, SPI and Ardiuno shield. Only when we select eMMC and SDIO wifi, the SDHC2 could be used. Otherwise, the command inhibit bits of eSDHC2_PRSSTAT register will never release. This would cause below continious error messages in linux since it uses polling mode to detect card.
"mmc1: Controller never released inhibit bit(s)."
"mmc1: Controller never released inhibit bit(s)."
"mmc1: Controller never released inhibit bit(s)."
This patch is to define esdhc_status_fixup function for RDB to disable SDHC2 status if no SDIO wifi or eMMC is selected.
---
Changes for v2:
- Added this patch
Changes for v3:
- Fixed checkpatch issue
Changes for v4:
- Removed incorrect comments in code
--- board/freescale/ls1012ardb/ls1012ardb.c | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+)
board/freescale/ls1012ardb/ls1012ardb.c +38 -0
@@ -113,6 +113,44 @@ int board_init(void)return 0 ; } +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 ; +u8 mux_sdhc2; + +do_fixup_by_path (blob, esdhc0_path,"status" ,"okay" , +sizeof ("okay" ),1 ); + +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_IO1_ADDR ,0 ,1 , &io,1 ) <0 ) { +printf ("Error reading i2c boot information!\n" ); +return 0 ;/* Don't want to hang() on this error */ + } + + mux_sdhc2 = (io &0x0c ) >>2 ; +/* Enable SDHC2 only when use SDIO wifi and eMMC */ +if (mux_sdhc2 ==2 || mux_sdhc2 ==0 ) +do_fixup_by_path (blob, esdhc1_path,"status" ,"okay" , +sizeof ("okay" ),1 ); +else +do_fixup_by_path (blob, esdhc1_path,"status" ,"disabled" , +sizeof ("disabled" ),1 ); +return 0 ; +} +int ft_board_setup (void *blob,bd_t *bd) {arch_fixup_fdt (blob);
Signature · 1 line
2.1.0.27.g96db324
PATCH v4 1/3 mmc: fsl_esdhc: move 'status' property fixup into a weak function
In reply to Yangbo LuQuoted 4 lines · Yangbo Lu
Move fdt fixup of 'status' property into a weak function. This allows board to define 'status' fdt fixup by themselves.
Signed-off-by Yangbo Lu <[email protected]>
Quoted 8 lines
---
Changes for v2:
- None
Changes for v3:
- None
Changes for v4:
- None
---
This set is applied to fsl-qoriq master, awaiting upstream. Thanks.
York