summaryrefslogtreecommitdiffstats
path: root/arch/mips/lantiq/setup.c
blob: 1ff6c9d6cb93eb6e21109f9a8c0a3f3941cba4a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/*
 *  This program is free software; you can redistribute it and/or modify it
 *  under the terms of the GNU General Public License version 2 as published
 *  by the Free Software Foundation.
 *
 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
 */

#include <linux/kernel.h>
#include <linux/export.h>
#include <linux/io.h>
#include <linux/ioport.h>
#include <asm/bootinfo.h>

#include <lantiq_soc.h>

#include "machtypes.h"
#include "devices.h"
#include "prom.h"

void __init plat_mem_setup(void)
{
	/* assume 16M as default incase uboot fails to pass proper ramsize */
	unsigned long memsize = 16;
	char **envp = (char **) KSEG1ADDR(fw_arg2);

	ioport_resource.start = IOPORT_RESOURCE_START;
	ioport_resource.end = IOPORT_RESOURCE_END;
	iomem_resource.start = IOMEM_RESOURCE_START;
	iomem_resource.end = IOMEM_RESOURCE_END;

	set_io_port_base((unsigned long) KSEG1);

	while (*envp) {
		char *e = (char *)KSEG1ADDR(*envp);
		if (!strncmp(e, "memsize=", 8)) {
			e += 8;
			if (strict_strtoul(e, 0, &memsize))
				pr_warn("bad memsize specified\n");
		}
		envp++;
	}
	memsize *= 1024 * 1024;
	add_memory_region(0x00000000, memsize, BOOT_MEM_RAM);
}

static int __init
lantiq_setup(void)
{
	ltq_soc_setup();
	mips_machine_setup();
	return 0;
}

arch_initcall(lantiq_setup);

static void __init
lantiq_generic_init(void)
{
	/* Nothing to do */
}

MIPS_MACHINE(LTQ_MACH_GENERIC,
	     "Generic",
	     "Generic Lantiq based board",
	     lantiq_generic_init);