2 #include <linux/init.h>
3 #include <linux/kernel.h>
6 #include <linux/ioport.h>
7 #include <asm/reboot.h>
8 #include <asm/system.h>
10 #include <ifxmips_cgu.h>
12 #define SYSTEM_AR9 "AR9"
13 #define SYSTEM_AR9_CHIPID1 0x00129083
14 #define SYSTEM_AR9_CHIPID2 0x0012B083
16 static unsigned int chiprev
= 0;
17 unsigned char ifxmips_sys_type
[IFXMIPS_SYS_TYPE_LEN
];
20 ifxmips_get_cpu_ver(void)
22 return (ifxmips_r32(IFXMIPS_MPS_CHIPID
) & 0xF0000000) >> 28;
24 EXPORT_SYMBOL(ifxmips_get_cpu_ver
);
29 return ifxmips_sys_type
;
33 ifxmips_machine_restart(char *command
)
35 printk(KERN_NOTICE
"System restart\n");
37 ifxmips_w32(ifxmips_r32(IFXMIPS_RCU_RST
) | IFXMIPS_RCU_RST_ALL
,
43 ifxmips_machine_halt(void)
45 printk(KERN_NOTICE
"System halted.\n");
51 ifxmips_machine_power_off(void)
53 printk(KERN_NOTICE
"Please turn off the power now.\n");
58 static inline u16
get_chip_partnum(void)
60 return (ifxmips_r32(IFXMIPS_MPS_CHIPID
) & 0x0FFFF000) >> 12;
64 ifxmips_soc_setup(void)
66 char *name
= SYSTEM_AR9
;
67 ioport_resource
.start
= IOPORT_RESOURCE_START
;
68 ioport_resource
.end
= IOPORT_RESOURCE_END
;
69 iomem_resource
.start
= IOMEM_RESOURCE_START
;
70 iomem_resource
.end
= IOMEM_RESOURCE_END
;
72 _machine_restart
= ifxmips_machine_restart
;
73 _machine_halt
= ifxmips_machine_halt
;
74 pm_power_off
= ifxmips_machine_power_off
;
76 switch (get_chip_partnum())
94 printk(KERN_ERR
"This is not a AR9 chiprev : 0x%08X\n", get_chip_partnum());
99 snprintf(ifxmips_sys_type
, IFXMIPS_SYS_TYPE_LEN
- 1, "%s rev1.%d %dMhz",
100 name
, ifxmips_get_cpu_ver(),
101 ifxmips_get_cpu_hz() / 1000000);
102 ifxmips_sys_type
[IFXMIPS_SYS_TYPE_LEN
- 1] = '\0';