OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * ADM5120 specific setup |
||
3 | * |
||
4 | * Copyright (C) 2007-2009 Gabor Juhos <juhosg@openwrt.org> |
||
5 | * |
||
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) |
||
9 | * |
||
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 |
||
13 | * |
||
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. |
||
17 | * |
||
18 | */ |
||
19 | |||
20 | #include <linux/init.h> |
||
21 | #include <linux/kernel.h> |
||
22 | #include <linux/io.h> |
||
23 | #include <linux/reboot.h> |
||
24 | #include <linux/time.h> |
||
25 | |||
26 | #include <asm/reboot.h> |
||
27 | #include <asm/time.h> |
||
28 | #include <asm/bootinfo.h> |
||
29 | #include <asm/mips_machine.h> |
||
30 | #include <asm/idle.h> |
||
31 | |||
32 | #include <asm/mach-adm5120/adm5120_info.h> |
||
33 | #include <asm/mach-adm5120/adm5120_defs.h> |
||
34 | #include <asm/mach-adm5120/adm5120_switch.h> |
||
35 | #include <asm/mach-adm5120/adm5120_platform.h> |
||
36 | |||
37 | #define ADM5120_SYS_TYPE_LEN 64 |
||
38 | |||
39 | unsigned char adm5120_sys_type[ADM5120_SYS_TYPE_LEN]; |
||
40 | void (*adm5120_board_reset)(void); |
||
41 | |||
42 | static char *prom_names[ADM5120_PROM_LAST+1] __initdata = { |
||
43 | [ADM5120_PROM_GENERIC] = "Generic", |
||
44 | [ADM5120_PROM_CFE] = "CFE", |
||
45 | [ADM5120_PROM_UBOOT] = "U-Boot", |
||
46 | [ADM5120_PROM_MYLOADER] = "MyLoader", |
||
47 | [ADM5120_PROM_ROUTERBOOT] = "RouterBOOT", |
||
48 | [ADM5120_PROM_BOOTBASE] = "Bootbase" |
||
49 | }; |
||
50 | |||
51 | static void __init adm5120_report(void) |
||
52 | { |
||
53 | printk(KERN_INFO "SoC : %s\n", adm5120_sys_type); |
||
54 | printk(KERN_INFO "Bootdev : %s flash\n", |
||
55 | adm5120_nand_boot ? "NAND" : "NOR"); |
||
56 | printk(KERN_INFO "Prom : %s\n", prom_names[adm5120_prom_type]); |
||
57 | } |
||
58 | |||
59 | const char *get_system_type(void) |
||
60 | { |
||
61 | return adm5120_sys_type; |
||
62 | } |
||
63 | |||
64 | static void adm5120_restart(char *command) |
||
65 | { |
||
66 | /* TODO: stop switch before reset */ |
||
67 | |||
68 | if (adm5120_board_reset) |
||
69 | adm5120_board_reset(); |
||
70 | |||
71 | SW_WRITE_REG(SWITCH_REG_SOFT_RESET, 1); |
||
72 | } |
||
73 | |||
74 | static void adm5120_halt(void) |
||
75 | { |
||
76 | local_irq_disable(); |
||
77 | |||
78 | while (1) { |
||
79 | if (cpu_wait) |
||
80 | cpu_wait(); |
||
81 | } |
||
82 | } |
||
83 | |||
84 | void __init plat_time_init(void) |
||
85 | { |
||
86 | mips_hpt_frequency = adm5120_speed / 2; |
||
87 | } |
||
88 | |||
89 | void __init plat_mem_setup(void) |
||
90 | { |
||
91 | adm5120_soc_init(); |
||
92 | adm5120_mem_init(); |
||
93 | |||
94 | sprintf(adm5120_sys_type, "ADM%04X%s rev %u, running at %lu.%03lu MHz", |
||
95 | adm5120_product_code, |
||
96 | adm5120_package_bga() ? "" : "P", |
||
97 | adm5120_revision, |
||
98 | (adm5120_speed / 1000000), (adm5120_speed / 1000) % 1000); |
||
99 | |||
100 | adm5120_report(); |
||
101 | |||
102 | _machine_restart = adm5120_restart; |
||
103 | _machine_halt = adm5120_halt; |
||
104 | pm_power_off = adm5120_halt; |
||
105 | |||
106 | set_io_port_base(KSEG1); |
||
107 | } |
||
108 | |||
109 | static int __init adm5120_board_setup(void) |
||
110 | { |
||
111 | adm5120_gpio_init(); |
||
112 | |||
113 | mips_machine_setup(); |
||
114 | |||
115 | return 0; |
||
116 | } |
||
117 | arch_initcall(adm5120_board_setup); |
||
118 | |||
119 | static void __init adm5120_generic_board_setup(void) |
||
120 | { |
||
121 | adm5120_add_device_uart(0); |
||
122 | adm5120_add_device_uart(1); |
||
123 | |||
124 | adm5120_add_device_flash(0); |
||
125 | adm5120_add_device_switch(6, NULL); |
||
126 | } |
||
127 | |||
128 | MIPS_MACHINE(MACH_ADM5120_GENERIC, "Generic", "Generic ADM5120 board", |
||
129 | adm5120_generic_board_setup); |