]> git.sur5r.net Git - u-boot/commitdiff
freescale/qixis: Add support for booting from NAND
authorScott Wood <scottwood@freescale.com>
Sat, 21 Mar 2015 02:28:29 +0000 (19:28 -0700)
committerYork Sun <yorksun@freescale.com>
Thu, 23 Apr 2015 23:46:51 +0000 (16:46 -0700)
Use "qixis_reset nand" to reset the board to boot from NAND.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: York Sun <yorksun@freescale.com>
board/freescale/common/qixis.c

index a49e3006d9d7897358cfa4d6d7baecf401df99e5..9f6b0e7f31ed36e0be7844cd11de555f6d56ba00 100644 (file)
@@ -138,24 +138,23 @@ void qixis_bank_reset(void)
        QIXIS_WRITE(rcfg_ctl, QIXIS_RCFG_CTL_RECONFIG_START);
 }
 
-/* Set the boot bank to the power-on default bank */
-void clear_altbank(void)
+static void __maybe_unused set_lbmap(int lbmap)
 {
        u8 reg;
 
        reg = QIXIS_READ(brdcfg[0]);
-       reg = (reg & ~QIXIS_LBMAP_MASK) | QIXIS_LBMAP_DFLTBANK;
+       reg = (reg & ~QIXIS_LBMAP_MASK) | lbmap;
        QIXIS_WRITE(brdcfg[0], reg);
 }
 
-/* Set the boot bank to the alternate bank */
-void set_altbank(void)
+static void __maybe_unused set_rcw_src(int rcw_src)
 {
        u8 reg;
 
-       reg = QIXIS_READ(brdcfg[0]);
-       reg = (reg & ~QIXIS_LBMAP_MASK) | QIXIS_LBMAP_ALTBANK;
-       QIXIS_WRITE(brdcfg[0], reg);
+       reg = QIXIS_READ(dutcfg[1]);
+       reg = (reg & ~1) | (rcw_src & 1);
+       QIXIS_WRITE(dutcfg[1], reg);
+       QIXIS_WRITE(dutcfg[0], (rcw_src >> 1) & 0xff);
 }
 
 static void qixis_dump_regs(void)
@@ -201,11 +200,22 @@ int qixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
        int i;
 
        if (argc <= 1) {
-               clear_altbank();
+               set_lbmap(QIXIS_LBMAP_DFLTBANK);
                qixis_reset();
        } else if (strcmp(argv[1], "altbank") == 0) {
-               set_altbank();
+               set_lbmap(QIXIS_LBMAP_ALTBANK);
                qixis_bank_reset();
+       } else if (strcmp(argv[1], "nand") == 0) {
+#ifdef QIXIS_LBMAP_NAND
+               QIXIS_WRITE(rst_ctl, 0x30);
+               QIXIS_WRITE(rcfg_ctl, 0);
+               set_lbmap(QIXIS_LBMAP_NAND);
+               set_rcw_src(QIXIS_RCW_SRC_NAND);
+               QIXIS_WRITE(rcfg_ctl, 0x20);
+               QIXIS_WRITE(rcfg_ctl, 0x21);
+#else
+               printf("Not implemented\n");
+#endif
        } else if (strcmp(argv[1], "watchdog") == 0) {
                static char *period[9] = {"2s", "4s", "8s", "16s", "32s",
                                          "1min", "2min", "4min", "8min"};
@@ -244,6 +254,7 @@ U_BOOT_CMD(
        "Reset the board using the FPGA sequencer",
        "- hard reset to default bank\n"
        "qixis_reset altbank - reset to alternate bank\n"
+       "qixis_reset nand - reset to nand\n"
        "qixis watchdog <watchdog_period> - set the watchdog period\n"
        "       period: 1s 2s 4s 8s 16s 32s 1min 2min 4min 8min\n"
        "qixis_reset dump - display the QIXIS registers\n"