You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "lupyuen (via GitHub)" <gi...@apache.org> on 2023/05/10 23:00:06 UTC

[GitHub] [nuttx] lupyuen opened a new pull request, #9243: arm64/a64: Add support for Multiple UART Ports

lupyuen opened a new pull request, #9243:
URL: https://github.com/apache/nuttx/pull/9243

   ## 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)](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)
   
   ### Modified Files
   
   `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
   
   ### 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)](https://lupyuen.github.io/articles/lte2)
   
   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`
   
   ```bash
   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](https://github.com/lupyuen2/wip-pinephone-nuttx/blob/uart2/boards/arm64/a64/pinephone/src/pinephone_bringup.c#L208-L347)
   
   [(Explained here)](https://lupyuen.github.io/articles/lte#power-up-wth-nuttx)
   
   UART3 works correctly (for both runs) when we sent AT Commands for Phone Call and SMS:
   
   - Modem Test App (run twice): [hello_main.c](https://github.com/lupyuen2/wip-pinephone-nuttx-apps/blob/uart/examples/hello/hello_main.c)
   
     [(Explained here)](https://lupyuen.github.io/articles/lte2#outgoing-phone-call)
   
   - [Modem Test Log](https://gist.github.com/lupyuen/c6630b0a6e1616aada546143552fb113)
   
   ### Regression Test
   
   We tested UART0 with the Build Configuration `pinephone:nsh`
   
   ```bash
   tools/configure.sh pinephone:nsh
   ```
   
   UART0 works correctly as the Serial Console:
   
   - [Regression Test Log](https://gist.github.com/lupyuen/722e28f60d8311cccbd3031b0fe2c07f)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] jerpelea merged pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "jerpelea (via GitHub)" <gi...@apache.org>.
jerpelea merged PR #9243:
URL: https://github.com/apache/nuttx/pull/9243


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] lupyuen commented on pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#issuecomment-1542918859

   Rebased with Master, to restart macOS Build


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#discussion_r1190620104


##########
arch/arm64/src/a64/a64_serial.c:
##########
@@ -603,18 +1335,66 @@ static struct uart_dev_s    g_uart1port =
 
 void arm64_earlyserialinit(void)
 {
-  /* NOTE: This function assumes that low level hardware configuration
+  int ret;
+
+  /* NOTE: This function assumes that UART0 low level hardware configuration
    * -- including all clocking and pin configuration -- was performed
-   * earlier in the boot sequence.
+   * earlier by U-Boot Bootloader.
    */
 
-  /* Enable the console UART.  The other UARTs will be initialized if and
-   * when they are first opened.
-   */
+#ifdef CONFIG_A64_UART1
+  /* Configure UART1 */
+
+  ret = a64_uart_init(UART1_GATING, UART1_RST, PIO_UART1_TX, PIO_UART1_RX);
+
+  if (ret < 0)
+    {
+      _err("UART1 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART1 */
+
+#ifdef CONFIG_A64_UART2
+  /* Configure UART2 */
+
+  ret = a64_uart_init(UART2_GATING, UART2_RST, PIO_UART2_TX, PIO_UART2_RX);
+
+  if (ret < 0)
+    {
+      _err("UART2 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART2 */
+
+#ifdef CONFIG_A64_UART3
+  /* Configure UART3 */
+
+  ret = a64_uart_init(UART3_GATING, UART3_RST, PIO_UART3_TX, PIO_UART3_RX);
+
+  if (ret < 0)
+    {
+      _err("UART3 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART3 */
+
+#ifdef CONFIG_A64_UART4
+  /* Configure UART4 */
+
+  ret = a64_uart_init(UART4_GATING, UART4_RST, PIO_UART4_TX, PIO_UART4_RX);
+
+  if (ret < 0)
+    {
+      _err("UART4 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART4 */
+
 #ifdef CONSOLE_DEV
+  /* Enable the console at UART0 */
+
   CONSOLE_DEV.isconsole = true;
   a64_uart_setup(&CONSOLE_DEV);
 #endif
+
+  UNUSED(a64_uart_init);

Review Comment:
   why need this?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on a diff in pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#discussion_r1190662911


##########
arch/arm64/src/a64/a64_serial.c:
##########
@@ -603,18 +1335,66 @@ static struct uart_dev_s    g_uart1port =
 
 void arm64_earlyserialinit(void)
 {
-  /* NOTE: This function assumes that low level hardware configuration
+  int ret;
+
+  /* NOTE: This function assumes that UART0 low level hardware configuration
    * -- including all clocking and pin configuration -- was performed
-   * earlier in the boot sequence.
+   * earlier by U-Boot Bootloader.
    */
 
-  /* Enable the console UART.  The other UARTs will be initialized if and
-   * when they are first opened.
-   */
+#ifdef CONFIG_A64_UART1
+  /* Configure UART1 */
+
+  ret = a64_uart_init(UART1_GATING, UART1_RST, PIO_UART1_TX, PIO_UART1_RX);
+
+  if (ret < 0)
+    {
+      _err("UART1 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART1 */
+
+#ifdef CONFIG_A64_UART2
+  /* Configure UART2 */
+
+  ret = a64_uart_init(UART2_GATING, UART2_RST, PIO_UART2_TX, PIO_UART2_RX);
+
+  if (ret < 0)
+    {
+      _err("UART2 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART2 */
+
+#ifdef CONFIG_A64_UART3
+  /* Configure UART3 */
+
+  ret = a64_uart_init(UART3_GATING, UART3_RST, PIO_UART3_TX, PIO_UART3_RX);
+
+  if (ret < 0)
+    {
+      _err("UART3 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART3 */
+
+#ifdef CONFIG_A64_UART4
+  /* Configure UART4 */
+
+  ret = a64_uart_init(UART4_GATING, UART4_RST, PIO_UART4_TX, PIO_UART4_RX);
+
+  if (ret < 0)
+    {
+      _err("UART4 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART4 */
+
 #ifdef CONSOLE_DEV
+  /* Enable the console at UART0 */
+
   CONSOLE_DEV.isconsole = true;
   a64_uart_setup(&CONSOLE_DEV);
 #endif
+
+  UNUSED(a64_uart_init);

Review Comment:
   Ok, understand.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] lupyuen commented on a diff in pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on code in PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#discussion_r1190643984


##########
arch/arm64/src/a64/a64_serial.c:
##########
@@ -603,18 +1335,66 @@ static struct uart_dev_s    g_uart1port =
 
 void arm64_earlyserialinit(void)
 {
-  /* NOTE: This function assumes that low level hardware configuration
+  int ret;
+
+  /* NOTE: This function assumes that UART0 low level hardware configuration
    * -- including all clocking and pin configuration -- was performed
-   * earlier in the boot sequence.
+   * earlier by U-Boot Bootloader.
    */
 
-  /* Enable the console UART.  The other UARTs will be initialized if and
-   * when they are first opened.
-   */
+#ifdef CONFIG_A64_UART1
+  /* Configure UART1 */
+
+  ret = a64_uart_init(UART1_GATING, UART1_RST, PIO_UART1_TX, PIO_UART1_RX);
+
+  if (ret < 0)
+    {
+      _err("UART1 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART1 */
+
+#ifdef CONFIG_A64_UART2
+  /* Configure UART2 */
+
+  ret = a64_uart_init(UART2_GATING, UART2_RST, PIO_UART2_TX, PIO_UART2_RX);
+
+  if (ret < 0)
+    {
+      _err("UART2 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART2 */
+
+#ifdef CONFIG_A64_UART3
+  /* Configure UART3 */
+
+  ret = a64_uart_init(UART3_GATING, UART3_RST, PIO_UART3_TX, PIO_UART3_RX);
+
+  if (ret < 0)
+    {
+      _err("UART3 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART3 */
+
+#ifdef CONFIG_A64_UART4
+  /* Configure UART4 */
+
+  ret = a64_uart_init(UART4_GATING, UART4_RST, PIO_UART4_TX, PIO_UART4_RX);
+
+  if (ret < 0)
+    {
+      _err("UART4 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART4 */
+
 #ifdef CONSOLE_DEV
+  /* Enable the console at UART0 */
+
   CONSOLE_DEV.isconsole = true;
   a64_uart_setup(&CONSOLE_DEV);
 #endif
+
+  UNUSED(a64_uart_init);

Review Comment:
   `a64_uart_init` is a Static Function, called to init UART1 to UART4. Since UART0 is already initialised by U-Boot Bootloader, we don't call `a64_uart_init` to init UART0.
   
   Without the line `UNUSED(a64_uart_init)`, the compiler fails with this error:
   
   ```text
   CC:  chip/a64_serial.c chip/a64_serial.c:962:12: error: 'a64_uart_init' defined but not used [-Werror=unused-function]
     962 | static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx,
         |            ^~~~~~~~~~~~~
   cc1: all warnings being treated as errors
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] lupyuen commented on a diff in pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on code in PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#discussion_r1190643984


