commit
9b5b60a05c
@ -0,0 +1,128 @@ |
||||
/* |
||||
* Copyright (C) 2013 Samsung Electronics |
||||
* Akshay Saraswat <akshay.s@samsung.com>
|
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <config.h> |
||||
#include <asm/arch/cpu.h> |
||||
|
||||
.globl relocate_wait_code
|
||||
relocate_wait_code: |
||||
adr r0, code_base @ r0: source address (start)
|
||||
adr r1, code_end @ r1: source address (end)
|
||||
ldr r2, =0x02073000 @ r2: target address
|
||||
1: |
||||
ldmia r0!, {r3-r6} |
||||
stmia r2!, {r3-r6} |
||||
cmp r0, r1 |
||||
blt 1b |
||||
b code_end |
||||
.ltorg |
||||
/* |
||||
* Secondary core waits here until Primary wake it up. |
||||
* Below code is copied to CONFIG_EXYNOS_RELOCATE_CODE_BASE. |
||||
* This is a workaround code which is supposed to act as a |
||||
* substitute/supplement to the iROM code. |
||||
* |
||||
* This workaround code is relocated to the address 0x02073000 |
||||
* because that comes out to be the last 4KB of the iRAM |
||||
* (Base Address - 0x02020000, Limit Address - 0x020740000). |
||||
* |
||||
* U-boot and kernel are aware of this code and flags by the simple |
||||
* fact that we are implementing a workaround in the last 4KB |
||||
* of the iRAM and we have already defined these flag and address |
||||
* values in both kernel and U-boot for our use. |
||||
*/ |
||||
code_base: |
||||
b 1f |
||||
/* |
||||
* These addresses are being used as flags in u-boot and kernel. |
||||
* |
||||
* Jump address for resume and flag to check for resume/reset: |
||||
* Resume address - 0x2073008 |
||||
* Resume flag - 0x207300C |
||||
* |
||||
* Jump address for cluster switching: |
||||
* Switch address - 0x2073018 |
||||
* |
||||
* Jump address for core hotplug: |
||||
* Hotplug address - 0x207301C |
||||
* |
||||
* Jump address for C2 state (Reserved for future not being used right now): |
||||
* C2 address - 0x2073024 |
||||
* |
||||
* Managed per core status for the active cluster: |
||||
* CPU0 state - 0x2073028 |
||||
* CPU1 state - 0x207302C |
||||
* CPU2 state - 0x2073030 |
||||
* CPU3 state - 0x2073034 |
||||
* |
||||
* Managed per core GIC status for the active cluster: |
||||
* CPU0 gic state - 0x2073038 |
||||
* CPU1 gic state - 0x207303C |
||||
* CPU2 gic state - 0x2073040 |
||||
* CPU3 gic state - 0x2073044 |
||||
* |
||||
* Logic of the code: |
||||
* Step-1: Read current CPU status. |
||||
* Step-2: If it's a resume then continue, else jump to step 4. |
||||
* Step-3: Clear inform1 PMU register and jump to inform0 value. |
||||
* Step-4: If it's a switch, C2 or reset, get the hotplug address. |
||||
* Step-5: If address is not available, enter WFE. |
||||
* Step-6: If address is available, jump to that address. |
||||
*/ |
||||
nop @ for backward compatibility
|
||||
.word 0x0 @ REG0: RESUME_ADDR
|
||||
.word 0x0 @ REG1: RESUME_FLAG
|
||||
.word 0x0 @ REG2
|
||||
.word 0x0 @ REG3
|
||||
_switch_addr: |
||||
.word 0x0 @ REG4: SWITCH_ADDR
|
||||
_hotplug_addr: |
||||
.word 0x0 @ REG5: CPU1_BOOT_REG
|
||||
.word 0x0 @ REG6
|
||||
_c2_addr: |
||||
.word 0x0 @ REG7: REG_C2_ADDR
|
||||
_cpu_state: |
||||
.word 0x1 @ CPU0_STATE : RESET
|
||||
.word 0x2 @ CPU1_STATE : SECONDARY RESET
|
||||
.word 0x2 @ CPU2_STATE : SECONDARY RESET
|
||||
.word 0x2 @ CPU3_STATE : SECONDARY RESET
|
||||
_gic_state: |
||||
.word 0x0 @ CPU0 - GICD_IGROUPR0
|
||||
.word 0x0 @ CPU1 - GICD_IGROUPR0
|
||||
.word 0x0 @ CPU2 - GICD_IGROUPR0
|
||||
.word 0x0 @ CPU3 - GICD_IGROUPR0
|
||||
1: |
||||
adr r0, _cpu_state |
||||
mrc p15, 0, r7, c0, c0, 5 @ read MPIDR
|
||||
and r7, r7, #0xf @ r7 = cpu id
|
||||
/* Read the current cpu state */ |
||||
ldr r10, [r0, r7, lsl #2] |
||||
svc_entry: |
||||
tst r10, #(1 << 4) |
||||
adrne r0, _switch_addr |
||||
bne wait_for_addr |
||||
/* Clear INFORM1 */ |
||||
ldr r0, =(0x10040000 + 0x804) |
||||
ldr r1, [r0] |
||||
cmp r1, #0x0 |
||||
movne r1, #0x0 |
||||
strne r1, [r0] |
||||
/* Get INFORM0 */ |
||||
ldrne r1, =(0x10040000 + 0x800) |
||||
ldrne pc, [r1] |
||||
tst r10, #(1 << 0) |
||||
ldrne pc, =0x23e00000 |
||||
adr r0, _hotplug_addr |
||||
wait_for_addr: |
||||
ldr r1, [r0] |
||||
cmp r1, #0x0 |
||||
bxne r1 |
||||
wfe |
||||
b wait_for_addr |
||||
.ltorg |
||||
code_end: |
||||
mov pc, lr |
File diff suppressed because it is too large
Load Diff
@ -1,28 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2014 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/sg-regs.h> |
||||
|
||||
void sg_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* Set DDR size */ |
||||
tmp = sg_memconf_val_ch0(CONFIG_SDRAM0_SIZE, CONFIG_DDR_NUM_CH0); |
||||
tmp |= sg_memconf_val_ch1(CONFIG_SDRAM1_SIZE, CONFIG_DDR_NUM_CH1); |
||||
#if CONFIG_SDRAM0_BASE + CONFIG_SDRAM0_SIZE < CONFIG_SDRAM1_BASE |
||||
tmp |= SG_MEMCONF_SPARSEMEM; |
||||
#endif |
||||
writel(tmp, SG_MEMCONF); |
||||
|
||||
/* Input ports must be enabled before deasserting reset of cores */ |
||||
tmp = readl(SG_IECTRL); |
||||
tmp |= 0x1; |
||||
writel(tmp, SG_IECTRL); |
||||
} |
@ -1,29 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2014 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/sc-regs.h> |
||||
|
||||
void clkrst_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* deassert reset */ |
||||
tmp = readl(SC_RSTCTRL); |
||||
tmp |= SC_RSTCTRL_NRST_ETHER | SC_RSTCTRL_NRST_UMC1 |
||||
| SC_RSTCTRL_NRST_UMC0 | SC_RSTCTRL_NRST_NAND; |
||||
writel(tmp, SC_RSTCTRL); |
||||
readl(SC_RSTCTRL); /* dummy read */ |
||||
|
||||
/* privide clocks */ |
||||
tmp = readl(SC_CLKCTRL); |
||||
tmp |= SC_CLKCTRL_CLK_ETHER | SC_CLKCTRL_CLK_MIO | SC_CLKCTRL_CLK_UMC |
||||
| SC_CLKCTRL_CLK_NAND | SC_CLKCTRL_CLK_SBC | SC_CLKCTRL_CLK_PERI; |
||||
writel(tmp, SC_CLKCTRL); |
||||
readl(SC_CLKCTRL); /* dummy read */ |
||||
} |
@ -1,75 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2014 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/sbc-regs.h> |
||||
#include <asm/arch/sg-regs.h> |
||||
|
||||
void sbc_init(void) |
||||
{ |
||||
#if defined(CONFIG_PFC_MICRO_SUPPORT_CARD) |
||||
/*
|
||||
* Only CS1 is connected to support card. |
||||
* BKSZ[1:0] should be set to "01". |
||||
*/ |
||||
writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL10); |
||||
writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL11); |
||||
writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL12); |
||||
writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL14); |
||||
|
||||
if (boot_is_swapped()) { |
||||
/*
|
||||
* Boot Swap On: boot from external NOR/SRAM |
||||
* 0x02000000-0x03ffffff is a mirror of 0x00000000-0x01ffffff. |
||||
* |
||||
* 0x00000000-0x01efffff, 0x02000000-0x03efffff: memory bank |
||||
* 0x01f00000-0x01ffffff, 0x03f00000-0x03ffffff: peripherals |
||||
*/ |
||||
writel(0x0000bc01, SBBASE0); |
||||
} else { |
||||
/*
|
||||
* Boot Swap Off: boot from mask ROM |
||||
* 0x00000000-0x01ffffff: mask ROM |
||||
* 0x02000000-0x3effffff: memory bank (31MB) |
||||
* 0x03f00000-0x3fffffff: peripherals (1MB) |
||||
*/ |
||||
writel(0x0000be01, SBBASE0); /* dummy */ |
||||
writel(0x0200be01, SBBASE1); |
||||
} |
||||
#elif defined(CONFIG_DCC_MICRO_SUPPORT_CARD) |
||||
#if !defined(CONFIG_SPL_BUILD) |
||||
/* XECS0: boot/sub memory (boot swap = off/on) */ |
||||
writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL00); |
||||
writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL01); |
||||
writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL02); |
||||
writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL04); |
||||
#endif |
||||
/* XECS1: sub/boot memory (boot swap = off/on) */ |
||||
writel(SBCTRL0_SAVEPIN_MEM_VALUE, SBCTRL10); |
||||
writel(SBCTRL1_SAVEPIN_MEM_VALUE, SBCTRL11); |
||||
writel(SBCTRL2_SAVEPIN_MEM_VALUE, SBCTRL12); |
||||
writel(SBCTRL4_SAVEPIN_MEM_VALUE, SBCTRL14); |
||||
|
||||
/* XECS3: peripherals */ |
||||
writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL30); |
||||
writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL31); |
||||
writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL32); |
||||
writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL34); |
||||
|
||||
writel(0x0000bc01, SBBASE0); /* boot memory */ |
||||
writel(0x0400bc01, SBBASE1); /* sub memory */ |
||||
writel(0x0800bf01, SBBASE3); /* peripherals */ |
||||
|
||||
#if !defined(CONFIG_SPL_BUILD) |
||||
sg_set_pinsel(318, 5); /* PORT22 -> XECS0 */ |
||||
#endif |
||||
sg_set_pinsel(313, 5); /* PORT15 -> XECS3 */ |
||||
writel(0x00000001, SG_LOADPINCTRL); |
||||
|
||||
#endif /* CONFIG_XXX_MICRO_SUPPORT_CARD */ |
||||
} |
@ -1,28 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2014 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/sg-regs.h> |
||||
|
||||
void sg_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* Set DDR size */ |
||||
tmp = sg_memconf_val_ch0(CONFIG_SDRAM0_SIZE, CONFIG_DDR_NUM_CH0); |
||||
tmp |= sg_memconf_val_ch1(CONFIG_SDRAM1_SIZE, CONFIG_DDR_NUM_CH1); |
||||
#if CONFIG_SDRAM0_BASE + CONFIG_SDRAM0_SIZE < CONFIG_SDRAM1_BASE |
||||
tmp |= SG_MEMCONF_SPARSEMEM; |
||||
#endif |
||||
writel(tmp, SG_MEMCONF); |
||||
|
||||
/* Input ports must be enabled before deasserting reset of cores */ |
||||
tmp = readl(SG_IECTRL); |
||||
tmp |= 1 << 6; |
||||
writel(tmp, SG_IECTRL); |
||||
} |
@ -1,29 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2014 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/sc-regs.h> |
||||
|
||||
void clkrst_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* deassert reset */ |
||||
tmp = readl(SC_RSTCTRL); |
||||
tmp |= SC_RSTCTRL_NRST_ETHER | SC_RSTCTRL_NRST_UMC1 |
||||
| SC_RSTCTRL_NRST_UMC0 | SC_RSTCTRL_NRST_NAND; |
||||
writel(tmp, SC_RSTCTRL); |
||||
readl(SC_RSTCTRL); /* dummy read */ |
||||
|
||||
/* privide clocks */ |
||||
tmp = readl(SC_CLKCTRL); |
||||
tmp |= SC_CLKCTRL_CLK_ETHER | SC_CLKCTRL_CLK_MIO | SC_CLKCTRL_CLK_UMC |
||||
| SC_CLKCTRL_CLK_NAND | SC_CLKCTRL_CLK_SBC | SC_CLKCTRL_CLK_PERI; |
||||
writel(tmp, SC_CLKCTRL); |
||||
readl(SC_CLKCTRL); /* dummy read */ |
||||
} |
@ -0,0 +1,9 @@ |
||||
#
|
||||
# (C) Copyright 2014 - 2015 Xilinx, Inc.
|
||||
# Michal Simek <michal.simek@xilinx.com>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0+
|
||||
#
|
||||
|
||||
obj-y += clk.o
|
||||
obj-y += cpu.o
|
@ -0,0 +1,49 @@ |
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc. |
||||
* Michal Simek <michal.simek@xilinx.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <asm/arch/sys_proto.h> |
||||
|
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
unsigned long get_uart_clk(int dev_id) |
||||
{ |
||||
u32 ver = zynqmp_get_silicon_version(); |
||||
|
||||
switch (ver) { |
||||
case ZYNQMP_CSU_VERSION_EP108: |
||||
return 25000000; |
||||
} |
||||
|
||||
return 133000000; |
||||
} |
||||
|
||||
#ifdef CONFIG_CLOCKS |
||||
/**
|
||||
* set_cpu_clk_info() - Initialize clock framework |
||||
* Always returns zero. |
||||
* |
||||
* This function is called from common code after relocation and sets up the |
||||
* clock framework. The framework must not be used before this function had been |
||||
* called. |
||||
*/ |
||||
int set_cpu_clk_info(void) |
||||
{ |
||||
gd->cpu_clk = get_tbclk(); |
||||
|
||||
/* Support Veloce to show at least 1MHz via bdi */ |
||||
if (gd->cpu_clk > 1000000) |
||||
gd->bd->bi_arm_freq = gd->cpu_clk / 1000000; |
||||
else |
||||
gd->bd->bi_arm_freq = 1; |
||||
|
||||
gd->bd->bi_dsp_freq = 0; |
||||
|
||||
return 0; |
||||
} |
||||
#endif |
@ -0,0 +1,28 @@ |
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc. |
||||
* Michal Simek <michal.simek@xilinx.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/hardware.h> |
||||
#include <asm/arch/sys_proto.h> |
||||
#include <asm/io.h> |
||||
|
||||
#define ZYNQ_SILICON_VER_MASK 0xF000 |
||||
#define ZYNQ_SILICON_VER_SHIFT 12 |
||||
|
||||
DECLARE_GLOBAL_DATA_PTR; |
||||
|
||||
unsigned int zynqmp_get_silicon_version(void) |
||||
{ |
||||
gd->cpu_clk = get_tbclk(); |
||||
|
||||
switch (gd->cpu_clk) { |
||||
case 50000000: |
||||
return ZYNQMP_CSU_VERSION_QEMU; |
||||
} |
||||
|
||||
return ZYNQMP_CSU_VERSION_EP108; |
||||
} |
@ -1,33 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2014 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef __PLAT_UNIPHIER_EHCI_H |
||||
#define __PLAT_UNIPHIER_EHCI_H |
||||
|
||||
#include <linux/types.h> |
||||
#include <asm/io.h> |
||||
#include "mio-regs.h" |
||||
|
||||
struct uniphier_ehci_platform_data { |
||||
unsigned long base; |
||||
}; |
||||
|
||||
extern struct uniphier_ehci_platform_data uniphier_ehci_platdata[]; |
||||
|
||||
static inline void uniphier_ehci_reset(int index, int on) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
tmp = readl(MIO_USB_RSTCTRL(index)); |
||||
if (on) |
||||
tmp &= ~MIO_USB_RSTCTRL_XRST; |
||||
else |
||||
tmp |= MIO_USB_RSTCTRL_XRST; |
||||
writel(tmp, MIO_USB_RSTCTRL(index)); |
||||
} |
||||
|
||||
#endif /* __PLAT_UNIPHIER_EHCI_H */ |
@ -0,0 +1,13 @@ |
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc. |
||||
* Michal Simek <michal.simek@xilinx.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef _ASM_ARCH_CLK_H_ |
||||
#define _ASM_ARCH_CLK_H_ |
||||
|
||||
unsigned long get_uart_clk(int dev_id); |
||||
|
||||
#endif /* _ASM_ARCH_CLK_H_ */ |
@ -0,0 +1,52 @@ |
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc. |
||||
* Michal Simek <michal.simek@xilinx.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef _ASM_ARCH_HARDWARE_H |
||||
#define _ASM_ARCH_HARDWARE_H |
||||
|
||||
#define ZYNQ_SERIAL_BASEADDR0 0xFF000000 |
||||
#define ZYNQ_SERIAL_BASEADDR1 0xFF001000 |
||||
|
||||
#define ZYNQ_SDHCI_BASEADDR0 0xFF160000 |
||||
#define ZYNQ_SDHCI_BASEADDR1 0xFF170000 |
||||
|
||||
#define ZYNQMP_CRL_APB_BASEADDR 0xFF5E0000 |
||||
#define ZYNQMP_CRL_APB_TIMESTAMP_REF_CTRL_CLKACT 0x1000000 |
||||
|
||||
struct crlapb_regs { |
||||
u32 reserved0[74]; |
||||
u32 timestamp_ref_ctrl; /* 0x128 */ |
||||
u32 reserved0_1[53]; |
||||
u32 boot_mode; /* 0x200 */ |
||||
u32 reserved1[26]; |
||||
}; |
||||
|
||||
#define crlapb_base ((struct crlapb_regs *)ZYNQMP_CRL_APB_BASEADDR) |
||||
|
||||
#define ZYNQMP_IOU_SCNTR 0xFF250000 |
||||
#define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_EN 0x1 |
||||
#define ZYNQMP_IOU_SCNTR_COUNTER_CONTROL_REGISTER_HDBG 0x2 |
||||
|
||||
struct iou_scntr { |
||||
u32 counter_control_register; |
||||
u32 reserved0[7]; |
||||
u32 base_frequency_id_register; |
||||
}; |
||||
|
||||
#define iou_scntr ((struct iou_scntr *)ZYNQMP_IOU_SCNTR) |
||||
|
||||
/* Bootmode setting values */ |
||||
#define BOOT_MODES_MASK 0x0000000F |
||||
#define SD_MODE 0x00000005 |
||||
#define JTAG_MODE 0x00000000 |
||||
|
||||
/* Board version value */ |
||||
#define ZYNQMP_CSU_VERSION_SILICON 0x0 |
||||
#define ZYNQMP_CSU_VERSION_EP108 0x1 |
||||
#define ZYNQMP_CSU_VERSION_QEMU 0x3 |
||||
|
||||
#endif /* _ASM_ARCH_HARDWARE_H */ |
@ -0,0 +1,15 @@ |
||||
/*
|
||||
* (C) Copyright 2014 - 2015 Xilinx, Inc. |
||||
* Michal Simek <michal.simek@xilinx.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#ifndef _ASM_ARCH_SYS_PROTO_H |
||||
#define _ASM_ARCH_SYS_PROTO_H |
||||
|
||||
int zynq_sdhci_init(unsigned long regbase); |
||||
|
||||
unsigned int zynqmp_get_silicon_version(void); |
||||
|
||||
#endif /* _ASM_ARCH_SYS_PROTO_H */ |
@ -0,0 +1,104 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2015 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <linux/sizes.h> |
||||
#include <asm/io.h> |
||||
#include <mach/sg-regs.h> |
||||
|
||||
static inline u32 sg_memconf_val_ch0(unsigned long size, int num) |
||||
{ |
||||
int size_mb = size / num; |
||||
u32 ret; |
||||
|
||||
switch (size_mb) { |
||||
case SZ_64M: |
||||
ret = SG_MEMCONF_CH0_SZ_64M; |
||||
break; |
||||
case SZ_128M: |
||||
ret = SG_MEMCONF_CH0_SZ_128M; |
||||
break; |
||||
case SZ_256M: |
||||
ret = SG_MEMCONF_CH0_SZ_256M; |
||||
break; |
||||
case SZ_512M: |
||||
ret = SG_MEMCONF_CH0_SZ_512M; |
||||
break; |
||||
case SZ_1G: |
||||
ret = SG_MEMCONF_CH0_SZ_1G; |
||||
break; |
||||
default: |
||||
BUG(); |
||||
break; |
||||
} |
||||
|
||||
switch (num) { |
||||
case 1: |
||||
ret |= SG_MEMCONF_CH0_NUM_1; |
||||
break; |
||||
case 2: |
||||
ret |= SG_MEMCONF_CH0_NUM_2; |
||||
break; |
||||
default: |
||||
BUG(); |
||||
break; |
||||
} |
||||
return ret; |
||||
} |
||||
|
||||
static inline u32 sg_memconf_val_ch1(unsigned long size, int num) |
||||
{ |
||||
int size_mb = size / num; |
||||
u32 ret; |
||||
|
||||
switch (size_mb) { |
||||
case SZ_64M: |
||||
ret = SG_MEMCONF_CH1_SZ_64M; |
||||
break; |
||||
case SZ_128M: |
||||
ret = SG_MEMCONF_CH1_SZ_128M; |
||||
break; |
||||
case SZ_256M: |
||||
ret = SG_MEMCONF_CH1_SZ_256M; |
||||
break; |
||||
case SZ_512M: |
||||
ret = SG_MEMCONF_CH1_SZ_512M; |
||||
break; |
||||
case SZ_1G: |
||||
ret = SG_MEMCONF_CH1_SZ_1G; |
||||
break; |
||||
default: |
||||
BUG(); |
||||
break; |
||||
} |
||||
|
||||
switch (num) { |
||||
case 1: |
||||
ret |= SG_MEMCONF_CH1_NUM_1; |
||||
break; |
||||
case 2: |
||||
ret |= SG_MEMCONF_CH1_NUM_2; |
||||
break; |
||||
default: |
||||
BUG(); |
||||
break; |
||||
} |
||||
return ret; |
||||
} |
||||
|
||||
void memconf_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* Set DDR size */ |
||||
tmp = sg_memconf_val_ch0(CONFIG_SDRAM0_SIZE, CONFIG_DDR_NUM_CH0); |
||||
tmp |= sg_memconf_val_ch1(CONFIG_SDRAM1_SIZE, CONFIG_DDR_NUM_CH1); |
||||
#if CONFIG_SDRAM0_BASE + CONFIG_SDRAM0_SIZE < CONFIG_SDRAM1_BASE |
||||
tmp |= SG_MEMCONF_SPARSEMEM; |
||||
#endif |
||||
writel(tmp, SG_MEMCONF); |
||||
} |
@ -0,0 +1,42 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2015 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <asm/io.h> |
||||
#include <mach/sc-regs.h> |
||||
|
||||
void clkrst_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* deassert reset */ |
||||
tmp = readl(SC_RSTCTRL); |
||||
#ifdef CONFIG_UNIPHIER_ETH |
||||
tmp |= SC_RSTCTRL_NRST_ETHER; |
||||
#endif |
||||
#ifdef CONFIG_USB_EHCI_UNIPHIER |
||||
tmp |= SC_RSTCTRL_NRST_STDMAC; |
||||
#endif |
||||
#ifdef CONFIG_NAND_DENALI |
||||
tmp |= SC_RSTCTRL_NRST_NAND; |
||||
#endif |
||||
writel(tmp, SC_RSTCTRL); |
||||
readl(SC_RSTCTRL); /* dummy read */ |
||||
|
||||
/* privide clocks */ |
||||
tmp = readl(SC_CLKCTRL); |
||||
#ifdef CONFIG_UNIPHIER_ETH |
||||
tmp |= SC_CLKCTRL_CEN_ETHER; |
||||
#endif |
||||
#ifdef CONFIG_USB_EHCI_UNIPHIER |
||||
tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC; |
||||
#endif |
||||
#ifdef CONFIG_NAND_DENALI |
||||
tmp |= SC_CLKCTRL_CEN_NAND; |
||||
#endif |
||||
writel(tmp, SC_CLKCTRL); |
||||
readl(SC_CLKCTRL); /* dummy read */ |
||||
} |
@ -0,0 +1 @@ |
||||
#include "../ph1-pro4/early_clkrst_init.c" |
@ -0,0 +1,50 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2015 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <mach/sbc-regs.h> |
||||
#include <mach/sg-regs.h> |
||||
|
||||
void sbc_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* system bus output enable */ |
||||
tmp = readl(PC0CTRL); |
||||
tmp &= 0xfffffcff; |
||||
writel(tmp, PC0CTRL); |
||||
|
||||
/*
|
||||
* Only CS1 is connected to support card. |
||||
* BKSZ[1:0] should be set to "01". |
||||
*/ |
||||
writel(SBCTRL0_SAVEPIN_PERI_VALUE, SBCTRL10); |
||||
writel(SBCTRL1_SAVEPIN_PERI_VALUE, SBCTRL11); |
||||
writel(SBCTRL2_SAVEPIN_PERI_VALUE, SBCTRL12); |
||||
writel(SBCTRL4_SAVEPIN_PERI_VALUE, SBCTRL14); |
||||
|
||||
if (boot_is_swapped()) { |
||||
/*
|
||||
* Boot Swap On: boot from external NOR/SRAM |
||||
* 0x02000000-0x03ffffff is a mirror of 0x00000000-0x01ffffff. |
||||
* |
||||
* 0x00000000-0x01efffff, 0x02000000-0x03efffff: memory bank |
||||
* 0x01f00000-0x01ffffff, 0x03f00000-0x03ffffff: peripherals |
||||
*/ |
||||
writel(0x0000bc01, SBBASE0); |
||||
} else { |
||||
/*
|
||||
* Boot Swap Off: boot from mask ROM |
||||
* 0x00000000-0x01ffffff: mask ROM |
||||
* 0x02000000-0x03efffff: memory bank (31MB) |
||||
* 0x03f00000-0x03ffffff: peripherals (1MB) |
||||
*/ |
||||
writel(0x0000be01, SBBASE0); /* dummy */ |
||||
writel(0x0200be01, SBBASE1); |
||||
} |
||||
} |
@ -0,0 +1,19 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2015 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <asm/io.h> |
||||
#include <mach/sg-regs.h> |
||||
|
||||
void sg_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* Input ports must be enabled before deasserting reset of cores */ |
||||
tmp = readl(SG_IECTRL); |
||||
tmp |= 0x1; |
||||
writel(tmp, SG_IECTRL); |
||||
} |
@ -0,0 +1,57 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2015 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <asm/io.h> |
||||
#include <mach/sc-regs.h> |
||||
|
||||
void clkrst_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* deassert reset */ |
||||
tmp = readl(SC_RSTCTRL); |
||||
#ifdef CONFIG_USB_XHCI_UNIPHIER |
||||
tmp |= SC_RSTCTRL_NRST_USB3B0 | SC_RSTCTRL_NRST_USB3C0 | |
||||
SC_RSTCTRL_NRST_GIO; |
||||
#endif |
||||
#ifdef CONFIG_UNIPHIER_ETH |
||||
tmp |= SC_RSTCTRL_NRST_ETHER; |
||||
#endif |
||||
#ifdef CONFIG_USB_EHCI_UNIPHIER |
||||
tmp |= SC_RSTCTRL_NRST_STDMAC; |
||||
#endif |
||||
#ifdef CONFIG_NAND_DENALI |
||||
tmp |= SC_RSTCTRL_NRST_NAND; |
||||
#endif |
||||
writel(tmp, SC_RSTCTRL); |
||||
readl(SC_RSTCTRL); /* dummy read */ |
||||
|
||||
#ifdef CONFIG_USB_XHCI_UNIPHIER |
||||
tmp = readl(SC_RSTCTRL2); |
||||
tmp |= SC_RSTCTRL2_NRST_USB3B1 | SC_RSTCTRL2_NRST_USB3C1; |
||||
writel(tmp, SC_RSTCTRL2); |
||||
readl(SC_RSTCTRL2); /* dummy read */ |
||||
#endif |
||||
|
||||
/* privide clocks */ |
||||
tmp = readl(SC_CLKCTRL); |
||||
#ifdef CONFIG_USB_XHCI_UNIPHIER |
||||
tmp |= SC_CLKCTRL_CEN_USB31 | SC_CLKCTRL_CEN_USB30 | |
||||
SC_CLKCTRL_CEN_GIO; |
||||
#endif |
||||
#ifdef CONFIG_UNIPHIER_ETH |
||||
tmp |= SC_CLKCTRL_CEN_ETHER; |
||||
#endif |
||||
#ifdef CONFIG_USB_EHCI_UNIPHIER |
||||
tmp |= SC_CLKCTRL_CEN_MIO | SC_CLKCTRL_CEN_STDMAC; |
||||
#endif |
||||
#ifdef CONFIG_NAND_DENALI |
||||
tmp |= SC_CLKCTRL_CEN_NAND; |
||||
#endif |
||||
writel(tmp, SC_CLKCTRL); |
||||
readl(SC_CLKCTRL); /* dummy read */ |
||||
} |
@ -1,29 +1,31 @@ |
||||
/*
|
||||
* Copyright (C) 2011-2014 Panasonic Corporation |
||||
* Copyright (C) 2011-2015 Panasonic Corporation |
||||
* Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <spl.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/sc-regs.h> |
||||
#include <mach/sc-regs.h> |
||||
|
||||
void clkrst_init(void) |
||||
void early_clkrst_init(void) |
||||
{ |
||||
u32 tmp; |
||||
|
||||
/* deassert reset */ |
||||
tmp = readl(SC_RSTCTRL); |
||||
tmp |= SC_RSTCTRL_NRST_ETHER | SC_RSTCTRL_NRST_UMC1 |
||||
| SC_RSTCTRL_NRST_UMC0 | SC_RSTCTRL_NRST_NAND; |
||||
|
||||
tmp |= SC_RSTCTRL_NRST_UMC1 | SC_RSTCTRL_NRST_UMC0; |
||||
if (spl_boot_device() != BOOT_DEVICE_NAND) |
||||
tmp &= ~SC_RSTCTRL_NRST_NAND; |
||||
writel(tmp, SC_RSTCTRL); |
||||
readl(SC_RSTCTRL); /* dummy read */ |
||||
|
||||
/* privide clocks */ |
||||
tmp = readl(SC_CLKCTRL); |
||||
tmp |= SC_CLKCTRL_CLK_ETHER | SC_CLKCTRL_CLK_MIO | SC_CLKCTRL_CLK_UMC |
||||
| SC_CLKCTRL_CLK_NAND | SC_CLKCTRL_CLK_SBC | SC_CLKCTRL_CLK_PERI; |
||||
tmp |= SC_CLKCTRL_CEN_UMC | SC_CLKCTRL_CEN_SBC | SC_CLKCTRL_CEN_PERI; |
||||
writel(tmp, SC_CLKCTRL); |
||||
readl(SC_CLKCTRL); /* dummy read */ |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue