Skip to content

Commit

Permalink
platform: add radxa zero3 support
Browse files Browse the repository at this point in the history
Signed-off-by: Nascs <[email protected]>
  • Loading branch information
nascs authored and tingleby committed Aug 28, 2024
1 parent a62c094 commit 8a37e75
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 4 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions docs/index.java.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions docs/radxa_zero3.md
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions include/arm/radxa_rock_3c.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/arm/arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 10 additions & 2 deletions src/arm/radxa_rock_3c.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8a37e75

Please sign in to comment.