arm64/a64: Add support for Multiple UART Ports

Currently only Port UART0 is supported for Allwinner A64. This PR adds support for all UART Ports: UART1 to UART4. (Except R-UART, which is a special low-power UART)

This is required for the upcoming LTE Modem Driver (Quectel EG25-G) for PINE64 PinePhone, which uses UART3. [(Details here)](https://lupyuen.github.io/articles/lte2)

The code was adapted from the NuttX UART Driver for Allwinner A1X: [`a1x_serial.c`](https://github.com/apache/nuttx/blob/master/arch/arm/src/a1x/a1x_serial.c)

`arch/arm64/src/a64/a64_serial.c`: Added ports UART1 to UART4, based on [`a1x_serial.c`](https://github.com/apache/nuttx/blob/master/arch/arm/src/a1x/a1x_serial.c)

`arch/arm64/src/a64/a64_serial.h`: Added IRQs for UART1 to UART4. Moved UART Base Addresses to `a64_memorymap.h`

`arch/arm64/src/a64/hardware/a64_memorymap.h`: Added UART Base Addresses for UART0 to UART4

`arch/arm64/src/a64/Kconfig`: Added UART1 to UART4 to Allwinner A64 Peripheral Selection menu

`boards/arm64/a64/pinephone/configs/lcd/defconfig`, `lvgl/defconfig`, `nsh/defconfig`, `sensor/defconfig`: Fixed `UART1_SERIAL_CONSOLE` to `UART0_SERIAL_CONSOLE`
This commit is contained in:
Lee Lup Yuen 2023-05-10 07:43:25 +08:00 committed by Alin Jerpelea
parent 4f4a00ab1f
commit 4ed48c33e9
9 changed files with 935 additions and 73 deletions

View File

@ -193,5 +193,5 @@ RSB Yes
TCON0 Yes
TWI / I2C Yes
Touch Panel (GT917S) Yes
UART Yes Only UART0 is supported
UART Yes
======================== ======= =====

View File

@ -34,13 +34,6 @@ config A64_TCON0
---help---
Select to enable support for Timing Controller TCON0.
config A64_UART
bool "UART"
default n
select UART1_SERIALDRIVER
---help---
Select to enable support for UART.
config A64_RTWI
bool "Two-wire Master Controller R"
default n
@ -65,6 +58,46 @@ config A64_TWI2
---help---
Select to enable support for TWI2.
config A64_UART
bool "UART 0"
default n
select UART0_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART0.
config A64_UART1
bool "UART 1"
default n
select UART1_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART1.
config A64_UART2
bool "UART 2"
default n
select UART2_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART2.
config A64_UART3
bool "UART 3"
default n
select UART3_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART3.
config A64_UART4
bool "UART 4"
default n
select UART4_SERIALDRIVER
select ARCH_HAVE_SERIAL_TERMIOS
---help---
Select to enable support for UART4.
endmenu # Allwinner A64 Peripheral Selection
endif # ARCH_CHIP_A64

File diff suppressed because it is too large Load Diff

View File

@ -49,9 +49,16 @@
****************************************************************************/
#ifdef CONFIG_ARCH_CHIP_A64
#define CONFIG_A64_UART_BASE 0x1C28000 /* A64 UART0 Base Address */
#define CONFIG_A64_UART_IRQ 32 /* A64 UART0 IRQ */
#endif
/* IRQ for A64 UART */
#define A64_UART0_IRQ 32 /* A64 UART0 IRQ */
#define A64_UART1_IRQ 33 /* A64 UART1 IRQ */
#define A64_UART2_IRQ 34 /* A64 UART2 IRQ */
#define A64_UART3_IRQ 35 /* A64 UART3 IRQ */
#define A64_UART4_IRQ 36 /* A64 UART4 IRQ */
#endif /* CONFIG_ARCH_CHIP_A64 */
/****************************************************************************
* Public Function Prototypes

View File

@ -39,6 +39,11 @@
#define A64_CCU_ADDR 0x01c20000 /* CCU 0x01c2:0000-0x01c2:03ff 1K */
#define A64_PIO_ADDR 0x01c20800 /* PIO 0x01c2:0800-0x01c2:0bff 1K */
#define A64_PWM_ADDR 0x01c21400 /* PWM 0x01c2:1400-0x01c2:17ff 1K */
#define A64_UART0_ADDR 0x01c28000 /* UART 0 0x01c2:8000-0x01c2:83ff 1K */
#define A64_UART1_ADDR 0x01c28400 /* UART 1 0x01c2:8400-0x01c2:87ff 1K */
#define A64_UART2_ADDR 0x01c28800 /* UART 2 0x01c2:8800-0x01c2:8bff 1K */
#define A64_UART3_ADDR 0x01c28c00 /* UART 3 0x01c2:8c00-0x01c2:8fff 1K */
#define A64_UART4_ADDR 0x01c29000 /* UART 4 0x01c2:9000-0x01c2:93ff 1K */
#define A64_TWI0_ADDR 0x01c2ac00 /* TWI 0 0x01c2:ac00-0x01c2:afff 1K */
#define A64_TWI1_ADDR 0x01c2b000 /* TWI 1 0x01c2:b000-0x01c2:B3ff 1K */
#define A64_TWI2_ADDR 0x01c2b400 /* TWI 2 0x01c2:b400-0x01c2:b7ff 1K */

View File

@ -64,7 +64,7 @@ CONFIG_SYSTEM_SYSTEM=y
CONFIG_SYSTEM_TIME64=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USEC_PER_TICK=1000
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y

View File

@ -82,7 +82,7 @@ CONFIG_SYSTEM_SYSTEM=y
CONFIG_SYSTEM_TIME64=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USEC_PER_TICK=1000
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y

View File

@ -63,7 +63,7 @@ CONFIG_SYSTEM_SYSTEM=y
CONFIG_SYSTEM_TIME64=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USEC_PER_TICK=1000
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y

View File

@ -68,7 +68,7 @@ CONFIG_SYSTEM_SYSTEM=y
CONFIG_SYSTEM_TIME64=y
CONFIG_TESTING_GETPRIME=y
CONFIG_TESTING_OSTEST=y
CONFIG_UART1_SERIAL_CONSOLE=y
CONFIG_UART0_SERIAL_CONSOLE=y
CONFIG_USEC_PER_TICK=1000
CONFIG_USERLED=y
CONFIG_USERLED_LOWER=y