Skip to contentSkip to conversation

Move eSDHC adapter card code to board files

PATCH New Yangbo Lu 2 participants 8 messages Jun 17, 2020 – Jul 8, 2020

Subsystems (2)
lore
Share & tools
lore

Yangbo Lu

author
#0 lore raw

cover Move eSDHC adapter card code to board files

The eSDHC adapter card identification and multiplexing configuration through FPGA had been implemented in both common mmc driver and fsl_esdhc driver. However it is proper to move these code to board files and do it during board initialization. The FPGA registers are also board specific.

This patch-set is to move eSDHC adapter card identification and multiplexing configuration from mmc driver to specific board files. Add eSDHC adapter card identification for LX2 QDS.
And the option CONFIG_FSL_ESDHC_ADAPTER_IDENT is no longer needed.

CI build result
https://travis-ci.org/github/yangbolu1991/u-boot-test/builds/699180417

Yangbo Lu (4):
Drop global data sdhc_adapter for powerpc
Move eSDHC adapter card identification to board files
board: fsl: lx2160aqds: identify SDHC adapter during board init
configs: lx2160aqds: enable CONFIG_BOARD_EARLY_INIT_R

 arch/powerpc/include/asm/global_data.h       |  4 +--
 board/freescale/common/qixis.h               | 14 +++++++---
 board/freescale/lx2160a/lx2160a.c            | 36 +++++++++++++++++++++++--
 board/freescale/t1040qds/t1040qds.c          | 29 ++++++++++++++++++++-
 board/freescale/t208xqds/t208xqds.c          | 29 ++++++++++++++++++++-
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |  1 +
 configs/lx2160aqds_tfa_defconfig             |  1 +
 doc/README.fsl-esdhc                         | 14 ----------
 drivers/mmc/fsl_esdhc.c                      | 39 ----------------------------
 drivers/mmc/mmc-uclass.c                     |  4 +--
 drivers/mmc/mmc.c                            |  7 +----
 drivers/mmc/mmc_legacy.c                     |  7 +----
 drivers/mmc/mmc_private.h                    |  4 +--
 include/configs/T1040QDS.h                   |  1 -
 include/configs/T208xQDS.h                   |  1 -
 include/fsl_esdhc.h                          |  4 ---
 scripts/config_whitelist.txt                 |  1 -
 17 files changed, 108 insertions(+), 88 deletions(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/4 Drop global data sdhc_adapter for powerpc

The sdhc_adapter of global data has not been used, and we do not have to use it as global data even we may need it in the future.

---
 arch/powerpc/include/asm/global_data.h | 4 +---
 drivers/mmc/fsl_esdhc.c                | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/include/asm/global_data.h +1 -3
index 1620fba..192a02d 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * (C) Copyright 2002-2010
+ * Copyright 2020 NXP
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  */
 
@@ -15,9 +16,6 @@ struct arch_global_data {
 #if defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 	u32 sdhc_per_clk;
-#if defined(CONFIG_FSL_ESDHC_ADAPTER_IDENT)
-	u8 sdhc_adapter;
-#endif
 #endif
 #if defined(CONFIG_MPC8xx)
 	unsigned long brg_clk;
drivers/mmc/fsl_esdhc.c +0 -1
index a4b923a..38cbca1 100644
@@ -678,7 +678,6 @@ void mmc_adapter_card_type_ident(void)
 	u8 value;
 
 	card_id = QIXIS_READ(present) & QIXIS_SDID_MASK;
-	gd->arch.sdhc_adapter = card_id;
 
 	switch (card_id) {
 	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC45:
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/4 Drop global data sdhc_adapter for powerpc

Quoted 7 lines

Subject: [PATCH 1/4] Drop global data sdhc_adapter for powerpc

The sdhc_adapter of global data has not been used, and we do not have to use it as global data even we may need it in the future.

Regards,
Peng.

Quoted 42 lines
---
 arch/powerpc/include/asm/global_data.h | 4 +---
 drivers/mmc/fsl_esdhc.c                | 1 -
 2 files changed, 1 insertion(+), 4 deletions(-)
arch/powerpc/include/asm/global_data.h +1 -3
index 1620fba..192a02d 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * (C) Copyright 2002-2010
+ * Copyright 2020 NXP
  * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
  */
 
@@ -15,9 +16,6 @@ struct arch_global_data {  #if
 defined(CONFIG_FSL_ESDHC)
 	u32 sdhc_clk;
 	u32 sdhc_per_clk;
-#if defined(CONFIG_FSL_ESDHC_ADAPTER_IDENT)
-	u8 sdhc_adapter;
-#endif
 #endif
 #if defined(CONFIG_MPC8xx)
 	unsigned long brg_clk;
drivers/mmc/fsl_esdhc.c index renamed from drivers/mmc/fsl_esdhc.c +0 -0

a4b923a..38cbca1 100644

drivers/mmc/fsl_esdhc.c +0 -2
@@ -678,7 +678,6 @@ void mmc_adapter_card_type_ident(void)
 	u8 value;
 
 	card_id = QIXIS_READ(present) & QIXIS_SDID_MASK;
-	gd->arch.sdhc_adapter = card_id;
 
 	switch (card_id) {
 	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC45:
--

2.7.4

author
#3 lore raw

PATCH 2/4 Move eSDHC adapter card identification to board files

In reply to Yangbo Lu

The eSDHC adapter card identification and multiplexing configuration through FPGA had been implemented in both common mmc driver and fsl_esdhc driver. However it is proper to move these code to board files and do it during board initialization. The FPGA registers are also board specific.

This patch is to move eSDHC adapter card identification and multiplexing configuration from mmc driver to specific board files. And the option CONFIG_FSL_ESDHC_ADAPTER_IDENT is no longer needed.

---
 board/freescale/common/qixis.h      |  3 +--
 board/freescale/t1040qds/t1040qds.c | 29 +++++++++++++++++++++++++++-
 board/freescale/t208xqds/t208xqds.c | 29 +++++++++++++++++++++++++++-
 doc/README.fsl-esdhc                | 14 --------------
 drivers/mmc/fsl_esdhc.c             | 38 -------------------------------------
 drivers/mmc/mmc-uclass.c            |  4 +---
 drivers/mmc/mmc.c                   |  7 +------
 drivers/mmc/mmc_legacy.c            |  7 +------
 drivers/mmc/mmc_private.h           |  4 +---
 include/configs/T1040QDS.h          |  1 -
 include/configs/T208xQDS.h          |  1 -
 include/fsl_esdhc.h                 |  4 ----
 scripts/config_whitelist.txt        |  1 -
 13 files changed, 61 insertions(+), 81 deletions(-)
board/freescale/common/qixis.h +1 -2
index c11062e..ac5abc3 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2011 Freescale Semiconductor
+ * Copyright 2020 NXP
  * Author: Shengzhou Liu <[email protected]>
  *
  * This file provides support for the QIXIS of some Freescale reference boards.
@@ -115,7 +116,6 @@ void qixis_write_i2c(unsigned int reg, u8 value);
 #endif
 
 /* Use for SDHC adapter card type identification and operation */
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
 #define QIXIS_SDID_MASK                         0x07
 #define QIXIS_ESDHC_ADAPTER_TYPE_EMMC45         0x1	/* eMMC Card Rev4.5 */
 #define QIXIS_ESDHC_ADAPTER_TYPE_SDMMC_LEGACY   0x2	/* SD/MMC Legacy Card */
@@ -131,6 +131,5 @@ void qixis_write_i2c(unsigned int reg, u8 value);
 #define QIXIS_DAT4		0X01
 
 #define QIXIS_EVDD_BY_SDHC_VS	0x0c
-#endif
 
 #endif
board/freescale/t1040qds/t1040qds.c +28 -1
index cf38d84..18eb395 100644
@@ -131,6 +131,33 @@ static void qe_board_setup(void)
 	}
 }
 
+static void esdhc_adapter_card_ident(void)
+{
+	u8 card_id, value;
+
+	card_id = QIXIS_READ(present) & QIXIS_SDID_MASK;
+
+	switch (card_id) {
+	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC45:
+		value = QIXIS_READ(brdcfg[5]);
+		value |= (QIXIS_DAT4 | QIXIS_DAT5_6_7);
+		QIXIS_WRITE(brdcfg[5], value);
+		break;
+	case QIXIS_ESDHC_ADAPTER_TYPE_SDMMC_LEGACY:
+		value = QIXIS_READ(pwr_ctl[1]);
+		value |= QIXIS_EVDD_BY_SDHC_VS;
+		QIXIS_WRITE(pwr_ctl[1], value);
+		break;
+	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC44:
+		value = QIXIS_READ(brdcfg[5]);
+		value |= (QIXIS_SDCLKIN | QIXIS_SDCLKOUT);
+		QIXIS_WRITE(brdcfg[5], value);
+		break;
+	default:
+		break;
+	}
+}
+
 int board_early_init_f(void)
 {
 #if defined(CONFIG_DEEP_SLEEP)
@@ -170,7 +197,7 @@ int board_early_init_r(void)
 		0, flash_esel, BOOKE_PAGESZ_256M, 1);
 #endif
 	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0);
-
+	esdhc_adapter_card_ident();
 	return 0;
 }
 
board/freescale/t208xqds/t208xqds.c +28 -1
index 4d980e1..88169ae 100644
@@ -345,6 +345,33 @@ int brd_mux_lane_to_slot(void)
 	return 0;
 }
 
