Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm64/a64: Add support for Multiple UART Ports #9243

Merged
merged 1 commit into from
May 11, 2023

Conversation

lupyuen
Copy link
Member

@lupyuen lupyuen commented May 10, 2023

Summary

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)

The code was adapted from the NuttX UART Driver for Allwinner A1X: a1x_serial.c

Modified Files

arch/arm64/src/a64/a64_serial.c: Added ports UART1 to UART4, based on 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

Updated Documentation

Documentation/platforms/arm/a64/boards/pinephone/index.rst: UART Driver now supports all UART Ports

Impact

With this PR, Allwinner A64 will support UART1 to UART4. This is required for the upcoming LTE Modem Driver (Quectel EG25-G) for PINE64 PinePhone, which uses UART3. (Details here)

There is no impact to existing code, which uses only UART0.

Testing

We tested UART3 on PINE64 PinePhone. For Regression Testing, we tested UART0.

UART3 Test

We tested UART3 with the Build Configuration pinephone:lvgl

tools/configure.sh pinephone:lvgl
make menuconfig
## Enable Allwinner A64 > UART3

To activate serial comms on UART3, we started PinePhone's Quectel EG25-G LTE Modem in pinephone_bringup.c

(Explained here)

UART3 works correctly (for both runs) when we sent AT Commands for Phone Call and SMS:

Regression Test

We tested UART0 with the Build Configuration pinephone:nsh

tools/configure.sh pinephone:nsh

UART0 works correctly as the Serial Console:

@lupyuen
Copy link
Member Author

lupyuen commented May 10, 2023

Rebased with Master, to restart macOS Build.

Now the "Linux (Other)" Build fails because I fixed the A64 Kconfig from UART1_SERIALDRIVER to UART0_SERIALDRIVER. I'm fixing the build now.

Configuration/Tool: pinephone/sensor
Cleaning...
Configuring...
Building NuttX...
Normalize pinephone/sensor
71d70
< CONFIG_UART1_SERIAL_CONSOLE=y
Saving the new configuration file
HEAD detached at pull/9243/merge
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   boards/arm64/a64/pinephone/configs/sensor/defconfig

(Source)

UPDATE: I fixed the defconfig files, "Linux (Other)" Build is now OK. Sorry about that.

@lupyuen lupyuen marked this pull request as draft May 11, 2023 01:10
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`
@lupyuen lupyuen marked this pull request as ready for review May 11, 2023 02:21
Copy link
Contributor

@xiaoxiang781216 xiaoxiang781216 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@xiaoxiang781216 xiaoxiang781216 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@xiaoxiang781216 xiaoxiang781216 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@jerpelea jerpelea merged commit 4ed48c3 into apache:master May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants