]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
arch:exynos: boot mode: add get_boot_mode(), code cleanup
authorPrzemyslaw Marczak <p.marczak@samsung.com>
Mon, 1 Sep 2014 11:50:44 +0000 (13:50 +0200)
committerMinkyu Kang <mk7.kang@samsung.com>
Fri, 5 Sep 2014 04:58:49 +0000 (13:58 +0900)
This patch introduces code clean-up for exynos boot mode check.
It includes:
- removal of typedef: boot_mode
- move the boot mode enum to arch-exynos/power.h
- add bootmode for sequence: eMMC 4.4 ch4 / SD ch2
- add new function: get_boot_mode() for OM[5:1] pin check
- update spl boot code

Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Changes v5:
- exynos: boot mode: add missing bootmode (1st:EMMC 4.4 / 2nd:SD ch2)

Changes v6:
- none

changes v7:
- change boot mode name: BOOT_MODE_MMC to BOOT_MODE_SD
Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
arch/arm/cpu/armv7/exynos/power.c
arch/arm/cpu/armv7/exynos/spl_boot.c
arch/arm/include/asm/arch-exynos/power.h
arch/arm/include/asm/arch-exynos/spl.h

index 638ee0b30b5d5e87b742ed86648966a497cd81e0..e1ab3d6997c813461f8932e4370481f3512213ee 100644 (file)
@@ -202,3 +202,10 @@ void power_exit_wakeup(void)
        else
                exynos4_power_exit_wakeup();
 }
+
+unsigned int get_boot_mode(void)
+{
+       unsigned int om_pin = samsung_get_base_power();
+
+       return readl(om_pin) & OM_PIN_MASK;
+}
index 79166303d13c4bad88cfb0aa6f590c5acb343c13..658e4cb715f92647d108780c4c81a70b10295bf0 100644 (file)
@@ -20,7 +20,6 @@
 #include "clock_init.h"
 
 DECLARE_GLOBAL_DATA_PTR;
-#define OM_STAT         (0x1f << 1)
 
 /* Index into irom ptr table */
 enum index {
@@ -184,7 +183,7 @@ static void exynos_spi_copy(unsigned int uboot_size, unsigned int uboot_addr)
 */
 void copy_uboot_to_ram(void)
 {
-       enum boot_mode bootmode = BOOT_MODE_OM;
+       unsigned int bootmode = BOOT_MODE_OM;
 
        u32 (*copy_bl2)(u32 offset, u32 nblock, u32 dst) = NULL;
        u32 offset = 0, size = 0;
@@ -207,7 +206,7 @@ void copy_uboot_to_ram(void)
 #endif
 
        if (bootmode == BOOT_MODE_OM)
-               bootmode = readl(samsung_get_base_power()) & OM_STAT;
+               bootmode = get_boot_mode();
 
        switch (bootmode) {
 #ifdef CONFIG_SPI_BOOTING
@@ -216,7 +215,7 @@ void copy_uboot_to_ram(void)
                exynos_spi_copy(param->uboot_size, CONFIG_SYS_TEXT_BASE);
                break;
 #endif
-       case BOOT_MODE_MMC:
+       case BOOT_MODE_SD:
                offset = BL2_START_OFFSET;
                size = BL2_SIZE_BLOC_COUNT;
                copy_bl2 = get_irom_func(MMC_INDEX);
index 4f2447b3f8ad4faa04c218cad5fb49eff6667426..e8a98a54714a2411c49b49e2546d124537d549ff 100644 (file)
@@ -1670,6 +1670,27 @@ struct exynos5420_power {
 };
 #endif /* __ASSEMBLY__ */
 
+#define OM_PIN_BITS    0x1f
+#define OM_PIN_SHIFT   0x1
+#define OM_PIN_MASK    (OM_PIN_BITS << OM_PIN_SHIFT)
+
+enum {
+       /*
+        * Assign the OM pin values for respective boot modes.
+        * Exynos4 does not support spi boot and the mmc boot OM
+        * pin values are the same across Exynos4 and Exynos5.
+        */
+       BOOT_MODE_SD = 4,      /* SD_CH2  | USB */
+       BOOT_MODE_EMMC = 8,     /* EMMC4.4 | USB */
+       BOOT_MODE_EMMC_SD = 40, /* EMMC4.4 | SD_CH2 */
+       BOOT_MODE_SERIAL = 20,
+       /* Boot based on Operating Mode pin settings */
+       BOOT_MODE_OM = 32,
+       BOOT_MODE_USB,  /* Boot using USB download */
+};
+
+unsigned int get_boot_mode(void);
+
 void set_mipi_phy_ctrl(unsigned int dev_index, unsigned int enable);
 
 #define EXYNOS_MIPI_PHY_ENABLE         (1 << 0)
index b1d68c3d216442f6b3f15d5f905d3d3ca37427c9..cdcb2bc7ada2880312ac6065aef63f9553bac2a1 100644 (file)
@@ -8,20 +8,7 @@
 #define __ASM_ARCH_EXYNOS_SPL_H__
 
 #include <asm/arch-exynos/dmc.h>
-
-enum boot_mode {
-       /*
-        * Assign the OM pin values for respective boot modes.
-        * Exynos4 does not support spi boot and the mmc boot OM
-        * pin values are the same across Exynos4 and Exynos5.
-        */
-       BOOT_MODE_MMC = 4,
-       BOOT_MODE_EMMC = 8,     /* EMMC4.4 */
-       BOOT_MODE_SERIAL = 20,
-       /* Boot based on Operating Mode pin settings */
-       BOOT_MODE_OM = 32,
-       BOOT_MODE_USB,  /* Boot using USB download */
-};
+#include <asm/arch/power.h>
 
 #ifndef __ASSEMBLY__
 /* Parameters of early board initialization in SPL */
@@ -62,7 +49,7 @@ struct spl_machine_param {
         * table only for mmc boot.
         */
        u32             uboot_size;
-       enum boot_mode  boot_source;    /* Boot device */
+       unsigned        boot_source;    /* Boot device */
        unsigned        frequency_mhz;  /* Frequency of memory in MHz */
        unsigned        arm_freq_mhz;   /* ARM Frequency in MHz */
        u32             serial_base;    /* Serial base address */