From faeca29216f27f17cc3922d00e98a72067e4120f Mon Sep 17 00:00:00 2001 From: Grigory Kletsko Date: Fri, 17 Jun 2016 15:51:56 +0300 Subject: Add sllin kernel module for LIN support For porter ext01 board use ldattach 25 /dev/ttySC9 to enable sllin line discipline. --- .../sllin/files/0001-cross-compile.patch | 26 ++++++++++++++ .../files/0002-fix-termios-struct-access.patch | 40 ++++++++++++++++++++++ .../0003-disable-debug-fix-otput-formating.patch | 38 ++++++++++++++++++++ common/recipes-support/sllin/sllin_git.bb | 35 +++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 common/recipes-support/sllin/files/0001-cross-compile.patch create mode 100644 common/recipes-support/sllin/files/0002-fix-termios-struct-access.patch create mode 100644 common/recipes-support/sllin/files/0003-disable-debug-fix-otput-formating.patch create mode 100644 common/recipes-support/sllin/sllin_git.bb (limited to 'common') diff --git a/common/recipes-support/sllin/files/0001-cross-compile.patch b/common/recipes-support/sllin/files/0001-cross-compile.patch new file mode 100644 index 0000000..8011028 --- /dev/null +++ b/common/recipes-support/sllin/files/0001-cross-compile.patch @@ -0,0 +1,26 @@ +From c65b62a8e1b183fac9a32f7b0282b4f3156a5840 Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov +Date: Tue, 19 Apr 2016 14:15:07 +0300 +Subject: [PATCH 1/2] cross-compile + + +Signed-off-by: Andrey Gusakov +--- + sllin/Makefile | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/sllin/Makefile b/sllin/Makefile +index 8ae7510..23caf8e 100644 +--- a/sllin/Makefile ++++ b/sllin/Makefile +@@ -1,7 +1,5 @@ + obj-m += sllin.o +-KPATH=/lib/modules/$(shell uname -r)/build +-#KPATH=/mnt/data/_dokumenty_/_w_/_dce_can_/src/can-benchmark/kernel/build/shark/3.0.4 +-#KPATH=/mnt/data/_dokumenty_/_w_/_dce_can_/src/can-benchmark/kernel/build/shark/2.6.36 ++#KPATH=/lib/modules/$(shell uname -r)/build + + all: + make -C ${KPATH} M=$(PWD) modules +-- +1.7.10.4 diff --git a/common/recipes-support/sllin/files/0002-fix-termios-struct-access.patch b/common/recipes-support/sllin/files/0002-fix-termios-struct-access.patch new file mode 100644 index 0000000..74c29e0 --- /dev/null +++ b/common/recipes-support/sllin/files/0002-fix-termios-struct-access.patch @@ -0,0 +1,40 @@ +From 79fa7985df1f77a34d03188f1251fb7aa8efce0c Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov +Date: Tue, 19 Apr 2016 15:38:29 +0300 +Subject: [PATCH 2/2] fix termios struct access + + +Signed-off-by: Andrey Gusakov +--- + sllin/sllin.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/sllin/sllin.c b/sllin/sllin.c +index b97219e..54aff92 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -210,17 +210,17 @@ static int sltty_change_speed(struct tty_struct *tty, unsigned speed) + + mutex_lock(&tty->termios_mutex); + +- old_termios = *(tty->termios); ++ old_termios = tty->termios; + + cflag = CS8 | CREAD | CLOCAL | HUPCL; + cflag &= ~(CBAUD | CIBAUD); + cflag |= BOTHER; +- tty->termios->c_cflag = cflag; +- tty->termios->c_oflag = 0; +- tty->termios->c_lflag = 0; ++ tty->termios.c_cflag = cflag; ++ tty->termios.c_oflag = 0; ++ tty->termios.c_lflag = 0; + + /* Enable interrupt when UART-Break or Framing error received */ +- tty->termios->c_iflag = BRKINT | INPCK; ++ tty->termios.c_iflag = BRKINT | INPCK; + + tty_encode_baud_rate(tty, speed, speed); + +-- +1.7.10.4 diff --git a/common/recipes-support/sllin/files/0003-disable-debug-fix-otput-formating.patch b/common/recipes-support/sllin/files/0003-disable-debug-fix-otput-formating.patch new file mode 100644 index 0000000..3fe0052 --- /dev/null +++ b/common/recipes-support/sllin/files/0003-disable-debug-fix-otput-formating.patch @@ -0,0 +1,38 @@ +From 2348a515641bc661570c4d3706149d6814c4f727 Mon Sep 17 00:00:00 2001 +From: Andrey Gusakov +Date: Thu, 21 Apr 2016 12:57:07 +0300 +Subject: [PATCH] disable debug, fix otput formating + + +Signed-off-by: Andrey Gusakov +--- + sllin/sllin.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/sllin/sllin.c b/sllin/sllin.c +index 54aff92..9402f54 100644 +--- a/sllin/sllin.c ++++ b/sllin/sllin.c +@@ -41,8 +41,6 @@ + * Funded by: Volkswagen Group Research + */ + +-#define DEBUG 1 /* Enables pr_debug() printouts */ +- + #include + #include + +@@ -1442,9 +1440,9 @@ static int __init sllin_init(void) + } + + #ifdef BREAK_BY_BAUD +- pr_debug("sllin: Break is generated by baud-rate change."); ++ pr_debug("sllin: Break is generated by baud-rate change.\n"); + #else +- pr_debug("sllin: Break is generated manually with tiny sleep."); ++ pr_debug("sllin: Break is generated manually with tiny sleep.\n"); + #endif + + return status; +-- +1.7.10.4 diff --git a/common/recipes-support/sllin/sllin_git.bb b/common/recipes-support/sllin/sllin_git.bb new file mode 100644 index 0000000..775e1d2 --- /dev/null +++ b/common/recipes-support/sllin/sllin_git.bb @@ -0,0 +1,35 @@ +SUMMARY = "Linux LIN bus drivers and tools" +SECTION = "kernel/modules" +DEPENDS = "virtual/kernel" + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://sllin.c;md5=ac3527fbbdb552a45de22cc3f56a7fe4" + +PN = "sllin" +PE = "1" +PV = "0.1" + +SRC_URI = "git://rtime.felk.cvut.cz/linux-lin.git \ + file://0001-cross-compile.patch;striplevel=2 \ + file://0002-fix-termios-struct-access.patch;striplevel=2 \ + file://0003-disable-debug-fix-otput-formating.patch;striplevel=2 \ +" +SRCREV = "5c02d1856f32f8206f467b11cb61faf557c1882f" + +S = "${WORKDIR}/git/sllin" + +inherit module + +EXTRA_OEMAKE = "KPATH=${STAGING_KERNEL_DIR} KLIB=${D}" + +do_install() { + # Create shared folder + install -d ${D}/lib/modules/${KERNEL_VERSION}/tty/ + + # Copy kernel module + install -m 0644 ${S}/sllin.ko ${D}/lib/modules/${KERNEL_VERSION}/tty/ +} + +FILES_kernel-module-${PN} = " \ + /lib/modules/${KERNEL_VERSION}/tty/sllin.ko \ +" \ No newline at end of file -- cgit 1.2.3-korg