summaryrefslogtreecommitdiff
path: root/board/toradex/aquila-am69/ddrs_patch.h
blob: 2c79fd03a2a28eaf6aec89c5b768391adc327f00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2025 Toradex - https://www.toradex.com/
 */

#ifndef __AQUILA_AM69_DDRS_PATCH_H
#define __AQUILA_AM69_DDRS_PATCH_H

struct ddr_reg_patch {
	u32 off;
	u32 val;
};

struct ddrss_patch {
	u32 ddr_fhs_cnt;
	struct ddr_reg_patch *ctl_patch;
	u32 ctl_patch_num;
	struct ddr_reg_patch *pi_patch;
	u32 pi_patch_num;
	struct ddr_reg_patch *phy_patch;
	u32 phy_patch_num;
};

/**
 * aquila_am69_fdt_apply_ddr_patch - Apply DDRSS patches to the R5 U-Boot device tree
 * @fdt:         Pointer to the flattened device tree (FDT) blob in memory
 * @ddrss_patch: Array of pointers to DDRSS patch structures (one per controller)
 * @intrlv_size: Value to set for the "intrlv-size" property
 *
 * This function updates the MSMC node in the device tree by setting the
 * "intrlv-size" property and applying DDRSS patches to each of the four
 * memory controller nodes.
 *
 * Returns 0 on success or a negative error code on failure.
 */
int aquila_am69_fdt_apply_ddr_patch(void *fdt, struct ddrss_patch *ddrss_patch[4], u32 intrlv_size);

#endif // __AQUILA_AM69_DDRS_PATCH_H