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

OBSOLETE: arm64/a64: Add support for Multiple UART Ports #27

Closed
wants to merge 1 commit into from

Conversation

lupyuen
Copy link

@lupyuen lupyuen commented May 4, 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

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 lupyuen marked this pull request as draft May 8, 2023 23:09
@lupyuen lupyuen changed the title TODO: Uart TODO: Add support for PinePhone Allwinner A64 USB May 8, 2023
@lupyuen lupyuen changed the title TODO: Add support for PinePhone Allwinner A64 USB TODO: UART May 8, 2023
@lupyuen lupyuen changed the title TODO: UART arm64/a64: Add support for Multiple UART Ports May 8, 2023
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

`Documentation/platforms/arm/a64/boards/pinephone/index.rst`: UART Driver now supports all UART Ports
@lupyuen lupyuen changed the title arm64/a64: Add support for Multiple UART Ports OBSOLETE: arm64/a64: Add support for Multiple UART Ports May 10, 2023
@lupyuen lupyuen closed this May 10, 2023
lupyuen pushed a commit that referenced this pull request Oct 15, 2024
set CONFIG_PRIORITY_INHERITANCE=y
set CONFIG_SEM_PREALLOCHOLDERS=0 or CONFIG_SEM_PREALLOCHOLDERS=8

    #24 0x4dcab71 in __assert assert/lib_assert.c:37
    #25 0x4d6b0e9 in nxsem_destroyholder semaphore/sem_holder.c:602
    #26 0x4d80cf7 in nxsem_destroy semaphore/sem_destroy.c:80
    #27 0x4d80db9 in sem_destroy semaphore/sem_destroy.c:120
    #28 0x4dcb077 in nxmutex_destroy misc/lib_mutex.c:122
    #29 0x4dc6611 in pipecommon_freedev pipes/pipe_common.c:117
    #30 0x4dc7fdc in pipecommon_close pipes/pipe_common.c:397
    #31 0x4ed4f6d in file_close vfs/fs_close.c:78
    #32 0x6a91133 in local_free local/local_conn.c:184
    #33 0x6a92a9c in local_release local/local_release.c:129
    #34 0x6a91d1a in local_subref local/local_conn.c:271
    #35 0x6a75767 in local_close local/local_sockif.c:797
    #36 0x4e978f6 in psock_close socket/net_close.c:102
    #37 0x4eed1b9 in sock_file_close socket/socket.c:115
    #38 0x4ed4f6d in file_close vfs/fs_close.c:78
    #39 0x4ed1459 in nx_close_from_tcb inode/fs_files.c:754
    #40 0x4ed1501 in nx_close inode/fs_files.c:781
    #41 0x4ed154a in close inode/fs_files.c:819
    #42 0x6bcb9ce in property_get kvdb/client.c:307
    #43 0x6bcd465 in property_get_int32 kvdb/common.c:270
    #44 0x5106c9a in tz_offset_restore app/miwear_bluetooth.c:745
    #45 0x510893f in miwear_bluetooth_main app/miwear_bluetooth.c:1033
    #46 0x4dcf5c8 in nxtask_startup sched/task_startup.c:70
    #47 0x4d70873 in nxtask_start task/task_start.c:134
    #48 0x4e04a07 in pre_start sim/sim_initialstate.c:52

Signed-off-by: ligd <liguiding1@xiaomi.com>
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.

1 participant