summaryrefslogtreecommitdiff
path: root/drivers/ddr/altera/sdram_agilex.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2025-08-08 11:13:41 -0600
committerTom Rini <trini@konsulko.com>2025-08-08 11:13:41 -0600
commit83ce0b483c1680cb39565a9d91c6ef113a309c38 (patch)
tree45a8e2266c17af616c08100f1307d428f69047a5 /drivers/ddr/altera/sdram_agilex.c
parente51e139cdf81b2f4c373294a2186fefcf5573388 (diff)
parent8eecbaf957191b159176e92175121db907c480b2 (diff)
Merge tag 'u-boot-socfpga-next-20250808' of https://source.denx.de/u-boot/custodians/u-boot-socfpga
This pull request introduces initial U-Boot support for Agilex7 M-series, along with several enhancements and cleanups across existing Agilex platforms. Key changes include new board support, DDR driver additions, updated device trees, and broader SoCFPGA SPL improvements. Highlights: - Agilex7 M-series bring-up: - Basic DT support and board initialization for Agilex7 M-series SoC and SoCDK. - New sdram_agilex7m DDR driver with UIBSSM mailbox support and HBM support. - Clock driver support for Agilex7 M-series. - New defconfig: socfpga_agilex7m_defconfig. - Agilex and Agilex5 enhancements: - Improved SPL support: ASYNC interrupt enabling, system manager init refactor, and cold scratch register usage. - Updated firewall probing and watchdog support in SPL. - Cleaned up DDR code, added secure region support for ATF, and improved warm reset handling. - Device Tree and config updates: - Migration to upstream Linux DT layout for Agilex platforms. - Consolidated socfpga_agilex_defconfig and removed deprecated configs. - Platform-specific environment variables for Distro Boot added. - Driver fixes and cleanups: - dwc_eth_xgmac and clk-agilex cleanup and improvements. - Several coverity and style fixes. Contributions in this PR are from Alif Zakuan Yuslaimi, Tingting Meng, and Andrew Goodbody. This patch set has been tested on Agilex 5 devkit, Agilex devkit and Agilex7m devkit. Passing all pipeline tests at SoCFPGA U-boot custodian https://source.denx.de/u-boot/custodians/u-boot-socfpga/-/pipelines/27318
Diffstat (limited to 'drivers/ddr/altera/sdram_agilex.c')
-rw-r--r--drivers/ddr/altera/sdram_agilex.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/ddr/altera/sdram_agilex.c b/drivers/ddr/altera/sdram_agilex.c
index 7f2cccb6af2..b36a765a5de 100644
--- a/drivers/ddr/altera/sdram_agilex.c
+++ b/drivers/ddr/altera/sdram_agilex.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2019 Intel Corporation <www.intel.com>
+ * Copyright (C) 2025 Altera Corporation <www.altera.com>
*
*/
@@ -72,12 +73,22 @@ int sdram_mmr_init_full(struct udevice *dev)
*/
/* Configure DDR IO size x16, x32 and x64 mode */
u32 update_value;
+ u32 reg;
update_value = hmc_readl(plat, NIOSRESERVED0);
update_value = (update_value & 0xFF) >> 5;
- /* Configure DDR data rate 0-HAlf-rate 1-Quarter-rate */
- update_value |= (hmc_readl(plat, CTRLCFG3) & 0x4);
+ /* Read ACF from boot_scratch_cold_8 register bit[18]*/
+ reg = readl(socfpga_get_sysmgr_addr() +
+ SYSMGR_SOC64_BOOT_SCRATCH_COLD8);
+ reg = ((reg & SYSMGR_SCRATCH_REG_8_ACF_DDR_RATE_MASK)
+ >> SYSMGR_SCRATCH_REG_8_ACF_DDR_RATE_SHIFT);
+
+ /* bit-2 of DDRIOCTRL: Configure DDR data rate 0-Half-rate 1-Quarter-rate */
+ clrsetbits_le32(&update_value,
+ DDR_HMC_DDRIOCTRL_MPFE_HMCA_DATA_RATE_MSK,
+ reg << DDR_HMC_DDRIOCTRL_MPFE_HMCA_DATA_RATE_SHIFT);
+
hmc_ecc_writel(plat, update_value, DDRIOCTRL);
/* Copy values MMR IOHMC dramaddrw to HMC adp DRAMADDRWIDTH */
@@ -114,20 +125,6 @@ int sdram_mmr_init_full(struct udevice *dev)
printf("DDR: %lld MiB\n", gd->ram_size >> 20);
- /* This enables nonsecure access to DDR */
- /* mpuregion0addr_limit */
- FW_MPU_DDR_SCR_WRITEL(gd->ram_size - 1,
- FW_MPU_DDR_SCR_MPUREGION0ADDR_LIMIT);
- FW_MPU_DDR_SCR_WRITEL(0x1F, FW_MPU_DDR_SCR_MPUREGION0ADDR_LIMITEXT);
-
- /* nonmpuregion0addr_limit */
- FW_MPU_DDR_SCR_WRITEL(gd->ram_size - 1,
- FW_MPU_DDR_SCR_NONMPUREGION0ADDR_LIMIT);
-
- /* Enable mpuregion0enable and nonmpuregion0enable */
- FW_MPU_DDR_SCR_WRITEL(MPUREGION0_ENABLE | NONMPUREGION0_ENABLE,
- FW_MPU_DDR_SCR_EN_SET);
-
u32 ctrlcfg1 = hmc_readl(plat, CTRLCFG1);
/* Enable or disable the DDR ECC */
@@ -157,11 +154,10 @@ int sdram_mmr_init_full(struct udevice *dev)
DDR_HMC_ECCCTL2_AWB_EN_SET_MSK));
}
- /* Enable non-secure reads/writes to HMC Adapter for SDRAM ECC */
- writel(FW_HMC_ADAPTOR_MPU_MASK, FW_HMC_ADAPTOR_REG_ADDR);
-
sdram_size_check(&bd);
+ sdram_set_firewall(&bd);
+
priv->info.base = bd.bi_dram[0].start;
priv->info.size = gd->ram_size;