+static void esdhc_adapter_card_ident(void)
+{
+	u8 card_id, value;
+
+	card_id = QIXIS_READ(present) & QIXIS_SDID_MASK;
+
+	switch (card_id) {
+	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC45:
+		value = QIXIS_READ(brdcfg[5]);
+		value |= (QIXIS_DAT4 | QIXIS_DAT5_6_7);
+		QIXIS_WRITE(brdcfg[5], value);
+		break;
+	case QIXIS_ESDHC_ADAPTER_TYPE_SDMMC_LEGACY:
+		value = QIXIS_READ(pwr_ctl[1]);
+		value |= QIXIS_EVDD_BY_SDHC_VS;
+		QIXIS_WRITE(pwr_ctl[1], value);
+		break;
+	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC44:
+		value = QIXIS_READ(brdcfg[5]);
+		value |= (QIXIS_SDCLKIN | QIXIS_SDCLKOUT);
+		QIXIS_WRITE(brdcfg[5], value);
+		break;
+	default:
+		break;
+	}
+}
+
 int board_early_init_r(void)
 {
 	const unsigned int flashbase = CONFIG_SYS_FLASH_BASE;
@@ -384,7 +411,7 @@ int board_early_init_r(void)
 
 	brd_mux_lane_to_slot();
 	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT, 0);
