Skip to content

Commit

Permalink
Initial imx93 support
Browse files Browse the repository at this point in the history
Same LPUART as imx8qxp. Timers seem new and needs a new driver.
For now, use ARM generic timer when KernelArmExportPCNTUser and
KernelArmExportPTMRUser are enabled.

Signed-off-by: Indan Zupancic <[email protected]>
  • Loading branch information
Indanz committed Nov 29, 2024
1 parent 5af066b commit 0010a58
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 1 deletion.
2 changes: 1 addition & 1 deletion libplatsupport/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ else()
message(FATAL_ERROR "Unsupported KernelArch '${KernelArch}'")
endif()

if(KernelPlatformQEMUArmVirt OR KernelPlatformQuartz64)
if(KernelPlatformQEMUArmVirt OR KernelPlatformQuartz64 OR KernelPlatformIMX93)
if(KernelArmExportPCNTUser AND KernelArmExportPTMRUser)
list(APPEND deps src/arch/arm/generic_ltimer.c)
endif()
Expand Down
14 changes: 14 additions & 0 deletions libplatsupport/plat_include/imx93/platsupport/plat/clock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright 2024, Indan Zupancic
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once

enum clk_id {
NCLOCKS,
};

enum clock_gate {
NCLKGATES
};
10 changes: 10 additions & 0 deletions libplatsupport/plat_include/imx93/platsupport/plat/i2c.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright 2024, Indan Zupancic
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once

enum i2c_id {
NI2C
};
21 changes: 21 additions & 0 deletions libplatsupport/plat_include/imx93/platsupport/plat/serial.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright 2024, Indan Zupancic
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once

enum chardev_id {
PS_SERIAL0,
PS_SERIAL1,
PS_SERIAL2,
PS_SERIAL3,
PS_SERIAL4,
PS_SERIAL5,
PS_SERIAL6,
PS_SERIAL7,

NUM_CHARDEV,

PS_SERIAL_DEFAULT = PS_SERIAL0
};
Empty file.
70 changes: 70 additions & 0 deletions libplatsupport/src/plat/imx93/chardev.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright 2024, Indan Zupancic
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "../../chardev.h"

static const struct dev_defn lpuart[NUM_CHARDEV] = {
{
.id = PS_SERIAL0,
.paddr = 0x44380000,
.size = 4096,
.init_fn = uart_init
},
{
.id = PS_SERIAL1,
.paddr = 0x44390000,
.size = 4096,
.init_fn = uart_init
},
{
.id = PS_SERIAL2,
.paddr = 0x42570000,
.size = 4096,
.init_fn = uart_init
},
{
.id = PS_SERIAL3,
.paddr = 0x42580000,
.size = 4096,
.init_fn = uart_init
},
{
.id = PS_SERIAL4,
.paddr = 0x42590000,
.size = 4096,
.init_fn = uart_init
},
{
.id = PS_SERIAL5,
.paddr = 0x425a0000,
.size = 4096,
.init_fn = uart_init
},
{
.id = PS_SERIAL6,
.paddr = 0x42690000,
.size = 4096,
.init_fn = uart_init,
},
{
.id = PS_SERIAL7,
.paddr = 0x426a0000,
.size = 4096,
.init_fn = uart_init,
}
};

struct ps_chardevice *
ps_cdev_init(enum chardev_id id, const ps_io_ops_t *ops, struct ps_chardevice *dev)
{
if (id < PS_SERIAL0 || id >= NUM_CHARDEV) {
return NULL;
}
if (lpuart[id].init_fn(&lpuart[id], ops, dev)) {
return NULL;
}
return dev;
}

1 change: 1 addition & 0 deletions libplatsupport/src/plat/imx93/serial.c
2 changes: 2 additions & 0 deletions libplatsupport/src/plat/tqma8xqp1gb/serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
* i.MX 8DualX/8DualXPlus/8QuadXPlus Applications Processor Reference Manual
* Revision 0 (IMX8DQXPRM.pdf)
* Chapter 16.13 (page 7908)
*
* Same LPUART is used by i.MX93.
*/
#include <string.h>
#include <stdlib.h>
Expand Down

0 comments on commit 0010a58

Please sign in to comment.