1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright 2010 Ben. Herrenschmidt, IBM Corporation.
5 * Based on earlier code:
6 * Copyright (C) Paul Mackerras 1997.
8 * Matt Porter <mporter@kernel.crashing.org>
9 * Copyright 2002-2005 MontaVista Software Inc.
11 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
12 * Copyright (c) 2003, 2004 Zultys Technologies
14 * Copyright 2007 David Gibson, IBM Corporation.
33 static u32 ibm4xx_memstart
;
35 static void iss_4xx_fixups(void)
40 memory
= finddevice("/memory");
42 fatal("Can't find memory node\n");
43 /* This assumes #address-cells = 2, #size-cells =1 and that */
44 getprop(memory
, "reg", reg
, sizeof(reg
));
46 /* If the device tree specifies the memory range, use it */
47 ibm4xx_memstart
= reg
[1];
49 /* othersize, read it from the SDRAM controller */
50 ibm4xx_sdram_fixup_memsize();
53 static void *iss_4xx_vmlinux_alloc(unsigned long size
)
55 return (void *)ibm4xx_memstart
;
58 #define SPRN_PIR 0x11E /* Processor Identification Register */
59 void platform_init(void)
61 unsigned long end_of_ram
= 0x08000000;
62 unsigned long avail_ram
= end_of_ram
- (unsigned long)_end
;
65 simple_alloc_init(_end
, avail_ram
, 128, 64);
66 platform_ops
.fixups
= iss_4xx_fixups
;
67 platform_ops
.vmlinux_alloc
= iss_4xx_vmlinux_alloc
;
68 platform_ops
.exit
= ibm44x_dbcr_reset
;
69 pir_reg
= mfspr(SPRN_PIR
);
70 fdt_set_boot_cpuid_phys(_dtb_start
, pir_reg
);
72 serial_console_init();