From 8a37e75f4a156bb23d879954552ba9197e4bd7e8 Mon Sep 17 00:00:00 2001 From: Nascs Date: Fri, 12 Jul 2024 07:01:57 +0000 Subject: [PATCH] platform: add radxa zero3 support Signed-off-by: Nascs --- README.md | 3 ++- docs/index.java.md | 1 + docs/index.md | 1 + docs/radxa_zero3.md | 20 ++++++++++++++++++++ include/arm/radxa_rock_3c.h | 1 + src/arm/arm.c | 3 ++- src/arm/radxa_rock_3c.c | 12 ++++++++++-- 7 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 docs/radxa_zero3.md diff --git a/README.md b/README.md index 26ed63479..3c7dc2f26 100644 --- a/README.md +++ b/README.md @@ -46,13 +46,14 @@ ARM * [96Boards](../master/docs/96boards.md) * [ADLINK IPi-SMARC ARM](../master/docs/adlink_ipi_arm.md) * [Radxa CM3](../master/docs/radxa_cm3.md) +* [Radxa CM5 IO](../master/docs/radxa_cm5_io.md) * [Radxa E25](../master/docs/radxa_e25.md) * [Radxa ROCK 3A](../master/docs/radxa_rock_3a.md) * [Radxa ROCK 3B](../master/docs/radxa_rock_3b.md) * [Radxa ROCK 3C](../master/docs/radxa_rock_3c.md) * [Radxa ROCK 5A](../master/docs/radxa_rock_5a.md) * [Radxa ROCK 5B](../master/docs/radxa_rock_5b.md) -* [Radxa CM5 IO](../master/docs/radxa_cm5_io.md) +* [Radxa ZERO3](../master/docs/radxa_zero3.md) * [Rock Pi 4](../master/docs/rockpi4.md) * [Orange Pi Prime](../master/docs/orange_pi_prime.md) diff --git a/docs/index.java.md b/docs/index.java.md index 033602aa5..cb55323bc 100644 --- a/docs/index.java.md +++ b/docs/index.java.md @@ -62,6 +62,7 @@ Specific platform information for supported platforms is documented here: - @ref radxa_rock_3c - @ref radxa_rock_5a - @ref radxa_rock_5b +- @ref radxa_zero3 - @ref rockpi4 ## DEBUGGING diff --git a/docs/index.md b/docs/index.md index 841ade12b..4bd01f406 100644 --- a/docs/index.md +++ b/docs/index.md @@ -70,6 +70,7 @@ Specific platform information for supported platforms is documented here: - @ref radxa_rock_3c - @ref radxa_rock_5a - @ref radxa_rock_5b +- @ref radxa_zero3 - @ref rockpi4 ## DEBUGGING diff --git a/docs/radxa_zero3.md b/docs/radxa_zero3.md new file mode 100644 index 000000000..8e9afb95f --- /dev/null +++ b/docs/radxa_zero3.md @@ -0,0 +1,20 @@ +Radxa ZERO 3 {#_Radxa} +===================== + +Radxa ZERO 3 is an ultra-small, versatile platform that can be used for a wide variety of applications, including IoT devices, machine learning edge computing, home automation, education, and entertainment. + +The ZERO 3W and ZERO 3E differ only in storage and network interfaces. + +Pin Mapping +----------- + +The Radxa ZERO 3's GPIO pinout is compatible with the [Radxa ROCK 3C](./radxa_rock_3c.md). + +Supports +-------- + +You can find additional product support in the following channels: + +- [Product Info](https://docs.radxa.com/en/zero/zero3) +- [Forums](https://forum.radxa.com/c/rock3) +- [Github](https://github.com/radxa) diff --git a/include/arm/radxa_rock_3c.h b/include/arm/radxa_rock_3c.h index 62b294ee9..42b5c8d4e 100644 --- a/include/arm/radxa_rock_3c.h +++ b/include/arm/radxa_rock_3c.h @@ -21,6 +21,7 @@ extern "C" { #define MRAA_RADXA_ROCK_3C_AIO_COUNT 0 #define MRAA_RADXA_ROCK_3C_PIN_COUNT 40 #define PLATFORM_NAME_RADXA_ROCK_3C "Radxa ROCK3 Model C" +#define PLATFORM_NAME_RADXA_ZERO3 "Radxa ZERO 3" mraa_board_t * mraa_radxa_rock_3c(); diff --git a/src/arm/arm.c b/src/arm/arm.c index 9a20c168a..093021006 100644 --- a/src/arm/arm.c +++ b/src/arm/arm.c @@ -110,7 +110,8 @@ mraa_arm_platform() platform_type = MRAA_RADXA_ROCK_3A; else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ROCK_3B)) platform_type = MRAA_RADXA_ROCK_3B; - else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ROCK_3C)) + else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ROCK_3C) || + mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ZERO3)) platform_type = MRAA_RADXA_ROCK_3C; else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ROCK_5A)) platform_type = MRAA_RADXA_ROCK_5A; diff --git a/src/arm/radxa_rock_3c.c b/src/arm/radxa_rock_3c.c index 87172977d..949dc7ca0 100644 --- a/src/arm/radxa_rock_3c.c +++ b/src/arm/radxa_rock_3c.c @@ -49,11 +49,19 @@ mraa_radxa_rock_3c() return NULL; } + if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ROCK_3C)) { + b->platform_name = PLATFORM_NAME_RADXA_ROCK_3C; + } else if (mraa_file_contains("/proc/device-tree/model", PLATFORM_NAME_RADXA_ZERO3)) { + b->platform_name = PLATFORM_NAME_RADXA_ZERO3; + } else { + syslog(LOG_ERR, "An unknown product detected. Fail early..."); + free(b); + return NULL; + } + // pin mux for buses are setup by default by kernel so tell mraa to ignore them b->no_bus_mux = 1; b->phy_pin_count = MRAA_RADXA_ROCK_3C_PIN_COUNT + 1; - - b->platform_name = PLATFORM_NAME_RADXA_ROCK_3C; b->chardev_capable = 1; // UART