-
+	esdhc_adapter_card_ident();
 	return 0;
 }
 
doc/README.fsl-esdhc +0 -14
index 29cc661..b620625 100644
@@ -1,19 +1,5 @@
 Freescale esdhc-specific options
 
-	- CONFIG_FSL_ESDHC_ADAPTER_IDENT
-		Support Freescale adapter card type identification. This is implemented by
-		operating Qixis FPGA relevant registers. The STAT_PRES1 register has SDHC
-		Card ID[0:2] bits showing the type of card installed in the SDHC Adapter Slot.
-
-		SDHC Card ID[0:2]	Adapter Card Type
-		0b000			reserved
-		0b001			eMMC Card Rev4.5
-		0b010			SD/MMC Legacy Card
-		0b011			eMMC Card Rev4.4
-		0b100			reserved
-		0b101			MMC Card
-		0b110			SD Card Rev2.0/3.0
-		0b111			No card is present
 	- CONFIG_SYS_FSL_ESDHC_LE
 		ESDHC IP is in little-endian mode. Accessing ESDHC registers can be
 		determined by ESDHC IP's endian mode or processor's endian mode.
drivers/mmc/fsl_esdhc.c +0 -38
index 38cbca1..d99e8ee 100644
@@ -671,44 +671,6 @@ static void fsl_esdhc_get_cfg_common(struct fsl_esdhc_priv *priv,
 	cfg->b_max = CONFIG_SYS_MMC_MAX_BLK_COUNT;
 }
 
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-void mmc_adapter_card_type_ident(void)
-{
-	u8 card_id;
-	u8 value;
-
-	card_id = QIXIS_READ(present) & QIXIS_SDID_MASK;
-
-	switch (card_id) {
-	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC45:
-		value = QIXIS_READ(brdcfg[5]);
-		value |= (QIXIS_DAT4 | QIXIS_DAT5_6_7);
-		QIXIS_WRITE(brdcfg[5], value);
-		break;
-	case QIXIS_ESDHC_ADAPTER_TYPE_SDMMC_LEGACY:
-		value = QIXIS_READ(pwr_ctl[1]);
-		value |= QIXIS_EVDD_BY_SDHC_VS;
-		QIXIS_WRITE(pwr_ctl[1], value);
-		break;
-	case QIXIS_ESDHC_ADAPTER_TYPE_EMMC44:
-		value = QIXIS_READ(brdcfg[5]);
-		value |= (QIXIS_SDCLKIN | QIXIS_SDCLKOUT);
-		QIXIS_WRITE(brdcfg[5], value);
-		break;
-	case QIXIS_ESDHC_ADAPTER_TYPE_RSV:
-		break;
-	case QIXIS_ESDHC_ADAPTER_TYPE_MMC:
-		break;
-	case QIXIS_ESDHC_ADAPTER_TYPE_SD:
-		break;
-	case QIXIS_ESDHC_NO_ADAPTER:
-		break;
-	default:
-		break;
-	}
-}
-#endif
-
 #ifdef CONFIG_OF_LIBFDT
 __weak int esdhc_status_fixup(void *blob, const char *compat)
 {
drivers/mmc/mmc-uclass.c +1 -3
index c5b7872..90690c8 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2015 Google, Inc
+ * Copyright 2020 NXP
  * Written by Simon Glass <[email protected]>
  */
 
@@ -309,9 +310,6 @@ void mmc_do_preinit(void)
 
 		if (!m)
 			continue;
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-		mmc_set_preinit(m, 1);
-#endif
 		if (m->preinit)
 			mmc_start_init(m);
 	}
