Fix .21 compilation on memory.c (#1778)
[openwrt.git] / target / linux / adm5120-2.6 / files / arch / mips / adm5120 / setup.c
1 /*
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
7 */
8
9 #include <linux/autoconf.h>
10 #include <linux/init.h>
11 #include <linux/device.h>
12 #include <linux/platform_device.h>
13
14 #include <asm/reboot.h>
15 #include <asm/io.h>
16 #include <asm/time.h>
17
18 #include <adm5120_info.h>
19
20 #define ADM5120_SOFTRESET 0x12000004
21 #define STATUS_IE 0x00000001
22 #define ALLINTS (IE_IRQ0 | IE_IRQ5 | STATUS_IE)
23
24 void mips_time_init(void);
25
26 extern unsigned int mips_counter_frequency;
27
28 void adm5120_restart(char *command)
29 {
30 *(u32*)KSEG1ADDR(ADM5120_SOFTRESET)=1;
31 }
32
33
34 void adm5120_halt(void)
35 {
36 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
37 while (1);
38 }
39
40
41 void adm5120_power_off(void)
42 {
43 adm5120_halt();
44 }
45
46 void __init adm5120_time_init(void)
47 {
48 mips_counter_frequency = adm5120_speed >> 1;
49 }
50
51 void __init plat_timer_setup(struct irqaction *irq)
52 {
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);
57 }
58
59 void __init plat_mem_setup(void)
60 {
61 printk(KERN_INFO "ADM5120 board setup\n");
62
63 board_time_init = adm5120_time_init;
64 //board_timer_setup = mips_timer_setup;
65
66 _machine_restart = adm5120_restart;
67 _machine_halt = adm5120_halt;
68 pm_power_off = adm5120_power_off;
69
70 set_io_port_base(KSEG1);
71 }
72
73 const char *get_system_type(void)
74 {
75 return adm5120_board_name();
76 }
77
78 static struct resource adm5120_hcd_resources[] = {
79 [0] = {
80 .start = 0x11200000,
81 .end = 0x11200084,
82 .flags = IORESOURCE_MEM,
83 },
84 [1] = {
85 .start = 0x3,
86 .end = 0x3,
87 .flags = IORESOURCE_IRQ,
88 },
89 };
90
91 static struct platform_device adm5120hcd_device = {
92 .name = "adm5120-hcd",
93 .id = -1,
94 .num_resources = ARRAY_SIZE(adm5120_hcd_resources),
95 .resource = adm5120_hcd_resources,
96 };
97
98 static struct platform_device *devices[] __initdata = {
99 &adm5120hcd_device,
100 };
101
102 static int __init adm5120_init(void)
103 {
104 return platform_add_devices(devices, ARRAY_SIZE(devices));
105 }
106
107 subsys_initcall(adm5120_init);
This page took 0.0507069999999999 seconds and 5 git commands to generate.