Skip to content

Commit

Permalink
drivers/char: rename arm-uart.c to uart-init.c
Browse files Browse the repository at this point in the history
Rename the file containing uart_init() to enable reuse across other
architectures that utilize device trees or SPCR tables to locate UART
information.
After locating UART data, {acpi}_device_init() is called to initialize
the UART.

arm_uart_init() is renamed to uart_init() to be reused by other
architectures.

A new configuration option, CONFIG_GENERIC_UART_INIT, is introduced,
currently available only for Arm. Enabling CONFIG_UART_INIT on additional
architectures will require additional functionality, such as device tree
mapping and unflattening, etc.

arm-uart.c is removed from "ARM (W/ VIRTUALIZATION EXTENSIONS) ARCHITECTURE"
section in the MAINTAINERS file, as it is no longer Arm-specific and can
now be maintained by maintainers of other architectures.

Use GENERIC_UART_INIT for CONFIG_ARM by adding `select GENERIC_UART_INIT`
to CONFIG_ARM.

Signed-off-by: Oleksii Kurochko <[email protected]>
Reviewed-by: Michal Orzel <[email protected]>
Acked-by: Julien Grall <[email protected]>
  • Loading branch information
Oleksii Kurochko authored and Julien Grall committed Nov 28, 2024
1 parent a14593e commit 7bd8d37
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 15 deletions.
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ S: Supported
L: [email protected]
F: docs/misc/arm/
F: xen/arch/arm/
F: xen/drivers/char/arm-uart.c
F: xen/drivers/char/cadence-uart.c
F: xen/drivers/char/exynos4210-uart.c
F: xen/drivers/char/imx-lpuart.c
Expand Down
1 change: 1 addition & 0 deletions xen/arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ config ARM_64
config ARM
def_bool y
select FUNCTION_ALIGNMENT_4B
select GENERIC_UART_INIT
select HAS_ALTERNATIVE if HAS_VMAP
select HAS_DEVICE_TREE
select HAS_PASSTHROUGH
Expand Down
2 changes: 1 addition & 1 deletion xen/arch/arm/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)

gic_preinit();

arm_uart_init();
uart_init();
console_init_preirq();
console_init_ring();

Expand Down
3 changes: 3 additions & 0 deletions xen/drivers/char/Kconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
config GENERIC_UART_INIT
bool

config HAS_NS16550
bool "NS16550 UART driver" if ARM
default n if RISCV
Expand Down
2 changes: 1 addition & 1 deletion xen/drivers/char/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ obj-$(CONFIG_HAS_EHCI) += ehci-dbgp.o
obj-$(CONFIG_XHCI) += xhci-dbc.o
obj-$(CONFIG_HAS_IMX_LPUART) += imx-lpuart.o
obj-$(CONFIG_HAS_LINFLEX) += linflex-uart.o
obj-$(CONFIG_ARM) += arm-uart.o
obj-$(CONFIG_GENERIC_UART_INIT) += uart-init.o
obj-y += serial.o
obj-$(CONFIG_XEN_GUEST) += xen_pv_console.o
obj-$(CONFIG_PV_SHIM) += consoled.o
15 changes: 4 additions & 11 deletions xen/drivers/char/arm-uart.c → xen/drivers/char/uart-init.c
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */

/*
* Derived from:
* xen/drivers/char/arm-uart.c
*
* Generic uart retrieved via the device tree or ACPI
*
* Julien Grall <[email protected]>
* Copyright (c) 2013 Linaro Limited.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#include <asm/device.h>
Expand Down Expand Up @@ -126,7 +119,7 @@ static void __init acpi_uart_init(void)
static void __init acpi_uart_init(void) { }
#endif

void __init arm_uart_init(void)
void __init uart_init(void)
{
if ( acpi_disabled )
dt_uart_init();
Expand Down
2 changes: 1 addition & 1 deletion xen/include/xen/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ void xhci_dbc_uart_init(void);
static void inline xhci_dbc_uart_init(void) {}
#endif

void arm_uart_init(void);
void uart_init(void);

struct physdev_dbgp_op;
int dbgp_op(const struct physdev_dbgp_op *op);
Expand Down

0 comments on commit 7bd8d37

Please sign in to comment.