From 9edff66511c2dd70a5159c4b9016eb41460c0a9f Mon Sep 17 00:00:00 2001 From: peter-kutak Date: Sun, 23 May 2021 00:11:15 +0200 Subject: [PATCH 1/2] Update ttyebusm.c resolve nullpointer crash on kernel 5.10 --- ttyebusm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ttyebusm.c b/ttyebusm.c index f79468c..50f9f72 100644 --- a/ttyebusm.c +++ b/ttyebusm.c @@ -813,7 +813,11 @@ unsigned int ttyebus_raspi_model(void) set_fs(old_fs); return 0; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,14,0) + NumBytes = kernel_read(filp, buf, sizeof(buf), 0); +#else NumBytes = filp->f_op->read(filp, buf, sizeof(buf), &filp->f_pos); +#endif set_fs(old_fs); // restore the segment descriptor From 6628f3a66985cce1b14c4c01d8e102b059d7d858 Mon Sep 17 00:00:00 2001 From: Peter Kutak Date: Sun, 6 Jun 2021 19:26:48 +0200 Subject: [PATCH 2/2] Beginning with kernel 5.10 RASPI 2 and 3 uses IRQ 114 and RASPI 4 uses IRQ 29 according to discusion on github I have only RPi Zero and RPi 2 --- ttyebusm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ttyebusm.c b/ttyebusm.c index 50f9f72..d4ca3f9 100644 --- a/ttyebusm.c +++ b/ttyebusm.c @@ -188,13 +188,21 @@ static int IrqCounter = 0; // The UART interrupt on model B+ is allocated to 81. // The UART interrupt on RASPI2,3 is allocated to 87, beginning with kernel 4.19.42, it is allocated to 81. // For RASPI 4, the interrupt is 34 and is shared with all other UARTs. +// Beginning with kernel 5.10 RASPI 2 and 3 uses IRQ 114 and RASPI 4 uses IRQ 29 #define RASPI_1_UART_IRQ 81 -#define RASPI_4_UART_IRQ 34 #if LINUX_VERSION_CODE < KERNEL_VERSION(4,19,42) #define RASPI_23_UART_IRQ 87 -#else +#elif LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) #define RASPI_23_UART_IRQ 81 +#else +#define RASPI_23_UART_IRQ 114 #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,10,0) +#define RASPI_4_UART_IRQ 34 +#else +#define RASPI_4_UART_IRQ 29 +#endif + // PL011 UART register (16C650 type) // =================================