2 * (C) Copyright 2007-2011
3 * Allwinner Technology Co., Ltd. <www.allwinnertech.com>
4 * Tom Cubie <tangliang@allwinnertech.com>
6 * SPDX-License-Identifier: GPL-2.0+
11 #include <asm/arch/cpu.h>
12 #include <asm/arch/clock.h>
14 #ifdef CONFIG_MACH_SUN6I
15 int sunxi_get_ss_bonding_id(void)
17 struct sunxi_ccm_reg * const ccm =
18 (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
19 static int bonding_id = -1;
24 /* Enable Security System */
25 setbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_RESET_OFFSET_SS);
26 setbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_SS);
28 bonding_id = readl(SUNXI_SS_BASE);
29 bonding_id = (bonding_id >> 16) & 0x7;
31 /* Disable Security System again */
32 clrbits_le32(&ccm->ahb_gate0, 1 << AHB_GATE_OFFSET_SS);
33 clrbits_le32(&ccm->ahb_reset0_cfg, 1 << AHB_RESET_OFFSET_SS);
39 #ifdef CONFIG_DISPLAY_CPUINFO
40 int print_cpuinfo(void)
42 #ifdef CONFIG_MACH_SUN4I
43 puts("CPU: Allwinner A10 (SUN4I)\n");
44 #elif defined CONFIG_MACH_SUN5I
45 u32 val = readl(SUNXI_SID_BASE + 0x08);
46 switch ((val >> 12) & 0xf) {
47 case 0: puts("CPU: Allwinner A12 (SUN5I)\n"); break;
48 case 3: puts("CPU: Allwinner A13 (SUN5I)\n"); break;
49 case 7: puts("CPU: Allwinner A10s (SUN5I)\n"); break;
50 default: puts("CPU: Allwinner A1X (SUN5I)\n");
52 #elif defined CONFIG_MACH_SUN6I
53 switch (sunxi_get_ss_bonding_id()) {
54 case SUNXI_SS_BOND_ID_A31:
55 puts("CPU: Allwinner A31 (SUN6I)\n");
57 case SUNXI_SS_BOND_ID_A31S:
58 puts("CPU: Allwinner A31s (SUN6I)\n");
61 printf("CPU: Allwinner A31? (SUN6I, id: %d)\n",
62 sunxi_get_ss_bonding_id());
64 #elif defined CONFIG_MACH_SUN7I
65 puts("CPU: Allwinner A20 (SUN7I)\n");
66 #elif defined CONFIG_MACH_SUN8I
67 puts("CPU: Allwinner A23 (SUN8I)\n");
69 #warning Please update cpu_info.c with correct CPU information
70 puts("CPU: SUNXI Family\n");