b33c483d241fa211fd746d91799f28d34952f1eb
[openwrt/staging/chunkeey.git] / target / linux / adm8668 / files-3.14 / arch / mips / adm8668 / setup.c
1 #include <linux/init.h>
2 #include <linux/reboot.h>
3
4 #include <asm/reboot.h>
5 #include <adm8668.h>
6
7 static void adm8668_restart(char *cmd)
8 {
9 int i;
10
11 /* the real deal */
12 for (i = 0; i < 1000; i++)
13 ;
14 ADM8668_CONFIG_REG(ADM8668_CR1) = 1;
15 }
16
17 void __init plat_mem_setup(void)
18 {
19 _machine_restart = adm8668_restart;
20 }
21
22 const char *get_system_type(void)
23 {
24 unsigned long chipid = ADM8668_CONFIG_REG(ADM8668_CR0);
25 int product, revision;
26 static char ret[32];
27
28 product = chipid >> 16;
29 revision = chipid & 0xffff;
30
31 /* i getting fancy :\ */
32 snprintf(ret, sizeof(ret), "ADM%xr%x", product, revision);
33
34 return ret;
35 }
36