2 * Copyright (C) ADMtek Incorporated.
3 * Creator : daniell@admtek.com.tw
4 * Copyright 1999, 2000 MIPS Technologies, Inc.
5 * Copyright Jeroen Vreeken (pe1rxq@amsat.org), 2005
6 * Copyright (C) 2007 OpenWrt.org
9 #include <linux/autoconf.h>
10 #include <linux/init.h>
11 #include <linux/device.h>
12 #include <linux/platform_device.h>
14 #include <asm/reboot.h>
18 #include <adm5120_info.h>
20 #define ADM5120_SOFTRESET 0x12000004
21 #define STATUS_IE 0x00000001
22 #define ALLINTS (IE_IRQ0 | IE_IRQ5 | STATUS_IE)
24 void mips_time_init(void);
26 extern unsigned int mips_counter_frequency
;
28 void adm5120_restart(char *command
)
30 *(u32
*)KSEG1ADDR(ADM5120_SOFTRESET
)=1;
34 void adm5120_halt(void)
36 printk(KERN_NOTICE
"\n** You can safely turn off the power\n");
41 void adm5120_power_off(void)
46 void __init
adm5120_time_init(void)
48 mips_counter_frequency
= adm5120_speed
>> 1;
51 void __init
plat_timer_setup(struct irqaction
*irq
)
53 /* to generate the first timer interrupt */
54 write_c0_compare(read_c0_count()+ mips_counter_frequency
/HZ
);
55 clear_c0_status(ST0_BEV
);
56 set_c0_status(ALLINTS
);
59 void __init
plat_mem_setup(void)
61 printk(KERN_INFO
"ADM5120 board setup\n");
63 board_time_init
= adm5120_time_init
;
64 //board_timer_setup = mips_timer_setup;
66 _machine_restart
= adm5120_restart
;
67 _machine_halt
= adm5120_halt
;
68 pm_power_off
= adm5120_power_off
;
70 set_io_port_base(KSEG1
);
73 const char *get_system_type(void)
75 return adm5120_board_name();
78 static struct resource adm5120_hcd_resources
[] = {
82 .flags
= IORESOURCE_MEM
,
87 .flags
= IORESOURCE_IRQ
,
91 static struct platform_device adm5120hcd_device
= {
92 .name
= "adm5120-hcd",
94 .num_resources
= ARRAY_SIZE(adm5120_hcd_resources
),
95 .resource
= adm5120_hcd_resources
,
98 static struct platform_device
*devices
[] __initdata
= {
102 static int __init
adm5120_init(void)
104 return platform_add_devices(devices
, ARRAY_SIZE(devices
));
107 subsys_initcall(adm5120_init
);