2 * ADM5120 specific setup
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
6 * This code was based on the ADM5120 specific port of the Linux 2.6.10 kernel
7 * done by Jeroen Vreeken
8 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
10 * Jeroen's code was based on the Linux 2.4.xx source codes found in various
11 * tarballs released by Edimax for it's ADM5120 based devices
12 * Copyright (C) ADMtek Incorporated
14 * This program is free software; you can redistribute it and/or modify it
15 * under the terms of the GNU General Public License version 2 as published
16 * by the Free Software Foundation.
20 #include <linux/init.h>
21 #include <linux/kernel.h>
24 #include <asm/reboot.h>
26 #include <asm/mips_machine.h>
28 #include <asm/mach-adm5120/adm5120_info.h>
29 #include <asm/mach-adm5120/adm5120_defs.h>
30 #include <asm/mach-adm5120/adm5120_switch.h>
31 #include <asm/mach-adm5120/adm5120_platform.h>
33 void (*adm5120_board_reset)(void);
35 static char *prom_names[ADM5120_PROM_LAST+1] __initdata = {
36 [ADM5120_PROM_GENERIC] = "Generic",
37 [ADM5120_PROM_CFE] = "CFE",
38 [ADM5120_PROM_UBOOT] = "U-Boot",
39 [ADM5120_PROM_MYLOADER] = "MyLoader",
40 [ADM5120_PROM_ROUTERBOOT] = "RouterBOOT",
41 [ADM5120_PROM_BOOTBASE] = "Bootbase"
44 static void __init adm5120_report(void)
46 printk(KERN_INFO "SoC : ADM%04X%s revision %d, running "
49 adm5120_package_bga() ? "" : "P",
50 adm5120_revision, (adm5120_speed / 1000000));
51 printk(KERN_INFO "Bootdev : %s flash\n",
52 adm5120_nand_boot ? "NAND":"NOR");
53 printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]);
56 const char *get_system_type(void)
58 return mips_machine_name;
61 static void adm5120_restart(char *command)
63 /* TODO: stop switch before reset */
65 if (adm5120_board_reset)
66 adm5120_board_reset();
68 SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1);
71 static void adm5120_halt(void)
81 void __init plat_time_init(void)
83 mips_hpt_frequency = adm5120_speed / 2;
86 void __init plat_mem_setup(void)
92 _machine_restart = adm5120_restart;
93 _machine_halt = adm5120_halt;
94 pm_power_off = adm5120_halt;
96 set_io_port_base(KSEG1);
99 static int __init adm5120_board_setup(void)
103 mips_machine_setup(adm5120_mach_type);
107 arch_initcall(adm5120_board_setup);
109 static void __init adm5120_generic_board_setup(void)
111 adm5120_add_device_uart(0);
112 adm5120_add_device_uart(1);
114 adm5120_add_device_flash(0);
115 adm5120_add_device_switch(6, NULL);
118 MIPS_MACHINE(MACH_ADM5120_GENERIC, "Generic ADM5120 board",
119 adm5120_generic_board_setup);