Browse Source

Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-samsung

- Various exynos fixes
Tom Rini 4 years ago
parent
commit
3e12744a90

+ 2 - 1
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";
 };

+ 1 - 1
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 {

+ 1 - 0
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

+ 28 - 0
board/samsung/common/board.c

@@ -25,6 +25,8 @@
 #include <asm/arch/sromc.h>
 #include <lcd.h>
 #include <i2c.h>
+#include <mmc.h>
+#include <stdio_dev.h>
 #include <usb.h>
 #include <dwc3-uboot.h>
 #include <samsung/misc.h>
@@ -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();
+}

+ 4 - 4
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;
 

+ 3 - 3
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)

+ 1 - 0
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

+ 1 - 0
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

+ 5 - 0
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;

+ 5 - 5
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 <config_distro_bootcmd.h>
@@ -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 \