1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-02 17:22:22 +02:00

serial: pl01x: Prepare the driver to support SPL_OF_PLATDATA

This commit prepares the pl01x serial driver to be used with
SPL_OF_PLATDATA enabled.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
This commit is contained in:
Lukasz Majewski
2023-05-19 12:43:52 +02:00
committed by Stefano Babic
parent fdef5e1502
commit 875752adc8
2 changed files with 16 additions and 0 deletions

View File

@@ -291,8 +291,16 @@ int pl01x_serial_probe(struct udevice *dev)
struct pl01x_serial_plat *plat = dev_get_plat(dev); struct pl01x_serial_plat *plat = dev_get_plat(dev);
struct pl01x_priv *priv = dev_get_priv(dev); struct pl01x_priv *priv = dev_get_priv(dev);
#if CONFIG_IS_ENABLED(OF_PLATDATA)
struct dtd_serial_pl01x *dtplat = &plat->dtplat;
priv->regs = (struct pl01x_regs *)dtplat->reg[0];
plat->type = dtplat->type;
#else
priv->regs = (struct pl01x_regs *)plat->base; priv->regs = (struct pl01x_regs *)plat->base;
#endif
priv->type = plat->type; priv->type = plat->type;
if (!plat->skip_init) if (!plat->skip_init)
return pl01x_generic_serial_init(priv->regs, priv->type); return pl01x_generic_serial_init(priv->regs, priv->type);
else else
@@ -380,8 +388,10 @@ int pl01x_serial_of_to_plat(struct udevice *dev)
U_BOOT_DRIVER(serial_pl01x) = { U_BOOT_DRIVER(serial_pl01x) = {
.name = "serial_pl01x", .name = "serial_pl01x",
.id = UCLASS_SERIAL, .id = UCLASS_SERIAL,
#if CONFIG_IS_ENABLED(OF_REAL)
.of_match = of_match_ptr(pl01x_serial_id), .of_match = of_match_ptr(pl01x_serial_id),
.of_to_plat = of_match_ptr(pl01x_serial_of_to_plat), .of_to_plat = of_match_ptr(pl01x_serial_of_to_plat),
#endif
.plat_auto = sizeof(struct pl01x_serial_plat), .plat_auto = sizeof(struct pl01x_serial_plat),
.probe = pl01x_serial_probe, .probe = pl01x_serial_probe,
.ops = &pl01x_serial_ops, .ops = &pl01x_serial_ops,
@@ -389,6 +399,8 @@ U_BOOT_DRIVER(serial_pl01x) = {
.priv_auto = sizeof(struct pl01x_priv), .priv_auto = sizeof(struct pl01x_priv),
}; };
DM_DRIVER_ALIAS(serial_pl01x, arm_pl011)
DM_DRIVER_ALIAS(serial_pl01x, arm_pl010)
#endif #endif
#if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011) #if defined(CONFIG_DEBUG_UART_PL010) || defined(CONFIG_DEBUG_UART_PL011)

View File

@@ -20,7 +20,11 @@ enum pl01x_type {
* @skip_init: Don't attempt to change port configuration (also means @clock * @skip_init: Don't attempt to change port configuration (also means @clock
* is ignored) * is ignored)
*/ */
#include <dt-structs.h>
struct pl01x_serial_plat { struct pl01x_serial_plat {
#if CONFIG_IS_ENABLED(OF_PLATDATA)
struct dtd_serial_pl01x dtplat;
#endif
unsigned long base; unsigned long base;
enum pl01x_type type; enum pl01x_type type;
unsigned int clock; unsigned int clock;