blob: f1c605ab80816476cf11b7cdcf693d9e554f5786 [file] [log] [blame]
John Crispin171bb2f2011-03-30 09:27:47 +02001/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
5 *
6 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7 */
8
9#include <linux/kernel.h>
John Crispin4af92e72011-11-10 21:33:07 +010010#include <linux/export.h>
John Crispin171bb2f2011-03-30 09:27:47 +020011#include <linux/io.h>
12#include <linux/ioport.h>
13#include <asm/bootinfo.h>
14
15#include <lantiq_soc.h>
16
John Crispina053ac12011-03-30 09:27:54 +020017#include "prom.h"
18
John Crispin171bb2f2011-03-30 09:27:47 +020019void __init plat_mem_setup(void)
20{
21 /* assume 16M as default incase uboot fails to pass proper ramsize */
22 unsigned long memsize = 16;
23 char **envp = (char **) KSEG1ADDR(fw_arg2);
24
25 ioport_resource.start = IOPORT_RESOURCE_START;
26 ioport_resource.end = IOPORT_RESOURCE_END;
27 iomem_resource.start = IOMEM_RESOURCE_START;
28 iomem_resource.end = IOMEM_RESOURCE_END;
29
30 set_io_port_base((unsigned long) KSEG1);
31
32 while (*envp) {
33 char *e = (char *)KSEG1ADDR(*envp);
34 if (!strncmp(e, "memsize=", 8)) {
35 e += 8;
36 if (strict_strtoul(e, 0, &memsize))
37 pr_warn("bad memsize specified\n");
38 }
39 envp++;
40 }
41 memsize *= 1024 * 1024;
42 add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
43}