Skip to content

Commit 93c733c

Browse files
committed
uart0-helloworld-sdboot: add support for Allwinner A733
Enable UART's pinctrl and clock settings. The clock and pio offset for UART controller is changed in A733. Signed-off-by: Yixun Lan <dlan@gentoo.org>
1 parent 1181a3a commit 93c733c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

uart0-helloworld-sdboot.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ typedef unsigned char u8;
8080
#define R329_UART0_BASE 0x02500000
8181
#define R329_PIO_BASE 0x02000400
8282
#define R329_CCM_BASE 0x02001000
83+
#define A733_CCM_BASE 0x02002000
8384

8485
#define V853_PIO_BASE 0x02000000
8586

@@ -175,6 +176,7 @@ enum sunxi_gpio_number {
175176
#define FLAG_NEW_CLOCK BIT(3)
176177
#define FLAG_UART_ON_APB1 BIT(4)
177178
#define FLAG_A80_CLOCK BIT(5)
179+
#define FLAG_A733_GPIO BIT(6)
178180

179181
#define FLAG_NCAT2 FLAG_NEW_GPIO | FLAG_NEW_CLOCK
180182

@@ -239,6 +241,8 @@ static const struct soc_info {
239241
R329_UART0_BASE, SUNXI_GPH(9), MUX_5, FLAG_NCAT2 },
240242
{ 0x1890, "A523", V853_PIO_BASE, R329_CCM_BASE, SRAM_A1_ADDR_20000,
241243
R329_UART0_BASE, SUNXI_GPB(9), MUX_2, FLAG_NCAT2 },
244+
{ 0x1903, "A733", V853_PIO_BASE, A733_CCM_BASE, SRAM_A1_ADDR_20000,
245+
R329_UART0_BASE, SUNXI_GPB(9), MUX_2, FLAG_NEW_CLOCK | FLAG_A733_GPIO},
242246
};
243247

244248
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
@@ -409,7 +413,10 @@ static const struct soc_info *sunxi_detect_soc(void)
409413
static void clock_init_uart(const struct soc_info *soc)
410414
{
411415
if (soc->flags & FLAG_NEW_CLOCK) {
412-
set_wbit(soc->ccu_base + 0x90c,
416+
int reg_ofs;
417+
418+
reg_ofs = (soc->soc_id == 0x1903) ? 0xe00 : 0x90c;
419+
set_wbit(soc->ccu_base + reg_ofs,
413420
0x10001 << (CONFIG_CONS_INDEX - 1));
414421
} else {
415422
int bit = 16 + CONFIG_CONS_INDEX - 1;
@@ -446,13 +453,25 @@ static void gpio_init(const struct soc_info *soc)
446453
pio_bank_size = 0x30;
447454
pio_dat_off = 0x10;
448455
pio_pull_off = 0x24;
456+
} else if (soc->flags & FLAG_A733_GPIO) {
457+
pio_bank_size = 0x80;
458+
pio_dat_off = 0x10;
459+
pio_pull_off = 0x30;
449460
} else {
450461
/* GPIO V1 */
451462
pio_bank_size = 0x24;
452463
pio_dat_off = 0x10;
453464
pio_pull_off = 0x1c;
454465
}
455466

467+
/*
468+
* For Allwinner SoC A733:
469+
* Adjust pio_base offset by shift size 0x80, as
470+
* PB bank start at 0x100 with the bank size 0x80
471+
*/
472+
if (soc->soc_id == 0x1903)
473+
pio_base += 0x80;
474+
456475
if (soc->flags & FLAG_UART_ON_PORTF) {
457476
/* Disable normal UART0 pins to avoid conflict */
458477
sunxi_gpio_set_cfgpin(soc->uart0_tx_pin, MUX_GPIO_INPUT);

0 commit comments

Comments
 (0)