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
8 #include <linux/autoconf.h>
9 #include <linux/init.h>
10 #include <linux/device.h>
11 #include <linux/platform_device.h>
13 #include <asm/reboot.h>
17 #define ADM5120_SOFTRESET 0x12000004
18 #define STATUS_IE 0x00000001
19 #define ALLINTS (IE_IRQ0 | IE_IRQ5 | STATUS_IE)
21 #define ADM5120_CODEREG 0x12000000
22 #define ADM5120_CPU_CLK_MASK 0x00300000
23 #define ADM5120_CPU_CLK_175 0x00000000
24 #define ADM5120_CPU_CLK_200 0x00100000
25 #define ADM5120_CPU_CLK_225 0x00200000
26 #define ADM5120_CPU_CLK_250 0x00300000
28 void mips_time_init(void);
30 extern unsigned int mips_counter_frequency
;
32 void adm5120_restart(char *command
)
34 *(u32
*)KSEG1ADDR(ADM5120_SOFTRESET
)=1;
38 void adm5120_halt(void)
40 printk(KERN_NOTICE
"\n** You can safely turn off the power\n");
45 void adm5120_power_off(void)
50 void __init
mips_time_init(void)
54 clock
= *(u32
*)KSEG1ADDR(ADM5120_CODEREG
);
56 switch (clock
& ADM5120_CPU_CLK_MASK
) {
57 case ADM5120_CPU_CLK_175
:
58 mips_counter_frequency
= 87500000;
59 printk("CPU clock: 175MHz\n");
61 case ADM5120_CPU_CLK_200
:
62 mips_counter_frequency
= 100000000;
63 printk("CPU clock: 200MHz\n");
65 case ADM5120_CPU_CLK_225
:
66 mips_counter_frequency
= 112500000;
67 printk("CPU clock: 225MHz\n");
69 case ADM5120_CPU_CLK_250
:
70 mips_counter_frequency
= 125000000;
71 printk("CPU clock: 250MHz\n");
76 void __init
plat_timer_setup(struct irqaction
*irq
)
78 /* to generate the first timer interrupt */
79 write_c0_compare(read_c0_count()+ mips_counter_frequency
/HZ
);
80 clear_c0_status(ST0_BEV
);
81 set_c0_status(ALLINTS
);
84 void __init
plat_mem_setup(void)
86 printk(KERN_INFO
"ADM5120 board setup\n");
88 board_time_init
= mips_time_init
;
89 //board_timer_setup = mips_timer_setup;
91 _machine_restart
= adm5120_restart
;
92 _machine_halt
= adm5120_halt
;
93 pm_power_off
= adm5120_power_off
;
95 set_io_port_base(KSEG1
);
98 const char *get_system_type(void)
100 return "ADM5120 Board";
103 static struct resource adm5120_hcd_resources
[] = {
107 .flags
= IORESOURCE_MEM
,
112 .flags
= IORESOURCE_IRQ
,
116 static struct platform_device adm5120hcd_device
= {
117 .name
= "adm5120-hcd",
119 .num_resources
= ARRAY_SIZE(adm5120_hcd_resources
),
120 .resource
= adm5120_hcd_resources
,
123 static struct platform_device
*devices
[] __initdata
= {
127 static int __init
adm5120_init(void)
129 return platform_add_devices(devices
, ARRAY_SIZE(devices
));
132 subsys_initcall(adm5120_init
);