0001
0002
0003
0004
0005 #include <linux/init.h>
0006 #include <linux/kernel.h>
0007 #include <linux/export.h>
0008 #include <linux/reboot.h>
0009 #include <linux/string.h>
0010
0011 #include <asm/bootinfo.h>
0012 #include <asm/cpu.h>
0013 #include <asm/mipsregs.h>
0014 #include <asm/io.h>
0015 #include <asm/sibyte/sb1250.h>
0016
0017 #include <asm/sibyte/bcm1480_regs.h>
0018 #include <asm/sibyte/bcm1480_scd.h>
0019 #include <asm/sibyte/sb1250_scd.h>
0020
0021 unsigned int sb1_pass;
0022 unsigned int soc_pass;
0023 unsigned int soc_type;
0024 EXPORT_SYMBOL(soc_type);
0025 unsigned int periph_rev;
0026 EXPORT_SYMBOL_GPL(periph_rev);
0027 unsigned int zbbus_mhz;
0028 EXPORT_SYMBOL(zbbus_mhz);
0029
0030 static unsigned int part_type;
0031
0032 static char *soc_str;
0033 static char *pass_str;
0034
0035 static int __init setup_bcm1x80_bcm1x55(void)
0036 {
0037 switch (soc_pass) {
0038 case K_SYS_REVISION_BCM1480_S0:
0039 periph_rev = 1;
0040 pass_str = "S0 (pass1)";
0041 break;
0042 case K_SYS_REVISION_BCM1480_A1:
0043 periph_rev = 1;
0044 pass_str = "A1 (pass1)";
0045 break;
0046 case K_SYS_REVISION_BCM1480_A2:
0047 periph_rev = 1;
0048 pass_str = "A2 (pass1)";
0049 break;
0050 case K_SYS_REVISION_BCM1480_A3:
0051 periph_rev = 1;
0052 pass_str = "A3 (pass1)";
0053 break;
0054 case K_SYS_REVISION_BCM1480_B0:
0055 periph_rev = 1;
0056 pass_str = "B0 (pass2)";
0057 break;
0058 default:
0059 printk("Unknown %s rev %x\n", soc_str, soc_pass);
0060 periph_rev = 1;
0061 pass_str = "Unknown Revision";
0062 break;
0063 }
0064
0065 return 0;
0066 }
0067
0068
0069
0070 static int __init sys_rev_decode(void)
0071 {
0072 int ret = 0;
0073
0074 switch (soc_type) {
0075 case K_SYS_SOC_TYPE_BCM1x80:
0076 if (part_type == K_SYS_PART_BCM1480)
0077 soc_str = "BCM1480";
0078 else if (part_type == K_SYS_PART_BCM1280)
0079 soc_str = "BCM1280";
0080 else
0081 soc_str = "BCM1x80";
0082 ret = setup_bcm1x80_bcm1x55();
0083 break;
0084
0085 case K_SYS_SOC_TYPE_BCM1x55:
0086 if (part_type == K_SYS_PART_BCM1455)
0087 soc_str = "BCM1455";
0088 else if (part_type == K_SYS_PART_BCM1255)
0089 soc_str = "BCM1255";
0090 else
0091 soc_str = "BCM1x55";
0092 ret = setup_bcm1x80_bcm1x55();
0093 break;
0094
0095 default:
0096 printk("Unknown part type %x\n", part_type);
0097 ret = 1;
0098 break;
0099 }
0100
0101 return ret;
0102 }
0103
0104 void __init bcm1480_setup(void)
0105 {
0106 uint64_t sys_rev;
0107 int plldiv;
0108
0109 sb1_pass = read_c0_prid() & PRID_REV_MASK;
0110 sys_rev = __raw_readq(IOADDR(A_SCD_SYSTEM_REVISION));
0111 soc_type = SYS_SOC_TYPE(sys_rev);
0112 part_type = G_SYS_PART(sys_rev);
0113 soc_pass = G_SYS_REVISION(sys_rev);
0114
0115 if (sys_rev_decode()) {
0116 printk("Restart after failure to identify SiByte chip\n");
0117 machine_restart(NULL);
0118 }
0119
0120 plldiv = G_BCM1480_SYS_PLL_DIV(__raw_readq(IOADDR(A_SCD_SYSTEM_CFG)));
0121 zbbus_mhz = ((plldiv >> 1) * 50) + ((plldiv & 1) * 25);
0122
0123 printk("Broadcom SiByte %s %s @ %d MHz (SB-1A rev %d)\n",
0124 soc_str, pass_str, zbbus_mhz * 2, sb1_pass);
0125 printk("Board type: %s\n", get_system_type());
0126 }