2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
19 #include <linux/autoconf.h>
20 #include <linux/init.h>
21 #include <linux/module.h>
22 #include <linux/types.h>
23 #include <linux/string.h>
24 #include <linux/mtd/physmap.h>
25 #include <linux/kernel.h>
26 #include <linux/reboot.h>
27 #include <linux/platform_device.h>
28 #include <asm/bootinfo.h>
29 #include <asm/reboot.h>
33 #include <asm/ifxmips/ifxmips.h>
35 #define MAX_IFXMIPS_DEVS 9
37 #define BOARD_DANUBE "Danube"
38 #define BOARD_DANUBE_CHIPID 0x10129083
40 #define BOARD_TWINPASS "Twinpass"
41 #define BOARD_TWINPASS_CHIPID 0x3012D083
43 static unsigned int chiprev
;
44 static struct platform_device
*ifxmips_devs
[MAX_IFXMIPS_DEVS
];
46 spinlock_t ebu_lock
= SPIN_LOCK_UNLOCKED
;
47 EXPORT_SYMBOL_GPL(ebu_lock
);
49 static struct platform_device
54 .name
= "ifxmips_led",
58 static struct platform_device
63 .name
= "ifxmips_gpio",
67 static struct platform_device
72 .name
= "ifxmips_mii0",
76 static struct platform_device
81 .name
= "ifxmips_wdt",
85 static struct physmap_flash_data
90 static struct resource
91 ifxmips_mtd_resource
= {
92 .start
= IFXMIPS_FLASH_START
,
93 .end
= IFXMIPS_FLASH_START
+ IFXMIPS_FLASH_MAX
- 1,
94 .flags
= IORESOURCE_MEM
,
97 static struct platform_device
102 .name
= "ifxmips_mtd",
104 .platform_data
= &ifxmips_mtd_data
,
107 .resource
= &ifxmips_mtd_resource
,
111 #ifdef CONFIG_GPIO_DEVICE
112 static struct resource
113 ifxmips_gpio_dev_resources
[] = {
117 .start
= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) |
118 (1 << 4) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12),
119 .end
= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) |
120 (1 << 4) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12),
124 static struct platform_device
125 ifxmips_gpio_dev
[] = {
129 .num_resources
= ARRAY_SIZE(ifxmips_gpio_dev_resources
),
130 .resource
= ifxmips_gpio_dev_resources
,
136 get_system_type(void)
138 chiprev
= ifxmips_r32(IFXMIPS_MPS_CHIPID
);
141 case BOARD_DANUBE_CHIPID
:
144 case BOARD_TWINPASS_CHIPID
:
145 return BOARD_TWINPASS
;
148 return BOARD_SYSTEM_TYPE
;
152 ifxmips_init_devices(void)
156 ifxmips_devs
[dev
++] = ifxmips_led
;
157 ifxmips_devs
[dev
++] = ifxmips_gpio
;
158 ifxmips_devs
[dev
++] = ifxmips_mii
;
159 ifxmips_devs
[dev
++] = ifxmips_mtd
;
160 ifxmips_devs
[dev
++] = ifxmips_wdt
;
161 #ifdef CONFIG_GPIO_DEVICE
162 ifxmips_devs
[dev
++] = ifxmips_gpio_dev
;
164 return platform_add_devices(ifxmips_devs
, dev
);
167 arch_initcall(ifxmips_init_devices
);