summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2018-10-15 07:20:07 -0400
committerTom Rini <trini@konsulko.com>2018-10-15 07:20:07 -0400
commit6e7a186dc5d50f563e224e9ae7be70defff7ee0d (patch)
tree6dd8a9f9ec9a8ed48538e6d621a51939a2d36af9
parent19ca29f3ff5811e058360aa275208d219b3078c2 (diff)
parent6e63314f432d32d2ce12a51dafa78129e81fe9cf (diff)
downloadu-boot-6e7a186dc5d50f563e224e9ae7be70defff7ee0d.tar.gz
Merge tag 'arc-more-updates-for-2018.11-rc2-2' of git://git.denx.de/u-boot-arc
More fixes and improvements for ARC here: Fixes (this time included for real): * Take care of global uninitialized variables They used to be put right after .bss section and were never zeroed as they should be. Now merged with normal .bss Improvements: * Print more verbose CPU info for boards built on real silicon * Add support for SD-card detection on all ARC boards * Quite a few fixes for IoT DK - Support reset by command - Print of CPU freq on boot - Link for eFlash etc
-rw-r--r--arch/arc/config.mk2
-rw-r--r--arch/arc/lib/cpu.c2
-rw-r--r--board/synopsys/axs10x/axs10x.c7
-rw-r--r--board/synopsys/emdk/emdk.c7
-rw-r--r--board/synopsys/hsdk/hsdk.c15
-rw-r--r--board/synopsys/iot_devkit/iot_devkit.c43
-rw-r--r--configs/iot_devkit_defconfig5
7 files changed, 72 insertions, 9 deletions
diff --git a/arch/arc/config.mk b/arch/arc/config.mk
index d255c90e35..18005d9993 100644
--- a/arch/arc/config.mk
+++ b/arch/arc/config.mk
@@ -43,7 +43,7 @@ PLATFORM_CPPFLAGS += -mcpu=archs
endif
PLATFORM_CPPFLAGS += -ffixed-r25 -D__ARC__ -gdwarf-2 -mno-sdata
-PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections
+PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections -fno-common
# Needed for relocation
LDFLAGS_FINAL += -pie --gc-sections
diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c
index 50cd7cdb61..a969a16722 100644
--- a/arch/arc/lib/cpu.c
+++ b/arch/arc/lib/cpu.c
@@ -60,7 +60,7 @@ const char *decode_identity(void)
}
}
-int print_cpuinfo(void)
+__weak int print_cpuinfo(void)
{
printf("CPU: %s\n", decode_identity());
return 0;
diff --git a/board/synopsys/axs10x/axs10x.c b/board/synopsys/axs10x/axs10x.c
index af78127dde..c95f7af7a7 100644
--- a/board/synopsys/axs10x/axs10x.c
+++ b/board/synopsys/axs10x/axs10x.c
@@ -33,6 +33,13 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct dwmci_host *host = mmc->priv;
+
+ return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
#define AXS_MB_CREG 0xE0011000
int board_early_init_f(void)
diff --git a/board/synopsys/emdk/emdk.c b/board/synopsys/emdk/emdk.c
index bbb946a700..79cafefb8b 100644
--- a/board/synopsys/emdk/emdk.c
+++ b/board/synopsys/emdk/emdk.c
@@ -34,6 +34,13 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct dwmci_host *host = mmc->priv;
+
+ return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
#define CREG_BASE 0xF0001000
#define CREG_BOOT_OFFSET 0
#define CREG_BOOT_WP_OFFSET 8
diff --git a/board/synopsys/hsdk/hsdk.c b/board/synopsys/hsdk/hsdk.c
index fb4286f71b..b6aefdbe6d 100644
--- a/board/synopsys/hsdk/hsdk.c
+++ b/board/synopsys/hsdk/hsdk.c
@@ -1019,6 +1019,13 @@ int board_late_init(void)
return 0;
}
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct dwmci_host *host = mmc->priv;
+
+ return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
int board_mmc_init(bd_t *bis)
{
struct dwmci_host *host = NULL;
@@ -1046,3 +1053,11 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+ printf("CPU: ARC HS38 v2.1c\n");
+ return 0;
+}
+#endif /* CONFIG_DISPLAY_CPUINFO */
diff --git a/board/synopsys/iot_devkit/iot_devkit.c b/board/synopsys/iot_devkit/iot_devkit.c
index c185d5cdb5..f8838fb3ce 100644
--- a/board/synopsys/iot_devkit/iot_devkit.c
+++ b/board/synopsys/iot_devkit/iot_devkit.c
@@ -17,6 +17,7 @@ DECLARE_GLOBAL_DATA_PTR;
#define AHBCKDIV (void *)(SYSCON_BASE + 0x04)
#define APBCKDIV (void *)(SYSCON_BASE + 0x08)
#define APBCKEN (void *)(SYSCON_BASE + 0x0C)
+#define RESET_REG (void *)(SYSCON_BASE + 0x18)
#define CLKSEL (void *)(SYSCON_BASE + 0x24)
#define CLKSTAT (void *)(SYSCON_BASE + 0x28)
#define PLLCON (void *)(SYSCON_BASE + 0x2C)
@@ -67,6 +68,14 @@ static int set_cpu_freq(unsigned int clk)
writel((readl(PLLCON) & PLL_MASK_2) | 0x200191, PLLCON);
break;
+ case 136:
+ writel(readl(PLLCON) & PLL_MASK_0, PLLCON);
+ /* pll_off=1, M=17, N=1, OD=1, PLL_OUT_CLK=136M */
+ writel((readl(PLLCON) & PLL_MASK_1) | 0x100111, PLLCON);
+ /* pll_off=0, M=17, N=1, OD=1, PLL_OUT_CLK=136M */
+ writel((readl(PLLCON) & PLL_MASK_2) | 0x100111, PLLCON);
+ break;
+
case 144:
writel(readl(PLLCON) & PLL_MASK_0, PLLCON);
/* pll_off=1, M=18, N=1, OD=1, PLL_OUT_CLK=144M */
@@ -99,7 +108,7 @@ extern u8 __ram_end[];
*/
int mach_cpu_init(void)
{
- int offset, freq;
+ int offset;
/* Don't relocate U-Boot */
gd->flags |= GD_FLG_SKIP_RELOC;
@@ -120,12 +129,12 @@ int mach_cpu_init(void)
if (offset < 0)
return offset;
- freq = fdtdec_get_int(gd->fdt_blob, offset, "clock-frequency", 0);
- if (!freq)
+ gd->cpu_clk = fdtdec_get_int(gd->fdt_blob, offset, "clock-frequency", 0);
+ if (!gd->cpu_clk)
return -EINVAL;
/* If CPU freq > 100 MHz, divide eFLASH clock by 2 */
- if (freq > 100000000) {
+ if (gd->cpu_clk > 100000000) {
u32 reg = readl(AHBCKDIV);
reg &= ~(0xF << 8);
@@ -133,7 +142,7 @@ int mach_cpu_init(void)
writel(reg, AHBCKDIV);
}
- return set_cpu_freq(freq);
+ return set_cpu_freq(gd->cpu_clk);
}
#define ARC_PERIPHERAL_BASE 0xF0000000
@@ -161,8 +170,32 @@ int board_mmc_init(bd_t *bis)
return 0;
}
+int board_mmc_getcd(struct mmc *mmc)
+{
+ struct dwmci_host *host = mmc->priv;
+
+ return !(dwmci_readl(host, DWMCI_CDETECT) & 1);
+}
+
+#define IOTDK_RESET_SEQ 0x55AA6699
+
+void reset_cpu(ulong addr)
+{
+ writel(IOTDK_RESET_SEQ, RESET_REG);
+}
+
int checkboard(void)
{
puts("Board: Synopsys IoT Development Kit\n");
return 0;
};
+
+#ifdef CONFIG_DISPLAY_CPUINFO
+int print_cpuinfo(void)
+{
+ char mhz[8];
+
+ printf("CPU: ARC EM9D at %s MHz\n", strmhz(mhz, gd->cpu_clk));
+ return 0;
+}
+#endif /* CONFIG_DISPLAY_CPUINFO */
diff --git a/configs/iot_devkit_defconfig b/configs/iot_devkit_defconfig
index 1f0f9c3256..1b6dd9e55a 100644
--- a/configs/iot_devkit_defconfig
+++ b/configs/iot_devkit_defconfig
@@ -4,8 +4,9 @@ CONFIG_CPU_ARCEM6=y
CONFIG_SYS_ICACHE_OFF=y
CONFIG_SYS_DCACHE_OFF=y
CONFIG_TARGET_IOT_DEVKIT=y
-CONFIG_SYS_TEXT_BASE=0x20000000
+CONFIG_SYS_TEXT_BASE=0x00000000
CONFIG_SYS_CLK_FREQ=16000000
+CONFIG_LOCALVERSION="-iotdk-1.0"
# CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
CONFIG_SYS_PROMPT="IoTDK# "
# CONFIG_CMD_BOOTD is not set
@@ -17,7 +18,6 @@ CONFIG_SYS_PROMPT="IoTDK# "
# CONFIG_CMD_LOADS is not set
CONFIG_CMD_MMC=y
CONFIG_CMD_USB=y
-# CONFIG_CMD_NET is not set
CONFIG_CMD_FAT=y
CONFIG_OF_CONTROL=y
CONFIG_OF_EMBED=y
@@ -25,6 +25,7 @@ CONFIG_DEFAULT_DEVICE_TREE="iot_devkit"
CONFIG_ENV_IS_IN_FAT=y
CONFIG_ENV_FAT_INTERFACE="mmc"
CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
+# CONFIG_NET is not set
CONFIG_DM=y
CONFIG_MMC=y
CONFIG_MMC_DW=y