drivers/mmc/mmc.c +1 -6
index 620bb93..2bd1f02 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2008, Freescale Semiconductor, Inc
+ * Copyright 2020 NXP
  * Andy Fleming
  *
  * Based vaguely on the Linux code
@@ -2777,9 +2778,6 @@ int mmc_get_op_cond(struct mmc *mmc)
 	if (mmc->has_init)
 		return 0;
 
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-	mmc_adapter_card_type_ident();
-#endif
 	err = mmc_power_init(mmc);
 	if (err)
 		return err;
@@ -3061,9 +3059,6 @@ int mmc_init_device(int num)
 	m = mmc_get_mmc_dev(dev);
 	if (!m)
 		return 0;
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-	mmc_set_preinit(m, 1);
-#endif
 	if (m->preinit)
 		mmc_start_init(m);
 
drivers/mmc/mmc_legacy.c +1 -6
index 2bb12ce..a05da6c 100644
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (C) 2016 Google, Inc
+ * Copyright 2020 NXP
  * Written by Simon Glass <[email protected]>
  */
 
@@ -23,9 +24,6 @@ struct mmc *find_mmc_device(int dev_num)
 void mmc_do_preinit(void)
 {
 	struct mmc *m = &mmc_static;
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-	mmc_set_preinit(m, 1);
-#endif
 	if (m->preinit)
 		mmc_start_init(m);
 }
