mirror of
https://github.com/apache/nuttx.git
synced 2026-05-28 11:56:10 +08:00
arch: Rename up_[early]serialinit to [arm64|riscv|x86_64][early]serialinit
The naming standard at: https://cwiki.apache.org/confluence/display/NUTTX/Naming+of+Architecture%2C+MCU%2C+and+Board+Interfaces requires that all MCU-private function begin with the name of the architecture, not up_. follow the change from: https://github.com/apache/nuttx/pull/930 Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
committed by
Petro Karashchenko
parent
6c6a54b0c9
commit
bc3e6c84e1
+1
-1
@@ -114,7 +114,7 @@ config ARCH_EARLY_PRINT
|
|||||||
different platform, if NuttX runing at wrong ELs or state it will
|
different platform, if NuttX runing at wrong ELs or state it will
|
||||||
be not normal anymore. So we need to print something in arm64_head.S
|
be not normal anymore. So we need to print something in arm64_head.S
|
||||||
to debug this situation.
|
to debug this situation.
|
||||||
Enabling this option will need to implement up_earlyserialinit and
|
Enabling this option will need to implement arm64_earlyserialinit and
|
||||||
arm64_lowputc functions just you see in qemu, if you not sure,
|
arm64_lowputc functions just you see in qemu, if you not sure,
|
||||||
keeping the option disable.
|
keeping the option disable.
|
||||||
|
|
||||||
|
|||||||
@@ -49,15 +49,6 @@
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* Initialize A64 UART
|
|
||||||
* xb: Register that contains the UART Base Address
|
|
||||||
* c: Scratch register number
|
|
||||||
*/
|
|
||||||
|
|
||||||
GTEXT(up_earlyserialinit)
|
|
||||||
SECTION_FUNC(text, up_earlyserialinit)
|
|
||||||
ret /* Do nothing because U-Boot has already initialized UART */
|
|
||||||
|
|
||||||
/* Wait for A64 UART to be ready to transmit
|
/* Wait for A64 UART to be ready to transmit
|
||||||
* xb: Register that contains the UART Base Address
|
* xb: Register that contains the UART Base Address
|
||||||
* wt: Scratch register number
|
* wt: Scratch register number
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ primary_core:
|
|||||||
* Should only be called on the boot CPU
|
* Should only be called on the boot CPU
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bl up_earlyserialinit
|
bl arm64_earlyserialinit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRINT(primary_boot, "- Ready to Boot Primary CPU\r\n")
|
PRINT(primary_boot, "- Ready to Boot Primary CPU\r\n")
|
||||||
|
|||||||
@@ -50,24 +50,6 @@
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* PL011 UART initialization
|
|
||||||
* xb: register which contains the UART base address
|
|
||||||
* c: scratch register number
|
|
||||||
*/
|
|
||||||
|
|
||||||
GTEXT(up_earlyserialinit)
|
|
||||||
SECTION_FUNC(text, up_earlyserialinit)
|
|
||||||
ldr x15, =CONFIG_UART0_BASE
|
|
||||||
mov x0, #(7372800 / EARLY_UART_PL011_BAUD_RATE % 16)
|
|
||||||
strh w0, [x15, #0x28] /* -> UARTFBRD (Baud divisor fraction) */
|
|
||||||
mov x0, #(7372800 / EARLY_UART_PL011_BAUD_RATE / 16)
|
|
||||||
strh w0, [x15, #0x24] /* -> UARTIBRD (Baud divisor integer) */
|
|
||||||
mov x0, #0x60 /* 8n1 */
|
|
||||||
str w0, [x15, #0x2C] /* -> UARTLCR_H (Line control) */
|
|
||||||
ldr x0, =0x00000301 /* RXE | TXE | UARTEN */
|
|
||||||
str w0, [x15, #0x30] /* -> UARTCR (Control Register) */
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* PL011 UART wait UART to be ready to transmit
|
/* PL011 UART wait UART to be ready to transmit
|
||||||
* xb: register which contains the UART base address
|
* xb: register which contains the UART base address
|
||||||
* c: scratch register number
|
* c: scratch register number
|
||||||
|
|||||||
@@ -50,24 +50,6 @@
|
|||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* PL011 UART initialization
|
|
||||||
* xb: register which contains the UART base address
|
|
||||||
* c: scratch register number
|
|
||||||
*/
|
|
||||||
|
|
||||||
GTEXT(up_earlyserialinit)
|
|
||||||
SECTION_FUNC(text, up_earlyserialinit)
|
|
||||||
ldr x15, =UART1_BASE_ADDRESS
|
|
||||||
mov x0, #(7372800 / EARLY_UART_PL011_BAUD_RATE % 16)
|
|
||||||
strh w0, [x15, #0x28] /* -> UARTFBRD (Baud divisor fraction) */
|
|
||||||
mov x0, #(7372800 / EARLY_UART_PL011_BAUD_RATE / 16)
|
|
||||||
strh w0, [x15, #0x24] /* -> UARTIBRD (Baud divisor integer) */
|
|
||||||
mov x0, #0x60 /* 8n1 */
|
|
||||||
str w0, [x15, #0x2C] /* -> UARTLCR_H (Line control) */
|
|
||||||
ldr x0, =0x00000301 /* RXE | TXE | UARTEN */
|
|
||||||
str w0, [x15, #0x30] /* -> UARTCR (Control Register) */
|
|
||||||
ret
|
|
||||||
|
|
||||||
/* PL011 UART wait UART to be ready to transmit
|
/* PL011 UART wait UART to be ready to transmit
|
||||||
* xb: register which contains the UART base address
|
* xb: register which contains the UART base address
|
||||||
* c: scratch register number
|
* c: scratch register number
|
||||||
|
|||||||
@@ -29,17 +29,6 @@
|
|||||||
|
|
||||||
#include <arch/qemu-rv/chip.h>
|
#include <arch/qemu-rv/chip.h>
|
||||||
|
|
||||||
#ifndef __ASSEMBLY__
|
|
||||||
|
|
||||||
/* Include the chip interrupt definition file */
|
|
||||||
|
|
||||||
/* Serial initial function defined in uart_16550.c */
|
|
||||||
|
|
||||||
extern void up_earlyserialinit(void);
|
|
||||||
extern void up_serialinit(void);
|
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
|
||||||
|
|
||||||
#include "qemu_rv_memorymap.h"
|
#include "qemu_rv_memorymap.h"
|
||||||
|
|
||||||
#include "hardware/qemu_rv_clint.h"
|
#include "hardware/qemu_rv_clint.h"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include <nuttx/init.h>
|
#include <nuttx/init.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
#include <nuttx/serial/uart_16550.h>
|
||||||
#include <arch/board/board.h>
|
#include <arch/board/board.h>
|
||||||
|
|
||||||
#include "riscv_internal.h"
|
#include "riscv_internal.h"
|
||||||
@@ -117,7 +118,7 @@ void qemu_rv_start(int mhartid)
|
|||||||
showprogress('A');
|
showprogress('A');
|
||||||
|
|
||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
up_earlyserialinit();
|
riscv_earlyserialinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
showprogress('B');
|
showprogress('B');
|
||||||
@@ -218,7 +219,12 @@ void qemu_rv_start(int mhartid)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void riscv_earlyserialinit(void)
|
||||||
|
{
|
||||||
|
u16550_earlyserialinit();
|
||||||
|
}
|
||||||
|
|
||||||
void riscv_serialinit(void)
|
void riscv_serialinit(void)
|
||||||
{
|
{
|
||||||
up_serialinit();
|
u16550_serialinit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,7 +56,4 @@
|
|||||||
* Public Functions Prototypes
|
* Public Functions Prototypes
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void);
|
|
||||||
void up_serialinit(void);
|
|
||||||
|
|
||||||
#endif /* __ARCH_X86_SRC_QEMU_CHIP_H */
|
#endif /* __ARCH_X86_SRC_QEMU_CHIP_H */
|
||||||
|
|||||||
@@ -93,13 +93,13 @@ int up_putc(int ch)
|
|||||||
#ifdef USE_EARLYSERIALINIT
|
#ifdef USE_EARLYSERIALINIT
|
||||||
void x86_earlyserialinit(void)
|
void x86_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
up_earlyserialinit();
|
u16550_earlyserialinit();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_SERIALDRIVER
|
#ifdef USE_SERIALDRIVER
|
||||||
void x86_serialinit(void)
|
void x86_serialinit(void)
|
||||||
{
|
{
|
||||||
up_serialinit();
|
u16550_serialinit();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -43,9 +43,4 @@
|
|||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
/* Serial initial function defined in uart_16550.c */
|
|
||||||
|
|
||||||
extern void up_earlyserialinit(void);
|
|
||||||
extern void up_serialinit(void);
|
|
||||||
|
|
||||||
#endif /* __ARCH_X86_64_SRC_INTEL64_CHIP_H */
|
#endif /* __ARCH_X86_64_SRC_INTEL64_CHIP_H */
|
||||||
|
|||||||
@@ -101,10 +101,10 @@ int up_putc(int ch)
|
|||||||
|
|
||||||
void x86_64_earlyserialinit(void)
|
void x86_64_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
up_earlyserialinit();
|
u16550_earlyserialinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
void x86_64_serialinit(void)
|
void x86_64_serialinit(void)
|
||||||
{
|
{
|
||||||
up_serialinit();
|
u16550_serialinit();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,11 +73,6 @@ config RPMSG_UART
|
|||||||
select SERIAL_REMOVABLE
|
select SERIAL_REMOVABLE
|
||||||
select SERIAL_IFLOWCONTROL
|
select SERIAL_IFLOWCONTROL
|
||||||
|
|
||||||
config RPMSG_SERIALINIT
|
|
||||||
bool "Add dummy up_serialinit for UART rpmsg"
|
|
||||||
default y if !16550_UART && !MCU_SERIAL
|
|
||||||
depends on RPMSG_UART
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Standard serial driver configuration
|
# Standard serial driver configuration
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -1276,7 +1276,7 @@ static void u16550_putc(FAR struct u16550_s *priv, int ch)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_earlyserialinit
|
* Name: u16550_earlyserialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in debug so that the
|
* Performs the low level UART initialization early in debug so that the
|
||||||
@@ -1288,7 +1288,7 @@ static void u16550_putc(FAR struct u16550_s *priv, int ch)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
void u16550_earlyserialinit(void)
|
||||||
{
|
{
|
||||||
/* Configuration whichever one is the console */
|
/* Configuration whichever one is the console */
|
||||||
|
|
||||||
@@ -1301,15 +1301,15 @@ void up_earlyserialinit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: u16550_serialinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes that
|
* Register serial console and serial ports. This assumes that
|
||||||
* up_earlyserialinit was called previously.
|
* u16550_earlyserialinit was called previously.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void up_serialinit(void)
|
void u16550_serialinit(void)
|
||||||
{
|
{
|
||||||
#ifdef CONSOLE_DEV
|
#ifdef CONSOLE_DEV
|
||||||
uart_register("/dev/console", &CONSOLE_DEV);
|
uart_register("/dev/console", &CONSOLE_DEV);
|
||||||
|
|||||||
@@ -469,15 +469,3 @@ fail:
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_RPMSG_SERIALINIT
|
|
||||||
/* Dummy function to make linker happy */
|
|
||||||
|
|
||||||
void up_earlyserialinit(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void up_serialinit(void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_RPMSG_SERIALINIT */
|
|
||||||
|
|||||||
@@ -330,6 +330,32 @@ typedef uint64_t uart_addrwidth_t;
|
|||||||
* Public Functions Definitions
|
* Public Functions Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: u16550_earlyserialinit
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Performs the low level UART initialization early in debug so that the
|
||||||
|
* serial console will be available during bootup. This must be called
|
||||||
|
* before uart_serialinit.
|
||||||
|
*
|
||||||
|
* NOTE: Configuration of the CONSOLE UART was performed by uart_lowsetup()
|
||||||
|
* very early in the boot sequence.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void u16550_earlyserialinit(void);
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: u16550_serialinit
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Register serial console and serial ports. This assumes that
|
||||||
|
* u16550_earlyserialinit was called previously.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
void u16550_serialinit(void);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uart_getreg(), uart_putreg(), uart_ioctl()
|
* Name: uart_getreg(), uart_putreg(), uart_ioctl()
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user