[U-Boot] [v3, 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com --- Changes for v2: - None Changes for v3: - None --- drivers/mmc/fsl_esdhc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 9796d39..68de04e 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -908,17 +908,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", @@ -931,8 +940,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

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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com --- Changes for v2: - Added annotation in code - Added return value - Modified commit message Changes for v3: - None --- board/freescale/ls1012aqds/ls1012aqds.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index 94440b3..88fb4ce 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -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@1560000"; + char esdhc1_path[] = "/soc/esdhc@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) {

On 12/07/2016 07:42 PM, Yangbo Lu wrote:
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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- Added annotation in code
- Added return value
- Modified commit message
Changes for v3:
- None
board/freescale/ls1012aqds/ls1012aqds.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index 94440b3..88fb4ce 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -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@1560000";
- char esdhc1_path[] = "/soc/esdhc@1580000";
- u8 card_id;
- do_fixup_by_path(blob, esdhc0_path, "status", "okay",
sizeof("okay"), 1);
Don't you need to search it by compatible? Is the path always correct?
I guess it is always "okay" for esdhc0? This new function doesn't check hwconfig. Do you need to check?
- /*
* 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) {
York

-----Original Message----- From: york sun Sent: Friday, January 13, 2017 1:09 AM To: Y.B. Lu; u-boot@lists.denx.de Subject: Re: [U-Boot, v3, 2/3] armv8: ls1012a: define esdhc_status_fixup for QDS board
On 12/07/2016 07:42 PM, Yangbo Lu wrote:
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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- Added annotation in code
- Added return value
- Modified commit message
Changes for v3:
- None
board/freescale/ls1012aqds/ls1012aqds.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c index 94440b3..88fb4ce 100644 --- a/board/freescale/ls1012aqds/ls1012aqds.c +++ b/board/freescale/ls1012aqds/ls1012aqds.c @@ -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@1560000";
- char esdhc1_path[] = "/soc/esdhc@1580000";
- u8 card_id;
- do_fixup_by_path(blob, esdhc0_path, "status", "okay",
sizeof("okay"), 1);
Don't you need to search it by compatible? Is the path always correct?
[Lu Yangbo-B47093] Both eSDHC controllers of ls1012a have below compatibles. 'fsl,esdhc' 'fsl,ls1012a-esdhc'
Different compatibles for the two eSDHC controllers are not rejected since they are the same IP. The path will always be correct for ls1012a.
I guess it is always "okay" for esdhc0? This new function doesn't check hwconfig. Do you need to check?
[Lu Yangbo-B47093] Yes. Because this function is for ls1012aqds board. I removed hwconfig checking which it doesn't need.
- /*
* 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) {
York

On 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com --- Changes for v2: - Added this patch Changes for v3: - Fixed checkpatch issue --- board/freescale/ls1012ardb/ls1012ardb.c | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index 778434d..708e0a1 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -113,6 +113,45 @@ int board_init(void) return 0; }
+int esdhc_status_fixup(void *blob, const char *compat) +{ + char esdhc0_path[] = "/soc/esdhc@1560000"; + char esdhc1_path[] = "/soc/esdhc@1580000"; + u8 io = 0; + u8 mux_sdhc2; + + do_fixup_by_path(blob, esdhc0_path, "status", "okay", + sizeof("okay"), 1); + + /* Initialize i2c early for serial flash bank information */ + 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);

On 12/07/2016 07:42 PM, Yangbo Lu wrote:
On 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- Added this patch
Changes for v3:
- Fixed checkpatch issue
board/freescale/ls1012ardb/ls1012ardb.c | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index 778434d..708e0a1 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -113,6 +113,45 @@ int board_init(void) return 0; }
+int esdhc_status_fixup(void *blob, const char *compat) +{
- char esdhc0_path[] = "/soc/esdhc@1560000";
- char esdhc1_path[] = "/soc/esdhc@1580000";
- u8 io = 0;
- u8 mux_sdhc2;
- do_fixup_by_path(blob, esdhc0_path, "status", "okay",
sizeof("okay"), 1);
- /* Initialize i2c early for serial flash bank information */
- i2c_set_bus_num(0);
What do you mean "early" in the comment? This function is called after I2C is initialized.
- /*
* 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 */
In case of this error, do you want to "disable" esdhc1?
- }
- 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);
York

