diff options
Diffstat (limited to 'arch/mips/sibyte/bcm1480/setup.c')
-rw-r--r-- | arch/mips/sibyte/bcm1480/setup.c | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/arch/mips/sibyte/bcm1480/setup.c b/arch/mips/sibyte/bcm1480/setup.c new file mode 100644 index 000000000000..d90a0b87874c --- /dev/null +++ b/arch/mips/sibyte/bcm1480/setup.c | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000,2001,2002,2003,2004 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * | ||
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. | ||
13 | * | ||
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. | ||
17 | */ | ||
18 | #include <linux/config.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/reboot.h> | ||
21 | #include <linux/string.h> | ||
22 | |||
23 | #include <asm/bootinfo.h> | ||
24 | #include <asm/mipsregs.h> | ||
25 | #include <asm/io.h> | ||
26 | #include <asm/sibyte/sb1250.h> | ||
27 | |||
28 | #include <asm/sibyte/bcm1480_regs.h> | ||
29 | #include <asm/sibyte/bcm1480_scd.h> | ||
30 | #include <asm/sibyte/sb1250_scd.h> | ||
31 | |||
32 | unsigned int sb1_pass; | ||
33 | unsigned int soc_pass; | ||
34 | unsigned int soc_type; | ||
35 | unsigned int periph_rev; | ||
36 | unsigned int zbbus_mhz; | ||
37 | |||
38 | static unsigned int part_type; | ||
39 | |||
40 | static char *soc_str; | ||
41 | static char *pass_str; | ||
42 | |||
43 | static inline int setup_bcm1x80_bcm1x55(void); | ||
44 | |||
45 | /* Setup code likely to be common to all SiByte platforms */ | ||
46 | |||
47 | static inline int sys_rev_decode(void) | ||
48 | { | ||
49 | int ret = 0; | ||
50 | |||
51 | switch (soc_type) { | ||
52 | case K_SYS_SOC_TYPE_BCM1x80: | ||
53 | if (part_type == K_SYS_PART_BCM1480) | ||
54 | soc_str = "BCM1480"; | ||
55 | else if (part_type == K_SYS_PART_BCM1280) | ||
56 | soc_str = "BCM1280"; | ||
57 | else | ||
58 | soc_str = "BCM1x80"; | ||
59 | ret = setup_bcm1x80_bcm1x55(); | ||
60 | break; | ||
61 | |||
62 | case K_SYS_SOC_TYPE_BCM1x55: | ||
63 | if (part_type == K_SYS_PART_BCM1455) | ||
64 | soc_str = "BCM1455"; | ||
65 | else if (part_type == K_SYS_PART_BCM1255) | ||
66 | soc_str = "BCM1255"; | ||
67 | else | ||
68 | soc_str = "BCM1x55"; | ||
69 | ret = setup_bcm1x80_bcm1x55(); | ||
70 | break; | ||
71 | |||
72 | default: | ||
73 | prom_printf("Unknown part type %x\n", part_type); | ||
74 | ret = 1; | ||
75 | break; | ||
76 | } | ||
77 | return ret; | ||
78 | } | ||
79 | |||
80 | static inline int setup_bcm1x80_bcm1x55(void) | ||
81 | { | ||
82 | int ret = 0; | ||
83 | |||
84 | switch (soc_pass) { | ||
85 | case K_SYS_REVISION_BCM1480_S0: | ||
86 | periph_rev = 1; | ||
87 | pass_str = "S0 (pass1)"; | ||
88 | break; | ||
89 | case K_SYS_REVISION_BCM1480_A1: | ||
90 | periph_rev = 1; | ||
91 | pass_str = "A1 (pass1)"; | ||
92 | break; | ||
93 | case K_SYS_REVISION_BCM1480_A2: | ||
94 | periph_rev = 1; | ||
95 | pass_str = "A2 (pass1)"; | ||
96 | break; | ||
97 | case K_SYS_REVISION_BCM1480_A3: | ||
98 | periph_rev = 1; | ||
99 | pass_str = "A3 (pass1)"; | ||
100 | break; | ||
101 | case K_SYS_REVISION_BCM1480_B0: | ||
102 | periph_rev = 1; | ||
103 | pass_str = "B0 (pass2)"; | ||
104 | break; | ||
105 | default: | ||
106 | prom_printf("Unknown %s rev %x\n", soc_str, soc_pass); | ||
107 | periph_rev = 1; | ||
108 | pass_str = "Unknown Revision"; | ||
109 | break; | ||
110 | } | ||
111 | return ret; | ||
112 | } | ||
113 | |||
114 | void bcm1480_setup(void) | ||
115 | { | ||
116 | uint64_t sys_rev; | ||
117 | int plldiv; | ||
118 | |||
119 | sb1_pass = read_c0_prid() & 0xff; | ||
120 | sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION)); | ||
121 | soc_type = SYS_SOC_TYPE(sys_rev); | ||
122 | part_type = G_SYS_PART(sys_rev); | ||
123 | soc_pass = G_SYS_REVISION(sys_rev); | ||
124 | |||
125 | if (sys_rev_decode()) { | ||
126 | prom_printf("Restart after failure to identify SiByte chip\n"); | ||
127 | machine_restart(NULL); | ||
128 | } | ||
129 | |||
130 | plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG))); | ||
131 | zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25); | ||
132 | |||
133 | prom_printf("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n", | ||
134 | soc_str, pass_str, zbbus_mhz * 2, sb1_pass); | ||
135 | prom_printf("Board type: %s\n", get_system_type()); | ||
136 | } | ||