2 * arch/mips/ifxmips/board.c
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
18 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
22 #include <linux/autoconf.h>
23 #include <linux/init.h>
24 #include <linux/module.h>
25 #include <linux/types.h>
26 #include <linux/string.h>
27 #include <linux/mtd/physmap.h>
28 #include <linux/kernel.h>
29 #include <linux/reboot.h>
30 #include <linux/platform_device.h>
31 #include <asm/bootinfo.h>
32 #include <asm/reboot.h>
36 #include <asm/ifxmips/ifxmips.h>
38 #define MAX_IFXMIPS_DEVS 7
40 #define BOARD_DANUBE "Danube"
41 #define BOARD_DANUBE_CHIPID 0x10129083
43 #define BOARD_TWINPASS "Twinpass"
44 #define BOARD_TWINPASS_CHIPID 0x3012D083
46 #define BOARD_DANUBE "Danube"
48 static unsigned int chiprev
;
50 static struct platform_device
*ifxmips_devs
[MAX_IFXMIPS_DEVS
];
52 static struct platform_device ifxmips_led
[] =
56 .name
= "ifxmips_led",
60 static struct platform_device ifxmips_gpio
[] =
64 .name
= "ifxmips_gpio",
68 static struct platform_device ifxmips_mii
[] =
72 .name
= "ifxmips_mii0",
76 static struct platform_device ifxmips_wdt
[] =
80 .name
= "ifxmips_wdt",
84 static struct physmap_flash_data ifxmips_mtd_data
= {
88 static struct resource ifxmips_mtd_resource
= {
89 .start
= IFXMIPS_FLASH_START
,
90 .end
= IFXMIPS_FLASH_START
+ IFXMIPS_FLASH_MAX
- 1,
91 .flags
= IORESOURCE_MEM
,
94 static struct platform_device ifxmips_mtd
[] =
98 .name
= "ifxmips_mtd",
100 .platform_data
= &ifxmips_mtd_data
,
103 .resource
= &ifxmips_mtd_resource
,
107 #ifdef CONFIG_GPIO_DEVICE
108 static struct resource ifxmips_gpio_dev_resources
[] = {
112 .start
= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12),
113 .end
= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 8) | (1 << 9) | (1 << 12),
117 static struct platform_device ifxmips_gpio_dev
[] = {
121 .num_resources
= ARRAY_SIZE(ifxmips_gpio_dev_resources
),
122 .resource
= ifxmips_gpio_dev_resources
,
128 get_system_type (void)
130 chiprev
= ifxmips_r32(IFXMIPS_MPS_CHIPID
);
133 case BOARD_DANUBE_CHIPID
:
136 case BOARD_TWINPASS_CHIPID
:
137 return BOARD_TWINPASS
;
140 return BOARD_SYSTEM_TYPE
;
143 int __init
ifxmips_init_devices(void)
146 * This is where we detect what chip we are running on
147 * Currently we support 3 chips
149 * 2.) Twinpass (Danube without dsl phy)
154 /* the following devices are generic for all targets */
155 ifxmips_devs
[dev
++] = ifxmips_led
;
156 ifxmips_devs
[dev
++] = ifxmips_gpio
;
157 ifxmips_devs
[dev
++] = ifxmips_mii
;
158 ifxmips_devs
[dev
++] = ifxmips_mtd
;
159 ifxmips_devs
[dev
++] = ifxmips_wdt
;
160 #ifdef CONFIG_GPIO_DEVICE
161 ifxmips_devs
[dev
++] = ifxmips_gpio_dev
;
163 return platform_add_devices(ifxmips_devs
, dev
);
166 arch_initcall(ifxmips_init_devices
);