1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2007 Felix Fietkau <nbd@openwrt.org>
4 * Copyright (C) 2007 Eugene Konev <ejka@openwrt.org>
6 #include <linux/memblock.h>
7 #include <linux/init.h>
10 #include <linux/proc_fs.h>
11 #include <linux/string.h>
12 #include <linux/swap.h>
14 #include <asm/bootinfo.h>
16 #include <asm/sections.h>
18 #include <asm/mach-ar7/ar7.h>
20 static int __init
memsize(void)
22 u32 size
= (64 << 20);
23 u32
*addr
= (u32
*)KSEG1ADDR(AR7_SDRAM_BASE
+ size
- 4);
24 u32
*kernel_end
= (u32
*)KSEG1ADDR(CPHYSADDR((u32
)&_end
));
27 while (tmpaddr
> kernel_end
) {
28 *tmpaddr
= (u32
)tmpaddr
;
35 if (*tmpaddr
!= (u32
)tmpaddr
)
38 } while (size
< (64 << 20));
40 writel((u32
)tmpaddr
, &addr
);
45 void __init
prom_meminit(void)
49 pages
= memsize() >> PAGE_SHIFT
;
50 add_memory_region(PHYS_OFFSET
, pages
<< PAGE_SHIFT
, BOOT_MEM_RAM
);
53 void __init
prom_free_prom_memory(void)