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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]