-----Original Message----- From: york sun Sent: Friday, January 13, 2017 1:09 AM To: Y.B. Lu; u-boot@lists.denx.de Subject: Re: [U-Boot, v3, 3/3] armv8: ls1012a: define esdhc_status_fixup for RDB board
On 12/07/2016 07:42 PM, Yangbo Lu wrote:
On 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- Added this patch
Changes for v3:
- Fixed checkpatch issue
board/freescale/ls1012ardb/ls1012ardb.c | 39 +++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+)
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c index 778434d..708e0a1 100644 --- a/board/freescale/ls1012ardb/ls1012ardb.c +++ b/board/freescale/ls1012ardb/ls1012ardb.c @@ -113,6 +113,45 @@ int board_init(void) return 0; }
+int esdhc_status_fixup(void *blob, const char *compat) {
- char esdhc0_path[] = "/soc/esdhc@1560000";
- char esdhc1_path[] = "/soc/esdhc@1580000";
- u8 io = 0;
- u8 mux_sdhc2;
- do_fixup_by_path(blob, esdhc0_path, "status", "okay",
sizeof("okay"), 1);
- /* Initialize i2c early for serial flash bank information */
- i2c_set_bus_num(0);
What do you mean "early" in the comment? This function is called after I2C is initialized.
[Lu Yangbo-B47093] Sorry, it's really confusing comment. I will remove it.
- /*
* 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 */
In case of this error, do you want to "disable" esdhc1?
[Lu Yangbo-B47093] If error occurs here, I just used return to let kernel dts decide to use it or not.
- }
- 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);
York

Hi York,
Any comments on this patchset? Thanks a lot.
Best regards, Yangbo Lu
-----Original Message----- From: Yangbo Lu [mailto:yangbo.lu@nxp.com] Sent: Thursday, December 08, 2016 11:42 AM To: u-boot@lists.denx.de Cc: york sun; Y.B. Lu Subject: [v3, 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- None
Changes for v3:
- None
drivers/mmc/fsl_esdhc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 9796d39..68de04e 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -908,17 +908,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", @@ - 931,8 +940,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
-- 2.1.0.27.g96db324

On 01/11/2017 05:42 PM, Y.B. Lu wrote:
Hi York,
Any comments on this patchset? Thanks a lot.
You didn't CC me for this set. I didn't notice them in the list. See comment below.
Best regards, Yangbo Lu
-----Original Message----- From: Yangbo Lu [mailto:yangbo.lu@nxp.com] Sent: Thursday, December 08, 2016 11:42 AM To: u-boot@lists.denx.de Cc: york sun; Y.B. Lu Subject: [v3, 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- None
Changes for v3:
- None
drivers/mmc/fsl_esdhc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 9796d39..68de04e 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -908,17 +908,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;
What's your intention for the non-zero return? It is not considered an error, is it?
} #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;
With non-zero return, following code will be skipped. This is the same as code flow before this change. What are you going to do with the new board-level function?
Review comment continues on other patches in this set.
York

-----Original Message----- From: york sun Sent: Friday, January 13, 2017 1:09 AM To: Y.B. Lu; u-boot@lists.denx.de Subject: Re: [v3, 1/3] mmc: fsl_esdhc: move 'status' property fixup into a weak function
On 01/11/2017 05:42 PM, Y.B. Lu wrote:
Hi York,
Any comments on this patchset? Thanks a lot.
You didn't CC me for this set. I didn't notice them in the list. See comment below.
Best regards, Yangbo Lu
-----Original Message----- From: Yangbo Lu [mailto:yangbo.lu@nxp.com] Sent: Thursday, December 08, 2016 11:42 AM To: u-boot@lists.denx.de Cc: york sun; Y.B. Lu Subject: [v3, 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.
Signed-off-by: Yangbo Lu yangbo.lu@nxp.com
Changes for v2:
- None
Changes for v3:
- None
drivers/mmc/fsl_esdhc.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 9796d39..68de04e 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -908,17 +908,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;
What's your intention for the non-zero return? It is not considered an error, is it?
[Lu Yangbo-B47093] I intend to get non-zero return when there is no esdhc with 'okay' status. Then the following fixup could be dropped.
} #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;
With non-zero return, following code will be skipped. This is the same as code flow before this change. What are you going to do with the new board-level function?
[Lu Yangbo-B47093] As I said, if we 'disabled' the status, the following fixup could be dropped. The new board-level function is for some specific boards which have some hardware issue of esdhc. We need to check board hardware in board-level function first and decide to enable it or not.
Review comment continues on other patches in this set.
York
participants (3)
-
Y.B. Lu
-
Yangbo Lu
-
york sun