]> git.sur5r.net Git - u-boot/commitdiff
armv8: ls1088ardb: support force SDHC mode by hwconfig
authorYangbo Lu <yangbo.lu@nxp.com>
Mon, 27 Nov 2017 07:40:17 +0000 (15:40 +0800)
committerYork Sun <york.sun@nxp.com>
Wed, 13 Dec 2017 21:40:29 +0000 (13:40 -0800)
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>
board/freescale/ls1088a/ls1088a.c
board/freescale/ls1088a/ls1088a_qixis.h
include/configs/ls1088ardb.h

index 9daa00759083040c6c2c46f2a20d91e0ae40f844..cb589575b3d18c4a91a658933f26d0965e7ed655 100644 (file)
@@ -18,6 +18,7 @@
 #include <environment.h>
 #include <asm/arch-fsl-layerscape/soc.h>
 #include <asm/arch/ppa.h>
+#include <hwconfig.h>
 
 #include "../common/qixis.h"
 #include "ls1088a_qixis.h"
@@ -296,6 +297,23 @@ void board_retimer_init(void)
        select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
 }
 
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_TARGET_LS1088ARDB
+       u8 brdcfg5;
+
+       if (hwconfig("esdhc-force-sd")) {
+               brdcfg5 = QIXIS_READ(brdcfg[5]);
+               brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
+               brdcfg5 |= BRDCFG5_FORCE_SD;
+               QIXIS_WRITE(brdcfg[5], brdcfg5);
+       }
+#endif
+       return 0;
+}
+#endif
+
 int board_init(void)
 {
        init_final_memctl_regs();
index 4790461b47a80dc54d6600fac898c28b1ab561b6..6cad396cff56be657509d85798706eb888c2b905 100644 (file)
 #define BRDCFG9_SFPTX_MASK             0x10
 #define BRDCFG9_SFPTX_SHIFT            4
 
+/* Definitions of QIXIS Registers for LS1088ARDB */
+
+/* BRDCFG5 */
+#define BRDCFG5_SPISDHC_MASK           0x0C
+#define BRDCFG5_FORCE_SD               0x08
+
 #endif
index 1da8153a4e911447b2d159bc6ec7ccb6d9538715..1438bec1afdb16d442f2376dc2819b2837b76100 100644 (file)
@@ -11,6 +11,8 @@
 
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
+#define CONFIG_MISC_INIT_R
+
 #if defined(CONFIG_QSPI_BOOT)
 #define CONFIG_ENV_SIZE                        0x2000          /* 8KB */
 #define CONFIG_ENV_OFFSET              0x300000        /* 3MB */