Commit 44cdb5b6a10a7eb2e240866cb842e44ff9999960

Authored by Yangbo Lu
Committed by York Sun
1 parent cf71338ee7

armv8: ls1088ardb: support force SDHC mode by hwconfig

The BRDCFG5[SPISDHC] register field of Qixis device is used
to control SPI and SDHC signal routing.

10 = Force SDHC Mode
  - SPI_CS[0] is routed to CPLD for SDHC_VS use.
  - SPI_CS[1] is unused.
  - SPI_CS[2:3] are routed to the TDMRiser slot.

11 = Force eMMC Mode
  - SPI_CS[0:3] are routed to the eMMC card.

0X = Auto Mode
  - If SDHC_CS_B=0 (SDHC card installed): Use SDHC mode
    described above.
  - Else SDHC_CS_B=1 (no SDHC card installed): Use eMMC
    mode described above.

In default the hardware uses auto mode, but sometimes we need
to use force SDHC mode to support SD card hotplug, or SD sleep
waking up in kernel. This patch is to support force SDHC mode
by hwconfig.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>

Showing 3 changed files with 26 additions and 0 deletions Side-by-side Diff

board/freescale/ls1088a/ls1088a.c
... ... @@ -18,6 +18,7 @@
18 18 #include <environment.h>
19 19 #include <asm/arch-fsl-layerscape/soc.h>
20 20 #include <asm/arch/ppa.h>
  21 +#include <hwconfig.h>
21 22  
22 23 #include "../common/qixis.h"
23 24 #include "ls1088a_qixis.h"
... ... @@ -295,6 +296,23 @@
295 296 /*return the default channel*/
296 297 select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
297 298 }
  299 +
  300 +#ifdef CONFIG_MISC_INIT_R
  301 +int misc_init_r(void)
  302 +{
  303 +#ifdef CONFIG_TARGET_LS1088ARDB
  304 + u8 brdcfg5;
  305 +
  306 + if (hwconfig("esdhc-force-sd")) {
  307 + brdcfg5 = QIXIS_READ(brdcfg[5]);
  308 + brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
  309 + brdcfg5 |= BRDCFG5_FORCE_SD;
  310 + QIXIS_WRITE(brdcfg[5], brdcfg5);
  311 + }
  312 +#endif
  313 + return 0;
  314 +}
  315 +#endif
298 316  
299 317 int board_init(void)
300 318 {
board/freescale/ls1088a/ls1088a_qixis.h
... ... @@ -36,5 +36,11 @@
36 36 #define BRDCFG9_SFPTX_MASK 0x10
37 37 #define BRDCFG9_SFPTX_SHIFT 4
38 38  
  39 +/* Definitions of QIXIS Registers for LS1088ARDB */
  40 +
  41 +/* BRDCFG5 */
  42 +#define BRDCFG5_SPISDHC_MASK 0x0C
  43 +#define BRDCFG5_FORCE_SD 0x08
  44 +
39 45 #endif
include/configs/ls1088ardb.h
... ... @@ -11,6 +11,8 @@
11 11  
12 12 #define CONFIG_DISPLAY_BOARDINFO_LATE
13 13  
  14 +#define CONFIG_MISC_INIT_R
  15 +
14 16 #if defined(CONFIG_QSPI_BOOT)
15 17 #define CONFIG_ENV_SIZE 0x2000 /* 8KB */
16 18 #define CONFIG_ENV_OFFSET 0x300000 /* 3MB */