mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-12-19 00:11:30 +01:00
serial: uartlite: Add support for OF_PLATDATA
The first change is to list DM_DRIVER_ALIAS for compatible string to be able to match the driver. Only xps one is listed because opb one is likely unused for quite a long time. The second change is to add dtplat structure to plat data and fill register base in probe. Signed-off-by: Michal Simek <michal.simek@amd.com> Link: https://lore.kernel.org/r/b494dbad529e919d33977b8ea6e6dbcd14e78907.1753261604.git.michal.simek@amd.com
This commit is contained in:
parent
d0e8a208f6
commit
3a85a27e34
@ -32,7 +32,11 @@ struct uartlite {
|
||||
};
|
||||
|
||||
struct uartlite_plat {
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct dtd_serial_uartlite dtplat;
|
||||
#else
|
||||
struct uartlite *regs;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct uartlite_priv {
|
||||
@ -94,9 +98,16 @@ static int uartlite_serial_probe(struct udevice *dev)
|
||||
{
|
||||
struct uartlite_plat *plat = dev_get_plat(dev);
|
||||
struct uartlite_priv *priv = dev_get_priv(dev);
|
||||
struct uartlite *regs = plat->regs;
|
||||
struct uartlite *regs;
|
||||
int ret;
|
||||
|
||||
#if CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
struct dtd_serial_uartlite *dtplat = &plat->dtplat;
|
||||
|
||||
regs = (struct uartlite *)dtplat->reg[0];
|
||||
#else
|
||||
regs = plat->regs;
|
||||
#endif
|
||||
priv->regs = regs;
|
||||
|
||||
uart_out32(®s->control, 0);
|
||||
@ -112,6 +123,7 @@ static int uartlite_serial_probe(struct udevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
static int uartlite_serial_of_to_plat(struct udevice *dev)
|
||||
{
|
||||
struct uartlite_plat *plat = dev_get_plat(dev);
|
||||
@ -120,6 +132,7 @@ static int uartlite_serial_of_to_plat(struct udevice *dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static const struct dm_serial_ops uartlite_serial_ops = {
|
||||
.putc = uartlite_serial_putc,
|
||||
@ -137,13 +150,17 @@ U_BOOT_DRIVER(serial_uartlite) = {
|
||||
.name = "serial_uartlite",
|
||||
.id = UCLASS_SERIAL,
|
||||
.of_match = uartlite_serial_ids,
|
||||
#if !CONFIG_IS_ENABLED(OF_PLATDATA)
|
||||
.of_to_plat = uartlite_serial_of_to_plat,
|
||||
#endif
|
||||
.priv_auto = sizeof(struct uartlite_priv),
|
||||
.plat_auto = sizeof(struct uartlite_plat),
|
||||
.probe = uartlite_serial_probe,
|
||||
.ops = &uartlite_serial_ops,
|
||||
};
|
||||
|
||||
DM_DRIVER_ALIAS(serial_uartlite, xlnx_xps_uartlite_1_00_a)
|
||||
|
||||
#ifdef CONFIG_DEBUG_UART_UARTLITE
|
||||
|
||||
#include <debug_uart.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user