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
This commit is contained in:
Tom Rini 2018-10-15 07:20:07 -04:00
commit 6e7a186dc5
7 changed files with 72 additions and 9 deletions

View file

@ -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

View file

@ -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;

View file

@ -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)

View file

@ -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

View file

@ -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 */

View file

@ -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 */

View file

@ -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