Skip to content

Commit 4390ca6

Browse files
apritzelpaulkocialkowski
authored andcommitted
uart0-helloworld-sdboot: add support for Allwinner A80
The Allwinner A80 is quite an oddball: it uses a big.LITTLE configuration with Arm Cortex-A7 and A15 cores, and has a completely different memory map compared to all the other Allwinner SoCs. Add support for this SoC, by adding the respective base addresses for its peripherals and the pinmux into our SoC table. It also requires a small extension to the SoC detection routine, to accommodate for the different GIC mapping. Tested on an Cubieboard 4 (CC-A80). Signed-off-by: Andre Przywara <[email protected]>
1 parent 720ee04 commit 4390ca6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

uart0-helloworld-sdboot.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ typedef unsigned char u8;
6767
#define AW_CCM_BASE 0x01c20000
6868
#define AW_SRAMCTRL_BASE 0x01c00000
6969

70+
#define A80_SRAMCTRL_BASE 0x00800000
71+
#define A80_CCM_BASE 0x06000000
72+
#define A80_PIO_BASE 0x06000800
73+
#define A80_UART0_BASE 0x07000000
74+
7075
#define H6_UART0_BASE 0x05000000
7176
#define H6_PIO_BASE 0x0300B000
7277
#define H6_CCM_BASE 0x03001000
@@ -169,6 +174,7 @@ enum sunxi_gpio_number {
169174
#define FLAG_NEW_GPIO BIT(2)
170175
#define FLAG_NEW_CLOCK BIT(3)
171176
#define FLAG_UART_ON_APB1 BIT(4)
177+
#define FLAG_A80_CLOCK BIT(5)
172178

173179
#define FLAG_NCAT2 FLAG_NEW_GPIO | FLAG_NEW_CLOCK
174180

@@ -191,6 +197,8 @@ static const struct soc_info {
191197
SUNXI_UART0_BASE, SUNXI_GPB(19), MUX_2, FLAG_VAR1 | FLAG_UART_ON_PORTF },
192198
{ 0x1633, "A31/A31s", SUNXI_PIO_BASE, AW_CCM_BASE, SRAM_A1_ADDR_0,
193199
SUNXI_UART0_BASE, SUNXI_GPH(20), MUX_2, },
200+
{ 0x1639, "A80", A80_PIO_BASE, A80_CCM_BASE, SRAM_A1_ADDR_10000,
201+
A80_UART0_BASE, SUNXI_GPH(12), MUX_2, FLAG_A80_CLOCK },
194202
{ 0x1651, "A20", SUNXI_PIO_BASE, AW_CCM_BASE, SRAM_A1_ADDR_0,
195203
SUNXI_UART0_BASE, SUNXI_GPB(22), MUX_2 },
196204
{ 0x1663, "F1C100s", SUNXI_PIO_BASE, AW_CCM_BASE, SRAM_A1_ADDR_0,
@@ -296,6 +304,7 @@ static int sunxi_gpio_set_pull(u32 pin, u32 val)
296304

297305
#define VER_REG (AW_SRAMCTRL_BASE + 0x24)
298306
#define H6_VER_REG (H6_SRAMCTRL_BASE + 0x24)
307+
#define A80_VER_REG (A80_SRAMCTRL_BASE + 0x24)
299308
#define SUN4I_SID_BASE 0x01C23800
300309
#define SUN8I_SID_BASE 0x01C14000
301310

@@ -361,6 +370,8 @@ static const struct soc_info *sunxi_detect_soc(void)
361370
reg = H6_VER_REG;
362371
} else if ((readl(0x01c81008) & 0xfff) == 0x43b) {// GICD_IIDR @ legacy
363372
reg = VER_REG;
373+
} else if ((readl(0x01c41008) & 0xfff) == 0x43b) {// GICD_IIDR @ A80
374+
reg = A80_VER_REG;
364375
} else if ((readl(0x03400008) & 0xfff) == 0x43b) {// GICD_IIDR @ GIC-600
365376
reg = H6_VER_REG;
366377
} else {
@@ -407,6 +418,9 @@ static void clock_init_uart(const struct soc_info *soc)
407418
bit = 20 + CONFIG_CONS_INDEX - 1;
408419
gate_ofs = 0x068;
409420
reset_ofs = 0x2d0;
421+
} else if (soc->flags & FLAG_A80_CLOCK) {
422+
gate_ofs = 0x594;
423+
reset_ofs = 0x5b4;
410424
}
411425
/* Open the clock gate for UART0 */
412426
set_wbit(soc->ccu_base + gate_ofs, 1U << bit);

0 commit comments

Comments
 (0)