diff --git a/arch/arm/dts/exynos4412-odroid.dts b/arch/arm/dts/exynos4412-odroid.dts index cc8e0dd041..ce08e8dc1e 100644 --- a/arch/arm/dts/exynos4412-odroid.dts +++ b/arch/arm/dts/exynos4412-odroid.dts @@ -17,7 +17,7 @@ serial0 = "/serial@13800000"; console = "/serial@13810000"; mmc0 = &mshc_0; - mmc1 = &sdhci2; + mmc2 = &sdhci2; }; serial@13810000 { @@ -236,6 +236,7 @@ &sdhci2 { samsung,bus-width = <4>; samsung,timing = <1 2 3>; + cd-inverted; cd-gpios = <&gpk2 2 0>; status = "okay"; }; diff --git a/arch/arm/dts/exynos5422-odroidxu3.dts b/arch/arm/dts/exynos5422-odroidxu3.dts index 6df6be9181..256df6d6c2 100644 --- a/arch/arm/dts/exynos5422-odroidxu3.dts +++ b/arch/arm/dts/exynos5422-odroidxu3.dts @@ -10,7 +10,7 @@ #include "exynos54xx.dtsi" / { - model = "Odroid XU3 based on EXYNOS5422"; + model = "Odroid XU3/XU4/HC1/HC2 based on Exynos5422"; compatible = "samsung,odroidxu3", "samsung,exynos5"; aliases { diff --git a/arch/arm/mach-exynos/include/mach/cpu.h b/arch/arm/mach-exynos/include/mach/cpu.h index 766edeeb29..fb5fdaf3ba 100644 --- a/arch/arm/mach-exynos/include/mach/cpu.h +++ b/arch/arm/mach-exynos/include/mach/cpu.h @@ -17,6 +17,7 @@ #define EXYNOS4_GPIO_PART3_BASE 0x03860000 #define EXYNOS4_PRO_ID 0x10000000 +#define EXYNOS4_OP_MODE 0x10000008 #define EXYNOS4_SYSREG_BASE 0x10010000 #define EXYNOS4_POWER_BASE 0x10020000 #define EXYNOS4_SWRESET 0x10020400 diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c index 5d4646d14c..390060e51f 100644 --- a/board/samsung/common/board.c +++ b/board/samsung/common/board.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include #include @@ -43,6 +45,20 @@ __weak int exynos_power_init(void) return 0; } +/** + * get_boot_mmc_dev() - read boot MMC device id from XOM[7:5] pins. + */ +static int get_boot_mmc_dev(void) +{ + u32 mode = readl(EXYNOS4_OP_MODE) & 0x1C; + + if (mode == 0x04) + return 2; /* MMC2: SD */ + + /* MMC0: eMMC or unknown */ + return 0; +} + #if defined CONFIG_EXYNOS_TMU /* Boot Time Thermal Analysis for SoC temperature threshold breach */ static void boot_temp_check(void) @@ -281,6 +297,8 @@ int board_late_init(void) { struct udevice *dev; int ret; + int mmcbootdev = get_boot_mmc_dev(); + char mmcbootdev_str[16]; stdio_print_current_devices(); ret = uclass_first_device_err(UCLASS_CROS_EC, &dev); @@ -293,6 +311,11 @@ int board_late_init(void) panic("Cannot init cros-ec device"); return -1; } + + printf("Boot device: MMC(%u)\n", mmcbootdev); + sprintf(mmcbootdev_str, "%u", mmcbootdev); + env_set("mmcbootdev", mmcbootdev_str); + return 0; } #endif @@ -360,3 +383,8 @@ int board_usb_cleanup(int index, enum usb_init_type init) #endif return 0; } + +int mmc_get_env_dev(void) +{ + return get_boot_mmc_dev(); +} diff --git a/board/samsung/common/exynos5-dt-types.c b/board/samsung/common/exynos5-dt-types.c index 516c32923e..1413dc8978 100644 --- a/board/samsung/common/exynos5-dt-types.c +++ b/board/samsung/common/exynos5-dt-types.c @@ -67,7 +67,7 @@ static int odroid_get_adc_val(unsigned int *adcval) unsigned int adcval_prev = 0; int ret, retries = 20; - ret = adc_channel_single_shot("adc", CONFIG_ODROID_REV_AIN, + ret = adc_channel_single_shot("adc@12D10000", CONFIG_ODROID_REV_AIN, &adcval_prev); if (ret) return ret; @@ -75,8 +75,8 @@ static int odroid_get_adc_val(unsigned int *adcval) while (retries--) { mdelay(5); - ret = adc_channel_single_shot("adc", CONFIG_ODROID_REV_AIN, - adcval); + ret = adc_channel_single_shot("adc@12D10000", + CONFIG_ODROID_REV_AIN, adcval); if (ret) return ret; @@ -129,7 +129,7 @@ static const char *odroid_get_type_str(void) if (gd->board_type != EXYNOS5_BOARD_ODROID_XU3_REV02) goto exit; - ret = pmic_get("s2mps11", &dev); + ret = pmic_get("s2mps11_pmic@66", &dev); if (ret) goto exit; diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c index 387d1b9180..eef46b0dc4 100644 --- a/board/samsung/common/exynos5-dt.c +++ b/board/samsung/common/exynos5-dt.c @@ -65,9 +65,9 @@ int exynos_power_init(void) int ret; #ifdef CONFIG_PMIC_S2MPS11 - ret = pmic_get("s2mps11_pmic", &dev); + ret = pmic_get("s2mps11_pmic@66", &dev); #else - ret = pmic_get("max77686", &dev); + ret = pmic_get("max77686_pmic@09", &dev); if (!ret) { /* TODO(sjg@chromium.org): Move into the clock/pmic API */ ret = pmic_clrsetbits(dev, MAX77686_REG_PMIC_32KHZ, 0, @@ -79,7 +79,7 @@ int exynos_power_init(void) if (ret) return ret; } else { - ret = pmic_get("s5m8767-pmic", &dev); + ret = pmic_get("s5m8767_pmic@66", &dev); /* TODO(sjg@chromium.org): Use driver model to access clock */ #ifdef CONFIG_PMIC_S5M8767 if (!ret) diff --git a/configs/odroid-xu3_defconfig b/configs/odroid-xu3_defconfig index 20038d4197..2e982e1b53 100644 --- a/configs/odroid-xu3_defconfig +++ b/configs/odroid-xu3_defconfig @@ -14,6 +14,7 @@ CONFIG_FIT_BEST_MATCH=y CONFIG_SILENT_CONSOLE=y CONFIG_CONSOLE_MUX=y CONFIG_MISC_INIT_R=y +CONFIG_BOARD_LATE_INIT=y # CONFIG_DISPLAY_BOARDINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_BOARD_TYPES=y diff --git a/configs/odroid_defconfig b/configs/odroid_defconfig index be914e4caf..e4392e477e 100644 --- a/configs/odroid_defconfig +++ b/configs/odroid_defconfig @@ -17,6 +17,7 @@ CONFIG_BOOTARGS="Please use defined boot" CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SYS_CONSOLE_INFO_QUIET=y CONFIG_MISC_INIT_R=y +CONFIG_BOARD_LATE_INIT=y CONFIG_BOARD_TYPES=y CONFIG_SYS_PROMPT="Odroid # " # CONFIG_CMD_XIMG is not set diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c index 53efa968cf..b5fe828dd6 100644 --- a/drivers/mmc/s5p_sdhci.c +++ b/drivers/mmc/s5p_sdhci.c @@ -204,8 +204,13 @@ static int s5p_sdhci_probe(struct udevice *dev) if (ret) return ret; + ret = mmc_of_parse(dev, &plat->cfg); + if (ret) + return ret; + host->mmc = &plat->mmc; host->mmc->dev = dev; + ret = sdhci_setup_cfg(&plat->cfg, host, 0, 400000); if (ret) return ret; diff --git a/include/configs/odroid.h b/include/configs/odroid.h index 77fca32fca..a7e2a3d9a2 100644 --- a/include/configs/odroid.h +++ b/include/configs/odroid.h @@ -80,7 +80,7 @@ "tzsw raw 0x83f 0x138\0" #define BOOT_TARGET_DEVICES(func) \ - func(MMC, mmc, 1) \ + func(MMC, mmc, 2) \ func(MMC, mmc, 0) #include @@ -146,13 +146,13 @@ "run kernel_args;" \ "bootz ${kernel_addr_r} ${initrd_addr} ${fdt_addr};\0" \ "autoboot=" \ - "if test -e mmc 0 boot.scr; then; " \ + "if test -e mmc ${mmcbootdev} boot.scr; then; " \ "run boot_script; " \ - "elif test -e mmc 0 Image.itb; then; " \ + "elif test -e mmc ${mmcbootdev} Image.itb; then; " \ "run boot_fit;" \ - "elif test -e mmc 0 zImage; then; " \ + "elif test -e mmc ${mmcbootdev} zImage; then; " \ "run boot_zimg;" \ - "elif test -e mmc 0 uImage; then; " \ + "elif test -e mmc ${mmcbootdev} uImage; then; " \ "run boot_uimg;" \ "fi;\0" \ "console=" CONFIG_DEFAULT_CONSOLE \