]>
git.ipfire.org Git - people/ms/u-boot.git/blob - arch/arm/cpu/armv7/sunxi/cpu_info.c
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>
15 #ifdef CONFIG_MACH_SUN6I
16 int sunxi_get_ss_bonding_id(void)
18 struct sunxi_ccm_reg
* const ccm
=
19 (struct sunxi_ccm_reg
*)SUNXI_CCM_BASE
;
20 static int bonding_id
= -1;
25 /* Enable Security System */
26 setbits_le32(&ccm
->ahb_reset0_cfg
, 1 << AHB_RESET_OFFSET_SS
);
27 setbits_le32(&ccm
->ahb_gate0
, 1 << AHB_GATE_OFFSET_SS
);
29 bonding_id
= readl(SUNXI_SS_BASE
);
30 bonding_id
= (bonding_id
>> 16) & 0x7;
32 /* Disable Security System again */
33 clrbits_le32(&ccm
->ahb_gate0
, 1 << AHB_GATE_OFFSET_SS
);
34 clrbits_le32(&ccm
->ahb_reset0_cfg
, 1 << AHB_RESET_OFFSET_SS
);
40 #ifdef CONFIG_DISPLAY_CPUINFO
41 int print_cpuinfo(void)
43 #ifdef CONFIG_MACH_SUN4I
44 puts("CPU: Allwinner A10 (SUN4I)\n");
45 #elif defined CONFIG_MACH_SUN5I
46 u32 val
= readl(SUNXI_SID_BASE
+ 0x08);
47 switch ((val
>> 12) & 0xf) {
48 case 0: puts("CPU: Allwinner A12 (SUN5I)\n"); break;
49 case 3: puts("CPU: Allwinner A13 (SUN5I)\n"); break;
50 case 7: puts("CPU: Allwinner A10s (SUN5I)\n"); break;
51 default: puts("CPU: Allwinner A1X (SUN5I)\n");
53 #elif defined CONFIG_MACH_SUN6I
54 switch (sunxi_get_ss_bonding_id()) {
55 case SUNXI_SS_BOND_ID_A31
:
56 puts("CPU: Allwinner A31 (SUN6I)\n");
58 case SUNXI_SS_BOND_ID_A31S
:
59 puts("CPU: Allwinner A31s (SUN6I)\n");
62 printf("CPU: Allwinner A31? (SUN6I, id: %d)\n",
63 sunxi_get_ss_bonding_id());
65 #elif defined CONFIG_MACH_SUN7I
66 puts("CPU: Allwinner A20 (SUN7I)\n");
67 #elif defined CONFIG_MACH_SUN8I_A23
68 puts("CPU: Allwinner A23 (SUN8I)\n");
70 #warning Please update cpu_info.c with correct CPU information
71 puts("CPU: SUNXI Family\n");
77 int sunxi_get_sid(unsigned int *sid
)
79 #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_A23
80 #ifdef CONFIG_AXP221_POWER
81 return axp221_get_sid(sid
);
88 for (i
= 0; i
< 4; i
++)
89 sid
[i
] = readl(SUNXI_SID_BASE
+ 4 * i
);