]> git.sur5r.net Git - u-boot/blobdiff - board/freescale/common/qixis.c
Merge git://git.denx.de/u-boot-fsl-qoriq
[u-boot] / board / freescale / common / qixis.c
index 9f6b0e7f31ed36e0be7844cd11de555f6d56ba00..0db0ed667002f33d6f532faf1840ad3ab4a6abac 100644 (file)
 #include <i2c.h>
 #include "qixis.h"
 
+#ifndef QIXIS_LBMAP_BRDCFG_REG
+/*
+ * For consistency with existing platforms
+ */
+#define QIXIS_LBMAP_BRDCFG_REG 0x00
+#endif
+
 #ifdef CONFIG_SYS_I2C_FPGA_ADDR
 u8 qixis_read_i2c(unsigned int reg)
 {
@@ -27,6 +34,7 @@ void qixis_write_i2c(unsigned int reg, u8 value)
 }
 #endif
 
+#ifdef QIXIS_BASE
 u8 qixis_read(unsigned int reg)
 {
        void *p = (void *)QIXIS_BASE;
@@ -40,6 +48,7 @@ void qixis_write(unsigned int reg, u8 value)
 
        out_8(p + reg, value);
 }
+#endif
 
 u16 qixis_read_minor(void)
 {
@@ -142,9 +151,9 @@ static void __maybe_unused set_lbmap(int lbmap)
 {
        u8 reg;
 
-       reg = QIXIS_READ(brdcfg[0]);
+       reg = QIXIS_READ(brdcfg[QIXIS_LBMAP_BRDCFG_REG]);
        reg = (reg & ~QIXIS_LBMAP_MASK) | lbmap;
-       QIXIS_WRITE(brdcfg[0], reg);
+       QIXIS_WRITE(brdcfg[QIXIS_LBMAP_BRDCFG_REG], reg);
 }
 
 static void __maybe_unused set_rcw_src(int rcw_src)
@@ -215,6 +224,39 @@ int qixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
                QIXIS_WRITE(rcfg_ctl, 0x21);
 #else
                printf("Not implemented\n");
+#endif
+       } else if (strcmp(argv[1], "sd") == 0) {
+#ifdef QIXIS_LBMAP_SD
+               QIXIS_WRITE(rst_ctl, 0x30);
+               QIXIS_WRITE(rcfg_ctl, 0);
+               set_lbmap(QIXIS_LBMAP_SD);
+               set_rcw_src(QIXIS_RCW_SRC_SD);
+               QIXIS_WRITE(rcfg_ctl, 0x20);
+               QIXIS_WRITE(rcfg_ctl, 0x21);
+#else
+               printf("Not implemented\n");
+#endif
+       } else if (strcmp(argv[1], "sd_qspi") == 0) {
+#ifdef QIXIS_LBMAP_SD_QSPI
+               QIXIS_WRITE(rst_ctl, 0x30);
+               QIXIS_WRITE(rcfg_ctl, 0);
+               set_lbmap(QIXIS_LBMAP_SD_QSPI);
+               set_rcw_src(QIXIS_RCW_SRC_SD);
+               qixis_write_i2c(offsetof(struct qixis, rcfg_ctl), 0x20);
+               qixis_write_i2c(offsetof(struct qixis, rcfg_ctl), 0x21);
+#else
+               printf("Not implemented\n");
+#endif
+       } else if (strcmp(argv[1], "qspi") == 0) {
+#ifdef QIXIS_LBMAP_QSPI
+               QIXIS_WRITE(rst_ctl, 0x30);
+               QIXIS_WRITE(rcfg_ctl, 0);
+               set_lbmap(QIXIS_LBMAP_QSPI);
+               set_rcw_src(QIXIS_RCW_SRC_QSPI);
+               qixis_write_i2c(offsetof(struct qixis, rcfg_ctl), 0x20);
+               qixis_write_i2c(offsetof(struct qixis, 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",
@@ -255,6 +297,9 @@ U_BOOT_CMD(
        "- hard reset to default bank\n"
        "qixis_reset altbank - reset to alternate bank\n"
        "qixis_reset nand - reset to nand\n"
+       "qixis_reset sd - reset to sd\n"
+       "qixis_reset sd_qspi - reset to sd with qspi support\n"
+       "qixis_reset qspi - reset to qspi\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"