This is a low-cost ARMv8 SoC from Socionext Inc. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>master
parent
7381db86a9
commit
667dbcd01d
@ -0,0 +1,28 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Socionext Inc. |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: GPL-2.0+ |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <common.h> |
||||||
|
#include <linux/bitops.h> |
||||||
|
#include <linux/io.h> |
||||||
|
|
||||||
|
#include "../init.h" |
||||||
|
#include "../sg-regs.h" |
||||||
|
|
||||||
|
void uniphier_ld11_clk_init(void) |
||||||
|
{ |
||||||
|
if (readl(SG_PINMON0) & BIT(27)) { |
||||||
|
/* if booted without stand-by MPU */ |
||||||
|
|
||||||
|
writel(1, SG_ETPHYPSHUT); |
||||||
|
writel(1, SG_ETPHYCNT); |
||||||
|
|
||||||
|
udelay(1); /* wait for regulator level 1.1V -> 2.5V */ |
||||||
|
|
||||||
|
writel(3, SG_ETPHYCNT); |
||||||
|
writel(3, SG_ETPHYPSHUT); |
||||||
|
writel(7, SG_ETPHYCNT); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,124 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Socionext Inc. |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <common.h> |
||||||
|
#include <linux/io.h> |
||||||
|
#include <linux/sizes.h> |
||||||
|
#include <asm/processor.h> |
||||||
|
|
||||||
|
#include "../init.h" |
||||||
|
#include "umc64-regs.h" |
||||||
|
|
||||||
|
#define CONFIG_DDR_FREQ 1866 |
||||||
|
|
||||||
|
#define DRAM_CH_NR 2 |
||||||
|
|
||||||
|
enum dram_freq { |
||||||
|
DRAM_FREQ_1600M, |
||||||
|
DRAM_FREQ_NR, |
||||||
|
}; |
||||||
|
|
||||||
|
enum dram_size { |
||||||
|
DRAM_SZ_256M, |
||||||
|
DRAM_SZ_512M, |
||||||
|
DRAM_SZ_NR, |
||||||
|
}; |
||||||
|
|
||||||
|
/* umc */ |
||||||
|
static u32 umc_cmdctla[DRAM_FREQ_NR] = {0x060D0D20}; |
||||||
|
static u32 umc_cmdctlb[DRAM_FREQ_NR] = {0x2D211C08}; |
||||||
|
static u32 umc_cmdctlc[DRAM_FREQ_NR] = {0x00150C04}; |
||||||
|
static u32 umc_cmdctle[DRAM_FREQ_NR] = {0x0078071D}; |
||||||
|
static u32 umc_cmdctlf[DRAM_FREQ_NR] = {0x02000200}; |
||||||
|
static u32 umc_cmdctlg[DRAM_FREQ_NR] = {0x08080808}; |
||||||
|
|
||||||
|
static u32 umc_rdatactl_d0[DRAM_FREQ_NR] = {0x00000810}; |
||||||
|
static u32 umc_rdatactl_d1[DRAM_FREQ_NR] = {0x00000810}; |
||||||
|
static u32 umc_wdatactl_d0[DRAM_FREQ_NR] = {0x00000004}; |
||||||
|
static u32 umc_wdatactl_d1[DRAM_FREQ_NR] = {0x00000004}; |
||||||
|
static u32 umc_odtctl_d0[DRAM_FREQ_NR] = {0x02000002}; |
||||||
|
static u32 umc_odtctl_d1[DRAM_FREQ_NR] = {0x02000002}; |
||||||
|
static u32 umc_acssetb[DRAM_CH_NR] = {0x00000200, 0x00000203}; |
||||||
|
static u32 umc_memconfch[DRAM_FREQ_NR] = {0x00023605}; |
||||||
|
|
||||||
|
static int umc_dc_init(void __iomem *dc_base, enum dram_freq freq, |
||||||
|
unsigned long size, int ch) |
||||||
|
{ |
||||||
|
writel(umc_cmdctla[freq], dc_base + UMC_CMDCTLA); |
||||||
|
writel(umc_cmdctlb[freq], dc_base + UMC_CMDCTLB); |
||||||
|
writel(umc_cmdctlc[freq], dc_base + UMC_CMDCTLC); |
||||||
|
writel(umc_cmdctle[freq], dc_base + UMC_CMDCTLE); |
||||||
|
writel(umc_cmdctlf[freq], dc_base + UMC_CMDCTLF); |
||||||
|
writel(umc_cmdctlg[freq], dc_base + UMC_CMDCTLG); |
||||||
|
|
||||||
|
writel(umc_rdatactl_d0[freq], dc_base + UMC_RDATACTL_D0); |
||||||
|
writel(umc_rdatactl_d1[freq], dc_base + UMC_RDATACTL_D1); |
||||||
|
|
||||||
|
writel(umc_wdatactl_d0[freq], dc_base + UMC_WDATACTL_D0); |
||||||
|
writel(umc_wdatactl_d1[freq], dc_base + UMC_WDATACTL_D1); |
||||||
|
|
||||||
|
writel(umc_odtctl_d0[freq], dc_base + UMC_ODTCTL_D0); |
||||||
|
writel(umc_odtctl_d1[freq], dc_base + UMC_ODTCTL_D1); |
||||||
|
|
||||||
|
writel(0x00000003, dc_base + UMC_ACSSETA); |
||||||
|
writel(0x00000103, dc_base + UMC_FLOWCTLG); |
||||||
|
writel(umc_acssetb[ch], dc_base + UMC_ACSSETB); |
||||||
|
writel(0x02020200, dc_base + UMC_SPCSETB); |
||||||
|
writel(umc_memconfch[freq], dc_base + UMC_MEMCONFCH); |
||||||
|
writel(0x00000002, dc_base + UMC_ACFETCHCTRL); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
||||||
|
|
||||||
|
static int umc_ch_init(void __iomem *umc_ch_base, |
||||||
|
enum dram_freq freq, unsigned long size, int ch) |
||||||
|
{ |
||||||
|
void __iomem *dc_base = umc_ch_base; |
||||||
|
|
||||||
|
return umc_dc_init(dc_base, freq, size, ch); |
||||||
|
} |
||||||
|
|
||||||
|
static void um_init(void __iomem *um_base) |
||||||
|
{ |
||||||
|
writel(0x00000001, um_base + UMC_SIORST); |
||||||
|
writel(0x00000001, um_base + UMC_VO0RST); |
||||||
|
writel(0x00000001, um_base + UMC_VPERST); |
||||||
|
writel(0x00000001, um_base + UMC_RGLRST); |
||||||
|
writel(0x00000001, um_base + UMC_A2DRST); |
||||||
|
writel(0x00000001, um_base + UMC_DMDRST); |
||||||
|
} |
||||||
|
|
||||||
|
int uniphier_ld11_umc_init(const struct uniphier_board_data *bd) |
||||||
|
{ |
||||||
|
void __iomem *um_base = (void __iomem *)0x5B800000; |
||||||
|
void __iomem *umc_ch_base = (void __iomem *)0x5BC00000; |
||||||
|
enum dram_freq freq; |
||||||
|
int ch, ret; |
||||||
|
|
||||||
|
switch (bd->dram_freq) { |
||||||
|
case 1600: |
||||||
|
freq = DRAM_FREQ_1600M; |
||||||
|
break; |
||||||
|
default: |
||||||
|
pr_err("unsupported DRAM frequency %d MHz\n", bd->dram_freq); |
||||||
|
return -EINVAL; |
||||||
|
} |
||||||
|
|
||||||
|
for (ch = 0; ch < bd->dram_nr_ch; ch++) { |
||||||
|
unsigned long size = bd->dram_ch[ch].size; |
||||||
|
unsigned int width = bd->dram_ch[ch].width; |
||||||
|
|
||||||
|
ret = umc_ch_init(umc_ch_base, freq, size / (width / 16), ch); |
||||||
|
if (ret) { |
||||||
|
pr_err("failed to initialize UMC ch%d\n", ch); |
||||||
|
return ret; |
||||||
|
} |
||||||
|
|
||||||
|
umc_ch_base += 0x00200000; |
||||||
|
} |
||||||
|
|
||||||
|
um_init(um_base); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Socionext Inc. |
||||||
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: GPL-2.0+ |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <linux/io.h> |
||||||
|
|
||||||
|
#include "../init.h" |
||||||
|
#include "../sc64-regs.h" |
||||||
|
|
||||||
|
int uniphier_ld11_early_clk_init(const struct uniphier_board_data *bd) |
||||||
|
{ |
||||||
|
u32 tmp; |
||||||
|
|
||||||
|
/* deassert reset */ |
||||||
|
tmp = readl(SC_RSTCTRL7); |
||||||
|
tmp |= SC_RSTCTRL7_UMC31 | SC_RSTCTRL7_UMC30; |
||||||
|
writel(tmp, SC_RSTCTRL7); |
||||||
|
|
||||||
|
/* provide clocks */ |
||||||
|
tmp = readl(SC_CLKCTRL4); |
||||||
|
tmp |= SC_CLKCTRL4_PERI; |
||||||
|
writel(tmp, SC_CLKCTRL4); |
||||||
|
|
||||||
|
tmp = readl(SC_CLKCTRL7); |
||||||
|
tmp |= SC_CLKCTRL7_UMC31 | SC_CLKCTRL7_UMC30; |
||||||
|
writel(tmp, SC_CLKCTRL7); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Socionext Inc. |
||||||
|
* Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
||||||
|
* |
||||||
|
* SPDX-License-Identifier: GPL-2.0+ |
||||||
|
*/ |
||||||
|
|
||||||
|
#include <common.h> |
||||||
|
#include <spl.h> |
||||||
|
|
||||||
|
#include "../init.h" |
||||||
|
#include "../micro-support-card.h" |
||||||
|
|
||||||
|
int uniphier_ld11_init(const struct uniphier_board_data *bd) |
||||||
|
{ |
||||||
|
uniphier_sbc_init_savepin(bd); |
||||||
|
uniphier_pxs2_sbc_init(bd); |
||||||
|
uniphier_ld20_early_pin_init(bd); |
||||||
|
|
||||||
|
support_card_reset(); |
||||||
|
|
||||||
|
support_card_init(); |
||||||
|
|
||||||
|
led_puts("L0"); |
||||||
|
|
||||||
|
memconf_init(bd); |
||||||
|
|
||||||
|
led_puts("L1"); |
||||||
|
|
||||||
|
uniphier_ld11_early_clk_init(bd); |
||||||
|
|
||||||
|
led_puts("L2"); |
||||||
|
|
||||||
|
led_puts("L3"); |
||||||
|
|
||||||
|
#ifdef CONFIG_SPL_SERIAL_SUPPORT |
||||||
|
preloader_console_init(); |
||||||
|
#endif |
||||||
|
|
||||||
|
led_puts("L4"); |
||||||
|
|
||||||
|
{ |
||||||
|
int res; |
||||||
|
|
||||||
|
res = uniphier_ld11_umc_init(bd); |
||||||
|
if (res < 0) { |
||||||
|
while (1) |
||||||
|
; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
led_puts("L5"); |
||||||
|
|
||||||
|
dcache_disable(); |
||||||
|
|
||||||
|
led_puts("L6"); |
||||||
|
|
||||||
|
return 0; |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
CONFIG_ARM=y |
||||||
|
CONFIG_ARCH_UNIPHIER=y |
||||||
|
CONFIG_SYS_MALLOC_F_LEN=0x2000 |
||||||
|
CONFIG_ARCH_UNIPHIER_LD11=y |
||||||
|
CONFIG_MICRO_SUPPORT_CARD=y |
||||||
|
CONFIG_SYS_TEXT_BASE=0x84000000 |
||||||
|
CONFIG_DEFAULT_DEVICE_TREE="uniphier-ph1-ld11-ref" |
||||||
|
CONFIG_HUSH_PARSER=y |
||||||
|
# CONFIG_CMD_XIMG is not set |
||||||
|
# CONFIG_CMD_ENV_EXISTS is not set |
||||||
|
CONFIG_CMD_MMC=y |
||||||
|
CONFIG_CMD_I2C=y |
||||||
|
CONFIG_CMD_USB=y |
||||||
|
# CONFIG_CMD_FPGA is not set |
||||||
|
CONFIG_CMD_GPIO=y |
||||||
|
CONFIG_CMD_TFTPPUT=y |
||||||
|
CONFIG_CMD_PING=y |
||||||
|
CONFIG_CMD_TIME=y |
||||||
|
# CONFIG_CMD_MISC is not set |
||||||
|
CONFIG_CMD_FAT=y |
||||||
|
CONFIG_NET_RANDOM_ETHADDR=y |
||||||
|
CONFIG_SPL_OF_TRANSLATE=y |
||||||
|
CONFIG_GPIO_UNIPHIER=y |
||||||
|
CONFIG_PINCTRL=y |
||||||
|
CONFIG_SPL_PINCTRL=y |
||||||
|
CONFIG_UNIPHIER_SERIAL=y |
||||||
|
CONFIG_USB=y |
||||||
|
CONFIG_DM_USB=y |
||||||
|
CONFIG_USB_EHCI_HCD=y |
||||||
|
CONFIG_USB_EHCI_GENERIC=y |
||||||
|
CONFIG_USB_STORAGE=y |
Loading…
Reference in new issue