summaryrefslogtreecommitdiff
path: root/drivers/ram
AgeCommit message (Collapse)Author
2025-06-14Merge patch series "Hex value prefix case cleanup"Tom Rini
E Shattow <e@freeshell.de> says: Make consistent use of lowercase hexadecimal prefix '0x' throughout U-Boot. There are a few remaining uses of uppercase 'X' to denote hexadecimal prefix or placeholder in documentation and error messages. External devicetree-rebasing dts/upstream and the generated code of xilinx/zynq are ignored for the series. Link: https://lore.kernel.org/r/20250606224558.1117422-1-e@freeshell.de
2025-06-14drivers: use lowercase hex prefix styleE Shattow
Use consistent lowercase hex prefix style in drivers/* Does not change hex prefix case in allcaps uppercase style error messages Signed-off-by: E Shattow <e@freeshell.de>
2025-06-12ram: Move Kconfig options into their own menu entryYao Zi
RAM drivers using Device Model currently lack of their own Kconfig menu entry, which makes Kconfig put all options of the class in the top-level menu of device drivers. These options are also incorrectly grouped with pinctrl options in the generated .config, which is hard to read. Let's create a menu entry for these drivers. Fixes: 6c51df6859f ("dm: Add support for RAM drivers") Signed-off-by: Yao Zi <ziyao@disroot.org> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de> Reviewed-by: Tom Rini <trini@konsulko.com>
2025-06-11ram: stm32mp1: Add STM32MP13xx supportMarek Vasut
Add support for configuring DRAM controller on STM32MP13xx SoC. The DRAM controller is basically identical to the DWC controller on STM32MP15xx SoC, except the bus width is reduced from 32bit to 16bit and a few registers and bits are therefore not present. Handle the difference by factoring these parts out. Use IS_ENABLE() as much as possible to assure code which is not enabled on builds for a single SoC gets compiled out. Handle the different offset of RCC_DDRITFCR register and missing DDRC2 clock the same way. Signed-off-by: Marek Vasut <marek.vasut@mailbox.org>
2025-06-06ram: rockchip: Fix dependency of RAM_ROCKCHIP_DEBUGLukasz Czechowski
The RAM_ROCKCHIP_DEBUG can be used only if DEBUG_UART is available. The next commit introduces changes in definition of debug uart functions, so that DEBUG_UART is required to be defined in order to initialize uart and use print functions. Signed-off-by: Lukasz Czechowski <lukasz.czechowski@thaumatec.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-05-21ram: thead: Add initial DDR controller support for TH1520Yao Zi
This patch cleans the vendor code of DDR initialization up, converts the driver to fit in DM framework and use a firmware[1] packaged by binman to ship PHY configuration. Currently the driver is only capable of initializing the controller to work with dual-rank 3733MHz LPDDR4, which is shipped by 16GiB variants of LicheePi 4A boards and I could test with. Support for other configurations could be easily added later. Link: https://github.com/ziyao233/th1520-firmware # [1] Signed-off-by: Yao Zi <ziyao@disroot.org> Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2025-04-23ram: rockchip: Add rk3576 ddr driver supportHeiko Stuebner
Add ddr driver for rk3576 to get the ram capacity. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-04-23ram: rockchip: Add basic support for RK3528Jonas Karlman
Add support for reading DRAM size information from PMUGRF os_reg18 reg. Compared to most Rockchip SoCs the RK3528 use os_reg18 for DRAM info, instead of os_reg2. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2025-04-05arm: mach-k3: j721e: Split out J7200 SoC support from J721eAndrew Davis
Currently in j721e_init.c we check which firewalls to remove using the board configuration (e.g CONFIG_TARGET_J721E_R5_EVM). We do this as J721e and J7200 have different IP and firewalls but use the same SoC definition (SOC_K3_J721E) even though they are different SoCs. The idea was they would be similar enough that they both could use the same SoC config to help with common code sharing. Board checks would then be used differentiate. This has grown far too messy to maintain any more, especially now that there is more than one board using J721e (EVM, SK, Beagle AI64). As differentiation is done based on board, every one of these boards would have to have checks added for them. Instead let's split J7200 support out from J721e like how normal new SoC support is done. This patch touches several subsystems and could not be split much better as when we add SOC_K3_J7200 we want to make use of it in all spots that once used the combined SOC_K3_J721E so we can turn off SOC_K3_J721E when building for J7200 boards. Signed-off-by: Andrew Davis <afd@ti.com>
2025-03-29ram: renesas: dbsc5: Pass udevice and MODEMR0 to dbsc5_get_board_data()Marek Vasut
Pass DBSC5 udevice and MODEMR0 register values to board specific function dbsc5_get_board_data(). The board specific implementation of dbsc5_get_board_data() can return struct renesas_dbsc5_board_config which matches the board based on the content of MODEMR0 or content of DT accessible via the udevice. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-29ram: renesas: dbsc5: Factor out dbsc5_wait_dbwait()Marek Vasut
Extract wait for completion code from dbsc5_send_dbcmd2() into new separate function dbsc5_wait_dbwait(). This extracted code can be used to implement MR register read in the future. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-29ram: renesas: dbsc5: Improve dbsc5_send_dbcmd2() signatureMarek Vasut
Update dbsc5_send_dbcmd2() such that it takes multiple parameters instead of one magic register content value. These parameters are used to form the same resulting register value internally in the dbsc5_send_dbcmd2() function, but from well defined input constants. The new input constants are the operation code, channel, rank, and operation argument. The argument is operation code specific, therefore it is still a 16-bit magic number, but the rest of the arguments are now split up. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-29ram: renesas: dbsc5: Drop space before dbsc5_ddr_setval_all_ch()Marek Vasut
Remove leading space before dbsc5_ddr_setval_all_ch() , no functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-29ram: renesas: dbsc5: Clarify MR27/MR28/MR57 register operationsMarek Vasut
Rename dbsc5_ddr_register_read() to dbsc5_ddr_register_mr27_mr57_read() and dbsc5_ddr_register_set() to dbsc5_ddr_register_mr28_set() to make it clear what those functions really do. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-16ram: renesas: dbsc5: Make struct renesas_dbsc5_board_config publicMarek Vasut
Make struct renesas_dbsc5_board_config {} definition public via include/dbsc5.h, so this structure can be defined in board files and passed into the DBSC5 DRAM driver by overriding weak function dbsc5_get_board_data() on board level. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-16ram: renesas: dbsc5: Add V4H-3/V4H-5/V4H-7 OTP based detectionMarek Vasut
Add auto-detection and handling of Renesas R-Car V4H-3 and V4H-5 in addition to V4H-7 SoC variants based on OTP fuse programming. The V4H-3 and V4H-5 variants have reduced DRAM frequency options. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-16ram: renesas: dbsc5: Synchronize initialization code to rev.1.10Marek Vasut
Update the DRAM initialization code to match DBSC5 initialization code rev.1.10 , which is currently the latest version available. This makes DRAM initialization operational on Renesas R-Car V4H R8A779G0 rev.3.0. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-16ram: renesas: dbsc5: Fix DBTR11 calculationMarek Vasut
Reinstate missing increment by two in DBTR11 calculation based on the original DBSC5 initialization code rev.0.80. The original code did ... ODTLon - (js2[JS2_tODTon_min] - 1) + 1 , which was incorrectly converted into ODTLon - js2[JS2_tODTon_min], but should have been converted to ODTLon - js2[JS2_tODTon_min] + 2. Add the missing +2 . Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-16ram: renesas: dbsc5: Fix JS1 index calculationMarek Vasut
The JS1 index is calculated correctly, but the limiter cannot be the max() function because the index should be lower than JS1_USABLEC_SPEC_HI and the max() function would unconditionally override the JS1 index to JS1_USABLEC_SPEC_HI. Use clamp() to limit the JS1 index instead. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-03-16ram: renesas: dbsc5: Fix bitrate MD pin parsingMarek Vasut
Fix copy paste error in MD pin handling for 5500 Mbps and 4800 Mbps case, each should be handled by MD[19,17] == 2 and MD[19,17] == 3 respectively. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-01-27ram: k3-ddrss: Set SDRAM_IDX using device private data, ddr_ram_sizeSanthosh Kumar K
The SDRAM_IDX in DDRSS_V2A_CTL_REG describes the number of address bits minus 16 that are used to determine the mask used to detect memory rollover and prevent aliasing and false coherency issues. Set SDRAM_IDX using the device private data, ddr_ram_size for K3 family of SoCs. Signed-off-by: Santhosh Kumar K <s-k6@ti.com> Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
2025-01-14ram: k3-ddrss: Remove 'ti,ecc-enable' supportSanthosh Kumar K
The functionality of enabling Inline ECC is now controlled by CONFIG_K3_INLINE_ECC. So, remove the support for 'ti,ecc-enable' property to avoid redundancy and to ensure the Inline ECC feature is mananged through build-time config. Signed-off-by: Santhosh Kumar K <s-k6@ti.com> Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
2025-01-14drivers: ram: Kconfig: Add CONFIG_K3_INLINE_ECCNeha Malcom Francis
Add CONFIG_K3_INLINE_ECC so that ECC functions can be compiled into R5 SPL only when the config has been enabled. Signed-off-by: Neha Malcom Francis <n-francis@ti.com> Signed-off-by: Santhosh Kumar K <s-k6@ti.com> Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
2025-01-14ram: k3-ddrss: Enable ECC interruptsSanthosh Kumar K
Enable ECC 1-bit error, 2-bit error, multiple 1-bit error interrupts by setting the respective bits in the DDRSS_V2A_INT_SET_REG register. Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
2025-01-14ram: k3-ddrss: Setup ECC region start and rangeSanthosh Kumar K
Setup the ECC region's start and range using the device private data, ddrss->ddr_bank_base[0] and ddrss->ddr_ram_size. Also, move start and range of ECC regions from 32 bits to 64 bits to accommodate for DDR greater than or equal to 4GB. Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
2025-01-14ram: k3-ddrss: Add k3_ddrss_ddr_bank_base_size_calc() to solve 'calculations ↵Santhosh Kumar K
restricted to 32 bits' issue As R5 is a 32 bit processor, the RAM banks' base and size calculation is restricted to 32 bits, which results in wrong values if bank's base is greater than 32 bits or bank's size is greater than or equal to 4GB. So, add k3_ddrss_ddr_bank_base_size_calc() to get the base address and size of RAM's banks from the device tree memory node, and store in a 64 bit device private data which can be used for ECC reserved memory calculation, Setting ECC range and Fixing up bank size in device tree when ECC is enabled. Signed-off-by: Santhosh Kumar K <s-k6@ti.com> Reviewed-by: Wadim Egorov <w.egorov@phytec.de>
2025-01-14ram: k3-ddrss: Use the DDR controller BIST engine for ECC primingGeorgi Vlaev
The 1-bit inline ECC support in TI's DDRSS bridge requires the configured memory regions to be preloaded with a pattern before use. This is done by the k3-ddrss driver from the R5 SPL in a 'for' loop. It takes around 10 seconds to fill 2GB of memory, for example. Memset can cut the time in half and using DMA currently yields a similar result. The BIST engine of DDR controller provides support for initializing any memory region with a pattern. This bypasses the DDRSS bridge, so the required inline ECC data is not computed and populated in the memory. For some values like zero, the computed ECC syndrome is also zero and we can use these values to preload the memory from the DDR controller, without the assistance of the bridge. The registers involved in the process are described in the 'DDR controller registers' topic in [1] AM62 and [2] J721E reference manuals. The patch replaces the 'for' loop memory fill function with the BIST memory initialization procedure. This cuts the time to preload the 2GB memory from 10 seconds down to 1 second. The bist preload function uses the lpddr4 APIs in the k3-ddrss, so this is compatible with devices with both 16-bit LPDDR4 and 32-bit LPDDR4 interfaces (e.g J721E). [1] AM62x: https://www.ti.com/lit/pdf/spruiv7 [2] DRA829/TDA4VM: https://www.ti.com/lit/zip/spruil1 Signed-off-by: Georgi Vlaev <g-vlaev@ti.com> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
2024-12-29ram: renesas: Add Renesas R-Car Gen4 DBSC5 driverMarek Vasut
Add Renesas R-Car Gen4 DBSC5 DRAM controller driver. This driver is currently capable of bringing LPDDR5 DRAM on Renesas R-Car V4H Whitehawk board. Further boards can be supported by supplying board specific DRAM configuration data via dbsc5_get_board_data(). Support for R-Car V4M is not implemented, however the driver is already mostly prepared to support this SoC. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-12-06ram: k3-ddrss: drop debug() in timing-sensitive sequenceThéo Lebrun
Those debug() calls might be useful, but beware. They can cause the DDR controller to hang if we do not run the sequence quickly enough. They usually are not an issue with upstream U-Boot and the default DDR config, but they have become troublesome with custom DDR configs. Drop those debug() statements that shouldn't be present in time-sensitive code, to avoid anyone else falling into the trap. Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
2024-10-11Merge patch series "Tidy up use of 'SPL' and CONFIG_SPL_BUILD"Tom Rini
Simon Glass <sjg@chromium.org> says: When the SPL build-phase was first created it was designed to solve a particular problem (the need to init SDRAM so that U-Boot proper could be loaded). It has since expanded to become an important part of U-Boot, with three phases now present: TPL, VPL and SPL Due to this history, the term 'SPL' is used to mean both a particular phase (the one before U-Boot proper) and all the non-proper phases. This has become confusing. For a similar reason CONFIG_SPL_BUILD is set to 'y' for all 'SPL' phases, not just SPL. So code which can only be compiled for actual SPL, for example, must use something like this: #if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) In Makefiles we have similar issues. SPL_ has been used as a variable which expands to either SPL_ or nothing, to chose between options like CONFIG_BLK and CONFIG_SPL_BLK. When TPL appeared, a new SPL_TPL variable was created which expanded to 'SPL_', 'TPL_' or nothing. Later it was updated to support 'VPL_' as well. This series starts a change in terminology and usage to resolve the above issues: - The word 'xPL' is used instead of 'SPL' to mean a non-proper build - A new CONFIG_XPL_BUILD define indicates that the current build is an 'xPL' build - The existing CONFIG_SPL_BUILD is changed to mean SPL; it is not now defined for TPL and VPL phases - The existing SPL_ Makefile variable is renamed to SPL_ - The existing SPL_TPL Makefile variable is renamed to PHASE_ It should be noted that xpl_phase() can generally be used instead of the above CONFIGs without a code-space or run-time penalty. This series does not attempt to convert all of U-Boot to use this new terminology but it makes a start. In particular, renaming spl.h and common/spl seems like a bridge too far at this point. The series is fully bisectable. It has also been checked to ensure there are no code-size changes on any commit.
2024-10-11global: Rename SPL_TPL_ to PHASE_Simon Glass
Use PHASE_ as the symbol to select a particular XPL build. This means that SPL_TPL_ is no-longer set. Update the comment in bootstage to refer to this symbol, instead of SPL_ Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11drivers: Use CONFIG_XPL_BUILD instead of CONFIG_SPL_BUILDSimon Glass
Use the new symbol to refer to any 'SPL' build, including TPL and VPL Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_in_proper() to not_xpl()Simon Glass
Give this function a slightly easier name. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-11xpl: Rename spl_phase() to xpl_phase()Simon Glass
Rename this function to indicate that it refers to any xPL phase. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-03Merge patch series "vbe: Series part D"Tom Rini
Simon Glass <sjg@chromium.org> says: This includes various patches towards implementing the VBE abrec bootmeth in U-Boot.
2024-10-03ram: Support driver model in VPLSimon Glass
Some boards want to use RAM in VPL so add an option for that. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-30Merge tag 'v2024.10-rc6' into nextTom Rini
Prepare v2024.10-rc6
2024-09-24ram: k3-ddrss: Handle error properly in lpddr4_startUdit Kumar
In lpddr4_start function error returned by lpddr4_enablepiinitiator may go undetected due to overwrite of return code. Add support to handle error in above case. Reported-by: Andreas Dannenberg <dannenberg@ti.com> Signed-off-by: Udit Kumar <u-kumar1@ti.com> Reviewed-by: Bryan Brattlof <bb@ti.com>
2024-09-11ram: ast2700: Add DRAM controller initializationChia-Wei Wang
Add driver for AST2700 to initialize DRAM in SPL. This patch also refactors the Kconfig dependency of Aspeed DRAM drivers as some of them are shared among the file structures of RV and ARM ISAs. Signed-off-by: Chia-Wei Wang <chiawei_wang@aspeedtech.com> Acked-by: Leo Yu-Chi Liang <ycliang@andestech.com>
2024-08-05rockchip: Avoid #ifdefs in RK3399 SPLSimon Glass
The code here is confusing due to large blocks which are #ifdefed out. Add a function phase_sdram_init() which returns whether SDRAM init should happen in the current phase, using that as needed to control the code flow. This increases code size by about 500 bytes in SPL when the cache is on, since it must call the rather large rockchip_sdram_size() function. Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-05rockchip: Ensure memory size is available in RK3399 SPLSimon Glass
At present gd->ram_size is 0 in SPL, meaning that it is not possible to enable the cache. Correct this by always populating the RAM size correctly. This increases code size by about 500 bytes in SPL, since it must call the rather large rockchip_sdram_size() function. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2024-07-22drivers: ram: Remove duplicate newlinesMarek Vasut
Drop all duplicate newlines. No functional change. Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2024-06-19ram: k3-ddrss: Enable the am62ax's DDR controller for J722SJayesh Choudhary
The J722S family of SoCs uses the same DDR controller as found on the AM62A family. Enable this option when building for the J722S family. Signed-off-by: Vaishnav Achath <vaishnav.a@ti.com> Signed-off-by: Jayesh Choudhary <j-choudhary@ti.com> Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-07ram: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Signed-off-by: Tom Rini <trini@konsulko.com>
2024-04-26rockchip: rk3308: Move cru and grf include files to arch-rockchipJonas Karlman
Move cru_rk3308.h and grf_rk3308.h to arch-rockchip to match path used for all other Rockchip SoCs. Signed-off-by: Jonas Karlman <jonas@kwiboo.se> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2024-03-15Merge tag 'u-boot-rockchip-20240315' of ↵Tom Rini
https://source.denx.de/u-boot/custodians/u-boot-rockchip into next Please pull the updates for rockchip platform: - Add board: rk3588 Generic, Cool Pi CM5, Theobroma-Systems RK3588 Jaguar SBC, Toybrick TB-RK3588X; rk3588s Cool Pi 4B; rk3566 Pine64 PineTab2; - Add saradc v2 support; - Add PMIC RK806 support; - rk3588 disable force_jtag by default; - Migrate to use IO-domain driver for all boards; - Use common bss and stack addresses for rk33xx and rk35xx boards; - Other updates for driver, config and dts;
2024-03-13ram: k3-ddrss: enable the am62ax's DDR controller for am62pxBryan Brattlof
The am62px family of SoCs uses the same DDR controller as found on the am62ax family. Enable this option when building for the am62px family Reviewed-by: Neha Malcom Francis <n-francis@ti.com> Signed-off-by: Bryan Brattlof <bb@ti.com>
2024-03-13rockchip: include asm/io.h directly in asm/arch-rockchip/hardware.hQuentin Schulz
The different macros use writel which is defined in asm/io.h, so let's include the header so users of hardware.h do not need to include asm/io.h as well. While at it, remove asm/io.h includes wherever asm/arch-rockchip/hardware.h is included already. Cc: Quentin Schulz <foss+uboot@0leil.net> Reviewed-by: Kever Yang <kever.yang@rock-chips.com> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>