From c88bd796a625e54801592c360f5bf0f7d121bc5d Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Tue, 11 Jan 2022 10:43:46 +0200 Subject: Fix pincontrol for io controllers, rs9113, usbhub resets --- recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts | 13 ++++++------- recipes-kernel/linux/linux-at91_4.9.87.bb | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts index f485baa..9cbf5fa 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts @@ -100,22 +100,21 @@ pinctrl_mts_io_out: mts_io-0 { // gpio4 and gpio5 are reset in at91bootstrap. They should not be touched in Linux. atmel,pins = - ; /* PD18 USB Hub reset */ + ; /* PD20 WiFi_BT_LPMode Output */ output-high; // ignored by at91_pinctrl }; pinctrl_mts_io_in: mts_io-1 { atmel,pins = - ; /* PD20 WiFi_BT_LPMode Input */ + ; /* PD19 GNSS Int */ }; // GNSS kept in reset to prevent EXAR from hanging pinctrl_mts_io_gnss: mts_io-2 { atmel,pins = ; /* PD15 N_GNSS_RESET */ + AT91_PIOD 14 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT|AT91_PINCTRL_OUTPUT_VAL(0)) /* PD14 WiFi BT reset */ + AT91_PIOD 15 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT|AT91_PINCTRL_OUTPUT_VAL(0)) /* PD15 N_GNSS_RESET */ + AT91_PIOD 18 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT|AT91_PINCTRL_OUTPUT_VAL(0))>; /* PD18 USB Hub reset */ output-low; // ignored by at91_pinctrl }; }; diff --git a/recipes-kernel/linux/linux-at91_4.9.87.bb b/recipes-kernel/linux/linux-at91_4.9.87.bb index 7fc0e5d..67e72ed 100644 --- a/recipes-kernel/linux/linux-at91_4.9.87.bb +++ b/recipes-kernel/linux/linux-at91_4.9.87.bb @@ -19,7 +19,7 @@ RDEPENDS_kernel-modules_remove = "kernel-module-softdog" FILESEXTRAPATHS_prepend := "${THISDIR}/${P}:" KERNEL_EXTRA_ARGS ="LOADADDR=0x20008000" -PR = "r15" +PR = "r16" PKGR_kernel-module-i2c-at91 = "${PR}a${EXTENDPRAUTO}" PKGR_kernel-module-atmel-mci = "${PR}a${EXTENDPRAUTO}" KERNEL_VERSION = "${PV}" -- cgit v1.2.3 From 98314a55dfd117bce212b40cd95df6775213ef55 Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Tue, 11 Jan 2022 10:51:38 +0200 Subject: Fix pincontrol for io controllers, rs9113, usbhub resets - migrate changes for kernel 5.4 --- recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts b/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts index b7f05c4..a33b936 100644 --- a/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-5.4.81/mts-dts/mtcdt.dts @@ -488,22 +488,21 @@ pinctrl_mts_io_out: mts_io-0 { // gpio4 and gpio5 are reset in at91bootstrap. They should not be touched in Linux. atmel,pins = - ; /* PD18 USB Hub reset */ + ; /* PD20 WiFi_BT_LPMode Output */ output-high; // ignored by at91_pinctrl }; pinctrl_mts_io_in: mts_io-1 { atmel,pins = - ; /* PD20 WiFi_BT_LPMode Input */ + ; /* PD19 GNSS Int */ }; // GNSS kept in reset to prevent EXAR from hanging pinctrl_mts_io_gnss: mts_io-2 { atmel,pins = ; /* PD15 N_GNSS_RESET */ + AT91_PIOD 14 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT|AT91_PINCTRL_OUTPUT_VAL(0)) /* PD14 WiFi BT reset */ + AT91_PIOD 15 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT|AT91_PINCTRL_OUTPUT_VAL(0)) /* PD15 N_GNSS_RESET */ + AT91_PIOD 18 AT91_PERIPH_GPIO (AT91_PINCTRL_OUTPUT|AT91_PINCTRL_OUTPUT_VAL(0))>; /* PD18 USB Hub reset */ output-low; // ignored by at91_pinctrl }; }; -- cgit v1.2.3 From a71549ac36bb796f9110e4be7e96796ec6cdfd27 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 22 Nov 2021 15:17:40 -0600 Subject: Add a reset loop in case rs9113 does not appear on USB Hub --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 62 +++++++++++++++----------- recipes-kernel/rs9113/rs9113_1.6.5.bb | 7 +-- 2 files changed, 37 insertions(+), 32 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index 4ef6f4b..d9fb21e 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -28,33 +28,41 @@ case "$1" in exit 0 fi # Reset the RS9113 chip is ready, and - # wait for it to settle. - if [ -f "$RS9113_RESET" ] ; then - echo 1 >$RS9113_RESET - usleep $SLEEPTIME - echo 0 >$RS9113_RESET - usleep $SLEEPTIME - echo 1 >$RS9113_RESET - N=1 - while [ $N -lt 20 ] ; do - INT=$(cat $RS9113_INT) - WKUP=$(cat $RS9113_WKUP) - if [ $INT -ne 1 -o $WKUP -ne 1 ] ; then - usleep $INTSLEEPTIME - else - break - fi - done - if [ $INT -ne 1 ] ; then - logger -t rs9113 -p error -s "$RS9113_INT is $INT" - fi - if [ $WKUP -ne 1 ] ; then - logger -t rs9113 -p error -s "$RS9113_WKUP is $WKUP" - fi - else - # No WiFi BT, so exit quietly - exit 0 - fi + # wait for it to settle. + count=0 + while : ; do + if [ -f "$RS9113_RESET" ] ; then + echo 1 >$RS9113_RESET + usleep $SLEEPTIME + echo 0 >$RS9113_RESET + usleep $SLEEPTIME + echo 1 >$RS9113_RESET + N=1 + while [ $N -lt 20 ] ; do + INT=$(cat $RS9113_INT) + if ((INT != 1)) ; then + usleep $INTSLEEPTIME + else + break + fi + done + if [ $INT -ne 1 ] ; then + logger -t rs9113 -p error -s "$RS9113_INT is $INT" + fi + else + # No WiFi BT, so exit quietly + exit 0 + fi + if /usr/bin/lsusb -d 1618:9113 >/dev/null ; then + break + fi + sleep 15 + ((count++)) + if ((count > 5)) ; then + logger -t rs9113 -p error -s "RS9113 not found after $count resets" + break + fi + done /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG RETVAL=$? diff --git a/recipes-kernel/rs9113/rs9113_1.6.5.bb b/recipes-kernel/rs9113/rs9113_1.6.5.bb index edab39c..0627dcb 100644 --- a/recipes-kernel/rs9113/rs9113_1.6.5.bb +++ b/recipes-kernel/rs9113/rs9113_1.6.5.bb @@ -17,16 +17,13 @@ COMPATIBLE_MACHINE = "(mtcdt|mtrv1)" # To update this, manually copy ipk from Jenkin's job to # git://git@${MTS_INTERNAL_GIT}/mlinux/ipk.git;protocol=ssh;branch=${PV} # -PR = "r10" - -PKGR = "${PR}${KERNEL_MODULE_PACKAGE_SUFFIX}${EXTENDPRAUTO}" - +PR = "r12${KERNEL_MODULE_PACKAGE_SUFFIX}" SRC_URI = " \ file://rs9113/rs9113.init \ file://rs9113/rs9113.default \ file://rs9113/mts-rm-rs9113 \ file://rs9113/wpa_supplicant \ - file://rs9113-ipk/rs9113-from-src_${PV}-${PR}${KERNEL_MODULE_PACKAGE_SUFFIX}.0_${MACHINE}.ipk;name=binaries \ + file://rs9113-ipk/rs9113-from-src_${PV}-${PR}.0_${MACHINE}.ipk;name=binaries \ " SRCREV = "${PV}" -- cgit v1.2.3 From 6145ff3bd5a9fa09dfe074b838dabe4f1314cba2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 22 Nov 2021 16:13:44 -0600 Subject: Wait for USB, not the interrupt pin which is too early --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index d9fb21e..0d3d548 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -41,9 +41,9 @@ case "$1" in while [ $N -lt 20 ] ; do INT=$(cat $RS9113_INT) if ((INT != 1)) ; then - usleep $INTSLEEPTIME + usleep $INTSLEEPTIME else - break + break fi done if [ $INT -ne 1 ] ; then @@ -53,15 +53,21 @@ case "$1" in # No WiFi BT, so exit quietly exit 0 fi - if /usr/bin/lsusb -d 1618:9113 >/dev/null ; then - break - fi + n=0 + while ((n < 10)) ; do + usleep 50000 + if /usr/bin/lsusb -d 1618:9113 ; then + break 2 + fi + done + /usr/bin/logger -t "rs9113" -p error -s "Redpine not found on USB Hub." sleep 15 ((count++)) if ((count > 5)) ; then - logger -t rs9113 -p error -s "RS9113 not found after $count resets" + /usr/bin/logger -t "rs9113" -p error -s "RS9113 not found after $count resets" break fi + echo 'RS9113 not found, try resetting again' done /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG -- cgit v1.2.3 From c07fb6b4cefe31e76f2cf7d505cb2758518b7bb6 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 23 Nov 2021 02:49:19 -0600 Subject: New rs9113-from-src for building rs9113 --- recipes-kernel/rs9113/rs9113-from-src_1.6.5.bb | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/rs9113-from-src_1.6.5.bb b/recipes-kernel/rs9113/rs9113-from-src_1.6.5.bb index b9ddf80..8dac47e 100644 --- a/recipes-kernel/rs9113/rs9113-from-src_1.6.5.bb +++ b/recipes-kernel/rs9113/rs9113-from-src_1.6.5.bb @@ -2,14 +2,11 @@ DESCRIPTION = "USB Driver for Redpine RS9113" LICENSE = "Proprietary" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Proprietary;md5=0557f9d92cf58f2ccdd50f62f8ac0b28" PROVIDES = "rs9113-from-src" -PR = "r10" -PKGR = "${PR}${KERNEL_MODULE_PACKAGE_SUFFIX}${EXTENDPRAUTO}" -do_fetch[depends] += "virtual/kernel:do_shared_workdir" +PR = "r12${KERNEL_MODULE_PACKAGE_SUFFIX}" INHIBIT_PACKAGE_STRIP = "1" BB_STRICT_CHECKSUM = "0" inherit module SRCREV = "${PV}" -ERROR_QA_remove = "debug-files" # AUTOREV breaks mLinux source tarballs in Thud # SRCREV = "${AUTOREV}" -- cgit v1.2.3 From 21db6e1a1de6aba647f439625f029c19165a5754 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 23 Nov 2021 08:03:22 -0600 Subject: Remove i2c debug to prevent new I/O expander debug --- recipes-kernel/linux/linux-at91-4.9.87/defconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/defconfig b/recipes-kernel/linux/linux-at91-4.9.87/defconfig index 05971d9..bd91c7e 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/defconfig +++ b/recipes-kernel/linux/linux-at91-4.9.87/defconfig @@ -1885,9 +1885,9 @@ CONFIG_I2C_GPIO=m # CONFIG_I2C_STUB is not set CONFIG_I2C_SLAVE=y CONFIG_I2C_SLAVE_EEPROM=m -CONFIG_I2C_DEBUG_CORE=y -CONFIG_I2C_DEBUG_ALGO=y -CONFIG_I2C_DEBUG_BUS=y +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set CONFIG_SPI=y # CONFIG_SPI_DEBUG is not set CONFIG_SPI_MASTER=y -- cgit v1.2.3 From fbf80e077a2682e45397981eb89635f73c7d5c22 Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Tue, 11 Jan 2022 11:37:31 +0200 Subject: Remove i2c debug to prevent new I/O expander debug - kernel 5.4 --- recipes-kernel/linux/linux-at91-5.4.81/defconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-5.4.81/defconfig b/recipes-kernel/linux/linux-at91-5.4.81/defconfig index 022b72d..3b6613b 100644 --- a/recipes-kernel/linux/linux-at91-5.4.81/defconfig +++ b/recipes-kernel/linux/linux-at91-5.4.81/defconfig @@ -2090,9 +2090,9 @@ CONFIG_I2C_GPIO=m # CONFIG_I2C_STUB is not set CONFIG_I2C_SLAVE=y CONFIG_I2C_SLAVE_EEPROM=m -CONFIG_I2C_DEBUG_CORE=y -CONFIG_I2C_DEBUG_ALGO=y -CONFIG_I2C_DEBUG_BUS=y +# CONFIG_I2C_DEBUG_CORE is not set +# CONFIG_I2C_DEBUG_ALGO is not set +# CONFIG_I2C_DEBUG_BUS is not set # end of I2C support # CONFIG_I3C is not set -- cgit v1.2.3 From 920966356eb1047f93e3f828790ea4fadc292ec5 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 23 Nov 2021 08:14:33 -0600 Subject: Make sure mts-io is done loading, make sure loops break out --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 39 +++++++++----------------- 1 file changed, 14 insertions(+), 25 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index 0d3d548..e27a35d 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -27,47 +27,36 @@ case "$1" in # We don't want the driver loaded. exit 0 fi + + for i in {1..5} ; do + if [[ -f $RS9113_RESET ]] ; then + break + fi + done + # Reset the RS9113 chip is ready, and # wait for it to settle. - count=0 - while : ; do - if [ -f "$RS9113_RESET" ] ; then + for i in {1..5} ; do + if [[ -f $RS9113_RESET ]] ; then echo 1 >$RS9113_RESET usleep $SLEEPTIME echo 0 >$RS9113_RESET usleep $SLEEPTIME echo 1 >$RS9113_RESET - N=1 - while [ $N -lt 20 ] ; do - INT=$(cat $RS9113_INT) - if ((INT != 1)) ; then - usleep $INTSLEEPTIME - else - break - fi - done - if [ $INT -ne 1 ] ; then - logger -t rs9113 -p error -s "$RS9113_INT is $INT" - fi else # No WiFi BT, so exit quietly exit 0 fi - n=0 - while ((n < 10)) ; do - usleep 50000 + for j in {0..250} ; do if /usr/bin/lsusb -d 1618:9113 ; then break 2 fi + usleep 100000 done - /usr/bin/logger -t "rs9113" -p error -s "Redpine not found on USB Hub." - sleep 15 - ((count++)) - if ((count > 5)) ; then - /usr/bin/logger -t "rs9113" -p error -s "RS9113 not found after $count resets" - break + if ((i > 1)) ; then + logger -t rs9113 -p error -s "RS9113 not found after $i resets" + /usr/bin/lsusb | logger -t rs9113 -p error -s fi - echo 'RS9113 not found, try resetting again' done /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG -- cgit v1.2.3 From 8d8681be8ea784d03d47668c8182e8efe31f9a33 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 29 Nov 2021 12:53:26 -0600 Subject: Disable CRTSCTS when setting RS485 half duplex to match Vizzini driver --- .../mtcdt/linux-4.9-rs485-atmel-crtscts.patch | 20 ++++++++++++++++++++ recipes-kernel/linux/linux-at91_4.9.87.bb | 1 + 2 files changed, 21 insertions(+) create mode 100644 recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch new file mode 100644 index 0000000..1cf147e --- /dev/null +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch @@ -0,0 +1,20 @@ +This patch allows RS485 Half Duplex (ATMEL_US_USMODE_RS485 is half duplex) to +work even if handshaking is turned on. This mimics the behavior of the EXAR +USB/Serial driver known as Vizzini. It is impossible to use handshaking when +using ATMEL_US_USMODE_RS485. This provides compatibility between MTCDT-0.1 and +MTCDT-0.2. +======================================================================================= +diff -Naru orig/drivers/tty/serial/atmel_serial.c new/drivers/tty/serial/atmel_serial.c +--- orig/drivers/tty/serial/atmel_serial.c 2021-11-29 12:29:38.472076748 -0600 ++++ new/drivers/tty/serial/atmel_serial.c 2021-11-29 12:26:05.668072459 -0600 +@@ -2171,7 +2171,10 @@ + atmel_uart_writel(port, ATMEL_US_TTGR, + port->rs485.delay_rts_after_send); + mode |= ATMEL_US_USMODE_RS485; ++ /* CRTSCTS is impossible in RS485 mode, and breaks the driver ++ * so we cannot do a send. */ ++ termios->c_cflag &= ~CRTSCTS; + } else if (termios->c_cflag & CRTSCTS) { + /* RS232 with hardware handshake (RTS/CTS) */ + if (atmel_use_fifo(port) && + !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) { diff --git a/recipes-kernel/linux/linux-at91_4.9.87.bb b/recipes-kernel/linux/linux-at91_4.9.87.bb index 67e72ed..3b10efd 100644 --- a/recipes-kernel/linux/linux-at91_4.9.87.bb +++ b/recipes-kernel/linux/linux-at91_4.9.87.bb @@ -64,6 +64,7 @@ SRC_URI_append_mtcdt = "\ file://mt-at91.h \ file://linux-4.9-mtcdt-device-tree.patch \ file://linux-4.9-mtcdt-atmel-multidrop.patch \ + file://linux-4.9-rs485-atmel-crtscts.patch \ " SRC_URI_append_mtrv1 = "\ ${COMMON_PATCHES} \ -- cgit v1.2.3 From 83b181fb3210fb09a3e4a5c9ef3d3b755fd1b85e Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Tue, 11 Jan 2022 14:30:05 +0200 Subject: Disable CRTSCTS when setting RS485 half duplex to match Vizzini driver - adaptation for 5.4 kernel --- .../mtcdt/linux-5.4-rs485-atmel-crtscts.patch | 23 ++++++++++++++++++++++ recipes-kernel/linux/linux-at91_5.4.81.bb | 1 + 2 files changed, 24 insertions(+) create mode 100644 recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch b/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch new file mode 100644 index 0000000..d17ed37 --- /dev/null +++ b/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch @@ -0,0 +1,23 @@ +This patch allows RS485 Half Duplex (ATMEL_US_USMODE_RS485 is half duplex) to +work even if handshaking is turned on. This mimics the behavior of the EXAR +USB/Serial driver known as Vizzini. It is impossible to use handshaking when +using ATMEL_US_USMODE_RS485. This provides compatibility between MTCDT-0.1 and +MTCDT-0.2. +======================================================================================= +diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c +index 28d4a92c0d63..2d17558a807d 100644 +--- a/drivers/tty/serial/atmel_serial.c ++++ b/drivers/tty/serial/atmel_serial.c +@@ -2250,6 +2250,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, + atmel_uart_writel(port, ATMEL_US_TTGR, + port->rs485.delay_rts_after_send); + mode |= ATMEL_US_USMODE_RS485; ++ /* CRTSCTS is impossible in RS485 mode, and breaks the driver ++ * so we cannot do a send. */ ++ termios->c_cflag &= ~CRTSCTS; + } else if (port->iso7816.flags & SER_ISO7816_ENABLED) { + atmel_uart_writel(port, ATMEL_US_TTGR, port->iso7816.tg); + /* select mck clock, and output */ +-- +2.25.1 + diff --git a/recipes-kernel/linux/linux-at91_5.4.81.bb b/recipes-kernel/linux/linux-at91_5.4.81.bb index f57d418..9a427d2 100644 --- a/recipes-kernel/linux/linux-at91_5.4.81.bb +++ b/recipes-kernel/linux/linux-at91_5.4.81.bb @@ -45,6 +45,7 @@ COMMON_PATCHES = " \ file://linux-5.4-OF-DT-Overlay-configfs-interface.patch \ file://linux-5.4-revert-net-macb-Properly-handle-phylink-on-at91rm9200.patch \ file://linux-5.4-bring-back-PAE-bit-and-fix-NCFGR-values-applicable-f.patch \ + file://linux-5.4-rs485-atmel-crtscts.patch \ file://mt-at91.h \ " -- cgit v1.2.3 From 55110ee9a93835054016c88421a7fa61aaaea811 Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 30 Nov 2021 22:33:17 -0600 Subject: Enable XMIT and RCV in all cases when setting RS485 with Atmel serial --- .../mtcdt/linux-4.9-rs485-atmel-crtscts.patch | 115 ++++++++++++++++++++- 1 file changed, 110 insertions(+), 5 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch index 1cf147e..5642aee 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/linux-4.9-rs485-atmel-crtscts.patch @@ -2,19 +2,124 @@ This patch allows RS485 Half Duplex (ATMEL_US_USMODE_RS485 is half duplex) to work even if handshaking is turned on. This mimics the behavior of the EXAR USB/Serial driver known as Vizzini. It is impossible to use handshaking when using ATMEL_US_USMODE_RS485. This provides compatibility between MTCDT-0.1 and -MTCDT-0.2. +MTCDT-0.2. Note that frequently the state of the driver will be stopped if +handshaking was turned on before RS485 was set. We need to take steps to enable +transmit and receive when we go to RS485 mode, or the driver will be blocked. ======================================================================================= diff -Naru orig/drivers/tty/serial/atmel_serial.c new/drivers/tty/serial/atmel_serial.c ---- orig/drivers/tty/serial/atmel_serial.c 2021-11-29 12:29:38.472076748 -0600 -+++ new/drivers/tty/serial/atmel_serial.c 2021-11-29 12:26:05.668072459 -0600 -@@ -2171,7 +2171,10 @@ +--- orig/drivers/tty/serial/atmel_serial.c 2021-11-30 14:54:49.313993839 -0600 ++++ new/drivers/tty/serial/atmel_serial.c 2021-11-30 16:14:58.430090773 -0600 +@@ -74,6 +74,7 @@ + + static void atmel_start_rx(struct uart_port *port); + static void atmel_stop_rx(struct uart_port *port); ++static void atmel_start_tx(struct uart_port *port); + + #ifdef CONFIG_SERIAL_ATMEL_TTYAT + +@@ -357,6 +358,7 @@ + { + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); + unsigned int mode; ++ unsigned int sav_c_cflag = 0; + + /* Disable interrupts */ + atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); +@@ -369,11 +371,33 @@ + port->rs485 = *rs485conf; + + if (rs485conf->flags & SER_RS485_ENABLED) { +- dev_dbg(port->dev, "Setting UART to RS485\n"); +- atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; +- atmel_uart_writel(port, ATMEL_US_TTGR, ++ struct uart_state *state_p = port->state; ++ struct tty_struct *tty_struct_p = NULL; ++ ++ dev_dbg(port->dev, "Setting UART to RS485\n"); ++ if (state_p) ++ tty_struct_p = state_p->port.tty; ++ ++ if(tty_struct_p) { ++ struct ktermios *termios = &(tty_struct_p->termios); ++ sav_c_cflag = termios->c_cflag; ++ termios->c_cflag &= ~CRTSCTS; ++ } ++ ++ atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; ++ atmel_uart_writel(port, ATMEL_US_TTGR, + rs485conf->delay_rts_after_send); ++ dev_dbg(port->dev, ++ "atmel_config_rs485: orig: c_cflag 0x%x port status 0x%x, hw_stopped %d\n", ++ sav_c_cflag,port->status,port->hw_stopped ++ ); ++ ++ port->status &= ~UPSTAT_CTS_ENABLE; + mode |= ATMEL_US_USMODE_RS485; ++ port->hw_stopped = 0; // No longer possible ++ if (atmel_port->tx_stopped == true) ++ atmel_start_tx(port); ++ atmel_start_rx(port); + } else { + dev_dbg(port->dev, "Setting UART to RS232\n"); + if (atmel_use_pdc_tx(port)) +@@ -413,13 +437,36 @@ + unsigned int mode = atmel_uart_readl(port, ATMEL_US_MR); + unsigned int rts_paused, rts_ready; + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); ++ unsigned int sav_c_cflag = 0; + + /* override mode to RS485 if needed, otherwise keep the current mode */ + if (port->rs485.flags & SER_RS485_ENABLED) { +- atmel_uart_writel(port, ATMEL_US_TTGR, +- port->rs485.delay_rts_after_send); +- mode &= ~ATMEL_US_USMODE; +- mode |= ATMEL_US_USMODE_RS485; ++ struct uart_state *state_p = port->state; ++ struct tty_struct *tty_struct_p = NULL; ++ ++ if (state_p) ++ tty_struct_p = state_p->port.tty; ++ ++ if(tty_struct_p) { ++ struct ktermios *termios = &(tty_struct_p->termios); ++ ++ sav_c_cflag = termios->c_cflag; ++ termios->c_cflag &= ~CRTSCTS; ++ } ++ ++ atmel_uart_writel(port, ATMEL_US_TTGR, ++ port->rs485.delay_rts_after_send); ++ mode &= ~ATMEL_US_USMODE; ++ mode |= ATMEL_US_USMODE_RS485; ++ dev_dbg(port->dev, ++ "atmel_set_mctrl: SER_RS485_ENABLED: c_cflag 0x%x port status 0x%x, hw_stopped %d\n", ++ sav_c_cflag,port->status,port->hw_stopped ++ ); ++ port->status &= ~UPSTAT_CTS_ENABLE; ++ port->hw_stopped = 0; // No longer possible ++ if (atmel_port->tx_stopped == true) ++ atmel_start_tx(port); ++ atmel_start_rx(port); + } + + /* set the RTS line state according to the mode */ +@@ -2168,6 +2215,19 @@ atmel_uart_writel(port, ATMEL_US_TTGR, port->rs485.delay_rts_after_send); mode |= ATMEL_US_USMODE_RS485; + /* CRTSCTS is impossible in RS485 mode, and breaks the driver + * so we cannot do a send. */ ++ dev_dbg(port->dev, ++ "atmel_set_termios: SER_RS485_ENABLED: original: c_cflag 0x%x status 0x%x, hw_stopped %d\n", ++ termios->c_cflag,port->status,port->hw_stopped ++ ); ++ + termios->c_cflag &= ~CRTSCTS; ++ port->status &= ~UPSTAT_CTS_ENABLE; ++ port->hw_stopped = 0; // Not possible ++ if (atmel_port->tx_stopped == true) ++ atmel_start_tx(port); ++ atmel_start_rx(port); } else if (termios->c_cflag & CRTSCTS) { /* RS232 with hardware handshake (RTS/CTS) */ if (atmel_use_fifo(port) && - !mctrl_gpio_to_gpiod(atmel_port->gpios, UART_GPIO_CTS)) { -- cgit v1.2.3 From 0140a37aa7d5c01e8eb9e04889d8612445af0a3b Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Tue, 11 Jan 2022 16:30:22 +0200 Subject: Enable XMIT and RCV in all cases when setting RS485 with Atmel serial - adaptation for 5.4 kernel --- .../mtcdt/linux-5.4-rs485-atmel-crtscts.patch | 115 ++++++++++++++++++++- 1 file changed, 112 insertions(+), 3 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch b/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch index d17ed37..30cc7d5 100644 --- a/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch +++ b/recipes-kernel/linux/linux-at91-5.4.81/mtcdt/linux-5.4-rs485-atmel-crtscts.patch @@ -2,19 +2,128 @@ This patch allows RS485 Half Duplex (ATMEL_US_USMODE_RS485 is half duplex) to work even if handshaking is turned on. This mimics the behavior of the EXAR USB/Serial driver known as Vizzini. It is impossible to use handshaking when using ATMEL_US_USMODE_RS485. This provides compatibility between MTCDT-0.1 and -MTCDT-0.2. +MTCDT-0.2. Note that frequently the state of the driver will be stopped if +handshaking was turned on before RS485 was set. We need to take steps to enable +transmit and receive when we go to RS485 mode, or the driver will be blocked. ======================================================================================= diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c -index 28d4a92c0d63..2d17558a807d 100644 +index 2d17558a807d..e721e2028b4a 100644 --- a/drivers/tty/serial/atmel_serial.c +++ b/drivers/tty/serial/atmel_serial.c -@@ -2250,6 +2250,9 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, +@@ -62,6 +62,7 @@ + + static void atmel_start_rx(struct uart_port *port); + static void atmel_stop_rx(struct uart_port *port); ++static void atmel_start_tx(struct uart_port *port); + + #ifdef CONFIG_SERIAL_ATMEL_TTYAT + +@@ -300,6 +301,7 @@ static int atmel_config_rs485(struct uart_port *port, + { + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); + unsigned int mode; ++ unsigned int sav_c_cflag = 0; + + /* Disable interrupts */ + atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); +@@ -312,15 +314,33 @@ static int atmel_config_rs485(struct uart_port *port, + port->rs485 = *rs485conf; + + if (rs485conf->flags & SER_RS485_ENABLED) { +- dev_dbg(port->dev, "Setting UART to RS485\n"); +- if (port->rs485.flags & SER_RS485_RX_DURING_TX) +- atmel_port->tx_done_mask = ATMEL_US_TXRDY; +- else +- atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; ++ struct uart_state *state_p = port->state; ++ struct tty_struct *tty_struct_p = NULL; + +- atmel_uart_writel(port, ATMEL_US_TTGR, ++ dev_dbg(port->dev, "Setting UART to RS485\n"); ++ if (state_p) ++ tty_struct_p = state_p->port.tty; ++ ++ if(tty_struct_p) { ++ struct ktermios *termios = &(tty_struct_p->termios); ++ sav_c_cflag = termios->c_cflag; ++ termios->c_cflag &= ~CRTSCTS; ++ } ++ ++ atmel_port->tx_done_mask = ATMEL_US_TXEMPTY; ++ atmel_uart_writel(port, ATMEL_US_TTGR, + rs485conf->delay_rts_after_send); ++ dev_dbg(port->dev, ++ "atmel_config_rs485: orig: c_cflag 0x%x port status 0x%x, hw_stopped %d\n", ++ sav_c_cflag,port->status,port->hw_stopped ++ ); ++ ++ port->status &= ~UPSTAT_CTS_ENABLE; + mode |= ATMEL_US_USMODE_RS485; ++ port->hw_stopped = 0; // No longer possible ++ if (atmel_port->tx_stopped == true) ++ atmel_start_tx(port); ++ atmel_start_rx(port); + } else { + dev_dbg(port->dev, "Setting UART to RS232\n"); + if (atmel_use_pdc_tx(port)) +@@ -481,13 +501,36 @@ static void atmel_set_mctrl(struct uart_port *port, u_int mctrl) + unsigned int mode = atmel_uart_readl(port, ATMEL_US_MR); + unsigned int rts_paused, rts_ready; + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); ++ unsigned int sav_c_cflag = 0; + + /* override mode to RS485 if needed, otherwise keep the current mode */ + if (port->rs485.flags & SER_RS485_ENABLED) { +- atmel_uart_writel(port, ATMEL_US_TTGR, +- port->rs485.delay_rts_after_send); +- mode &= ~ATMEL_US_USMODE; +- mode |= ATMEL_US_USMODE_RS485; ++ struct uart_state *state_p = port->state; ++ struct tty_struct *tty_struct_p = NULL; ++ ++ if (state_p) ++ tty_struct_p = state_p->port.tty; ++ ++ if(tty_struct_p) { ++ struct ktermios *termios = &(tty_struct_p->termios); ++ ++ sav_c_cflag = termios->c_cflag; ++ termios->c_cflag &= ~CRTSCTS; ++ } ++ ++ atmel_uart_writel(port, ATMEL_US_TTGR, ++ port->rs485.delay_rts_after_send); ++ mode &= ~ATMEL_US_USMODE; ++ mode |= ATMEL_US_USMODE_RS485; ++ dev_dbg(port->dev, ++ "atmel_set_mctrl: SER_RS485_ENABLED: c_cflag 0x%x port status 0x%x, hw_stopped %d\n", ++ sav_c_cflag,port->status,port->hw_stopped ++ ); ++ port->status &= ~UPSTAT_CTS_ENABLE; ++ port->hw_stopped = 0; // No longer possible ++ if (atmel_port->tx_stopped == true) ++ atmel_start_tx(port); ++ atmel_start_rx(port); + } + + /* set the RTS line state according to the mode */ +@ -2250,6 +2250,19 @@ static void atmel_set_termios(struct uart_port *port, struct ktermios *termios, atmel_uart_writel(port, ATMEL_US_TTGR, port->rs485.delay_rts_after_send); mode |= ATMEL_US_USMODE_RS485; + /* CRTSCTS is impossible in RS485 mode, and breaks the driver + * so we cannot do a send. */ ++ dev_dbg(port->dev, ++ "atmel_set_termios: SER_RS485_ENABLED: original: c_cflag 0x%x status 0x%x, hw_stopped %d\n", ++ termios->c_cflag,port->status,port->hw_stopped ++ ); ++ + termios->c_cflag &= ~CRTSCTS; ++ port->status &= ~UPSTAT_CTS_ENABLE; ++ port->hw_stopped = 0; // Not possible ++ if (atmel_port->tx_stopped == true) ++ atmel_start_tx(port); ++ atmel_start_rx(port); } else if (port->iso7816.flags & SER_ISO7816_ENABLED) { atmel_uart_writel(port, ATMEL_US_TTGR, port->iso7816.tg); /* select mck clock, and output */ -- cgit v1.2.3 From 9b31c9e2c04e23cd94e4a3274409a82fa3f8adb0 Mon Sep 17 00:00:00 2001 From: John Klug Date: Mon, 6 Dec 2021 10:18:24 -0600 Subject: cd-gpio is on pioA 1 (or gpio0 pin 1) --- recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts index 9cbf5fa..ba57758 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts @@ -71,7 +71,6 @@ atmel,pins = ; /* PA1 gpio SD card pin pull up and deglitch */ }; - /* /delete-property/ cd-gpios; */ }; /delete-node/ mmc@f000c000; @@ -438,3 +437,9 @@ phandle,linux = ; // gpio-base = <136>; }; +&mmc0 { + slot@0 { + cd-gpios = <&pioA 1 GPIO_ACTIVE_HIGH>; + }; +}; + -- cgit v1.2.3 From 0e2ddfb80af9165ed63b3fb420876bf6f1056698 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 8 Dec 2021 09:15:21 -0600 Subject: Add rs9113-reset package for mPower to reset rs9113 --- recipes-kernel/rs9113/files/rs9113/rs9113.reset | 27 +++++++++++++++++++++++++ recipes-kernel/rs9113/rs9113.inc | 13 +++++++++++- recipes-kernel/rs9113/rs9113_1.6.5.bb | 1 + 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100755 recipes-kernel/rs9113/files/rs9113/rs9113.reset (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.reset b/recipes-kernel/rs9113/files/rs9113/rs9113.reset new file mode 100755 index 0000000..b4aca45 --- /dev/null +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.reset @@ -0,0 +1,27 @@ +#!/bin/sh +# Reset rs9113 +# Must be done after /etc/init.d/mts-io executes, and +# before any code that probes the USB bus. +function do_reset { + if ! [[ -w /sys/devices/platform/mts-io/wifi-bt-reset ]] ; then + exit 0 + fi + mts-io-sysfs store wifi-bt-reset 0 + usleep 60000 + mts-io-sysfs store wifi-bt-reset 1 +} + +case $1 in + start) + do_reset + ;; + stop) + ;; + reload) + do_reset + ;; + *) + echo "Usage: $0 {start|stop|reload}" + exit 2 + ;; +esac diff --git a/recipes-kernel/rs9113/rs9113.inc b/recipes-kernel/rs9113/rs9113.inc index 3f0eb66..9365a3e 100644 --- a/recipes-kernel/rs9113/rs9113.inc +++ b/recipes-kernel/rs9113/rs9113.inc @@ -17,6 +17,7 @@ PACKAGES = " \ ${PN}-dbg \ ${PN}-autostart \ ${PN}-btclonly \ + ${PN}-reset \ ${PN}-noarch \ " @@ -40,10 +41,15 @@ ALLOW_EMPTY_${PN}-btclonly = "1" DR = "${DL_DIR}/rs9113-ipk" FILESEXTRAPATHS_append := "${DR}:" -INITSCRIPT_PACKAGES = "${PN}-autostart ${PN}-rm" +INITSCRIPT_PACKAGES = "${PN}-autostart ${PN}-rm ${PN}-reset" INITSCRIPT_NAME_${PN}-autostart = "rs9113" INITSCRIPT_PARAMS_${PN}-autostart = "start 50 S ." + +INITSCRIPT_NAME_${PN}-reset = "rs9113-reset" +INITSCRIPT_PARAMS_${PN}-reset = "start 40 S ." + + # ${PN}-rm must start after mts-io driver is loaded. INITSCRIPT_NAME_${PN}-rm = "mts-rm-rs9113" INITSCRIPT_PARAMS_${PN}-rm = "start 39 S ." @@ -168,6 +174,10 @@ FILES_${PN}-misc = " \ CONFFILES_${PN}-noarch = "${sysconfdir}/default/" +FILES_${PN}-reset = " \ + ${sysconfdir}/init.d/rs9113-reset \ + " + # noarch gets what is left to package. FILES_${PN}-noarch = " \ /opt/ \ @@ -192,6 +202,7 @@ do_install () { install -d ${D}${sysconfdir}/default/ install -m 0755 ${MR}/wpa_supplicant ${D}/opt/rs9113/init.d install -m 0755 ${MR}/rs9113.init ${D}${sysconfdir}/init.d/rs9113 + install -m 0755 ${MR}/rs9113.reset ${D}${sysconfdir}/init.d/rs9113-reset install -m 0644 ${MR}/rs9113.default ${D}${sysconfdir}/default/rs9113 install -m 0755 ${MR}/mts-rm-rs9113 ${D}${sysconfdir}/init.d/mts-rm-rs9113 } diff --git a/recipes-kernel/rs9113/rs9113_1.6.5.bb b/recipes-kernel/rs9113/rs9113_1.6.5.bb index 0627dcb..89d7d55 100644 --- a/recipes-kernel/rs9113/rs9113_1.6.5.bb +++ b/recipes-kernel/rs9113/rs9113_1.6.5.bb @@ -21,6 +21,7 @@ PR = "r12${KERNEL_MODULE_PACKAGE_SUFFIX}" SRC_URI = " \ file://rs9113/rs9113.init \ file://rs9113/rs9113.default \ + file://rs9113/rs9113.reset \ file://rs9113/mts-rm-rs9113 \ file://rs9113/wpa_supplicant \ file://rs9113-ipk/rs9113-from-src_${PV}-${PR}.0_${MACHINE}.ipk;name=binaries \ -- cgit v1.2.3 From db0fa2189c47518bc6fdb82f84109705bb7cb53a Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 8 Dec 2021 17:21:38 -0600 Subject: User /etc/init.d/rs9113 reset in /etc/init.d/rs9113-reset --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 24 +++++++++++++++--------- recipes-kernel/rs9113/files/rs9113/rs9113.reset | 4 +--- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index e27a35d..b6c6e37 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -21,13 +21,7 @@ RS9113_WKUP=${MTS_IODIR}/wifi-bt-lpwkup . $CONFIG -case "$1" in - start) - if ((RS9113_LOAD == 0)) ; then - # We don't want the driver loaded. - exit 0 - fi - +function rs9113_reset { for i in {1..5} ; do if [[ -f $RS9113_RESET ]] ; then break @@ -58,6 +52,15 @@ case "$1" in /usr/bin/lsusb | logger -t rs9113 -p error -s fi done +} + +case "$1" in + start) + if ((RS9113_LOAD == 0)) ; then + # We don't want the driver loaded. + exit 0 + fi + rs9113_reset /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG RETVAL=$? @@ -82,7 +85,7 @@ case "$1" in $0 stop sleep 1 $0 start - ;; + ;; status) for dir in /sys/class/net/rpine[0-9]* ; do if [[ -d ${dir} ]] ; then @@ -93,8 +96,11 @@ case "$1" in echo Driver is not loaded exit 3 ;; + reset) + rs9113_reset + ;; *) - "Usage: $0 {start|stop|status|restart}" + "Usage: $0 {start|stop|status|restart|reset}" exit 2 ;; esac diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.reset b/recipes-kernel/rs9113/files/rs9113/rs9113.reset index b4aca45..7992f7d 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.reset +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.reset @@ -6,9 +6,7 @@ function do_reset { if ! [[ -w /sys/devices/platform/mts-io/wifi-bt-reset ]] ; then exit 0 fi - mts-io-sysfs store wifi-bt-reset 0 - usleep 60000 - mts-io-sysfs store wifi-bt-reset 1 + /etc/init.d/rs9113 reset } case $1 in -- cgit v1.2.3 From 03b1d268333d303abfe77b4134e8ee277c874a9f Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 8 Dec 2021 19:14:04 -0600 Subject: Remove possible extra reset of rs9113 --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 2 -- 1 file changed, 2 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index b6c6e37..0fffb94 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -32,8 +32,6 @@ function rs9113_reset { # wait for it to settle. for i in {1..5} ; do if [[ -f $RS9113_RESET ]] ; then - echo 1 >$RS9113_RESET - usleep $SLEEPTIME echo 0 >$RS9113_RESET usleep $SLEEPTIME echo 1 >$RS9113_RESET -- cgit v1.2.3 From 6b6d8a2e79d1f5fa6c09b8ae603908bd59e5c4ba Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 9 Dec 2021 14:52:00 -0600 Subject: Add logging to evaluate rs9113 initialization --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 45 ++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 6 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index 0fffb94..ced9e35 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -16,18 +16,49 @@ MTS_IODIR=/sys/devices/platform/mts-io RS9113_RESET=${MTS_IODIR}/wifi-bt-reset RS9113_INT=${MTS_IODIR}/wifi-bt-int RS9113_WKUP=${MTS_IODIR}/wifi-bt-lpwkup +RSTLOG=/var/config/rs9113rstlog [ -f $CONFIG ] || exit 1 . $CONFIG +pid=$$ +LOG_ERR=3 +LOG_INFO=6 + +prefix="<${pr}>rs9113[${pid}]: " +function syslog { + pr=$1 + shift + [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]] + s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@") + echo "$s" >/dev/kmsg + echo "$s" + echo "$s" >>${RSTLOG} +} + +function logfile { + [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]] + s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@") + echo "$s" >${RSTLOG} +} + +function logpipe { + OIFS="${IFS}" + IFS=$'\n' + while read ln ; do + syslog $1 $ln + done + IFS="${OIFS}" +} + function rs9113_reset { for i in {1..5} ; do if [[ -f $RS9113_RESET ]] ; then break fi done - + # Reset the RS9113 chip is ready, and # wait for it to settle. for i in {1..5} ; do @@ -39,15 +70,17 @@ function rs9113_reset { # No WiFi BT, so exit quietly exit 0 fi + logfile "After reset $i complete" for j in {0..250} ; do if /usr/bin/lsusb -d 1618:9113 ; then + logfile "lsusb found 1618:9113 after reset $i" break 2 fi usleep 100000 done if ((i > 1)) ; then - logger -t rs9113 -p error -s "RS9113 not found after $i resets" - /usr/bin/lsusb | logger -t rs9113 -p error -s + syslog $LOG_ERR "RS9113 not found after $i resets" + /usr/bin/lsusb | logpipe $LOG_ERR fi done } @@ -59,7 +92,7 @@ case "$1" in exit 0 fi rs9113_reset - /usr/bin/logger -t "rs9113" -p info -s "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" + syslog LOG_INFO "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG RETVAL=$? if [ $RETVAL -eq 0 ] ; then @@ -70,7 +103,7 @@ case "$1" in ;; stop) - /usr/bin/logger -t "rs9113" -p info -s "Unloading rs9113 modules" + syslog LOG_INFO "Unloading rs9113 modules" /usr/sbin/rs9113_remove_modules.sh RETVAL=$? if [ $RETVAL -eq 0 ] ; then @@ -98,7 +131,7 @@ case "$1" in rs9113_reset ;; *) - "Usage: $0 {start|stop|status|restart|reset}" + echo "Usage: $0 {start|stop|status|restart|reset}" exit 2 ;; esac -- cgit v1.2.3 From e183f5fb4fda9eb2a9af423453adf4332810005b Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 9 Dec 2021 09:19:20 -0600 Subject: Improve logging in /etc/init.d/rs9113 --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index ced9e35..5a5ed47 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -25,22 +25,23 @@ RSTLOG=/var/config/rs9113rstlog pid=$$ LOG_ERR=3 LOG_INFO=6 - -prefix="<${pr}>rs9113[${pid}]: " +name=rs9113 +format="%s[%d] %12.2fs: %s" +prefix1="<${pr}>rs9113[${pid}]: " +prefix2="rs9113[${pid}]: " function syslog { pr=$1 shift - [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]] - s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@") - echo "$s" >/dev/kmsg - echo "$s" + [[ $(cat /proc/uptime) =~ ([^[:space:]]+) ]] + s=$(printf "${format}" $name $pid ${BASH_REMATCH[1]} "$@") + echo "<${pr}>${s}" >/dev/kmsg echo "$s" >>${RSTLOG} } function logfile { - [[ $(cat /proc/uptime =~ ([^[:space:]]+) ]] - s=$(printf "%12.12fs %s" ${BASH_REMATCH[1]} "${prefix}$@") - echo "$s" >${RSTLOG} + [[ $(cat /proc/uptime) =~ ([^[:space:]]+) ]] + s=$(printf "${format}" $pr $name $pid ${BASH_REMATCH[1]} "$@") + echo "$s" >>${RSTLOG} } function logpipe { @@ -92,7 +93,7 @@ case "$1" in exit 0 fi rs9113_reset - syslog LOG_INFO "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" + syslog $LOG_INFO "Loading rs9113 modules with COEX=$COEX_MODE and Country=$SET_COUNTRY_CODE" /usr/sbin/rs9113_load_modules.sh $CONFIG RETVAL=$? if [ $RETVAL -eq 0 ] ; then @@ -103,7 +104,7 @@ case "$1" in ;; stop) - syslog LOG_INFO "Unloading rs9113 modules" + syslog $LOG_INFO "Unloading rs9113 modules" /usr/sbin/rs9113_remove_modules.sh RETVAL=$? if [ $RETVAL -eq 0 ] ; then -- cgit v1.2.3 From f2c8288cf7a4e1f35b2b69c013c569bacb1098f5 Mon Sep 17 00:00:00 2001 From: John Klug Date: Thu, 9 Dec 2021 18:44:58 -0600 Subject: Do not create extra file in /var/config for rs9113 reset. Use dmesg --- recipes-kernel/rs9113/files/rs9113/rs9113.init | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/files/rs9113/rs9113.init b/recipes-kernel/rs9113/files/rs9113/rs9113.init index 5a5ed47..6adeb5a 100755 --- a/recipes-kernel/rs9113/files/rs9113/rs9113.init +++ b/recipes-kernel/rs9113/files/rs9113/rs9113.init @@ -16,7 +16,6 @@ MTS_IODIR=/sys/devices/platform/mts-io RS9113_RESET=${MTS_IODIR}/wifi-bt-reset RS9113_INT=${MTS_IODIR}/wifi-bt-int RS9113_WKUP=${MTS_IODIR}/wifi-bt-lpwkup -RSTLOG=/var/config/rs9113rstlog [ -f $CONFIG ] || exit 1 @@ -27,21 +26,13 @@ LOG_ERR=3 LOG_INFO=6 name=rs9113 format="%s[%d] %12.2fs: %s" -prefix1="<${pr}>rs9113[${pid}]: " -prefix2="rs9113[${pid}]: " + function syslog { pr=$1 shift [[ $(cat /proc/uptime) =~ ([^[:space:]]+) ]] s=$(printf "${format}" $name $pid ${BASH_REMATCH[1]} "$@") echo "<${pr}>${s}" >/dev/kmsg - echo "$s" >>${RSTLOG} -} - -function logfile { - [[ $(cat /proc/uptime) =~ ([^[:space:]]+) ]] - s=$(printf "${format}" $pr $name $pid ${BASH_REMATCH[1]} "$@") - echo "$s" >>${RSTLOG} } function logpipe { @@ -71,10 +62,10 @@ function rs9113_reset { # No WiFi BT, so exit quietly exit 0 fi - logfile "After reset $i complete" + syslog $LOG_INFO "After reset $i complete" for j in {0..250} ; do if /usr/bin/lsusb -d 1618:9113 ; then - logfile "lsusb found 1618:9113 after reset $i" + syslog $LOG_INFO "lsusb found 1618:9113 after reset $i" break 2 fi usleep 100000 -- cgit v1.2.3 From a243b6cc46b483785c3c32a31cc24df729b6c46c Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 14 Dec 2021 12:39:30 -0600 Subject: Disable EHCI (High Speed USB) by default for MTCDT --- recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts index ba57758..0d86d4f 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts @@ -442,4 +442,7 @@ cd-gpios = <&pioA 1 GPIO_ACTIVE_HIGH>; }; }; - +// Disable EHCI, High Speed USB by default +&usb1 { + status = "disabled"; +}; -- cgit v1.2.3 From 6be916eafa196449060cf6ca3bd17c553d74e941 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 15 Dec 2021 07:13:28 -0600 Subject: Set EHCI (High Speed USB) by default for MTCDT --- recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts index 0d86d4f..ba57758 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts @@ -442,7 +442,4 @@ cd-gpios = <&pioA 1 GPIO_ACTIVE_HIGH>; }; }; -// Disable EHCI, High Speed USB by default -&usb1 { - status = "disabled"; -}; + -- cgit v1.2.3 From ead9856ec5484019e32140ef08a44563374df9f8 Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Tue, 11 Jan 2022 17:08:08 +0200 Subject: Disable EHCI (High Speed USB) by default for MTCDT Set EHCI (High Speed USB) by default for MTCDT annihilate each other. So there is no changes in 5.4 device tree --- recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts | 1 + 1 file changed, 1 insertion(+) (limited to 'recipes-kernel') diff --git a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts index ba57758..79e8fef 100644 --- a/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts +++ b/recipes-kernel/linux/linux-at91-4.9.87/mtcdt/mtcdt.dts @@ -8,6 +8,7 @@ #include + / { model = "Multi-Tech Systems MTCDT"; compatible = "atmel,at91sam9g25ek", "atmel,at91sam9x5ek", "atmel,at91sam9x5", "atmel,at91sam9"; -- cgit v1.2.3 From 740faaaeb030cee2583488378bd13827ad070fd9 Mon Sep 17 00:00:00 2001 From: Serhii Voloshynov Date: Thu, 13 Jan 2022 12:38:57 +0200 Subject: temporarily use rs9113 IPK r10. --- recipes-kernel/rs9113/rs9113_1.6.5.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'recipes-kernel') diff --git a/recipes-kernel/rs9113/rs9113_1.6.5.bb b/recipes-kernel/rs9113/rs9113_1.6.5.bb index 89d7d55..46578c9 100644 --- a/recipes-kernel/rs9113/rs9113_1.6.5.bb +++ b/recipes-kernel/rs9113/rs9113_1.6.5.bb @@ -17,7 +17,7 @@ COMPATIBLE_MACHINE = "(mtcdt|mtrv1)" # To update this, manually copy ipk from Jenkin's job to # git://git@${MTS_INTERNAL_GIT}/mlinux/ipk.git;protocol=ssh;branch=${PV} # -PR = "r12${KERNEL_MODULE_PACKAGE_SUFFIX}" +PR = "r10${KERNEL_MODULE_PACKAGE_SUFFIX}" SRC_URI = " \ file://rs9113/rs9113.init \ file://rs9113/rs9113.default \ -- cgit v1.2.3