Manuel Lauss | bd8510d | 2012-09-13 17:44:39 +0200 | [diff] [blame] | 1 | /* |
| 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 | |
| 10 | int __init db1200_board_setup(void); |
| 11 | int __init db1200_dev_setup(void); |
| 12 | int __init db1300_board_setup(void); |
| 13 | int __init db1300_dev_setup(void); |
| 14 | int __init db1550_board_setup(void); |
| 15 | int __init db1550_dev_setup(void); |
Manuel Lauss | 24e8c1a | 2012-09-14 14:47:10 +0200 | [diff] [blame] | 16 | int __init db1550_pci_setup(int); |
Manuel Lauss | bd8510d | 2012-09-13 17:44:39 +0200 | [diff] [blame] | 17 | |
| 18 | static 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 Lauss | 24e8c1a | 2012-09-14 14:47:10 +0200 | [diff] [blame] | 30 | case BCSR_WHOAMI_PB1550_SDR: |
| 31 | case BCSR_WHOAMI_PB1550_DDR: |
| 32 | return "PB1550"; |
Manuel Lauss | bd8510d | 2012-09-13 17:44:39 +0200 | [diff] [blame] | 33 | default: |
| 34 | return "(unknown)"; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | const char *get_system_type(void) |
| 39 | { |
| 40 | return board_type_str(); |
| 41 | } |
| 42 | |
| 43 | void __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 | |
| 65 | int __init db1235_arch_init(void) |
| 66 | { |
Manuel Lauss | 24e8c1a | 2012-09-14 14:47:10 +0200 | [diff] [blame] | 67 | 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 Lauss | bd8510d | 2012-09-13 17:44:39 +0200 | [diff] [blame] | 74 | return 0; |
| 75 | } |
| 76 | arch_initcall(db1235_arch_init); |
| 77 | |
| 78 | int __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 Lauss | 24e8c1a | 2012-09-14 14:47:10 +0200 | [diff] [blame] | 88 | case BCSR_WHOAMI_PB1550_SDR: |
| 89 | case BCSR_WHOAMI_PB1550_DDR: |
Manuel Lauss | bd8510d | 2012-09-13 17:44:39 +0200 | [diff] [blame] | 90 | return db1550_dev_setup(); |
| 91 | } |
| 92 | return 0; |
| 93 | } |
| 94 | device_initcall(db1235_dev_init); |