Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Simon Glass | dbc6e14 | 2016-03-16 07:44:37 -0600 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (c) 2016 Google, Inc |
Simon Glass | dbc6e14 | 2016-03-16 07:44:37 -0600 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | #ifndef __ASM_MRC_COMMON_H |
| 7 | #define __ASM_MRC_COMMON_H |
| 8 | |
| 9 | #include <linux/linkage.h> |
| 10 | |
| 11 | /** |
| 12 | * mrc_common_init() - Set up SDRAM |
| 13 | * |
| 14 | * This calls the memory reference code (MRC) to set up SDRAM |
| 15 | * |
| 16 | * @dev: Northbridge device |
| 17 | * @pei_data: Platform-specific data required by the MRC |
| 18 | * @use_asm_linkage: true if the call to MRC requires asmlinkage, false if it |
| 19 | * uses normal U-Boot calling |
Heinrich Schuchardt | 47b4c02 | 2022-01-19 18:05:50 +0100 | [diff] [blame] | 20 | * Return: 0 if OK, -ve on error |
Simon Glass | dbc6e14 | 2016-03-16 07:44:37 -0600 | [diff] [blame] | 21 | */ |
| 22 | int mrc_common_init(struct udevice *dev, void *pei_data, bool use_asm_linkage); |
| 23 | |
| 24 | asmlinkage void sdram_console_tx_byte(unsigned char byte); |
| 25 | |
| 26 | int mrc_locate_spd(struct udevice *dev, int size, const void **spd_datap); |
| 27 | |
| 28 | void report_memory_config(void); |
| 29 | |
| 30 | /** |
| 31 | * mrc_add_memory_area() - Add a new usable memory area to our list |
| 32 | * |
| 33 | * Note: @start and @end must not span the first 4GB boundary |
| 34 | * |
| 35 | * @info: Place to store memory info |
| 36 | * @start: Start of this memory area |
| 37 | * @end: End of this memory area + 1 |
| 38 | */ |
| 39 | int mrc_add_memory_area(struct memory_info *info, uint64_t start, |
| 40 | uint64_t end); |
| 41 | |
| 42 | /* |
| 43 | * This function looks for the highest region of memory lower than 4GB which |
| 44 | * has enough space for U-Boot where U-Boot is aligned on a page boundary. |
| 45 | * It overrides the default implementation found elsewhere which simply |
| 46 | * picks the end of ram, wherever that may be. The location of the stack, |
| 47 | * the relocation address, and how far U-Boot is moved by relocation are |
| 48 | * set in the global data structure. |
| 49 | */ |
Pali Rohár | 4f4f583 | 2022-09-09 17:32:40 +0200 | [diff] [blame] | 50 | phys_size_t mrc_common_board_get_usable_ram_top(phys_size_t total_size); |
Simon Glass | dbc6e14 | 2016-03-16 07:44:37 -0600 | [diff] [blame] | 51 | |
| 52 | void mrc_common_dram_init_banksize(void); |
| 53 | |
| 54 | #endif |