made Rock Pi 4 working again with recent 5.x kernels
Signed-off-by: Carsten Menke <cm@p-i-u.de>
This commit is contained in:
committed by
Tom Ingleby
parent
5b8ec38440
commit
79043568dd
@@ -46,6 +46,7 @@ ARM
|
|||||||
* [phyBOARD-Wega](../master/docs/phyboard-wega.md)
|
* [phyBOARD-Wega](../master/docs/phyboard-wega.md)
|
||||||
* [96Boards](../master/docs/96boards.md)
|
* [96Boards](../master/docs/96boards.md)
|
||||||
* [ADLINK IPi-SMARC ARM](../master/docs/adlink_ipi_arm.md)
|
* [ADLINK IPi-SMARC ARM](../master/docs/adlink_ipi_arm.md)
|
||||||
|
* [Rock Pi 4](../master/docs/rockpi4.md)
|
||||||
|
|
||||||
MIPS
|
MIPS
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -90,7 +90,10 @@ mraa_arm_platform()
|
|||||||
platform_type = MRAA_96BOARDS;
|
platform_type = MRAA_96BOARDS;
|
||||||
else if (mraa_file_contains("/proc/device-tree/model", "Avnet Ultra96 Rev1"))
|
else if (mraa_file_contains("/proc/device-tree/model", "Avnet Ultra96 Rev1"))
|
||||||
platform_type = MRAA_96BOARDS;
|
platform_type = MRAA_96BOARDS;
|
||||||
else if (mraa_file_contains("/proc/device-tree/model", "ROCK PI 4"))
|
else if (mraa_file_contains("/proc/device-tree/model", "ROCK Pi 4") ||
|
||||||
|
mraa_file_contains("/proc/device-tree/model", "ROCK PI 4A") ||
|
||||||
|
mraa_file_contains("/proc/device-tree/model", "ROCK PI 4B")
|
||||||
|
)
|
||||||
platform_type = MRAA_ROCKPI4;
|
platform_type = MRAA_ROCKPI4;
|
||||||
else if (mraa_file_contains("/proc/device-tree/compatible", "raspberrypi,"))
|
else if (mraa_file_contains("/proc/device-tree/compatible", "raspberrypi,"))
|
||||||
platform_type = MRAA_RASPBERRY_PI;
|
platform_type = MRAA_RASPBERRY_PI;
|
||||||
|
|||||||
@@ -15,13 +15,17 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#define DT_BASE "/proc/device-tree"
|
#define DT_BASE "/proc/device-tree"
|
||||||
|
/*
|
||||||
|
* "Radxa ROCK Pi 4" is the model name on stock 5.x kernels
|
||||||
|
* "ROCK PI 4A", "ROCK PI 4B" is used on Radxa 4.4 kernel
|
||||||
|
* so we search for the string below by ignoring case
|
||||||
|
*/
|
||||||
|
#define PLATFORM_NAME_ROCK_PI_4 "ROCK Pi 4"
|
||||||
#define PLATFORM_NAME_ROCK_PI_4A "ROCK PI 4A"
|
#define PLATFORM_NAME_ROCK_PI_4A "ROCK PI 4A"
|
||||||
#define PLATFORM_NAME_ROCK_PI_4B "ROCK PI 4B"
|
#define PLATFORM_NAME_ROCK_PI_4B "ROCK PI 4B"
|
||||||
|
|
||||||
#define MAX_SIZE 64
|
#define MAX_SIZE 64
|
||||||
|
|
||||||
const char* rockpi4a_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2","/dev/ttyS4"};
|
const char* rockpi4_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2","/dev/ttyS4"};
|
||||||
const char* rockpi4b_serialdev[MRAA_ROCKPI4_UART_COUNT] = { "/dev/ttyS2","/dev/ttyS4"};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mraa_rockpi4_pininfo(mraa_board_t* board, int index, int sysfs_pin, mraa_pincapabilities_t pincapabilities_t, char* fmt, ...)
|
mraa_rockpi4_pininfo(mraa_board_t* board, int index, int sysfs_pin, mraa_pincapabilities_t pincapabilities_t, char* fmt, ...)
|
||||||
@@ -67,14 +71,13 @@ mraa_rockpi4()
|
|||||||
|
|
||||||
if (mraa_file_exist(DT_BASE "/model")) {
|
if (mraa_file_exist(DT_BASE "/model")) {
|
||||||
// We are on a modern kernel, great!!!!
|
// We are on a modern kernel, great!!!!
|
||||||
if (mraa_file_contains(DT_BASE "/model", "ROCK PI 4A")) {
|
if (mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4) ||
|
||||||
b->platform_name = PLATFORM_NAME_ROCK_PI_4A;
|
mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4A) ||
|
||||||
b->uart_dev[0].device_path = (char*) rockpi4a_serialdev[0];
|
mraa_file_contains(DT_BASE "/model", PLATFORM_NAME_ROCK_PI_4B)
|
||||||
b->uart_dev[1].device_path = (char*) rockpi4a_serialdev[1];
|
) {
|
||||||
} else if (mraa_file_contains(DT_BASE "/model", "ROCK PI 4B")) {
|
b->platform_name = PLATFORM_NAME_ROCK_PI_4;
|
||||||
b->platform_name = PLATFORM_NAME_ROCK_PI_4B;
|
b->uart_dev[0].device_path = (char*) rockpi4_serialdev[0];
|
||||||
b->uart_dev[0].device_path = (char*) rockpi4b_serialdev[0];
|
b->uart_dev[1].device_path = (char*) rockpi4_serialdev[1];
|
||||||
b->uart_dev[1].device_path = (char*) rockpi4b_serialdev[1];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +88,7 @@ mraa_rockpi4()
|
|||||||
b->uart_dev[1].index = 4;
|
b->uart_dev[1].index = 4;
|
||||||
|
|
||||||
// I2C
|
// I2C
|
||||||
if ((strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI_4B, MAX_SIZE) == 0)
|
if (strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI_4, MAX_SIZE) == 0) {
|
||||||
|| (strncmp(b->platform_name, PLATFORM_NAME_ROCK_PI_4B, MAX_SIZE) == 0)) {
|
|
||||||
b->i2c_bus_count = MRAA_ROCKPI4_I2C_COUNT;
|
b->i2c_bus_count = MRAA_ROCKPI4_I2C_COUNT;
|
||||||
b->def_i2c_bus = 0;
|
b->def_i2c_bus = 0;
|
||||||
b->i2c_bus[0].bus_id = 7;
|
b->i2c_bus[0].bus_id = 7;
|
||||||
|
|||||||
Reference in New Issue
Block a user