9046057f9fe76120a015731420ad86e9694e01e9
[15.05/openwrt.git] / target / linux / adm5120 / files / arch / mips / adm5120 / setup.c
1 /*
2  *  $Id$
3  *
4  *  ADM5120 specific setup
5  *
6  *  Copyright (C) 2007 OpenWrt.org
7  *  Copyright (C) 2007 Gabor Juhos <juhosg at openwrt.org>
8  *
9  *  This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel
10  *  done by Jeroen Vreeken
11  *      Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
12  *
13  *  Jeroen's code was based on the Linux 2.4.xx source codes found in various
14  *  tarballs released by Edimax for it's ADM5120 based devices
15  *      Copyright (C) ADMtek Incorporated
16  *
17  *  This program is free software; you can redistribute it and/or modify it
18  *  under the terms of the GNU General Public License version 2 as published
19  *  by the Free Software Foundation.
20  *
21  */
22
23 #include <linux/init.h>
24 #include <linux/kernel.h>
25 #include <linux/io.h>
26 #include <linux/version.h>
27
28 #include <asm/reboot.h>
29 #include <asm/time.h>
30
31 #include <adm5120_info.h>
32 #include <adm5120_defs.h>
33 #include <adm5120_switch.h>
34 #include <adm5120_board.h>
35
36 static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
37         [ADM5120_PROM_GENERIC]          = "Generic",
38         [ADM5120_PROM_CFE]              = "CFE",
39         [ADM5120_PROM_UBOOT]            = "U-Boot",
40         [ADM5120_PROM_MYLOADER]         = "MyLoader",
41         [ADM5120_PROM_ROUTERBOOT]       = "RouterBOOT",
42         [ADM5120_PROM_BOOTBASE]         = "Bootbase"
43 };
44
45 static void __init adm5120_report(void)
46 {
47         printk(KERN_INFO "SoC      : ADM%04X%s revision %d, running "
48                 "at %ldMHz\n",
49                 adm5120_product_code,
50                 adm5120_package_bga() ? "" : "P",
51                 adm5120_revision, (adm5120_speed / 1000000));
52         printk(KERN_INFO "Bootdev  : %s flash\n",
53                 adm5120_nand_boot ? "NAND":"NOR");
54         printk(KERN_INFO "Prom     : %s\n", prom_names[adm5120_prom_type]);
55 }
56
57 void __init plat_mem_setup(void)
58 {
59         adm5120_soc_init();
60         adm5120_mem_init();
61         adm5120_report();
62
63 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24))
64 extern void plat_time_init(void) __init;
65         board_time_init = plat_time_init;
66 #endif
67
68         _machine_restart = adm5120_restart;
69         _machine_halt = adm5120_halt;
70         pm_power_off = adm5120_halt;
71
72         set_io_port_base(KSEG1);
73 }