xref: /OK3568_Linux_fs/kernel/arch/mips/include/asm/yamon-dt.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (C) 2016 Imagination Technologies
4*4882a593Smuzhiyun  * Author: Paul Burton <paul.burton@mips.com>
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef __MIPS_ASM_YAMON_DT_H__
8*4882a593Smuzhiyun #define __MIPS_ASM_YAMON_DT_H__
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include <linux/types.h>
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun /**
13*4882a593Smuzhiyun  * struct yamon_mem_region - Represents a contiguous range of physical RAM.
14*4882a593Smuzhiyun  * @start:	Start physical address.
15*4882a593Smuzhiyun  * @size:	Maximum size of region.
16*4882a593Smuzhiyun  * @discard:	Length of additional memory to discard after the region.
17*4882a593Smuzhiyun  */
18*4882a593Smuzhiyun struct yamon_mem_region {
19*4882a593Smuzhiyun 	phys_addr_t	start;
20*4882a593Smuzhiyun 	phys_addr_t	size;
21*4882a593Smuzhiyun 	phys_addr_t	discard;
22*4882a593Smuzhiyun };
23*4882a593Smuzhiyun 
24*4882a593Smuzhiyun /**
25*4882a593Smuzhiyun  * yamon_dt_append_cmdline() - Append YAMON-provided command line to /chosen
26*4882a593Smuzhiyun  * @fdt: the FDT blob
27*4882a593Smuzhiyun  *
28*4882a593Smuzhiyun  * Write the YAMON-provided command line to the bootargs property of the
29*4882a593Smuzhiyun  * /chosen node in @fdt.
30*4882a593Smuzhiyun  *
31*4882a593Smuzhiyun  * Return: 0 on success, else -errno
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun extern __init int yamon_dt_append_cmdline(void *fdt);
34*4882a593Smuzhiyun 
35*4882a593Smuzhiyun /**
36*4882a593Smuzhiyun  * yamon_dt_append_memory() - Append YAMON-provided memory info to /memory
37*4882a593Smuzhiyun  * @fdt:	the FDT blob
38*4882a593Smuzhiyun  * @regions:	zero size terminated array of physical memory regions
39*4882a593Smuzhiyun  *
40*4882a593Smuzhiyun  * Generate a /memory node in @fdt based upon memory size information provided
41*4882a593Smuzhiyun  * by YAMON in its environment and the @regions array.
42*4882a593Smuzhiyun  *
43*4882a593Smuzhiyun  * Return: 0 on success, else -errno
44*4882a593Smuzhiyun  */
45*4882a593Smuzhiyun extern __init int yamon_dt_append_memory(void *fdt,
46*4882a593Smuzhiyun 					const struct yamon_mem_region *regions);
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun /**
49*4882a593Smuzhiyun  * yamon_dt_serial_config() - Append YAMON-provided serial config to /chosen
50*4882a593Smuzhiyun  * @fdt: the FDT blob
51*4882a593Smuzhiyun  *
52*4882a593Smuzhiyun  * Generate a stdout-path property in the /chosen node of @fdt, based upon
53*4882a593Smuzhiyun  * information provided in the YAMON environment about the UART configuration
54*4882a593Smuzhiyun  * of the system.
55*4882a593Smuzhiyun  *
56*4882a593Smuzhiyun  * Return: 0 on success, else -errno
57*4882a593Smuzhiyun  */
58*4882a593Smuzhiyun extern __init int yamon_dt_serial_config(void *fdt);
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun #endif /* __MIPS_ASM_YAMON_DT_H__ */
61