IRQ handler rewrite by Gabor Juhos, uses C no longer assembly
[openwrt/svn-archive/archive.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 <asm/mach-adm5120/adm5120_info.h>
19 #include <asm/mach-adm5120/adm5120_defs.h>
20 #include <asm/mach-adm5120/adm5120_irq.h>
21
22 extern void adm5120_time_init(void) __init;
23
24 #define ADM5120_SOFTRESET 0x12000004
25
26 void adm5120_restart(char *command)
27 {
28 *(u32*)KSEG1ADDR(ADM5120_SOFTRESET)=1;
29 }
30
31
32 void adm5120_halt(void)
33 {
34 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
35 while (1);
36 }
37
38
39 void adm5120_power_off(void)
40 {
41 adm5120_halt();
42 }
43
44 void __init plat_mem_setup(void)
45 {
46 printk(KERN_INFO "ADM5120 board setup\n");
47
48 board_time_init = adm5120_time_init;
49
50 _machine_restart = adm5120_restart;
51 _machine_halt = adm5120_halt;
52 pm_power_off = adm5120_power_off;
53
54 set_io_port_base(KSEG1);
55 }
56
57 const char *get_system_type(void)
58 {
59 return adm5120_board_name();
60 }
61
62 static struct resource adm5120_hcd_resources[] = {
63 [0] = {
64 .start = ADM5120_USBC_BASE,
65 .end = ADM5120_USBC_BASE+ADM5120_USBC_SIZE-1,
66 .flags = IORESOURCE_MEM,
67 },
68 [1] = {
69 .start = ADM5120_IRQ_USBC,
70 .end = ADM5120_IRQ_USBC,
71 .flags = IORESOURCE_IRQ,
72 },
73 };
74
75 static struct platform_device adm5120hcd_device = {
76 .name = "adm5120-hcd",
77 .id = -1,
78 .num_resources = ARRAY_SIZE(adm5120_hcd_resources),
79 .resource = adm5120_hcd_resources,
80 };
81
82 static struct platform_device *devices[] __initdata = {
83 &adm5120hcd_device,
84 };
85
86 static int __init adm5120_init(void)
87 {
88 return platform_add_devices(devices, ARRAY_SIZE(devices));
89 }
90
91 subsys_initcall(adm5120_init);