@@ -77,9 +75,6 @@ void mmc_do_preinit(void)
 	list_for_each(entry, &mmc_devices) {
 		m = list_entry(entry, struct mmc, link);
 
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-		mmc_set_preinit(m, 1);
-#endif
 		if (m->preinit)
 			mmc_start_init(m);
 	}
drivers/mmc/mmc_private.h +1 -3
index 35170d0..a0900e8 100644
@@ -1,6 +1,7 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
  * Copyright 2008,2010 Freescale Semiconductor, Inc
+ * Copyright 2020 NXP
  * Andy Fleming
  *
  * Based (loosely) on the Linux code
@@ -16,9 +17,6 @@ int mmc_send_status(struct mmc *mmc, unsigned int *status);
 int mmc_poll_for_busy(struct mmc *mmc, int timeout);
 
 int mmc_set_blocklen(struct mmc *mmc, int len);
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-void mmc_adapter_card_type_ident(void);
-#endif
 
 #if CONFIG_IS_ENABLED(BLK)
 ulong mmc_bread(struct udevice *dev, lbaint_t start, lbaint_t blkcnt,
include/configs/T1040QDS.h +0 -1
index 7ad018b..0fc0228 100644
@@ -488,7 +488,6 @@ unsigned long get_board_ddr_clk(void);
 
 #ifdef CONFIG_MMC
 #define CONFIG_SYS_FSL_ESDHC_ADDR       CONFIG_SYS_MPC85xx_ESDHC_ADDR
-#define CONFIG_FSL_ESDHC_ADAPTER_IDENT
 #endif
 
 /* Qman/Bman */
include/configs/T208xQDS.h +0 -1
index c54f7f5..081672c 100644
@@ -637,7 +637,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_FSL_ESDHC_ADDR	CONFIG_SYS_MPC85xx_ESDHC_ADDR
 #define CONFIG_SYS_FSL_ESDHC_BROKEN_TIMEOUT
 #define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
-#define CONFIG_FSL_ESDHC_ADAPTER_IDENT
 #endif
 
 /*
include/fsl_esdhc.h +0 -4
index e148eaa..fdf5855 100644
@@ -16,10 +16,6 @@
 /* needed for the mmc_cfg definition */
 #include <mmc.h>
 
-#ifdef CONFIG_FSL_ESDHC_ADAPTER_IDENT
-#include "../board/freescale/common/qixis.h"
-#endif
-
 /* FSL eSDHC-specific constants */
 #define SYSCTL			0x0002e02c
 #define SYSCTL_INITA		0x08000000
scripts/config_whitelist.txt +0 -1
index f6bf6f2..d31f1e2 100644
@@ -556,7 +556,6 @@ CONFIG_FSL_DIU_CH7301
 CONFIG_FSL_DIU_FB
 CONFIG_FSL_DMA
 CONFIG_FSL_DSPI1
-CONFIG_FSL_ESDHC_ADAPTER_IDENT
 CONFIG_FSL_ESDHC_PIN_MUX
 CONFIG_FSL_FIXED_MMC_LOCATION
 CONFIG_FSL_FM_10GEC_REGULAR_NOTATION
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH 3/4 board: fsl: lx2160aqds: identify SDHC adapter during board init

In reply to Yangbo Lu

Add support for SDHC adapter identification and configuration during board init.

---
 board/freescale/common/qixis.h    | 11 ++++++++++-
 board/freescale/lx2160a/lx2160a.c | 36 ++++++++++++++++++++++++++++++++++--
 2 files changed, 44 insertions(+), 3 deletions(-)
board/freescale/common/qixis.h +10 -1
index ac5abc3..93638d2 100644
@@ -36,7 +36,12 @@ struct qixis {
 	u8 gdc;
 	u8 gdd;         /* DCM Debug Data Register,0x17 */
 	u8 dmack;
-	u8 res1[6];
+	u8 res1;
+	u8 sdhc1;
+	u8 sdhc2;
+	u8 stat_pres3;
+	u8 los_stat;
+	u8 usb_ctl;
 	u8 watch;       /* Watchdog Register,0x1F */
 	u8 pwr_ctl[2];  /* Power Control Register,0x20 */
 	u8 res2[2];
@@ -117,6 +122,7 @@ void qixis_write_i2c(unsigned int reg, u8 value);
 
 /* Use for SDHC adapter card type identification and operation */
 #define QIXIS_SDID_MASK                         0x07
+
 #define QIXIS_ESDHC_ADAPTER_TYPE_EMMC45         0x1	/* eMMC Card Rev4.5 */
 #define QIXIS_ESDHC_ADAPTER_TYPE_SDMMC_LEGACY   0x2	/* SD/MMC Legacy Card */
 #define QIXIS_ESDHC_ADAPTER_TYPE_EMMC44         0x3	/* eMMC Card Rev4.4 */
@@ -125,6 +131,9 @@ void qixis_write_i2c(unsigned int reg, u8 value);
 #define QIXIS_ESDHC_ADAPTER_TYPE_SD             0x6	/* SD Card Rev2.0 3.0 */
 #define QIXIS_ESDHC_NO_ADAPTER                  0x7	/* No Card is Present*/
 
+#define QIXIS_SDHC1_S1V3	0x80	/* SDHC1: SDHC1 3.3V power control */
+#define QIXIS_SDHC1_VS		0x30	/* BRDCFG11: route to SDHC1_VS */
+
 #define QIXIS_SDCLKIN		0x08
 #define QIXIS_SDCLKOUT		0x02
 #define QIXIS_DAT5_6_7		0X02
board/freescale/lx2160a/lx2160a.c +34 -2
index 73e05ee..97e72b1 100644
@@ -18,6 +18,7 @@
 #include <fdt_support.h>
 #include <linux/bitops.h>
 #include <linux/libfdt.h>
+#include <linux/delay.h>
 #include <fsl-mc/fsl_mc.h>
 #include <env_internal.h>
 #include <efi_loader.h>
@@ -379,7 +380,7 @@ int checkboard(void)
  */
 u8 qixis_esdhc_detect_quirk(void)
 {
-	/* for LX2160AQDS res1[1] @ offset 0x1A is SDHC1 Control/Status (SDHC1)
+	/*
 	 * SDHC1 Card ID:
 	 * Specifies the type of card installed in the SDHC1 adapter slot.
 	 * 000= (reserved)
@@ -391,10 +392,35 @@ u8 qixis_esdhc_detect_quirk(void)
 	 * 110= SDCard V2/V3 adapter installed.
 	 * 111= no adapter is installed.
 	 */
-	return ((QIXIS_READ(res1[1]) & QIXIS_SDID_MASK) !=
+	return ((QIXIS_READ(sdhc1) & QIXIS_SDID_MASK) !=
 		 QIXIS_ESDHC_NO_ADAPTER);
 }
 
+static void esdhc_adapter_card_ident(void)
+{
+	u8 card_id, val;
+
+	val = QIXIS_READ(sdhc1);
+	card_id = val & QIXIS_SDID_MASK;
+
+	switch (card_id) {
+	case QIXIS_ESDHC_ADAPTER_TYPE_SD:
+		/* Power cycle to card */
+		val &= ~QIXIS_SDHC1_S1V3;
+		QIXIS_WRITE(sdhc1, val);
+		mdelay(1);
+		val |= QIXIS_SDHC1_S1V3;
+		QIXIS_WRITE(sdhc1, val);
+		/* Route to SDHC1_VS */
+		val = QIXIS_READ(brdcfg[11]);
+		val |= QIXIS_SDHC1_VS;
+		QIXIS_WRITE(brdcfg[11], val);
+		break;
+	default:
+		break;
+	}
+}
+
 int config_board_mux(void)
 {
 	u8 reg11, reg5, reg13;
@@ -501,6 +527,12 @@ int config_board_mux(void)
 
 	return 0;
 }
+
+int board_early_init_r(void)
+{
+	esdhc_adapter_card_ident();
+	return 0;
+}
 #elif defined(CONFIG_TARGET_LX2160ARDB)
 int config_board_mux(void)
 {
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH 4/4 configs: lx2160aqds: enable CONFIG_BOARD_EARLY_INIT_R

In reply to Yangbo Lu

Enable CONFIG_BOARD_EARLY_INIT_R for SDHC adapter card identification and configuration.

---
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig | 1 +
 configs/lx2160aqds_tfa_defconfig             | 1 +
 2 files changed, 2 insertions(+)
configs/lx2160aqds_tfa_SECURE_BOOT_defconfig +1 -0
index 51d5dc3..50635d2 100644
@@ -18,6 +18,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
configs/lx2160aqds_tfa_defconfig +1 -0
index 716c089..2eb944e 100644
@@ -20,6 +20,7 @@ CONFIG_BOOTDELAY=10
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
 # CONFIG_USE_BOOTCOMMAND is not set
+CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_MISC_INIT_R=y
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
Signature · 1 line
2.7.4
author
#6 lore raw

cover Move eSDHC adapter card code to board files

In reply to Yangbo Lu

Hi Priyanka,

Any comments on this patch-set?
Thanks a lot.

Best regards,
Yangbo Lu

Quoted 57 lines

-----Original Message-----
From: Yangbo Lu <[email protected]>
Sent: Wednesday, June 17, 2020 6:09 PM
To: u-boot at lists.denx.de; Priyanka Jain <[email protected]>; Peng Fan <[email protected]>
Cc: Y.b. Lu <[email protected]>
Subject: [PATCH 0/4] Move eSDHC adapter card code to board files

The eSDHC adapter card identification and multiplexing configuration through FPGA had been implemented in both common mmc driver and fsl_esdhc driver. However it is proper to move these code to board files and do it during board initialization. The FPGA registers are also board specific.

This patch-set is to move eSDHC adapter card identification and multiplexing configuration from mmc driver to specific board files. Add eSDHC adapter card identification for LX2 QDS.
And the option CONFIG_FSL_ESDHC_ADAPTER_IDENT is no longer needed.

CI build result
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftravis-ci
.org%2Fgithub%2Fyangbolu1991%2Fu-boot-test%2Fbuilds%2F699180417&a mp;data=02%7C01%7Cyangbo.lu%40nxp.com%7C2351c69f76e142be1c4108d 812a73fd6%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637279 856821151607&amp;sdata=doJR9jInaSGNQHqZlOar%2BKb3kY%2F7xuQzNgA 88ADf8B0%3D&amp;reserved=0

Yangbo Lu (4):
Drop global data sdhc_adapter for powerpc
Move eSDHC adapter card identification to board files
board: fsl: lx2160aqds: identify SDHC adapter during board init
configs: lx2160aqds: enable CONFIG_BOARD_EARLY_INIT_R

 arch/powerpc/include/asm/global_data.h       |  4 +--
 board/freescale/common/qixis.h               | 14 +++++++---
 board/freescale/lx2160a/lx2160a.c            | 36
+++++++++++++++++++++++--
 board/freescale/t1040qds/t1040qds.c          | 29
++++++++++++++++++++-
 board/freescale/t208xqds/t208xqds.c          | 29
++++++++++++++++++++-
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |  1 +
 configs/lx2160aqds_tfa_defconfig             |  1 +
 doc/README.fsl-esdhc                         | 14 ----------
 drivers/mmc/fsl_esdhc.c                      | 39 ----------------------------
 drivers/mmc/mmc-uclass.c                     |  4 +--
 drivers/mmc/mmc.c                            |  7 +----
 drivers/mmc/mmc_legacy.c                     |  7 +----
 drivers/mmc/mmc_private.h                    |  4 +--
 include/configs/T1040QDS.h                   |  1 -
 include/configs/T208xQDS.h                   |  1 -
 include/fsl_esdhc.h                          |  4 ---
 scripts/config_whitelist.txt                 |  1 -
 17 files changed, 108 insertions(+), 88 deletions(-)

--
2.7.4

author
#7 lore raw

cover Move eSDHC adapter card code to board files

CC Xiaobo, Jiafei

Quoted 77 lines

-----Original Message-----
From: Y.b. Lu
Sent: Monday, July 6, 2020 10:47 AM
To: u-boot at lists.denx.de; Priyanka Jain <[email protected]>; Peng Fan <[email protected]>
Subject: RE: [PATCH 0/4] Move eSDHC adapter card code to board files

Hi Priyanka,

Any comments on this patch-set?
Thanks a lot.

Best regards,
Yangbo Lu

Quoted 14 lines

-----Original Message-----
From: Yangbo Lu <[email protected]>
Sent: Wednesday, June 17, 2020 6:09 PM
To: u-boot at lists.denx.de; Priyanka Jain <[email protected]>; Peng Fan <[email protected]>
Cc: Y.b. Lu <[email protected]>
Subject: [PATCH 0/4] Move eSDHC adapter card code to board files

The eSDHC adapter card identification and multiplexing configuration through FPGA had been implemented in both common mmc driver and fsl_esdhc driver. However it is proper to move these code to board files and do it during board initialization. The FPGA registers are also board specific.

Quoted 7 lines

This patch-set is to move eSDHC adapter card identification and multiplexing configuration from mmc driver to specific board files. Add eSDHC adapter card identification for LX2 QDS.
And the option CONFIG_FSL_ESDHC_ADAPTER_IDENT is no longer needed.

CI build result

https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftravis-ci

Quoted 1 line

.org%2Fgithub%2Fyangbolu1991%2Fu-boot-test%2Fbuilds%2F699180417&

a

Quoted 1 line

mp;data=02%7C01%7Cyangbo.lu%40nxp.com%7C2351c69f76e142be1c4108d

Quoted 1 line

812a73fd6%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C637279

Quoted 1 line

856821151607&amp;sdata=doJR9jInaSGNQHqZlOar%2BKb3kY%2F7xuQzNgA

Quoted 32 lines

88ADf8B0%3D&amp;reserved=0

Yangbo Lu (4):
Drop global data sdhc_adapter for powerpc
Move eSDHC adapter card identification to board files
board: fsl: lx2160aqds: identify SDHC adapter during board init
configs: lx2160aqds: enable CONFIG_BOARD_EARLY_INIT_R

 arch/powerpc/include/asm/global_data.h       |  4 +--
 board/freescale/common/qixis.h               | 14 +++++++---
 board/freescale/lx2160a/lx2160a.c            | 36
+++++++++++++++++++++++--
 board/freescale/t1040qds/t1040qds.c          | 29
++++++++++++++++++++-
 board/freescale/t208xqds/t208xqds.c          | 29
++++++++++++++++++++-
 configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |  1 +
 configs/lx2160aqds_tfa_defconfig             |  1 +
 doc/README.fsl-esdhc                         | 14 ----------
 drivers/mmc/fsl_esdhc.c                      | 39 ----------------------------
 drivers/mmc/mmc-uclass.c                     |  4 +--
 drivers/mmc/mmc.c                            |  7 +----
 drivers/mmc/mmc_legacy.c                     |  7 +----
 drivers/mmc/mmc_private.h                    |  4 +--
 include/configs/T1040QDS.h                   |  1 -
 include/configs/T208xQDS.h                   |  1 -
 include/fsl_esdhc.h                          |  4 ---
 scripts/config_whitelist.txt                 |  1 -
 17 files changed, 108 insertions(+), 88 deletions(-)

--
2.7.4