mirror of
https://github.com/torvalds/linux.git
synced 2024-11-15 00:21:59 +00:00
2874c5fd28
Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license as published by the free software foundation either version 2 of the license or at your option any later version extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 3029 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
74 lines
1.8 KiB
C
74 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
/*
|
|
* Copyright 2010 Ben. Herrenschmidt, IBM Corporation.
|
|
*
|
|
* Based on earlier code:
|
|
* Copyright (C) Paul Mackerras 1997.
|
|
*
|
|
* Matt Porter <mporter@kernel.crashing.org>
|
|
* Copyright 2002-2005 MontaVista Software Inc.
|
|
*
|
|
* Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
|
|
* Copyright (c) 2003, 2004 Zultys Technologies
|
|
*
|
|
* Copyright 2007 David Gibson, IBM Corporation.
|
|
*/
|
|
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
#include "types.h"
|
|
#include "elf.h"
|
|
#include "string.h"
|
|
#include "stdio.h"
|
|
#include "page.h"
|
|
#include "ops.h"
|
|
#include "reg.h"
|
|
#include "io.h"
|
|
#include "dcr.h"
|
|
#include "4xx.h"
|
|
#include "44x.h"
|
|
#include "libfdt.h"
|
|
|
|
BSS_STACK(4096);
|
|
|
|
static u32 ibm4xx_memstart;
|
|
|
|
static void iss_4xx_fixups(void)
|
|
{
|
|
void *memory;
|
|
u32 reg[3];
|
|
|
|
memory = finddevice("/memory");
|
|
if (!memory)
|
|
fatal("Can't find memory node\n");
|
|
/* This assumes #address-cells = 2, #size-cells =1 and that */
|
|
getprop(memory, "reg", reg, sizeof(reg));
|
|
if (reg[2])
|
|
/* If the device tree specifies the memory range, use it */
|
|
ibm4xx_memstart = reg[1];
|
|
else
|
|
/* othersize, read it from the SDRAM controller */
|
|
ibm4xx_sdram_fixup_memsize();
|
|
}
|
|
|
|
static void *iss_4xx_vmlinux_alloc(unsigned long size)
|
|
{
|
|
return (void *)ibm4xx_memstart;
|
|
}
|
|
|
|
#define SPRN_PIR 0x11E /* Processor Identification Register */
|
|
void platform_init(void)
|
|
{
|
|
unsigned long end_of_ram = 0x08000000;
|
|
unsigned long avail_ram = end_of_ram - (unsigned long)_end;
|
|
u32 pir_reg;
|
|
|
|
simple_alloc_init(_end, avail_ram, 128, 64);
|
|
platform_ops.fixups = iss_4xx_fixups;
|
|
platform_ops.vmlinux_alloc = iss_4xx_vmlinux_alloc;
|
|
platform_ops.exit = ibm44x_dbcr_reset;
|
|
pir_reg = mfspr(SPRN_PIR);
|
|
fdt_set_boot_cpuid_phys(_dtb_start, pir_reg);
|
|
fdt_init(_dtb_start);
|
|
serial_console_init();
|
|
}
|