use common get_system_type function
[openwrt/openwrt.git] / target / linux / ramips / files / arch / mips / ralink / common / setup.c
1 /*
2 * Ralink SoC common setup
3 *
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/io.h>
15
16 #include <asm/bootinfo.h>
17 #include <asm/addrspace.h>
18
19 #include <asm/mach-ralink/common.h>
20 #include <ralink_soc.h>
21
22 unsigned char ramips_sys_type[RAMIPS_SYS_TYPE_LEN];
23
24 const char *get_system_type(void)
25 {
26 return ramips_sys_type;
27 }
28
29 static void __init detect_mem_size(void)
30 {
31 unsigned long size;
32
33 for (size = RALINK_SOC_MEM_SIZE_MIN; size < RALINK_SOC_MEM_SIZE_MAX;
34 size <<= 1 ) {
35 if (!memcmp(detect_mem_size,
36 detect_mem_size + size, 1024))
37 break;
38 }
39
40 add_memory_region(RALINK_SOC_SDRAM_BASE, size, BOOT_MEM_RAM);
41 }
42
43 void __init plat_mem_setup(void)
44 {
45 set_io_port_base(KSEG1);
46
47 detect_mem_size();
48 ramips_soc_setup();
49 }