summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/armv7
diff options
context:
space:
mode:
authorAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-05-05 10:09:06 +0200
committerAlbert ARIBAUD <albert.u.boot@aribaud.net>2015-05-05 10:09:06 +0200
commitb939689c7b87773c44275a578ffc8674a867e39d (patch)
tree785d71eb0bbc707385e4456a14b21706223d99a3 /arch/arm/cpu/armv7
parent97840b5d1fe0960134c3553a9d9d1c1cd1be784d (diff)
parentace97d26176a3ebc9ec07738450de93eea35975c (diff)
downloadblackbird-obmc-uboot-b939689c7b87773c44275a578ffc8674a867e39d.tar.gz
blackbird-obmc-uboot-b939689c7b87773c44275a578ffc8674a867e39d.zip
Merge branch 'u-boot/master' into 'u-boot-arm/master'
Diffstat (limited to 'arch/arm/cpu/armv7')
-rw-r--r--arch/arm/cpu/armv7/Makefile3
-rw-r--r--arch/arm/cpu/armv7/exynos/Kconfig14
-rw-r--r--arch/arm/cpu/armv7/ls102xa/clock.c4
-rw-r--r--arch/arm/cpu/armv7/mx6/ddr.c7
-rw-r--r--arch/arm/cpu/armv7/omap-common/boot-common.c12
-rw-r--r--arch/arm/cpu/armv7/omap-common/sata.c6
-rw-r--r--arch/arm/cpu/armv7/omap-common/utils.c13
-rw-r--r--arch/arm/cpu/armv7/omap3/Kconfig27
-rw-r--r--arch/arm/cpu/armv7/omap5/hw_data.c4
-rw-r--r--arch/arm/cpu/armv7/omap5/prcm-regs.c4
-rw-r--r--arch/arm/cpu/armv7/rmobile/Kconfig12
-rw-r--r--arch/arm/cpu/armv7/socfpga/Makefile1
-rw-r--r--arch/arm/cpu/armv7/socfpga/lowlevel_init.S45
-rw-r--r--arch/arm/cpu/armv7/socfpga/misc.c2
-rw-r--r--arch/arm/cpu/armv7/socfpga/reset_manager.c24
-rw-r--r--arch/arm/cpu/armv7/socfpga/spl.c61
-rw-r--r--arch/arm/cpu/armv7/socfpga/system_manager.c9
-rw-r--r--arch/arm/cpu/armv7/sunxi/board.c29
-rw-r--r--arch/arm/cpu/armv7/sunxi/rsb.c8
-rw-r--r--arch/arm/cpu/armv7/sunxi/usbc.c77
-rw-r--r--arch/arm/cpu/armv7/vf610/generic.c45
-rw-r--r--arch/arm/cpu/armv7/zynq/Kconfig39
-rw-r--r--arch/arm/cpu/armv7/zynq/Makefile17
-rw-r--r--arch/arm/cpu/armv7/zynq/clk.c664
-rw-r--r--arch/arm/cpu/armv7/zynq/config.mk7
-rw-r--r--arch/arm/cpu/armv7/zynq/cpu.c67
-rw-r--r--arch/arm/cpu/armv7/zynq/ddrc.c50
-rw-r--r--arch/arm/cpu/armv7/zynq/lowlevel_init.S26
-rw-r--r--arch/arm/cpu/armv7/zynq/slcr.c196
-rw-r--r--arch/arm/cpu/armv7/zynq/spl.c90
-rw-r--r--arch/arm/cpu/armv7/zynq/timer.c166
-rw-r--r--arch/arm/cpu/armv7/zynq/u-boot-spl.lds62
-rw-r--r--arch/arm/cpu/armv7/zynq/u-boot.lds105
33 files changed, 285 insertions, 1611 deletions
diff --git a/arch/arm/cpu/armv7/Makefile b/arch/arm/cpu/armv7/Makefile
index 21fc03b97e..fcccd0c9ba 100644
--- a/arch/arm/cpu/armv7/Makefile
+++ b/arch/arm/cpu/armv7/Makefile
@@ -12,7 +12,7 @@ obj-y += cache_v7.o
obj-y += cpu.o cp15.o
obj-y += syslib.o
-ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI),)
+ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI)$(CONFIG_SOCFPGA),)
ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
obj-y += lowlevel_init.o
endif
@@ -56,4 +56,3 @@ obj-$(if $(filter stv0991,$(SOC)),y) += stv0991/
obj-$(CONFIG_ARCH_SUNXI) += sunxi/
obj-$(CONFIG_U8500) += u8500/
obj-$(CONFIG_VF610) += vf610/
-obj-$(CONFIG_ZYNQ) += zynq/
diff --git a/arch/arm/cpu/armv7/exynos/Kconfig b/arch/arm/cpu/armv7/exynos/Kconfig
index bd7540ac61..f6084ac476 100644
--- a/arch/arm/cpu/armv7/exynos/Kconfig
+++ b/arch/arm/cpu/armv7/exynos/Kconfig
@@ -65,19 +65,7 @@ endchoice
config SYS_SOC
default "exynos"
-config DM
- default y
-
-config DM_SERIAL
- default y
-
-config DM_SPI
- default y
-
-config DM_SPI_FLASH
- default y
-
-config DM_GPIO
+config DM_USB
default y
source "board/samsung/smdkv310/Kconfig"
diff --git a/arch/arm/cpu/armv7/ls102xa/clock.c b/arch/arm/cpu/armv7/ls102xa/clock.c
index 8f80c6175f..7a337e1c5b 100644
--- a/arch/arm/cpu/armv7/ls102xa/clock.c
+++ b/arch/arm/cpu/armv7/ls102xa/clock.c
@@ -20,7 +20,7 @@ void get_sys_info(struct sys_info *sys_info)
{
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
#ifdef CONFIG_FSL_IFC
- struct fsl_ifc *ifc_regs = (void *)CONFIG_SYS_IFC_ADDR;
+ struct fsl_ifc ifc_regs = {(void *)CONFIG_SYS_IFC_ADDR, (void *)NULL};
u32 ccr;
#endif
struct ccsr_clk *clk = (void *)(CONFIG_SYS_FSL_LS1_CLK_ADDR);
@@ -74,7 +74,7 @@ void get_sys_info(struct sys_info *sys_info)
}
#if defined(CONFIG_FSL_IFC)
- ccr = in_be32(&ifc_regs->ifc_ccr);
+ ccr = in_be32(&ifc_regs.gregs->ifc_ccr);
ccr = ((ccr & IFC_CCR_CLK_DIV_MASK) >> IFC_CCR_CLK_DIV_SHIFT) + 1;
sys_info->freq_localbus = sys_info->freq_systembus / ccr;
diff --git a/arch/arm/cpu/armv7/mx6/ddr.c b/arch/arm/cpu/armv7/mx6/ddr.c
index fef2231a39..653d58ef24 100644
--- a/arch/arm/cpu/armv7/mx6/ddr.c
+++ b/arch/arm/cpu/armv7/mx6/ddr.c
@@ -514,17 +514,21 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
/* MR2 */
val = (sysinfo->rtt_wr & 3) << 9 | (ddr3_cfg->SRT & 1) << 7 |
((tcwl - 3) & 3) << 3;
+ debug("MR2 CS%d: 0x%08x\n", cs, (u32)MR(val, 2, 3, cs));
mmdc0->mdscr = MR(val, 2, 3, cs);
/* MR3 */
+ debug("MR3 CS%d: 0x%08x\n", cs, (u32)MR(0, 3, 3, cs));
mmdc0->mdscr = MR(0, 3, 3, cs);
/* MR1 */
val = ((sysinfo->rtt_nom & 1) ? 1 : 0) << 2 |
((sysinfo->rtt_nom & 2) ? 1 : 0) << 6;
+ debug("MR1 CS%d: 0x%08x\n", cs, (u32)MR(val, 1, 3, cs));
mmdc0->mdscr = MR(val, 1, 3, cs);
/* MR0 */
val = ((tcl - 1) << 4) | /* CAS */
(1 << 8) | /* DLL Reset */
((twr - 3) << 9); /* Write Recovery */
+ debug("MR0 CS%d: 0x%08x\n", cs, (u32)MR(val, 0, 3, cs));
mmdc0->mdscr = MR(val, 0, 3, cs);
/* ZQ calibration */
val = (1 << 10);
@@ -535,10 +539,11 @@ void mx6_dram_cfg(const struct mx6_ddr_sysinfo *sysinfo,
mmdc0->mdpdc = (tcke & 0x7) << 16 |
5 << 12 | /* PWDT_1: 256 cycles */
5 << 8 | /* PWDT_0: 256 cycles */
- 1 << 7 | /* SLOW_PD */
1 << 6 | /* BOTH_CS_PD */
(tcksrx & 0x7) << 3 |
(tcksre & 0x7);
+ if (!sysinfo->pd_fast_exit)
+ mmdc0->mdpdc |= (1 << 7); /* SLOW_PD */
mmdc0->mapsr = 0x00001006; /* ADOPT power down enabled */
/* Step 11: Configure ZQ calibration: one-time and periodic 1ms */
diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 17500f2315..bbc6bed7ca 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -159,6 +159,16 @@ void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
#ifdef CONFIG_SCSI_AHCI_PLAT
void arch_preboot_os(void)
{
- ahci_reset(DWC_AHSATA_BASE);
+ ahci_reset((void __iomem *)DWC_AHSATA_BASE);
+}
+#endif
+
+#if defined(CONFIG_CMD_FASTBOOT) && !defined(CONFIG_ENV_IS_NOWHERE)
+int fb_set_reboot_flag(void)
+{
+ printf("Setting reboot to fastboot flag ...\n");
+ setenv("dofastboot", "1");
+ saveenv();
+ return 0;
}
#endif
diff --git a/arch/arm/cpu/armv7/omap-common/sata.c b/arch/arm/cpu/armv7/omap-common/sata.c
index d18bc50c5a..2c2d1bce36 100644
--- a/arch/arm/cpu/armv7/omap-common/sata.c
+++ b/arch/arm/cpu/armv7/omap-common/sata.c
@@ -69,7 +69,7 @@ int init_sata(int dev)
val = TI_SATA_IDLE_NO | TI_SATA_STANDBY_NO;
writel(val, TI_SATA_WRAPPER_BASE + TI_SATA_SYSCONFIG);
- ret = ahci_init(DWC_AHSATA_BASE);
+ ret = ahci_init((void __iomem *)DWC_AHSATA_BASE);
return ret;
}
@@ -88,6 +88,6 @@ void scsi_init(void)
void scsi_bus_reset(void)
{
- ahci_reset(DWC_AHSATA_BASE);
- ahci_init(DWC_AHSATA_BASE);
+ ahci_reset((void __iomem *)DWC_AHSATA_BASE);
+ ahci_init((void __iomem *)DWC_AHSATA_BASE);
}
diff --git a/arch/arm/cpu/armv7/omap-common/utils.c b/arch/arm/cpu/armv7/omap-common/utils.c
index 1696c2dbda..df5f817baa 100644
--- a/arch/arm/cpu/armv7/omap-common/utils.c
+++ b/arch/arm/cpu/armv7/omap-common/utils.c
@@ -60,3 +60,16 @@ void __weak usb_fake_mac_from_die_id(u32 *id)
eth_setenv_enetaddr("usbethaddr", device_mac);
}
}
+
+void __weak usb_set_serial_num_from_die_id(u32 *id)
+{
+ char serialno[72];
+ uint32_t serialno_lo, serialno_hi;
+
+ if (!getenv("serial#")) {
+ serialno_hi = id[0];
+ serialno_lo = id[1];
+ sprintf(serialno, "%08x%08x", serialno_hi, serialno_lo);
+ setenv("serial#", serialno);
+ }
+}
diff --git a/arch/arm/cpu/armv7/omap3/Kconfig b/arch/arm/cpu/armv7/omap3/Kconfig
index 1f96498fb8..cc82c5000e 100644
--- a/arch/arm/cpu/armv7/omap3/Kconfig
+++ b/arch/arm/cpu/armv7/omap3/Kconfig
@@ -17,6 +17,9 @@ config TARGET_OMAP3_SDP3430
config TARGET_OMAP3_BEAGLE
bool "TI OMAP3 BeagleBoard"
select SUPPORT_SPL
+ select DM
+ select DM_SERIAL
+ select DM_GPIO
config TARGET_CM_T35
bool "CompuLab CM-T3530 and CM-T3730 boards"
@@ -28,6 +31,9 @@ config TARGET_CM_T3517
config TARGET_DEVKIT8000
bool "TimLL OMAP3 Devkit8000"
select SUPPORT_SPL
+ select DM
+ select DM_SERIAL
+ select DM_GPIO
config TARGET_OMAP3_EVM
bool "TI OMAP3 EVM"
@@ -44,13 +50,22 @@ config TARGET_OMAP3_EVM_QUICK_NAND
config TARGET_OMAP3_IGEP00X0
bool "IGEP"
select SUPPORT_SPL
+ select DM
+ select DM_SERIAL
+ select DM_GPIO
config TARGET_OMAP3_OVERO
bool "OMAP35xx Gumstix Overo"
select SUPPORT_SPL
+ select DM
+ select DM_SERIAL
+ select DM_GPIO
config TARGET_OMAP3_ZOOM1
bool "TI Zoom1"
+ select DM
+ select DM_SERIAL
+ select DM_GPIO
config TARGET_AM3517_CRANE
bool "am3517_crane"
@@ -94,18 +109,12 @@ config TARGET_TWISTER
config TARGET_OMAP3_CAIRO
bool "QUIPOS CAIRO"
select SUPPORT_SPL
+ select DM
+ select DM_SERIAL
+ select DM_GPIO
endchoice
-config DM
- default y
-
-config DM_GPIO
- default y if DM
-
-config DM_SERIAL
- default y if DM
-
config SYS_SOC
default "omap3"
diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c b/arch/arm/cpu/armv7/omap5/hw_data.c
index e4abb25fc2..868415d038 100644
--- a/arch/arm/cpu/armv7/omap5/hw_data.c
+++ b/arch/arm/cpu/armv7/omap5/hw_data.c
@@ -460,7 +460,7 @@ void enable_basic_clocks(void)
(*prcm)->cm_l4per_gpio6_clkctrl,
(*prcm)->cm_l4per_gpio7_clkctrl,
(*prcm)->cm_l4per_gpio8_clkctrl,
-#ifdef CONFIG_USB_DWC3
+#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
(*prcm)->cm_l3init_ocp2scp1_clkctrl,
(*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
#endif
@@ -495,7 +495,7 @@ void enable_basic_clocks(void)
setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
HSMMC_CLKCTRL_CLKSEL_MASK);
-#ifdef CONFIG_USB_DWC3
+#if defined(CONFIG_USB_DWC3) || defined(CONFIG_USB_XHCI_OMAP)
/* Enable 960 MHz clock for dwc3 */
setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
OPTFCLKEN_REFCLK960M);
diff --git a/arch/arm/cpu/armv7/omap5/prcm-regs.c b/arch/arm/cpu/armv7/omap5/prcm-regs.c
index 440bb40a14..f80d36dc3c 100644
--- a/arch/arm/cpu/armv7/omap5/prcm-regs.c
+++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c
@@ -440,6 +440,10 @@ struct omap_sys_ctrl_regs const dra7xx_ctrl = {
.control_emif1_sdram_config_ext = 0x4AE0C144,
.control_emif2_sdram_config_ext = 0x4AE0C148,
.control_wkup_ldovbb_mpu_voltage_ctrl = 0x4AE0C158,
+ .control_std_fuse_die_id_0 = 0x4AE0C200,
+ .control_std_fuse_die_id_1 = 0x4AE0C208,
+ .control_std_fuse_die_id_2 = 0x4AE0C20C,
+ .control_std_fuse_die_id_3 = 0x4AE0C210,
.control_padconf_mode = 0x4AE0C5A0,
.control_xtal_oscillator = 0x4AE0C5A4,
.control_i2c_2 = 0x4AE0C5A8,
diff --git a/arch/arm/cpu/armv7/rmobile/Kconfig b/arch/arm/cpu/armv7/rmobile/Kconfig
index 2b333a3d46..57dcceccc7 100644
--- a/arch/arm/cpu/armv7/rmobile/Kconfig
+++ b/arch/arm/cpu/armv7/rmobile/Kconfig
@@ -8,24 +8,36 @@ config TARGET_ARMADILLO_800EVA
config TARGET_GOSE
bool "Gose board"
+ select DM
+ select DM_SERIAL
config TARGET_KOELSCH
bool "Koelsch board"
+ select DM
+ select DM_SERIAL
config TARGET_LAGER
bool "Lager board"
+ select DM
+ select DM_SERIAL
config TARGET_KZM9G
bool "KZM9D board"
config TARGET_ALT
bool "Alt board"
+ select DM
+ select DM_SERIAL
config TARGET_SILK
bool "Silk board"
+ select DM
+ select DM_SERIAL
config TARGET_PORTER
bool "Porter board"
+ select DM
+ select DM_SERIAL
endchoice
diff --git a/arch/arm/cpu/armv7/socfpga/Makefile b/arch/arm/cpu/armv7/socfpga/Makefile
index 8b6e108c42..7524ef90e4 100644
--- a/arch/arm/cpu/armv7/socfpga/Makefile
+++ b/arch/arm/cpu/armv7/socfpga/Makefile
@@ -7,7 +7,6 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y := lowlevel_init.o
obj-y += misc.o timer.o reset_manager.o system_manager.o clock_manager.o \
fpga_manager.o
obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o scan_manager.o
diff --git a/arch/arm/cpu/armv7/socfpga/lowlevel_init.S b/arch/arm/cpu/armv7/socfpga/lowlevel_init.S
deleted file mode 100644
index b4d0627871..0000000000
--- a/arch/arm/cpu/armv7/socfpga/lowlevel_init.S
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2012 Altera Corporation <www.altera.com>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <config.h>
-
-/* Set up the platform, once the cpu has been initialized */
-.globl lowlevel_init
-lowlevel_init:
-
- /* Remap */
-#ifdef CONFIG_SPL_BUILD
- /*
- * SPL : configure the remap (L3 NIC-301 GPV)
- * so the on-chip RAM at lower memory instead ROM.
- */
- ldr r0, =SOCFPGA_L3REGS_ADDRESS
- mov r1, #0x19
- str r1, [r0]
-#else
- /*
- * U-Boot : configure the remap (L3 NIC-301 GPV)
- * so the SDRAM at lower memory instead on-chip RAM.
- */
- ldr r0, =SOCFPGA_L3REGS_ADDRESS
- mov r1, #0x2
- str r1, [r0]
-
- /* Private components security */
-
- /*
- * U-Boot : configure private timer, global timer and cpu
- * component access as non secure for kernel stage (as required
- * by kernel)
- */
- mrc p15,4,r0,c15,c0,0
- add r1, r0, #0x54
- ldr r2, [r1]
- orr r2, r2, #0xff
- orr r2, r2, #0xf00
- str r2, [r1]
-#endif /* #ifdef CONFIG_SPL_BUILD */
- mov pc, lr
diff --git a/arch/arm/cpu/armv7/socfpga/misc.c b/arch/arm/cpu/armv7/socfpga/misc.c
index 7873c38e2b..0f8b4d095d 100644
--- a/arch/arm/cpu/armv7/socfpga/misc.c
+++ b/arch/arm/cpu/armv7/socfpga/misc.c
@@ -49,7 +49,7 @@ void enable_caches(void)
/*
* DesignWare Ethernet initialization
*/
-#ifdef CONFIG_DESIGNWARE_ETH
+#ifdef CONFIG_ETH_DESIGNWARE
int cpu_eth_init(bd_t *bis)
{
#if CONFIG_EMAC_BASE == SOCFPGA_EMAC0_ADDRESS
diff --git a/arch/arm/cpu/armv7/socfpga/reset_manager.c b/arch/arm/cpu/armv7/socfpga/reset_manager.c
index 25921e76c4..45b352bdfc 100644
--- a/arch/arm/cpu/armv7/socfpga/reset_manager.c
+++ b/arch/arm/cpu/armv7/socfpga/reset_manager.c
@@ -113,3 +113,27 @@ void socfpga_spim_enable(void)
clrbits_le32(reset, (1 << RSTMGR_PERMODRST_SPIM0_LSB) |
(1 << RSTMGR_PERMODRST_SPIM1_LSB));
}
+
+/* Bring UART0 out of reset. */
+void socfpga_uart0_enable(void)
+{
+ const void *reset = &reset_manager_base->per_mod_reset;
+
+ clrbits_le32(reset, 1 << RSTMGR_PERMODRST_UART0_LSB);
+}
+
+/* Bring SDRAM controller out of reset. */
+void socfpga_sdram_enable(void)
+{
+ const void *reset = &reset_manager_base->per_mod_reset;
+
+ clrbits_le32(reset, 1 << RSTMGR_PERMODRST_SDR_LSB);
+}
+
+/* Bring OSC1 timer out of reset. */
+void socfpga_osc1timer_enable(void)
+{
+ const void *reset = &reset_manager_base->per_mod_reset;
+
+ clrbits_le32(reset, 1 << RSTMGR_PERMODRST_OSC1TIMER0_LSB);
+}
diff --git a/arch/arm/cpu/armv7/socfpga/spl.c b/arch/arm/cpu/armv7/socfpga/spl.c
index 6a8c15d91f..f994658452 100644
--- a/arch/arm/cpu/armv7/socfpga/spl.c
+++ b/arch/arm/cpu/armv7/socfpga/spl.c
@@ -6,6 +6,7 @@
#include <common.h>
#include <asm/io.h>
+#include <asm/pl310.h>
#include <asm/u-boot.h>
#include <asm/utils.h>
#include <image.h>
@@ -15,9 +16,13 @@
#include <asm/arch/freeze_controller.h>
#include <asm/arch/clock_manager.h>
#include <asm/arch/scan_manager.h>
+#include <asm/arch/sdram.h>
DECLARE_GLOBAL_DATA_PTR;
+static struct pl310_regs *const pl310 =
+ (struct pl310_regs *)CONFIG_SYS_PL310_BASE;
+
#define MAIN_VCO_BASE ( \
(CONFIG_HPS_MAINPLLGRP_VCO_DENOM << \
CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET) | \
@@ -43,6 +48,31 @@ DECLARE_GLOBAL_DATA_PTR;
CLKMGR_SDRPLLGRP_VCO_NUMER_OFFSET) \
)
+void board_init_f(ulong dummy)
+{
+ struct socfpga_system_manager *sysmgr_regs =
+ (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS;
+ unsigned long reg;
+ /*
+ * First C code to run. Clear fake OCRAM ECC first as SBE
+ * and DBE might triggered during power on
+ */
+ reg = readl(&sysmgr_regs->eccgrp_ocram);
+ if (reg & SYSMGR_ECC_OCRAM_SERR)
+ writel(SYSMGR_ECC_OCRAM_SERR | SYSMGR_ECC_OCRAM_EN,
+ &sysmgr_regs->eccgrp_ocram);
+ if (reg & SYSMGR_ECC_OCRAM_DERR)
+ writel(SYSMGR_ECC_OCRAM_DERR | SYSMGR_ECC_OCRAM_EN,
+ &sysmgr_regs->eccgrp_ocram);
+
+ memset(__bss_start, 0, __bss_end - __bss_start);
+
+ /* Remap SDRAM to 0x0 */
+ writel(0x1, &pl310->pl310_addr_filter_start);
+
+ board_init_r(NULL, 0);
+}
+
u32 spl_boot_device(void)
{
return BOOT_DEVICE_RAM;
@@ -53,6 +83,7 @@ u32 spl_boot_device(void)
*/
void spl_board_init(void)
{
+ unsigned long sdram_size;
#ifndef CONFIG_SOCFPGA_VIRTUAL_TARGET
cm_config_t cm_default_cfg = {
/* main group */
@@ -144,10 +175,19 @@ void spl_board_init(void)
/* freeze all IO banks */
sys_mgr_frzctrl_freeze_req();
+ socfpga_sdram_enable();
+ socfpga_uart0_enable();
+ socfpga_osc1timer_enable();
+
+ timer_init();
+
debug("Reconfigure Clock Manager\n");
/* reconfigure the PLLs */
cm_basic_init(&cm_default_cfg);
+ /* Enable bootrom to configure IOs. */
+ sysmgr_enable_warmrstcfgio();
+
/* configure the IOCSR / IO buffer settings */
if (scan_mgr_configure_iocsr())
hang();
@@ -165,4 +205,25 @@ void spl_board_init(void)
/* enable console uart printing */
preloader_console_init();
+
+ if (sdram_mmr_init_full(0xffffffff) != 0) {
+ puts("SDRAM init failed.\n");
+ hang();
+ }
+
+ debug("SDRAM: Calibrating PHY\n");
+ /* SDRAM calibration */
+ if (sdram_calibration_full() == 0) {
+ puts("SDRAM calibration failed.\n");
+ hang();
+ }
+
+ sdram_size = sdram_calculate_size();
+ debug("SDRAM: %ld MiB\n", sdram_size >> 20);
+
+ /* Sanity check ensure correct SDRAM size specified */
+ if (get_ram_size(0, sdram_size) != sdram_size) {
+ puts("SDRAM size check failed!\n");
+ hang();
+ }
}
diff --git a/arch/arm/cpu/armv7/socfpga/system_manager.c b/arch/arm/cpu/armv7/socfpga/system_manager.c
index 11f7badbf2..8126e0d43c 100644
--- a/arch/arm/cpu/armv7/socfpga/system_manager.c
+++ b/arch/arm/cpu/armv7/socfpga/system_manager.c
@@ -66,3 +66,12 @@ void sysmgr_pinmux_init(void)
populate_sysmgr_fpgaintf_module();
}
+
+/*
+ * This bit allows the bootrom to configure the IOs after a warm reset.
+ */
+void sysmgr_enable_warmrstcfgio(void)
+{
+ setbits_le32(&sysmgr_regs->romcodegrp_ctrl,
+ SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO);
+}
diff --git a/arch/arm/cpu/armv7/sunxi/board.c b/arch/arm/cpu/armv7/sunxi/board.c
index c02c015096..c1b4cf5c2f 100644
--- a/arch/arm/cpu/armv7/sunxi/board.c
+++ b/arch/arm/cpu/armv7/sunxi/board.c
@@ -46,28 +46,33 @@ static int gpio_init(void)
sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUNXI_GPIO_INPUT);
sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUNXI_GPIO_INPUT);
#endif
- sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUNXI_GPF2_UART0_TX);
- sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUNXI_GPF4_UART0_RX);
+#if defined(CONFIG_MACH_SUN8I)
+ sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUN8I_GPF_UART0_TX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUN8I_GPF_UART0_RX);
+#else
+ sunxi_gpio_set_cfgpin(SUNXI_GPF(2), SUNXI_GPF_UART0_TX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPF(4), SUNXI_GPF_UART0_RX);
+#endif
sunxi_gpio_set_pull(SUNXI_GPF(4), 1);
#elif CONFIG_CONS_INDEX == 1 && (defined(CONFIG_MACH_SUN4I) || defined(CONFIG_MACH_SUN7I))
- sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB22_UART0_TX);
- sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB23_UART0_RX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPB(22), SUN4I_GPB_UART0);
+ sunxi_gpio_set_cfgpin(SUNXI_GPB(23), SUN4I_GPB_UART0);
sunxi_gpio_set_pull(SUNXI_GPB(23), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN5I)
- sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN5I_GPB19_UART0_TX);
- sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN5I_GPB20_UART0_RX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPB(19), SUN5I_GPB_UART0);
+ sunxi_gpio_set_cfgpin(SUNXI_GPB(20), SUN5I_GPB_UART0);
sunxi_gpio_set_pull(SUNXI_GPB(20), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 1 && defined(CONFIG_MACH_SUN6I)
- sunxi_gpio_set_cfgpin(SUNXI_GPH(20), SUN6I_GPH20_UART0_TX);
- sunxi_gpio_set_cfgpin(SUNXI_GPH(21), SUN6I_GPH21_UART0_RX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPH(20), SUN6I_GPH_UART0);
+ sunxi_gpio_set_cfgpin(SUNXI_GPH(21), SUN6I_GPH_UART0);
sunxi_gpio_set_pull(SUNXI_GPH(21), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 2 && defined(CONFIG_MACH_SUN5I)
- sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG3_UART1_TX);
- sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG4_UART1_RX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPG(3), SUN5I_GPG_UART1);
+ sunxi_gpio_set_cfgpin(SUNXI_GPG(4), SUN5I_GPG_UART1);
sunxi_gpio_set_pull(SUNXI_GPG(4), SUNXI_GPIO_PULL_UP);
#elif CONFIG_CONS_INDEX == 5 && defined(CONFIG_MACH_SUN8I)
- sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL2_R_UART_TX);
- sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL3_R_UART_RX);
+ sunxi_gpio_set_cfgpin(SUNXI_GPL(2), SUN8I_GPL_R_UART);
+ sunxi_gpio_set_cfgpin(SUNXI_GPL(3), SUN8I_GPL_R_UART);
sunxi_gpio_set_pull(SUNXI_GPL(3), SUNXI_GPIO_PULL_UP);
#else
#error Unsupported console port number. Please fix pin mux settings in board.c
diff --git a/arch/arm/cpu/armv7/sunxi/rsb.c b/arch/arm/cpu/armv7/sunxi/rsb.c
index b00befb301..f115a9cac4 100644
--- a/arch/arm/cpu/armv7/sunxi/rsb.c
+++ b/arch/arm/cpu/armv7/sunxi/rsb.c
@@ -21,15 +21,15 @@ static int rsb_set_device_mode(void);
static void rsb_cfg_io(void)
{
#ifdef CONFIG_MACH_SUN8I
- sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_GPL0_R_RSB_SCK);
- sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_GPL1_R_RSB_SDA);
+ sunxi_gpio_set_cfgpin(SUNXI_GPL(0), SUN8I_GPL_R_RSB);
+ sunxi_gpio_set_cfgpin(SUNXI_GPL(1), SUN8I_GPL_R_RSB);
sunxi_gpio_set_pull(SUNXI_GPL(0), 1);
sunxi_gpio_set_pull(SUNXI_GPL(1), 1);
sunxi_gpio_set_drv(SUNXI_GPL(0), 2);
sunxi_gpio_set_drv(SUNXI_GPL(1), 2);
#elif defined CONFIG_MACH_SUN9I
- sunxi_gpio_set_cfgpin(SUNXI_GPN(0), SUN9I_GPN0_R_RSB_SCK);
- sunxi_gpio_set_cfgpin(SUNXI_GPN(1), SUN9I_GPN1_R_RSB_SDA);
+ sunxi_gpio_set_cfgpin(SUNXI_GPN(0), SUN9I_GPN_R_RSB);
+ sunxi_gpio_set_cfgpin(SUNXI_GPN(1), SUN9I_GPN_R_RSB);
sunxi_gpio_set_pull(SUNXI_GPN(0), 1);
sunxi_gpio_set_pull(SUNXI_GPN(1), 1);
sunxi_gpio_set_drv(SUNXI_GPN(0), 2);
diff --git a/arch/arm/cpu/armv7/sunxi/usbc.c b/arch/arm/cpu/armv7/sunxi/usbc.c
index 524f25ce83..a0e9604cfa 100644
--- a/arch/arm/cpu/armv7/sunxi/usbc.c
+++ b/arch/arm/cpu/armv7/sunxi/usbc.c
@@ -41,6 +41,7 @@ static struct sunxi_usbc_hcd {
int usb_rst_mask;
int ahb_clk_mask;
int gpio_vbus;
+ int gpio_vbus_det;
int irq;
int id;
} sunxi_usbc_hcd[] = {
@@ -80,12 +81,6 @@ static struct sunxi_usbc_hcd {
static int enabled_hcd_count;
-static bool use_axp_drivebus(int index)
-{
- return index == 0 &&
- strcmp(CONFIG_USB0_VBUS_PIN, "axp_drivebus") == 0;
-}
-
void *sunxi_usbc_get_io_base(int index)
{
switch (index) {
@@ -102,9 +97,6 @@ void *sunxi_usbc_get_io_base(int index)
static int get_vbus_gpio(int index)
{
- if (use_axp_drivebus(index))
- return -1;
-
switch (index) {
case 0: return sunxi_name_to_gpio(CONFIG_USB0_VBUS_PIN);
case 1: return sunxi_name_to_gpio(CONFIG_USB1_VBUS_PIN);
@@ -113,6 +105,14 @@ static int get_vbus_gpio(int index)
return -1;
}
+static int get_vbus_detect_gpio(int index)
+{
+ switch (index) {
+ case 0: return sunxi_name_to_gpio(CONFIG_USB0_VBUS_DET);
+ }
+ return -1;
+}
+
static void usb_phy_write(struct sunxi_usbc_hcd *sunxi_usbc, int addr,
int data, int len)
{
@@ -192,22 +192,35 @@ void sunxi_usbc_enable_squelch_detect(int index, int enable)
int sunxi_usbc_request_resources(int index)
{
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
+ int ret = 0;
sunxi_usbc->gpio_vbus = get_vbus_gpio(index);
- if (sunxi_usbc->gpio_vbus != -1)
- return gpio_request(sunxi_usbc->gpio_vbus, "usbc_vbus");
+ if (sunxi_usbc->gpio_vbus != -1) {
+ ret |= gpio_request(sunxi_usbc->gpio_vbus, "usbc_vbus");
+ ret |= gpio_direction_output(sunxi_usbc->gpio_vbus, 0);
+ }
+
+ sunxi_usbc->gpio_vbus_det = get_vbus_detect_gpio(index);
+ if (sunxi_usbc->gpio_vbus_det != -1) {
+ ret |= gpio_request(sunxi_usbc->gpio_vbus_det, "usbc_vbus_det");
+ ret |= gpio_direction_input(sunxi_usbc->gpio_vbus_det);
+ }
- return 0;
+ return ret;
}
int sunxi_usbc_free_resources(int index)
{
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
+ int ret = 0;
if (sunxi_usbc->gpio_vbus != -1)
- return gpio_free(sunxi_usbc->gpio_vbus);
+ ret |= gpio_free(sunxi_usbc->gpio_vbus);
- return 0;
+ if (sunxi_usbc->gpio_vbus_det != -1)
+ ret |= gpio_free(sunxi_usbc->gpio_vbus_det);
+
+ return ret;
}
void sunxi_usbc_enable(int index)
@@ -258,22 +271,38 @@ void sunxi_usbc_vbus_enable(int index)
{
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
-#ifdef AXP_DRIVEBUS
- if (use_axp_drivebus(index))
- axp_drivebus_enable();
-#endif
if (sunxi_usbc->gpio_vbus != -1)
- gpio_direction_output(sunxi_usbc->gpio_vbus, 1);
+ gpio_set_value(sunxi_usbc->gpio_vbus, 1);
}
void sunxi_usbc_vbus_disable(int index)
{
struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
-#ifdef AXP_DRIVEBUS
- if (use_axp_drivebus(index))
- axp_drivebus_disable();
-#endif
if (sunxi_usbc->gpio_vbus != -1)
- gpio_direction_output(sunxi_usbc->gpio_vbus, 0);
+ gpio_set_value(sunxi_usbc->gpio_vbus, 0);
+}
+
+int sunxi_usbc_vbus_detect(int index)
+{
+ struct sunxi_usbc_hcd *sunxi_usbc = &sunxi_usbc_hcd[index];
+ int err, retries = 3;
+
+ if (sunxi_usbc->gpio_vbus_det == -1) {
+ eprintf("Error: invalid vbus detection pin\n");
+ return -1;
+ }
+
+ err = gpio_get_value(sunxi_usbc->gpio_vbus_det);
+ /*
+ * Vbus may have been provided by the board and just been turned of
+ * some milliseconds ago on reset, what we're measuring then is a
+ * residual charge on Vbus, sleep a bit and try again.
+ */
+ while (err > 0 && retries--) {
+ mdelay(100);
+ err = gpio_get_value(sunxi_usbc->gpio_vbus_det);
+ }
+
+ return err;
}
diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 92aaad9415..1bb9b8ed1d 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -18,6 +18,8 @@
DECLARE_GLOBAL_DATA_PTR;
#endif
+static char soc_type[] = "xx0";
+
#ifdef CONFIG_MXC_OCOTP
void enable_ocotp_clk(unsigned char enable)
{
@@ -284,14 +286,37 @@ static char *get_reset_cause(void)
int print_cpuinfo(void)
{
- printf("CPU: Freescale Vybrid VF610 at %d MHz\n",
- mxc_get_clock(MXC_ARM_CLK) / 1000000);
+ printf("CPU: Freescale Vybrid VF%s at %d MHz\n",
+ soc_type, mxc_get_clock(MXC_ARM_CLK) / 1000000);
printf("Reset cause: %s\n", get_reset_cause());
return 0;
}
#endif
+int arch_cpu_init(void)
+{
+ struct mscm *mscm = (struct mscm *)MSCM_BASE_ADDR;
+
+ soc_type[0] = mscm->cpxcount ? '6' : '5'; /*Dual Core => VF6x0 */
+ soc_type[1] = mscm->cpxcfg1 ? '1' : '0'; /* L2 Cache => VFx10 */
+
+ return 0;
+}
+
+#ifdef CONFIG_ARCH_MISC_INIT
+int arch_misc_init(void)
+{
+ char soc[6];
+
+ strcat(soc, "vf");
+ strcat(soc, soc_type);
+ setenv("soc", soc);
+
+ return 0;
+}
+#endif
+
int cpu_eth_init(bd_t *bis)
{
int rc = -ENODEV;
@@ -317,3 +342,19 @@ int get_clocks(void)
#endif
return 0;
}
+
+#ifndef CONFIG_SYS_DCACHE_OFF
+void enable_caches(void)
+{
+#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
+ enum dcache_option option = DCACHE_WRITETHROUGH;
+#else
+ enum dcache_option option = DCACHE_WRITEBACK;
+#endif
+ dcache_enable();
+ icache_enable();
+
+ /* Enable caching on OCRAM */
+ mmu_set_region_dcache_behaviour(IRAM_BASE_ADDR, IRAM_SIZE, option);
+}
+#endif
diff --git a/arch/arm/cpu/armv7/zynq/Kconfig b/arch/arm/cpu/armv7/zynq/Kconfig
deleted file mode 100644
index 3a52535ce0..0000000000
--- a/arch/arm/cpu/armv7/zynq/Kconfig
+++ /dev/null
@@ -1,39 +0,0 @@
-if ZYNQ
-
-choice
- prompt "Xilinx Zynq board select"
-
-config TARGET_ZYNQ_ZED
- bool "Zynq ZedBoard"
-
-config TARGET_ZYNQ_MICROZED
- bool "Zynq MicroZed"
-
-config TARGET_ZYNQ_ZC70X
- bool "Zynq ZC702/ZC706 Board"
-
-config TARGET_ZYNQ_ZC770
- bool "Zynq ZC770 Board"
-
-config TARGET_ZYNQ_ZYBO
- bool "Zynq Zybo Board"
-
-endchoice
-
-config SYS_BOARD
- default "zynq"
-
-config SYS_VENDOR
- default "xilinx"
-
-config SYS_SOC
- default "zynq"
-
-config SYS_CONFIG_NAME
- default "zynq_zed" if TARGET_ZYNQ_ZED
- default "zynq_microzed" if TARGET_ZYNQ_MICROZED
- default "zynq_zc70x" if TARGET_ZYNQ_ZC70X
- default "zynq_zc770" if TARGET_ZYNQ_ZC770
- default "zynq_zybo" if TARGET_ZYNQ_ZYBO
-
-endif
diff --git a/arch/arm/cpu/armv7/zynq/Makefile b/arch/arm/cpu/armv7/zynq/Makefile
deleted file mode 100644
index 901f2ce4cb..0000000000
--- a/arch/arm/cpu/armv7/zynq/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# (C) Copyright 2000-2003
-# Wolfgang Denk, DENX Software Engineering, wd@denx.de.
-#
-# (C) Copyright 2008
-# Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
-#
-# SPDX-License-Identifier: GPL-2.0+
-#
-
-obj-y := timer.o
-obj-y += cpu.o
-obj-y += ddrc.o
-obj-y += slcr.o
-obj-y += clk.o
-obj-y += lowlevel_init.o
-obj-$(CONFIG_SPL_BUILD) += spl.o
diff --git a/arch/arm/cpu/armv7/zynq/clk.c b/arch/arm/cpu/armv7/zynq/clk.c
deleted file mode 100644
index d2885dc2b9..0000000000
--- a/arch/arm/cpu/armv7/zynq/clk.c
+++ /dev/null
@@ -1,664 +0,0 @@
-/*
- * Copyright (C) 2013 Soren Brinkmann <soren.brinkmann@xilinx.com>
- * Copyright (C) 2013 Xilinx, Inc. All rights reserved.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-#include <common.h>
-#include <errno.h>
-#include <clk.h>
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/clk.h>
-
-/* Board oscillator frequency */
-#ifndef CONFIG_ZYNQ_PS_CLK_FREQ
-# define CONFIG_ZYNQ_PS_CLK_FREQ 33333333UL
-#endif
-
-/* Register bitfield defines */
-#define PLLCTRL_FBDIV_MASK 0x7f000
-#define PLLCTRL_FBDIV_SHIFT 12
-#define PLLCTRL_BPFORCE_MASK (1 << 4)
-#define PLLCTRL_PWRDWN_MASK 2
-#define PLLCTRL_PWRDWN_SHIFT 1
-#define PLLCTRL_RESET_MASK 1
-#define PLLCTRL_RESET_SHIFT 0
-
-#define ZYNQ_CLK_MAXDIV 0x3f
-#define CLK_CTRL_DIV1_SHIFT 20
-#define CLK_CTRL_DIV1_MASK (ZYNQ_CLK_MAXDIV << CLK_CTRL_DIV1_SHIFT)
-#define CLK_CTRL_DIV0_SHIFT 8
-#define CLK_CTRL_DIV0_MASK (ZYNQ_CLK_MAXDIV << CLK_CTRL_DIV0_SHIFT)
-#define CLK_CTRL_SRCSEL_SHIFT 4
-#define CLK_CTRL_SRCSEL_MASK (0x3 << CLK_CTRL_SRCSEL_SHIFT)
-
-#define CLK_CTRL_DIV2X_SHIFT 26
-#define CLK_CTRL_DIV2X_MASK (ZYNQ_CLK_MAXDIV << CLK_CTRL_DIV2X_SHIFT)
-#define CLK_CTRL_DIV3X_SHIFT 20
-#define CLK_CTRL_DIV3X_MASK (ZYNQ_CLK_MAXDIV << CLK_CTRL_DIV3X_SHIFT)
-
-#define ZYNQ_CLKMUX_SEL_0 0
-#define ZYNQ_CLKMUX_SEL_1 1
-#define ZYNQ_CLKMUX_SEL_2 2
-#define ZYNQ_CLKMUX_SEL_3 3
-
-DECLARE_GLOBAL_DATA_PTR;
-
-struct clk;
-
-/**
- * struct clk_ops:
- * @set_rate: Function pointer to set_rate() implementation
- * @get_rate: Function pointer to get_rate() implementation
- */
-struct clk_ops {
- int (*set_rate)(struct clk *clk, unsigned long rate);
- unsigned long (*get_rate)(struct clk *clk);
-};
-
-/**
- * struct clk:
- * @name: Clock name
- * @frequency: Currenct frequency
- * @parent: Parent clock
- * @flags: Clock flags
- * @reg: Clock control register
- * @ops: Clock operations
- */
-struct clk {
- char *name;
- unsigned long frequency;
- enum zynq_clk parent;
- unsigned int flags;
- u32 *reg;
- struct clk_ops ops;
-};
-#define ZYNQ_CLK_FLAGS_HAS_2_DIVS 1
-
-static struct clk clks[clk_max];
-
-/**
- * __zynq_clk_cpu_get_parent() - Decode clock multiplexer
- * @srcsel: Mux select value
- * Returns the clock identifier associated with the selected mux input.
- */
-static int __zynq_clk_cpu_get_parent(unsigned int srcsel)
-{
- unsigned int ret;
-
- switch (srcsel) {
- case ZYNQ_CLKMUX_SEL_0:
- case ZYNQ_CLKMUX_SEL_1:
- ret = armpll_clk;
- break;
- case ZYNQ_CLKMUX_SEL_2:
- ret = ddrpll_clk;
- break;
- case ZYNQ_CLKMUX_SEL_3:
- ret = iopll_clk;
- break;
- default:
- ret = armpll_clk;
- break;
- }
-
- return ret;
-}
-
-/**
- * ddr2x_get_rate() - Get clock rate of DDR2x clock
- * @clk: Clock handle
- * Returns the current clock rate of @clk.
- */
-static unsigned long ddr2x_get_rate(struct clk *clk)
-{
- u32 clk_ctrl = readl(clk->reg);
- u32 div = (clk_ctrl & CLK_CTRL_DIV2X_MASK) >> CLK_CTRL_DIV2X_SHIFT;
-
- return DIV_ROUND_CLOSEST(zynq_clk_get_rate(clk->parent), div);
-}
-
-/**
- * ddr3x_get_rate() - Get clock rate of DDR3x clock
- * @clk: Clock handle
- * Returns the current clock rate of @clk.
- */
-static unsigned long ddr3x_get_rate(struct clk *clk)
-{
- u32 clk_ctrl = readl(clk->reg);
- u32 div = (clk_ctrl & CLK_CTRL_DIV3X_MASK) >> CLK_CTRL_DIV3X_SHIFT;
-
- return DIV_ROUND_CLOSEST(zynq_clk_get_rate(clk->parent), div);
-}
-
-static void init_ddr_clocks(void)
-{
- u32 div0, div1;
- unsigned long prate = zynq_clk_get_rate(ddrpll_clk);
- u32 clk_ctrl = readl(&slcr_base->ddr_clk_ctrl);
-
- /* DDR2x */
- clks[ddr2x_clk].reg = &slcr_base->ddr_clk_ctrl;
- clks[ddr2x_clk].parent = ddrpll_clk;
- clks[ddr2x_clk].name = "ddr_2x";
- clks[ddr2x_clk].frequency = ddr2x_get_rate(&clks[ddr2x_clk]);
- clks[ddr2x_clk].ops.get_rate = ddr2x_get_rate;
-
- /* DDR3x */
- clks[ddr3x_clk].reg = &slcr_base->ddr_clk_ctrl;
- clks[ddr3x_clk].parent = ddrpll_clk;
- clks[ddr3x_clk].name = "ddr_3x";
- clks[ddr3x_clk].frequency = ddr3x_get_rate(&clks[ddr3x_clk]);
- clks[ddr3x_clk].ops.get_rate = ddr3x_get_rate;
-
- /* DCI */
- clk_ctrl = readl(&slcr_base->dci_clk_ctrl);
- div0 = (clk_ctrl & CLK_CTRL_DIV0_MASK) >> CLK_CTRL_DIV0_SHIFT;
- div1 = (clk_ctrl & CLK_CTRL_DIV1_MASK) >> CLK_CTRL_DIV1_SHIFT;
- clks[dci_clk].reg = &slcr_base->dci_clk_ctrl;
- clks[dci_clk].parent = ddrpll_clk;
- clks[dci_clk].frequency = DIV_ROUND_CLOSEST(
- DIV_ROUND_CLOSEST(prate, div0), div1);
- clks[dci_clk].name = "dci";
-
- gd->bd->bi_ddr_freq = clks[ddr3x_clk].frequency / 1000000;
-}
-
-static void init_cpu_clocks(void)
-{
- int clk_621;
- u32 reg, div, srcsel;
- enum zynq_clk parent;
-
- reg = readl(&slcr_base->arm_clk_ctrl);
- clk_621 = readl(&slcr_base->clk_621_true) & 1;
- div = (reg & CLK_CTRL_DIV0_MASK) >> CLK_CTRL_DIV0_SHIFT;
- srcsel = (reg & CLK_CTRL_SRCSEL_MASK) >> CLK_CTRL_SRCSEL_SHIFT;
- parent = __zynq_clk_cpu_get_parent(srcsel);
-
- /* cpu clocks */
- clks[cpu_6or4x_clk].reg = &slcr_base->arm_clk_ctrl;
- clks[cpu_6or4x_clk].parent = parent;
- clks[cpu_6or4x_clk].frequency = DIV_ROUND_CLOSEST(
- zynq_clk_get_rate(parent), div);
- clks[cpu_6or4x_clk].name = "cpu_6or4x";
-
- clks[cpu_3or2x_clk].reg = &slcr_base->arm_clk_ctrl;
- clks[cpu_3or2x_clk].parent = cpu_6or4x_clk;
- clks[cpu_3or2x_clk].frequency = zynq_clk_get_rate(cpu_6or4x_clk) / 2;
- clks[cpu_3or2x_clk].name = "cpu_3or2x";
-
- clks[cpu_2x_clk].reg = &slcr_base->arm_clk_ctrl;
- clks[cpu_2x_clk].parent = cpu_6or4x_clk;
- clks[cpu_2x_clk].frequency = zynq_clk_get_rate(cpu_6or4x_clk) /
- (2 + clk_621);
- clks[cpu_2x_clk].name = "cpu_2x";
-
- clks[cpu_1x_clk].reg = &slcr_base->arm_clk_ctrl;
- clks[cpu_1x_clk].parent = cpu_6or4x_clk;
- clks[cpu_1x_clk].frequency = zynq_clk_get_rate(cpu_6or4x_clk) /
- (4 + 2 * clk_621);
- clks[cpu_1x_clk].name = "cpu_1x";
-}
-
-/**
- * periph_calc_two_divs() - Calculate clock dividers
- * @cur_rate: Current clock rate
- * @tgt_rate: Target clock rate
- * @prate: Parent clock rate
- * @div0: First divider (output)
- * @div1: Second divider (output)
- * Returns the actual clock rate possible.
- *
- * Calculates clock dividers for clocks with two 6-bit dividers.
- */
-static unsigned long periph_calc_two_divs(unsigned long cur_rate,
- unsigned long tgt_rate, unsigned long prate, u32 *div0,
- u32 *div1)
-{
- long err, best_err = (long)(~0UL >> 1);
- unsigned long rate, best_rate = 0;
- u32 d0, d1;
-
- for (d0 = 1; d0 <= ZYNQ_CLK_MAXDIV; d0++) {
- for (d1 = 1; d1 <= ZYNQ_CLK_MAXDIV >> 1; d1++) {
- rate = DIV_ROUND_CLOSEST(DIV_ROUND_CLOSEST(prate, d0),
- d1);
- err = abs(rate - tgt_rate);
-
- if (err < best_err) {
- *div0 = d0;
- *div1 = d1;
- best_err = err;
- best_rate = rate;
- }
- }
- }
-
- return best_rate;
-}
-
-/**
- * zynq_clk_periph_set_rate() - Set clock rate
- * @clk: Handle of the peripheral clock
- * @rate: New clock rate
- * Sets the clock frequency of @clk to @rate. Returns zero on success.
- */
-static int zynq_clk_periph_set_rate(struct clk *clk,
- unsigned long rate)
-{
- u32 ctrl, div0 = 0, div1 = 0;
- unsigned long prate, new_rate, cur_rate = clk->frequency;
-
- ctrl = readl(clk->reg);
- prate = zynq_clk_get_rate(clk->parent);
- ctrl &= ~CLK_CTRL_DIV0_MASK;
-
- if (clk->flags & ZYNQ_CLK_FLAGS_HAS_2_DIVS) {
- ctrl &= ~CLK_CTRL_DIV1_MASK;
- new_rate = periph_calc_two_divs(cur_rate, rate, prate, &div0,
- &div1);
- ctrl |= div1 << CLK_CTRL_DIV1_SHIFT;
- } else {
- div0 = DIV_ROUND_CLOSEST(prate, rate);
- div0 &= ZYNQ_CLK_MAXDIV;
- new_rate = DIV_ROUND_CLOSEST(rate, div0);
- }
-
- /* write new divs to hardware */
- ctrl |= div0 << CLK_CTRL_DIV0_SHIFT;
- writel(ctrl, clk->reg);
-
- /* update frequency in clk framework */
- clk->frequency = new_rate;
-
- return 0;
-}
-
-/**
- * zynq_clk_periph_get_rate() - Get clock rate
- * @clk: Handle of the peripheral clock
- * Returns the current clock rate of @clk.
- */
-static unsigned long zynq_clk_periph_get_rate(struct clk *clk)
-{
- u32 clk_ctrl = readl(clk->reg);
- u32 div0 = (clk_ctrl & CLK_CTRL_DIV0_MASK) >> CLK_CTRL_DIV0_SHIFT;
- u32 div1 = 1;
-
- if (clk->flags & ZYNQ_CLK_FLAGS_HAS_2_DIVS)
- div1 = (clk_ctrl & CLK_CTRL_DIV1_MASK) >> CLK_CTRL_DIV1_SHIFT;
-
- /* a register value of zero == division by 1 */
- if (!div0)
- div0 = 1;
- if (!div1)
- div1 = 1;
-
- return
- DIV_ROUND_CLOSEST(
- DIV_ROUND_CLOSEST(zynq_clk_get_rate(clk->parent), div0),
- div1);
-}
-
-/**
- * __zynq_clk_periph_get_parent() - Decode clock multiplexer
- * @srcsel: Mux select value
- * Returns the clock identifier associated with the selected mux input.
- */
-static enum zynq_clk __zynq_clk_periph_get_parent(u32 srcsel)
-{
- switch (srcsel) {
- case ZYNQ_CLKMUX_SEL_0:
- case ZYNQ_CLKMUX_SEL_1:
- return iopll_clk;
- case ZYNQ_CLKMUX_SEL_2:
- return armpll_clk;
- case ZYNQ_CLKMUX_SEL_3:
- return ddrpll_clk;
- default:
- return 0;
- }
-}
-
-/**
- * zynq_clk_periph_get_parent() - Decode clock multiplexer
- * @clk: Clock handle
- * Returns the clock identifier associated with the selected mux input.
- */
-static enum zynq_clk zynq_clk_periph_get_parent(struct clk *clk)
-{
- u32 clk_ctrl = readl(clk->reg);
- u32 srcsel = (clk_ctrl & CLK_CTRL_SRCSEL_MASK) >> CLK_CTRL_SRCSEL_SHIFT;
-
- return __zynq_clk_periph_get_parent(srcsel);
-}
-
-/**
- * zynq_clk_register_periph_clk() - Set up a peripheral clock with the framework
- * @clk: Pointer to struct clk for the clock
- * @ctrl: Clock control register
- * @name: PLL name
- * @two_divs: Indicates whether the clock features one or two dividers
- */
-static int zynq_clk_register_periph_clk(struct clk *clk, u32 *ctrl, char *name,
- bool two_divs)
-{
- clk->name = name;
- clk->reg = ctrl;
- if (two_divs)
- clk->flags = ZYNQ_CLK_FLAGS_HAS_2_DIVS;
- clk->parent = zynq_clk_periph_get_parent(clk);
- clk->frequency = zynq_clk_periph_get_rate(clk);
- clk->ops.get_rate = zynq_clk_periph_get_rate;
- clk->ops.set_rate = zynq_clk_periph_set_rate;
-
- return 0;
-}
-
-static void init_periph_clocks(void)
-{
- zynq_clk_register_periph_clk(&clks[gem0_clk], &slcr_base->gem0_clk_ctrl,
- "gem0", 1);
- zynq_clk_register_periph_clk(&clks[gem1_clk], &slcr_base->gem1_clk_ctrl,
- "gem1", 1);
-
- zynq_clk_register_periph_clk(&clks[smc_clk], &slcr_base->smc_clk_ctrl,
- "smc", 0);
-
- zynq_clk_register_periph_clk(&clks[lqspi_clk],
- &slcr_base->lqspi_clk_ctrl, "lqspi", 0);
-
- zynq_clk_register_periph_clk(&clks[sdio0_clk],
- &slcr_base->sdio_clk_ctrl, "sdio0", 0);
- zynq_clk_register_periph_clk(&clks[sdio1_clk],
- &slcr_base->sdio_clk_ctrl, "sdio1", 0);
-
- zynq_clk_register_periph_clk(&clks[spi0_clk], &slcr_base->spi_clk_ctrl,
- "spi0", 0);
- zynq_clk_register_periph_clk(&clks[spi1_clk], &slcr_base->spi_clk_ctrl,
- "spi1", 0);
-
- zynq_clk_register_periph_clk(&clks[uart0_clk],
- &slcr_base->uart_clk_ctrl, "uart0", 0);
- zynq_clk_register_periph_clk(&clks[uart1_clk],
- &slcr_base->uart_clk_ctrl, "uart1", 0);
-
- zynq_clk_register_periph_clk(&clks[dbg_trc_clk],
- &slcr_base->dbg_clk_ctrl, "dbg_trc", 0);
- zynq_clk_register_periph_clk(&clks[dbg_apb_clk],
- &slcr_base->dbg_clk_ctrl, "dbg_apb", 0);
-
- zynq_clk_register_periph_clk(&clks[pcap_clk],
- &slcr_base->pcap_clk_ctrl, "pcap", 0);
-
- zynq_clk_register_periph_clk(&clks[fclk0_clk],
- &slcr_base->fpga0_clk_ctrl, "fclk0", 1);
- zynq_clk_register_periph_clk(&clks[fclk1_clk],
- &slcr_base->fpga1_clk_ctrl, "fclk1", 1);
- zynq_clk_register_periph_clk(&clks[fclk2_clk],
- &slcr_base->fpga2_clk_ctrl, "fclk2", 1);
- zynq_clk_register_periph_clk(&clks[fclk3_clk],
- &slcr_base->fpga3_clk_ctrl, "fclk3", 1);
-}
-
-/**
- * zynq_clk_register_aper_clk() - Set up a APER clock with the framework
- * @clk: Pointer to struct clk for the clock
- * @ctrl: Clock control register
- * @name: PLL name
- */
-static void zynq_clk_register_aper_clk(struct clk *clk, u32 *ctrl, char *name)
-{
- clk->name = name;
- clk->reg = ctrl;
- clk->parent = cpu_1x_clk;
- clk->frequency = zynq_clk_get_rate(clk->parent);
-}
-
-static void init_aper_clocks(void)
-{
- zynq_clk_register_aper_clk(&clks[usb0_aper_clk],
- &slcr_base->aper_clk_ctrl, "usb0_aper");
- zynq_clk_register_aper_clk(&clks[usb1_aper_clk],
- &slcr_base->aper_clk_ctrl, "usb1_aper");
-
- zynq_clk_register_aper_clk(&clks[gem0_aper_clk],
- &slcr_base->aper_clk_ctrl, "gem0_aper");
- zynq_clk_register_aper_clk(&clks[gem1_aper_clk],
- &slcr_base->aper_clk_ctrl, "gem1_aper");
-
- zynq_clk_register_aper_clk(&clks[sdio0_aper_clk],
- &slcr_base->aper_clk_ctrl, "sdio0_aper");
- zynq_clk_register_aper_clk(&clks[sdio1_aper_clk],
- &slcr_base->aper_clk_ctrl, "sdio1_aper");
-
- zynq_clk_register_aper_clk(&clks[spi0_aper_clk],
- &slcr_base->aper_clk_ctrl, "spi0_aper");
- zynq_clk_register_aper_clk(&clks[spi1_aper_clk],
- &slcr_base->aper_clk_ctrl, "spi1_aper");
-
- zynq_clk_register_aper_clk(&clks[can0_aper_clk],
- &slcr_base->aper_clk_ctrl, "can0_aper");
- zynq_clk_register_aper_clk(&clks[can1_aper_clk],
- &slcr_base->aper_clk_ctrl, "can1_aper");
-
- zynq_clk_register_aper_clk(&clks[i2c0_aper_clk],
- &slcr_base->aper_clk_ctrl, "i2c0_aper");
- zynq_clk_register_aper_clk(&clks[i2c1_aper_clk],
- &slcr_base->aper_clk_ctrl, "i2c1_aper");
-
- zynq_clk_register_aper_clk(&clks[uart0_aper_clk],
- &slcr_base->aper_clk_ctrl, "uart0_aper");
- zynq_clk_register_aper_clk(&clks[uart1_aper_clk],
- &slcr_base->aper_clk_ctrl, "uart1_aper");
-
- zynq_clk_register_aper_clk(&clks[gpio_aper_clk],
- &slcr_base->aper_clk_ctrl, "gpio_aper");
-
- zynq_clk_register_aper_clk(&clks[lqspi_aper_clk],
- &slcr_base->aper_clk_ctrl, "lqspi_aper");
-
- zynq_clk_register_aper_clk(&clks[smc_aper_clk],
- &slcr_base->aper_clk_ctrl, "smc_aper");
-}
-
-/**
- * __zynq_clk_pll_get_rate() - Get PLL rate
- * @addr: Address of the PLL's control register
- * Returns the current PLL output rate.
- */
-static unsigned long __zynq_clk_pll_get_rate(u32 *addr)
-{
- u32 reg, mul, bypass;
-
- reg = readl(addr);
- bypass = reg & PLLCTRL_BPFORCE_MASK;
- if (bypass)
- mul = 1;
- else
- mul = (reg & PLLCTRL_FBDIV_MASK) >> PLLCTRL_FBDIV_SHIFT;
-
- return CONFIG_ZYNQ_PS_CLK_FREQ * mul;
-}
-
-/**
- * zynq_clk_pll_get_rate() - Get PLL rate
- * @pll: Handle of the PLL
- * Returns the current clock rate of @pll.
- */
-static unsigned long zynq_clk_pll_get_rate(struct clk *pll)
-{
- return __zynq_clk_pll_get_rate(pll->reg);
-}
-
-/**
- * zynq_clk_register_pll() - Set up a PLL with the framework
- * @clk: Pointer to struct clk for the PLL
- * @ctrl: PLL control register
- * @name: PLL name
- * @prate: PLL input clock rate
- */
-static void zynq_clk_register_pll(struct clk *clk, u32 *ctrl, char *name,
- unsigned long prate)
-{
- clk->name = name;
- clk->reg = ctrl;
- clk->frequency = zynq_clk_pll_get_rate(clk);
- clk->ops.get_rate = zynq_clk_pll_get_rate;
-}
-
-/**
- * clkid_2_register() - Get clock control register
- * @id: Clock identifier of one of the PLLs
- * Returns the address of the requested PLL's control register.
- */
-static u32 *clkid_2_register(enum zynq_clk id)
-{
- switch (id) {
- case armpll_clk:
- return &slcr_base->arm_pll_ctrl;
- case ddrpll_clk:
- return &slcr_base->ddr_pll_ctrl;
- case iopll_clk:
- return &slcr_base->io_pll_ctrl;
- default:
- return &slcr_base->io_pll_ctrl;
- }
-}
-
-/* API */
-/**
- * zynq_clk_early_init() - Early init for the clock framework
- *
- * This function is called from before relocation and sets up the CPU clock
- * frequency in the global data struct.
- */
-void zynq_clk_early_init(void)
-{
- u32 reg = readl(&slcr_base->arm_clk_ctrl);
- u32 div = (reg & CLK_CTRL_DIV0_MASK) >> CLK_CTRL_DIV0_SHIFT;
- u32 srcsel = (reg & CLK_CTRL_SRCSEL_MASK) >> CLK_CTRL_SRCSEL_SHIFT;
- enum zynq_clk parent = __zynq_clk_cpu_get_parent(srcsel);
- u32 *pllreg = clkid_2_register(parent);
- unsigned long prate = __zynq_clk_pll_get_rate(pllreg);
-
- if (!div)
- div = 1;
-
- gd->cpu_clk = DIV_ROUND_CLOSEST(prate, div);
-}
-
-/**
- * get_uart_clk() - Get UART input frequency
- * @dev_index: UART ID
- * Returns UART input clock frequency in Hz.
- *
- * Compared to zynq_clk_get_rate() this function is designed to work before
- * relocation and can be called when the serial UART is set up.
- */
-unsigned long get_uart_clk(int dev_index)
-{
- u32 reg = readl(&slcr_base->uart_clk_ctrl);
- u32 div = (reg & CLK_CTRL_DIV0_MASK) >> CLK_CTRL_DIV0_SHIFT;
- u32 srcsel = (reg & CLK_CTRL_SRCSEL_MASK) >> CLK_CTRL_SRCSEL_SHIFT;
- enum zynq_clk parent = __zynq_clk_periph_get_parent(srcsel);
- u32 *pllreg = clkid_2_register(parent);
- unsigned long prate = __zynq_clk_pll_get_rate(pllreg);
-
- if (!div)
- div = 1;
-
- return DIV_ROUND_CLOSEST(prate, div);
-}
-
-/**
- * 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)
-{
- zynq_clk_register_pll(&clks[armpll_clk], &slcr_base->arm_pll_ctrl,
- "armpll", CONFIG_ZYNQ_PS_CLK_FREQ);
- zynq_clk_register_pll(&clks[ddrpll_clk], &slcr_base->ddr_pll_ctrl,
- "ddrpll", CONFIG_ZYNQ_PS_CLK_FREQ);
- zynq_clk_register_pll(&clks[iopll_clk], &slcr_base->io_pll_ctrl,
- "iopll", CONFIG_ZYNQ_PS_CLK_FREQ);
-
- init_ddr_clocks();
- init_cpu_clocks();
- init_periph_clocks();
- init_aper_clocks();
-
- gd->bd->bi_arm_freq = gd->cpu_clk / 1000000;
- gd->bd->bi_dsp_freq = 0;
-
- return 0;
-}
-
-/**
- * zynq_clk_get_rate() - Get clock rate
- * @clk: Clock identifier
- * Returns the current clock rate of @clk on success or zero for an invalid
- * clock id.
- */
-unsigned long zynq_clk_get_rate(enum zynq_clk clk)
-{
- if (clk < 0 || clk >= clk_max)
- return 0;
-
- return clks[clk].frequency;
-}
-
-/**
- * zynq_clk_set_rate() - Set clock rate
- * @clk: Clock identifier
- * @rate: Requested clock rate
- * Passes on the return value from the clock's set_rate() function or negative
- * errno.
- */
-int zynq_clk_set_rate(enum zynq_clk clk, unsigned long rate)
-{
- if (clk < 0 || clk >= clk_max)
- return -ENODEV;
-
- if (clks[clk].ops.set_rate)
- return clks[clk].ops.set_rate(&clks[clk], rate);
-
- return -ENXIO;
-}
-
-/**
- * zynq_clk_get_name() - Get clock name
- * @clk: Clock identifier
- * Returns the name of @clk.
- */
-const char *zynq_clk_get_name(enum zynq_clk clk)
-{
- return clks[clk].name;
-}
-
-/**
- * soc_clk_dump() - Print clock frequencies
- * Returns zero on success
- *
- * Implementation for the clk dump command.
- */
-int soc_clk_dump(void)
-{
- int i;
-
- printf("clk\t\tfrequency\n");
- for (i = 0; i < clk_max; i++) {
- const char *name = zynq_clk_get_name(i);
- if (name)
- printf("%10s%20lu\n", name, zynq_clk_get_rate(i));
- }
-
- return 0;
-}
diff --git a/arch/arm/cpu/armv7/zynq/config.mk b/arch/arm/cpu/armv7/zynq/config.mk
deleted file mode 100644
index 778a377e8a..0000000000
--- a/arch/arm/cpu/armv7/zynq/config.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Copyright (C) 2013 - 2015 Xilinx, Inc. All rights reserved.
-#
-# SPDX-License-Identifier: GPL-2.0
-#
-# Allow NEON instructions (needed for lowlevel_init.S with GNU toolchain)
-PLATFORM_RELFLAGS += -mfpu=neon
diff --git a/arch/arm/cpu/armv7/zynq/cpu.c b/arch/arm/cpu/armv7/zynq/cpu.c
deleted file mode 100644
index 914b1feb68..0000000000
--- a/arch/arm/cpu/armv7/zynq/cpu.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2012 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2012 Xilinx, Inc. All rights reserved.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/clk.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/hardware.h>
-
-#define ZYNQ_SILICON_VER_MASK 0xF0000000
-#define ZYNQ_SILICON_VER_SHIFT 28
-
-int arch_cpu_init(void)
-{
- zynq_slcr_unlock();
-#ifndef CONFIG_SPL_BUILD
- /* Device config APB, unlock the PCAP */
- writel(0x757BDF0D, &devcfg_base->unlock);
- writel(0xFFFFFFFF, &devcfg_base->rom_shadow);
-
-#if (CONFIG_SYS_SDRAM_BASE == 0)
- /* remap DDR to zero, FILTERSTART */
- writel(0, &scu_base->filter_start);
-
- /* OCM_CFG, Mask out the ROM, map ram into upper addresses */
- writel(0x1F, &slcr_base->ocm_cfg);
- /* FPGA_RST_CTRL, clear resets on AXI fabric ports */
- writel(0x0, &slcr_base->fpga_rst_ctrl);
- /* Set urgent bits with register */
- writel(0x0, &slcr_base->ddr_urgent_sel);
- /* Urgent write, ports S2/S3 */
- writel(0xC, &slcr_base->ddr_urgent);
-#endif
-#endif
- zynq_clk_early_init();
- zynq_slcr_lock();
-
- return 0;
-}
-
-unsigned int zynq_get_silicon_version(void)
-{
- unsigned int ver;
-
- ver = (readl(&devcfg_base->mctrl) &
- ZYNQ_SILICON_VER_MASK) >> ZYNQ_SILICON_VER_SHIFT;
-
- return ver;
-}
-
-void reset_cpu(ulong addr)
-{
- zynq_slcr_cpu_reset();
- while (1)
- ;
-}
-
-#ifndef CONFIG_SYS_DCACHE_OFF
-void enable_caches(void)
-{
- /* Enable D-cache. I-cache is already enabled in start.S */
- dcache_enable();
-}
-#endif
diff --git a/arch/arm/cpu/armv7/zynq/ddrc.c b/arch/arm/cpu/armv7/zynq/ddrc.c
deleted file mode 100644
index 5b20accbcb..0000000000
--- a/arch/arm/cpu/armv7/zynq/ddrc.c
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2012 - 2013 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2012 - 2013 Xilinx, Inc. All rights reserved.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/hardware.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-/* Control regsiter bitfield definitions */
-#define ZYNQ_DDRC_CTRLREG_BUSWIDTH_MASK 0xC
-#define ZYNQ_DDRC_CTRLREG_BUSWIDTH_SHIFT 2
-#define ZYNQ_DDRC_CTRLREG_BUSWIDTH_16BIT 1
-
-/* ECC scrub regsiter definitions */
-#define ZYNQ_DDRC_ECC_SCRUBREG_ECC_MODE_MASK 0x7
-#define ZYNQ_DDRC_ECC_SCRUBREG_ECCMODE_SECDED 0x4
-
-void zynq_ddrc_init(void)
-{
- u32 width, ecctype;
-
- width = readl(&ddrc_base->ddrc_ctrl);
- width = (width & ZYNQ_DDRC_CTRLREG_BUSWIDTH_MASK) >>
- ZYNQ_DDRC_CTRLREG_BUSWIDTH_SHIFT;
- ecctype = (readl(&ddrc_base->ecc_scrub) &
- ZYNQ_DDRC_ECC_SCRUBREG_ECC_MODE_MASK);
-
- /* ECC is enabled when memory is in 16bit mode and it is enabled */
- if ((ecctype == ZYNQ_DDRC_ECC_SCRUBREG_ECCMODE_SECDED) &&
- (width == ZYNQ_DDRC_CTRLREG_BUSWIDTH_16BIT)) {
- puts("ECC enabled ");
- /*
- * Clear the first 1MB because it is not initialized from
- * first stage bootloader. To get ECC to work all memory has
- * been initialized by writing any value.
- */
- /* cppcheck-suppress nullPointer */
- memset((void *)0, 0, 1 * 1024 * 1024);
-
- gd->ram_size /= 2;
- } else {
- puts("ECC disabled ");
- }
-}
diff --git a/arch/arm/cpu/armv7/zynq/lowlevel_init.S b/arch/arm/cpu/armv7/zynq/lowlevel_init.S
deleted file mode 100644
index 6d714b711c..0000000000
--- a/arch/arm/cpu/armv7/zynq/lowlevel_init.S
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright (C) 2013 Xilinx, Inc. All rights reserved.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <asm-offsets.h>
-#include <config.h>
-#include <linux/linkage.h>
-
-ENTRY(lowlevel_init)
-
- /* Enable the the VFP */
- mrc p15, 0, r1, c1, c0, 2
- orr r1, r1, #(0x3 << 20)
- orr r1, r1, #(0x3 << 20)
- mcr p15, 0, r1, c1, c0, 2
- isb
- fmrx r1, FPEXC
- orr r1,r1, #(1<<30)
- fmxr FPEXC, r1
-
- /* Move back to caller */
- mov pc, lr
-
-ENDPROC(lowlevel_init)
diff --git a/arch/arm/cpu/armv7/zynq/slcr.c b/arch/arm/cpu/armv7/zynq/slcr.c
deleted file mode 100644
index 2521589c07..0000000000
--- a/arch/arm/cpu/armv7/zynq/slcr.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Copyright (c) 2013 Xilinx Inc.
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <asm/io.h>
-#include <malloc.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/sys_proto.h>
-#include <asm/arch/clk.h>
-
-#define SLCR_LOCK_MAGIC 0x767B
-#define SLCR_UNLOCK_MAGIC 0xDF0D
-
-#define SLCR_USB_L1_SEL 0x04
-
-#define SLCR_IDCODE_MASK 0x1F000
-#define SLCR_IDCODE_SHIFT 12
-
-/*
- * zynq_slcr_mio_get_status - Get the status of MIO peripheral.
- *
- * @peri_name: Name of the peripheral for checking MIO status
- * @get_pins: Pointer to array of get pin for this peripheral
- * @num_pins: Number of pins for this peripheral
- * @mask: Mask value
- * @check_val: Required check value to get the status of periph
- */
-struct zynq_slcr_mio_get_status {
- const char *peri_name;
- const int *get_pins;
- int num_pins;
- u32 mask;
- u32 check_val;
-};
-
-static const int usb0_pins[] = {
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39
-};
-
-static const int usb1_pins[] = {
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51
-};
-
-static const struct zynq_slcr_mio_get_status mio_periphs[] = {
- {
- "usb0",
- usb0_pins,
- ARRAY_SIZE(usb0_pins),
- SLCR_USB_L1_SEL,
- SLCR_USB_L1_SEL,
- },
- {
- "usb1",
- usb1_pins,
- ARRAY_SIZE(usb1_pins),
- SLCR_USB_L1_SEL,
- SLCR_USB_L1_SEL,
- },
-};
-
-static int slcr_lock = 1; /* 1 means locked, 0 means unlocked */
-
-void zynq_slcr_lock(void)
-{
- if (!slcr_lock) {
- writel(SLCR_LOCK_MAGIC, &slcr_base->slcr_lock);
- slcr_lock = 1;
- }
-}
-
-void zynq_slcr_unlock(void)
-{
- if (slcr_lock) {
- writel(SLCR_UNLOCK_MAGIC, &slcr_base->slcr_unlock);
- slcr_lock = 0;
- }
-}
-
-/* Reset the entire system */
-void zynq_slcr_cpu_reset(void)
-{
- /*
- * Unlock the SLCR then reset the system.
- * Note that this seems to require raw i/o
- * functions or there's a lockup?
- */
- zynq_slcr_unlock();
-
- /*
- * Clear 0x0F000000 bits of reboot status register to workaround
- * the FSBL not loading the bitstream after soft-reboot
- * This is a temporary solution until we know more.
- */
- clrbits_le32(&slcr_base->reboot_status, 0xF000000);
-
- writel(1, &slcr_base->pss_rst_ctrl);
-}
-
-/* Setup clk for network */
-void zynq_slcr_gem_clk_setup(u32 gem_id, unsigned long clk_rate)
-{
- int ret;
-
- zynq_slcr_unlock();
-
- if (gem_id > 1) {
- printf("Non existing GEM id %d\n", gem_id);
- goto out;
- }
-
- ret = zynq_clk_set_rate(gem0_clk + gem_id, clk_rate);
- if (ret)
- goto out;
-
- if (gem_id) {
- /* Configure GEM_RCLK_CTRL */
- writel(1, &slcr_base->gem1_rclk_ctrl);
- } else {
- /* Configure GEM_RCLK_CTRL */
- writel(1, &slcr_base->gem0_rclk_ctrl);
- }
- udelay(100000);
-out:
- zynq_slcr_lock();
-}
-
-void zynq_slcr_devcfg_disable(void)
-{
- zynq_slcr_unlock();
-
- /* Disable AXI interface by asserting FPGA resets */
- writel(0xF, &slcr_base->fpga_rst_ctrl);
-
- /* Set Level Shifters DT618760 */
- writel(0xA, &slcr_base->lvl_shftr_en);
-
- zynq_slcr_lock();
-}
-
-void zynq_slcr_devcfg_enable(void)
-{
- zynq_slcr_unlock();
-
- /* Set Level Shifters DT618760 */
- writel(0xF, &slcr_base->lvl_shftr_en);
-
- /* Enable AXI interface by de-asserting FPGA resets */
- writel(0x0, &slcr_base->fpga_rst_ctrl);
-
- zynq_slcr_lock();
-}
-
-u32 zynq_slcr_get_boot_mode(void)
-{
- /* Get the bootmode register value */
- return readl(&slcr_base->boot_mode);
-}
-
-u32 zynq_slcr_get_idcode(void)
-{
- return (readl(&slcr_base->pss_idcode) & SLCR_IDCODE_MASK) >>
- SLCR_IDCODE_SHIFT;
-}
-
-/*
- * zynq_slcr_get_mio_pin_status - Get the MIO pin status of peripheral.
- *
- * @periph: Name of the peripheral
- *
- * Returns count to indicate the number of pins configured for the
- * given @periph.
- */
-int zynq_slcr_get_mio_pin_status(const char *periph)
-{
- const struct zynq_slcr_mio_get_status *mio_ptr;
- int val, i, j;
- int mio = 0;
-
- for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) {
- if (strcmp(periph, mio_periphs[i].peri_name) == 0) {
- mio_ptr = &mio_periphs[i];
- for (j = 0; j < mio_ptr->num_pins; j++) {
- val = readl(&slcr_base->mio_pin
- [mio_ptr->get_pins[j]]);
- if ((val & mio_ptr->mask) == mio_ptr->check_val)
- mio++;
- }
- break;
- }
- }
-
- return mio;
-}
diff --git a/arch/arm/cpu/armv7/zynq/spl.c b/arch/arm/cpu/armv7/zynq/spl.c
deleted file mode 100644
index b80c35794a..0000000000
--- a/arch/arm/cpu/armv7/zynq/spl.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * (C) Copyright 2014 Xilinx, Inc. Michal Simek
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-#include <common.h>
-#include <spl.h>
-
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/spl.h>
-#include <asm/arch/sys_proto.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-void board_init_f(ulong dummy)
-{
- ps7_init();
-
- /* Clear the BSS. */
- memset(__bss_start, 0, __bss_end - __bss_start);
-
- preloader_console_init();
- arch_cpu_init();
- board_init_r(NULL, 0);
-}
-
-#ifdef CONFIG_SPL_BOARD_INIT
-void spl_board_init(void)
-{
- board_init();
-}
-#endif
-
-u32 spl_boot_device(void)
-{
- u32 mode;
-
- switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
-#ifdef CONFIG_SPL_SPI_SUPPORT
- case ZYNQ_BM_QSPI:
- puts("qspi boot\n");
- mode = BOOT_DEVICE_SPI;
- break;
-#endif
- case ZYNQ_BM_NAND:
- mode = BOOT_DEVICE_NAND;
- break;
- case ZYNQ_BM_NOR:
- mode = BOOT_DEVICE_NOR;
- break;
-#ifdef CONFIG_SPL_MMC_SUPPORT
- case ZYNQ_BM_SD:
- puts("mmc boot\n");
- mode = BOOT_DEVICE_MMC1;
- break;
-#endif
- case ZYNQ_BM_JTAG:
- mode = BOOT_DEVICE_RAM;
- break;
- default:
- puts("Unsupported boot mode selected\n");
- hang();
- }
-
- return mode;
-}
-
-#ifdef CONFIG_SPL_MMC_SUPPORT
-u32 spl_boot_mode(void)
-{
- return MMCSD_MODE_FS;
-}
-#endif
-
-#ifdef CONFIG_SPL_OS_BOOT
-int spl_start_uboot(void)
-{
- /* boot linux */
- return 0;
-}
-#endif
-
-__weak void ps7_init(void)
-{
- /*
- * This function is overridden by the one in
- * board/xilinx/zynq/ps7_init.c, if it exists.
- */
-}
diff --git a/arch/arm/cpu/armv7/zynq/timer.c b/arch/arm/cpu/armv7/zynq/timer.c
deleted file mode 100644
index 303dbcfcea..0000000000
--- a/arch/arm/cpu/armv7/zynq/timer.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2012 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2011-2012 Xilinx, Inc. All rights reserved.
- *
- * (C) Copyright 2008
- * Guennadi Liakhovetki, DENX Software Engineering, <lg@denx.de>
- *
- * (C) Copyright 2004
- * Philippe Robin, ARM Ltd. <philippe.robin@arm.com>
- *
- * (C) Copyright 2002-2004
- * Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
- *
- * (C) Copyright 2003
- * Texas Instruments <www.ti.com>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Marius Groeger <mgroeger@sysgo.de>
- *
- * (C) Copyright 2002
- * Sysgo Real-Time Solutions, GmbH <www.elinos.com>
- * Alex Zuepke <azu@sysgo.de>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-#include <common.h>
-#include <div64.h>
-#include <asm/io.h>
-#include <asm/arch/hardware.h>
-#include <asm/arch/clk.h>
-
-DECLARE_GLOBAL_DATA_PTR;
-
-struct scu_timer {
- u32 load; /* Timer Load Register */
- u32 counter; /* Timer Counter Register */
- u32 control; /* Timer Control Register */
-};
-
-static struct scu_timer *timer_base =
- (struct scu_timer *)ZYNQ_SCUTIMER_BASEADDR;
-
-#define SCUTIMER_CONTROL_PRESCALER_MASK 0x0000FF00 /* Prescaler */
-#define SCUTIMER_CONTROL_PRESCALER_SHIFT 8
-#define SCUTIMER_CONTROL_AUTO_RELOAD_MASK 0x00000002 /* Auto-reload */
-#define SCUTIMER_CONTROL_ENABLE_MASK 0x00000001 /* Timer enable */
-
-#define TIMER_LOAD_VAL 0xFFFFFFFF
-#define TIMER_PRESCALE 255
-
-int timer_init(void)
-{
- const u32 emask = SCUTIMER_CONTROL_AUTO_RELOAD_MASK |
- (TIMER_PRESCALE << SCUTIMER_CONTROL_PRESCALER_SHIFT) |
- SCUTIMER_CONTROL_ENABLE_MASK;
-
- gd->arch.timer_rate_hz = (gd->cpu_clk / 2) / (TIMER_PRESCALE + 1);
-
- /* Load the timer counter register */
- writel(0xFFFFFFFF, &timer_base->load);
-
- /*
- * Start the A9Timer device
- * Enable Auto reload mode, Clear prescaler control bits
- * Set prescaler value, Enable the decrementer
- */
- clrsetbits_le32(&timer_base->control, SCUTIMER_CONTROL_PRESCALER_MASK,
- emask);
-
- /* Reset time */
- gd->arch.lastinc = readl(&timer_base->counter) /
- (gd->arch.timer_rate_hz / CONFIG_SYS_HZ);
- gd->arch.tbl = 0;
-
- return 0;
-}
-
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-ulong get_timer_masked(void)
-{
- ulong now;
-
- now = readl(&timer_base->counter) /
- (gd->arch.timer_rate_hz / CONFIG_SYS_HZ);
-
- if (gd->arch.lastinc >= now) {
- /* Normal mode */
- gd->arch.tbl += gd->arch.lastinc - now;
- } else {
- /* We have an overflow ... */
- gd->arch.tbl += gd->arch.lastinc + TIMER_LOAD_VAL - now + 1;
- }
- gd->arch.lastinc = now;
-
- return gd->arch.tbl;
-}
-
-void __udelay(unsigned long usec)
-{
- u32 countticks;
- u32 timeend;
- u32 timediff;
- u32 timenow;
-
- if (usec == 0)
- return;
-
- countticks = lldiv(((unsigned long long)gd->arch.timer_rate_hz * usec),
- 1000000);
-
- /* decrementing timer */
- timeend = readl(&timer_base->counter) - countticks;
-
-#if TIMER_LOAD_VAL != 0xFFFFFFFF
- /* do not manage multiple overflow */
- if (countticks >= TIMER_LOAD_VAL)
- countticks = TIMER_LOAD_VAL - 1;
-#endif
-
- do {
- timenow = readl(&timer_base->counter);
-
- if (timenow >= timeend) {
- /* normal case */
- timediff = timenow - timeend;
- } else {
- if ((TIMER_LOAD_VAL - timeend + timenow) <=
- countticks) {
- /* overflow */
- timediff = TIMER_LOAD_VAL - timeend + timenow;
- } else {
- /* missed the exact match */
- break;
- }
- }
- } while (timediff > 0);
-}
-
-/* Timer without interrupts */
-ulong get_timer(ulong base)
-{
- return get_timer_masked() - base;
-}
-
-/*
- * This function is derived from PowerPC code (read timebase as long long).
- * On ARM it just returns the timer value.
- */
-unsigned long long get_ticks(void)
-{
- return get_timer(0);
-}
-
-/*
- * This function is derived from PowerPC code (timebase clock frequency).
- * On ARM it returns the number of timer ticks per second.
- */
-ulong get_tbclk(void)
-{
- return CONFIG_SYS_HZ;
-}
diff --git a/arch/arm/cpu/armv7/zynq/u-boot-spl.lds b/arch/arm/cpu/armv7/zynq/u-boot-spl.lds
deleted file mode 100644
index 0f2f756f83..0000000000
--- a/arch/arm/cpu/armv7/zynq/u-boot-spl.lds
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2014 Xilinx, Inc. Michal Simek
- * Copyright (c) 2004-2008 Texas Instruments
- *
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\
- LENGTH = CONFIG_SPL_MAX_SIZE }
-MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR, \
- LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
- . = ALIGN(4);
- .text :
- {
- __image_copy_start = .;
- *(.vectors)
- CPUDIR/start.o (.text*)
- *(.text*)
- } > .sram
-
- . = ALIGN(4);
- .rodata : {
- *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
- } > .sram
-
- . = ALIGN(4);
- .data : {
- *(.data*)
- } > .sram
-
- . = ALIGN(4);
-
- . = .;
-
- __image_copy_end = .;
-
- _end = .;
-
- /* Move BSS section to RAM because of FAT */
- .bss (NOLOAD) : {
- __bss_start = .;
- *(.bss*)
- . = ALIGN(4);
- __bss_end = .;
- } > .sdram
-
- /DISCARD/ : { *(.dynsym) }
- /DISCARD/ : { *(.dynstr*) }
- /DISCARD/ : { *(.dynamic*) }
- /DISCARD/ : { *(.plt*) }
- /DISCARD/ : { *(.interp*) }
- /DISCARD/ : { *(.gnu*) }
-}
diff --git a/arch/arm/cpu/armv7/zynq/u-boot.lds b/arch/arm/cpu/armv7/zynq/u-boot.lds
deleted file mode 100644
index 4dc9bb0102..0000000000
--- a/arch/arm/cpu/armv7/zynq/u-boot.lds
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2004-2008 Texas Instruments
- *
- * (C) Copyright 2002
- * Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
- *
- * SPDX-License-Identifier: GPL-2.0+
- */
-
-OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
- . = 0x00000000;
-
- . = ALIGN(4);
- .text :
- {
- *(.__image_copy_start)
- *(.vectors)
- CPUDIR/start.o (.text*)
- *(.text*)
- }
-
- . = ALIGN(4);
- .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) }
-
- . = ALIGN(4);
- .data : {
- *(.data*)
- }
-
- . = ALIGN(4);
-
- . = .;
-
- . = ALIGN(4);
- .u_boot_list : {
- KEEP(*(SORT(.u_boot_list*)));
- }
-
- . = ALIGN(4);
-
- .image_copy_end :
- {
- *(.__image_copy_end)
- }
-
- .rel_dyn_start :
- {
- *(.__rel_dyn_start)
- }
-
- .rel.dyn : {
- *(.rel*)
- }
-
- .rel_dyn_end :
- {
- *(.__rel_dyn_end)
- }
-
- .end :
- {
- *(.__end)
- }
-
- _image_binary_end = .;
-
-/*
- * Compiler-generated __bss_start and __bss_end, see arch/arm/lib/bss.c
- * __bss_base and __bss_limit are for linker only (overlay ordering)
- */
-
- .bss_start __rel_dyn_start (OVERLAY) : {
- KEEP(*(.__bss_start));
- __bss_base = .;
- }
-
- .bss __bss_base (OVERLAY) : {
- *(.bss*)
- . = ALIGN(4);
- __bss_limit = .;
- }
-
- .bss_end __bss_limit (OVERLAY) : {
- KEEP(*(.__bss_end));
- }
-
- /*
- * Zynq needs to discard these sections because the user
- * is expected to pass this image on to tools for boot.bin
- * generation that require them to be dropped.
- */
- /DISCARD/ : { *(.dynsym) }
- /DISCARD/ : { *(.dynbss*) }
- /DISCARD/ : { *(.dynstr*) }
- /DISCARD/ : { *(.dynamic*) }
- /DISCARD/ : { *(.plt*) }
- /DISCARD/ : { *(.interp*) }
- /DISCARD/ : { *(.gnu*) }
- /DISCARD/ : { *(.ARM.exidx*) }
- /DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
-}
OpenPOWER on IntegriCloud