##########
arch/arm64/src/a64/a64_serial.c:
##########
@@ -603,18 +1335,66 @@ static struct uart_dev_s    g_uart1port =
 
 void arm64_earlyserialinit(void)
 {
-  /* NOTE: This function assumes that low level hardware configuration
+  int ret;
+
+  /* NOTE: This function assumes that UART0 low level hardware configuration
    * -- including all clocking and pin configuration -- was performed
-   * earlier in the boot sequence.
+   * earlier by U-Boot Bootloader.
    */
 
-  /* Enable the console UART.  The other UARTs will be initialized if and
-   * when they are first opened.
-   */
+#ifdef CONFIG_A64_UART1
+  /* Configure UART1 */
+
+  ret = a64_uart_init(UART1_GATING, UART1_RST, PIO_UART1_TX, PIO_UART1_RX);
+
+  if (ret < 0)
+    {
+      _err("UART1 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART1 */
+
+#ifdef CONFIG_A64_UART2
+  /* Configure UART2 */
+
+  ret = a64_uart_init(UART2_GATING, UART2_RST, PIO_UART2_TX, PIO_UART2_RX);
+
+  if (ret < 0)
+    {
+      _err("UART2 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART2 */
+
+#ifdef CONFIG_A64_UART3
+  /* Configure UART3 */
+
+  ret = a64_uart_init(UART3_GATING, UART3_RST, PIO_UART3_TX, PIO_UART3_RX);
+
+  if (ret < 0)
+    {
+      _err("UART3 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART3 */
+
+#ifdef CONFIG_A64_UART4
+  /* Configure UART4 */
+
+  ret = a64_uart_init(UART4_GATING, UART4_RST, PIO_UART4_TX, PIO_UART4_RX);
+
+  if (ret < 0)
+    {
+      _err("UART4 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART4 */
+
 #ifdef CONSOLE_DEV
+  /* Enable the console at UART0 */
+
   CONSOLE_DEV.isconsole = true;
   a64_uart_setup(&CONSOLE_DEV);
 #endif
+
+  UNUSED(a64_uart_init);

Review Comment:
   `a64_uart_init` is a Static Function, called to init UART1 to UART4. Since UART0 is already initialised by U-Boot Bootloader, we don't call `a64_uart_init` to init UART0.
   
   Without the line `UNUSED(a64_uart_init)`, the compiler fails with this error:
   
   ```text
   CC:  chip/a64_serial.c chip/a64_serial.c:962:12: error: 'a64_uart_init' defined but not used [-Werror=unused-function]
     962 | static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx,
         |            ^~~~~~~~~~~~~
   cc1: all warnings being treated as errors
   ```
   
   You're right it looks odd, I will change to this instead:
   
   ```c
   #if defined(CONFIG_A64_UART1) || defined(CONFIG_A64_UART2) || defined(CONFIG_A64_UART3) || defined(CONFIG_A64_UART4) || defined(CONFIG_A64_UART5)
   static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx, pio_pinset_t rx)
   ```
   
   I'm making the change now. Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] lupyuen commented on a diff in pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on code in PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#discussion_r1190643984


##########
arch/arm64/src/a64/a64_serial.c:
##########
@@ -603,18 +1335,66 @@ static struct uart_dev_s    g_uart1port =
 
 void arm64_earlyserialinit(void)
 {
-  /* NOTE: This function assumes that low level hardware configuration
+  int ret;
+
+  /* NOTE: This function assumes that UART0 low level hardware configuration
    * -- including all clocking and pin configuration -- was performed
-   * earlier in the boot sequence.
+   * earlier by U-Boot Bootloader.
    */
 
-  /* Enable the console UART.  The other UARTs will be initialized if and
-   * when they are first opened.
-   */
+#ifdef CONFIG_A64_UART1
+  /* Configure UART1 */
+
+  ret = a64_uart_init(UART1_GATING, UART1_RST, PIO_UART1_TX, PIO_UART1_RX);
+
+  if (ret < 0)
+    {
+      _err("UART1 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART1 */
+
+#ifdef CONFIG_A64_UART2
+  /* Configure UART2 */
+
+  ret = a64_uart_init(UART2_GATING, UART2_RST, PIO_UART2_TX, PIO_UART2_RX);
+
+  if (ret < 0)
+    {
+      _err("UART2 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART2 */
+
+#ifdef CONFIG_A64_UART3
+  /* Configure UART3 */
+
+  ret = a64_uart_init(UART3_GATING, UART3_RST, PIO_UART3_TX, PIO_UART3_RX);
+
+  if (ret < 0)
+    {
+      _err("UART3 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART3 */
+
+#ifdef CONFIG_A64_UART4
+  /* Configure UART4 */
+
+  ret = a64_uart_init(UART4_GATING, UART4_RST, PIO_UART4_TX, PIO_UART4_RX);
+
+  if (ret < 0)
+    {
+      _err("UART4 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART4 */
+
 #ifdef CONSOLE_DEV
+  /* Enable the console at UART0 */
+
   CONSOLE_DEV.isconsole = true;
   a64_uart_setup(&CONSOLE_DEV);
 #endif
+
+  UNUSED(a64_uart_init);

Review Comment:
   `a64_uart_init` is a Static Function, called to init UART1 to UART4. Since UART0 is already initialised by U-Boot Bootloader, we don't call `a64_uart_init` to init UART0.
   
   Without the line `UNUSED(a64_uart_init)`, the compiler fails with this error:
   
   ```text
   CC:  chip/a64_serial.c chip/a64_serial.c:962:12: error: 'a64_uart_init' defined but not used [-Werror=unused-function]
     962 | static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx,
         |            ^~~~~~~~~~~~~
   cc1: all warnings being treated as errors
   ```
   
   Alternative I can change to this instead:
   
   ```c
   #if defined(CONFIG_A64_UART1) || defined(CONFIG_A64_UART2) || defined(CONFIG_A64_UART3) || defined(CONFIG_A64_UART4) || defined(CONFIG_A64_UART5)
   static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx, pio_pinset_t rx)
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] lupyuen commented on a diff in pull request #9243: arm64/a64: Add support for Multiple UART Ports

Posted by "lupyuen (via GitHub)" <gi...@apache.org>.
lupyuen commented on code in PR #9243:
URL: https://github.com/apache/nuttx/pull/9243#discussion_r1190643984


##########
arch/arm64/src/a64/a64_serial.c:
##########
@@ -603,18 +1335,66 @@ static struct uart_dev_s    g_uart1port =
 
 void arm64_earlyserialinit(void)
 {
-  /* NOTE: This function assumes that low level hardware configuration
+  int ret;
+
+  /* NOTE: This function assumes that UART0 low level hardware configuration
    * -- including all clocking and pin configuration -- was performed
-   * earlier in the boot sequence.
+   * earlier by U-Boot Bootloader.
    */
 
-  /* Enable the console UART.  The other UARTs will be initialized if and
-   * when they are first opened.
-   */
+#ifdef CONFIG_A64_UART1
+  /* Configure UART1 */
+
+  ret = a64_uart_init(UART1_GATING, UART1_RST, PIO_UART1_TX, PIO_UART1_RX);
+
+  if (ret < 0)
+    {
+      _err("UART1 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART1 */
+
+#ifdef CONFIG_A64_UART2
+  /* Configure UART2 */
+
+  ret = a64_uart_init(UART2_GATING, UART2_RST, PIO_UART2_TX, PIO_UART2_RX);
+
+  if (ret < 0)
+    {
+      _err("UART2 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART2 */
+
+#ifdef CONFIG_A64_UART3
+  /* Configure UART3 */
+
+  ret = a64_uart_init(UART3_GATING, UART3_RST, PIO_UART3_TX, PIO_UART3_RX);
+
+  if (ret < 0)
+    {
+      _err("UART3 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART3 */
+
+#ifdef CONFIG_A64_UART4
+  /* Configure UART4 */
+
+  ret = a64_uart_init(UART4_GATING, UART4_RST, PIO_UART4_TX, PIO_UART4_RX);
+
+  if (ret < 0)
+    {
+      _err("UART4 config failed, ret=%d\n", ret);
+    }
+#endif /* CONFIG_A64_UART4 */
+
 #ifdef CONSOLE_DEV
+  /* Enable the console at UART0 */
+
   CONSOLE_DEV.isconsole = true;
   a64_uart_setup(&CONSOLE_DEV);
 #endif
+
+  UNUSED(a64_uart_init);

Review Comment:
   `a64_uart_init` is a Static Function, called to init UART1 to UART4. Since UART0 is already initialised by U-Boot Bootloader, we don't call `a64_uart_init` to init UART0.
   
   Without the line `UNUSED(a64_uart_init)`, the compiler fails with this error:
   
   ```text
   CC:  chip/a64_serial.c chip/a64_serial.c:962:12: error: 'a64_uart_init' defined but not used [-Werror=unused-function]
     962 | static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx,
         |            ^~~~~~~~~~~~~
   cc1: all warnings being treated as errors
   ```
   
   Alternatively I can fix this with:
   
   ```c
   #if defined(CONFIG_A64_UART1) || defined(CONFIG_A64_UART2) || defined(CONFIG_A64_UART3) || defined(CONFIG_A64_UART4) || defined(CONFIG_A64_UART5)
   static int a64_uart_init(uint32_t gating, uint32_t rst, pio_pinset_t tx, pio_pinset_t rx)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org