s5pc110: universal: support to upload uImage in SD-card
authorJaehoon Chung <jh80.chung@samsung.com>
Wed, 13 Oct 2010 04:12:20 +0000 (13:12 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Wed, 13 Oct 2010 04:12:20 +0000 (13:12 +0900)
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
board/samsung/universal_c110/universal.c
include/configs/s5pc110_universal.h

index 39cacd7..55b3af0 100644 (file)
@@ -2909,7 +2909,7 @@ int s5p_no_mmc_support(void)
 
 int board_mmc_init(bd_t *bis)
 {
-       int i;
+       int i, err;
        int buswidth = 4;
 
        if (s5p_no_mmc_support())
@@ -2956,7 +2956,27 @@ int board_mmc_init(bd_t *bis)
                gpio_set_pull(&gpio->j2, 7, GPIO_PULL_NONE);
        }
 
-       return s5p_mmc_init(0, buswidth);
+       /* T-flash detect */
+       gpio_cfg_pin(&gpio->h3, 4, 0xf);
+       gpio_set_pull(&gpio->h3, 4, GPIO_PULL_UP);
+
+       err = s5p_mmc_init(0, buswidth);
+
+       if (!gpio_get_value(&gpio->h3, 4)) {
+               for (i = 0; i < 7; i++) {
+                       if (i == 2)
+                               continue;
+                       /* GPG0[0:6] special function 2 */
+                       gpio_cfg_pin(&gpio->g2, i, 0x2);
+                       /* GPG0[0:6] pull disable */
+                       gpio_set_pull(&gpio->g2, i, GPIO_PULL_NONE);
+                       /* GPG0[0:6] drv 4x */
+                       gpio_set_drv(&gpio->g2, i, GPIO_DRV_4X);
+               }
+               err =s5p_mmc_init(2, 4);
+       }
+
+       return err;
 }
 #endif
 
index d0ae754..2b8adc2 100644 (file)
 #define CONFIG_CMD_SLEEP
 #define CONFIG_CMD_PMIC
 #define CONFIG_CMD_DEVICE_POWER
+#define CONFIG_CMD_FAT
 
 /* disabled commands */
 //#define CONFIG_CMD_GPIO
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND     "run ubifsboot"
+#define CONFIG_BOOTCOMMAND \
+       "if mmc rescan 1; then " \
+               "if run loaduimage; then " \
+                       "run sdboot; " \
+               "else run ubifsboot; " \
+               "fi; " \
+       "else run ubifsboot; fi"
 
 #define CONFIG_DEFAULT_CONSOLE "console=ttySAC2,115200n8\0"
 
        "mmcboot=set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
         CONFIG_UBI_MTD " ${opts} ${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
        "bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
+       "sdboot=set bootargs root=/dev/mmcblk0p2 " CONFIG_COMMON_BOOT \
+       CONFIG_UBI_MTD "; bootm 0x30007FC0\0" \
        "verify=n\0" \
        "rootfstype=cramfs\0" \
        "console=" CONFIG_DEFAULT_CONSOLE \
        "bootblock=" CONFIG_BOOTBLOCK "\0" \
        "ubiblock=" CONFIG_UBIBLOCK" \0" \
        "ubi=enabled\0" \
+       "loaduimage=fatload mmc 1 0x30007FC0 uImage\0" \
        "opts=always_resume=1"
 
 /*