2 * ADM5120 generic board code
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
12 #include <linux/init.h>
13 #include <linux/kernel.h>
14 #include <linux/list.h>
15 #include <linux/device.h>
16 #include <linux/platform_device.h>
18 #include <asm/bootinfo.h>
20 #include <asm/mach-adm5120/adm5120_info.h>
21 #include <asm/mach-adm5120/adm5120_defs.h>
22 #include <asm/mach-adm5120/adm5120_irq.h>
23 #include <asm/mach-adm5120/adm5120_board.h>
24 #include <asm/mach-adm5120/adm5120_platform.h>
26 #define PFX "ADM5120: "
28 static struct list_head adm5120_boards __initdata
=
29 LIST_HEAD_INIT(adm5120_boards
);
31 static char adm5120_board_name
[ADM5120_BOARD_NAMELEN
] = "Unknown board";
33 const char *get_system_type(void)
35 return adm5120_board_name
;
38 static struct adm5120_board
* __init
adm5120_board_find(unsigned long machtype
)
40 struct list_head
*this;
42 list_for_each(this, &adm5120_boards
) {
43 struct adm5120_board
*board
;
45 board
= list_entry(this, struct adm5120_board
, list
);
46 if (board
->mach_type
== machtype
)
53 static int __init
adm5120_board_setup(void)
55 struct adm5120_board
*board
;
57 board
= adm5120_board_find(mips_machtype
);
59 panic(PFX
"no board registered for machtype %lu\n",
63 memcpy(adm5120_board_name
, board
->name
, ADM5120_BOARD_NAMELEN
);
65 printk(KERN_INFO PFX
"board is '%s'\n", board
->name
);
69 adm5120_add_device_uart(0);
70 adm5120_add_device_uart(1);
72 if (board
->board_setup
)
77 arch_initcall(adm5120_board_setup
);
79 void __init
adm5120_board_register(struct adm5120_board
*board
)
81 list_add_tail(&board
->list
, &adm5120_boards
);
84 static void __init
adm5120_generic_board_setup(void)
86 adm5120_add_device_flash(0);
87 adm5120_add_device_switch(6, NULL
);
90 ADM5120_BOARD(MACH_ADM5120_GENERIC
, "Generic ADM5120 board",
91 adm5120_generic_board_setup
);