blob: c76a90f7866427724d74a4df340ab3de9fdf6d9d [file] [log] [blame]
Manuel Laussbd8510d2012-09-13 17:44:39 +02001/*
2 * DB1200/PB1200 / DB1550 / DB1300 board support.
3 *
4 * These 4 boards can reliably be supported in a single kernel image.
5 */
6
7#include <asm/mach-au1x00/au1000.h>
8#include <asm/mach-db1x00/bcsr.h>
9
10int __init db1200_board_setup(void);
11int __init db1200_dev_setup(void);
12int __init db1300_board_setup(void);
13int __init db1300_dev_setup(void);
14int __init db1550_board_setup(void);
15int __init db1550_dev_setup(void);
Manuel Lauss24e8c1a2012-09-14 14:47:10 +020016int __init db1550_pci_setup(int);
Manuel Laussbd8510d2012-09-13 17:44:39 +020017
18static const char *board_type_str(void)
19{
20 switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
21 case BCSR_WHOAMI_PB1200_DDR1:
22 case BCSR_WHOAMI_PB1200_DDR2:
23 return "PB1200";
24 case BCSR_WHOAMI_DB1200:
25 return "DB1200";
26 case BCSR_WHOAMI_DB1300:
27 return "DB1300";
28 case BCSR_WHOAMI_DB1550:
29 return "DB1550";
Manuel Lauss24e8c1a2012-09-14 14:47:10 +020030 case BCSR_WHOAMI_PB1550_SDR:
31 case BCSR_WHOAMI_PB1550_DDR:
32 return "PB1550";
Manuel Laussbd8510d2012-09-13 17:44:39 +020033 default:
34 return "(unknown)";
35 }
36}
37
38const char *get_system_type(void)
39{
40 return board_type_str();
41}
42
43void __init board_setup(void)
44{
45 int ret;
46
47 switch (alchemy_get_cputype()) {
48 case ALCHEMY_CPU_AU1550:
49 ret = db1550_board_setup();
50 break;
51 case ALCHEMY_CPU_AU1200:
52 ret = db1200_board_setup();
53 break;
54 case ALCHEMY_CPU_AU1300:
55 ret = db1300_board_setup();
56 break;
57 default:
58 pr_err("unsupported CPU on board\n");
59 ret = -ENODEV;
60 }
61 if (ret)
62 panic("cannot initialize board support\n");
63}
64
65int __init db1235_arch_init(void)
66{
Manuel Lauss24e8c1a2012-09-14 14:47:10 +020067 int id = BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI));
68 if (id == BCSR_WHOAMI_DB1550)
69 return db1550_pci_setup(0);
70 else if ((id == BCSR_WHOAMI_PB1550_SDR) ||
71 (id == BCSR_WHOAMI_PB1550_DDR))
72 return db1550_pci_setup(1);
73
Manuel Laussbd8510d2012-09-13 17:44:39 +020074 return 0;
75}
76arch_initcall(db1235_arch_init);
77
78int __init db1235_dev_init(void)
79{
80 switch (BCSR_WHOAMI_BOARD(bcsr_read(BCSR_WHOAMI))) {
81 case BCSR_WHOAMI_PB1200_DDR1:
82 case BCSR_WHOAMI_PB1200_DDR2:
83 case BCSR_WHOAMI_DB1200:
84 return db1200_dev_setup();
85 case BCSR_WHOAMI_DB1300:
86 return db1300_dev_setup();
87 case BCSR_WHOAMI_DB1550:
Manuel Lauss24e8c1a2012-09-14 14:47:10 +020088 case BCSR_WHOAMI_PB1550_SDR:
89 case BCSR_WHOAMI_PB1550_DDR:
Manuel Laussbd8510d2012-09-13 17:44:39 +020090 return db1550_dev_setup();
91 }
92 return 0;
93}
94device_initcall(db1235_dev_init);