diff options
5 files changed, 177 insertions, 35 deletions
diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init index f27415c..03bb5b0 100644 --- a/recipes-bsp/multitech/mts-io/mts-io.init +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -1,15 +1,88 @@ #!/bin/bash +### BEGIN INIT INFO +# Provides: mts-io +# Default-Start: S +# Default-Stop: +# Short-Description: load the mts-io driver +# Description: mts-io driver initializes the Conduit hardware and +# provides user mode access through the driver to the +# Conduit features. +### END INIT INFO + +((fail=0)) sysdir=/sys/devices/platform/mts-io +gpiodir=/sys/class/gpio + +USBRST=${sysdir}/usbhub-reset + +RST[0]="${sysdir}/mtq-reset" +RST[1]="${sysdir}/ap1-reset" +RST[2]="${sysdir}/ap2-reset" +RST[3]="${sysdir}/gnss-reset" +RST[4]="${sysdir}/secure-reset" +RST[5]="${sysdir}/eth-reset" +RS9113RST="${sysdir}/wifi-bt-reset" + +USLPTIME=30000 # 30 milliseconds from Redpine Signals Reset Spec +WAIT="/bin/busybox usleep ${USLPTIME}" +reset_path() { + pin=$1 + /usr/bin/logger -t "mts-io" -p info Reset $pin + + if [[ -f ${pin} ]] ; then + if ! ( (echo 1 >${pin}) && (echo 0 >${pin}) && ${WAIT} && (echo 1 >${pin}) ) ; then + /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${pin}" + fi + else + /usr/bin/logger -t "mts-io" -p error -s "${pin} does not exist" + return 1 + fi + return 0 +} +reset_array() { + ((i=${#RST[@]}-1)) + while ((i>=0)) ; do + if [[ -f ${RST[$i]} ]] ; then + if ! ( (echo 1 >${RST[i]}) ) ; then + /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RST[$i]}" + fi + else + /usr/bin/logger -t "mts-io" -p info -s "${RST[$i]} does not exist" + RST[$i]="" + fi + ((i--)) + done + while ((i>0)) ; do + if ((${#RST[$i] > 0)) && [[ -f ${RST[$i]} ]] ; then + if ! ( (echo 0 >${RST[i]}) ) ; then + /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RST[$i]}" + fi + else + /usr/bin/logger -t "mts-io" -p info -s "${RST[$i]} does not exist" + fi + done + ${WAIT} + while ((i>0)) ; do + if ((${#RST[$i] > 0)) && [[ -f ${RST[$i]} ]] ; then + if ! ( (echo 1 >${RST[i]}) ) ; then + /usr/bin/logger -t "mts-io" -p error -s "Failed write to ${RST[$i]}" + fi + else + /usr/bin/logger -t "mts-io" -p info -s "${RST[$i]} does not exist" + fi + done +} read_card_info() { ap1_product_id="" ap2_product_id="" + mts_hw_version="" - if [ -d $sysdir/ap1 ]; then + if [[ -d $sysdir/ap1 ]]; then ap1_product_id=$(cat $sysdir/ap1/product-id) fi - if [ -d $sysdir/ap2 ]; then + if [[ -d $sysdir/ap2 ]]; then ap2_product_id=$(cat $sysdir/ap2/product-id) fi } @@ -17,18 +90,18 @@ read_card_info() { mfser_init() { found_ap1=0 - if [[ "$ap1_product_id" =~ ^MTAC-MFSER- ]]; then - echo "mts-io: Linking /dev/mfser to /dev/ttyAP1" + if [[ $ap1_product_id =~ ^MTAC-MFSER- ]]; then + /usr/bin/logger -t "mts-io" -p info -s "Linking /dev/mfser to /dev/ttyAP1" ln -sf /dev/ttyAP1 /dev/mfser found_ap1=1 fi - if [[ "$ap2_product_id" =~ ^MTAC-MFSER- ]]; then + if [[ $ap2_product_id =~ ^MTAC-MFSER- ]]; then if [[ $found_ap1 = 1 ]]; then - echo "mts-io: Linking /dev/mfser-2 to /dev/ttyAP2" + /usr/bin/logger -t "mts-io" -p info -s "Linking /dev/mfser-2 to /dev/ttyAP2" ln -sf /dev/ttyAP2 /dev/mfser-2 else - echo "mts-io: Linking /dev/mfser to /dev/ttyAP2" + /usr/bin/logger -t "mts-io" -p info -s "Linking /dev/mfser to /dev/ttyAP2" ln -sf /dev/ttyAP2 /dev/mfser fi fi @@ -37,21 +110,57 @@ mfser_init() { case $1 in start) - echo "Loading mts-io module" - modprobe mts_io + /usr/bin/logger -t "mts-io" -p info -s "Loading mts-io module" + if ! modprobe mts_io ; then + ((fail++)) + fi read_card_info + if ! reset_path $USBRST ; then + ((fail++)) + fi + /bin/busybox usleep 100000 + reset_array + mts-io-sysfs store radio-reset 0 mfser_init + if ! reset_path $RS9113RST ; then + ((fail++)) + fi + + if ((fail == 0)) ; then + echo "OK" + else + echo "FAIL" + fi + exit $fail ;; stop) - echo "Unloading mts-io module" + /usr/bin/logger -t "mts-io" -p info -s "Unloading mts-io module" modprobe -r mts_io + RETVAL=$? + if ((RETVAL == 0)) ; then + echo "OK" + else + echo "FAIL" + fi ;; - + restart) + $0 stop + sleep 1 + $0 start + ;; + status) + if [[ -d ${sysdir} ]] ; then + echo Driver is loaded + exit 0 + else + echo Driver is not loaded + exit 3 + fi + ;; *) - echo "Usage: $0 {start|stop}" + echo "Usage: $0 {start|stop|status|restart}" exit 2 ;; esac - diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-pps-gpio.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-pps-gpio.patch new file mode 100644 index 0000000..554b53f --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-pps-gpio.patch @@ -0,0 +1,31 @@ +diff -uprN old/Documentation/devicetree/bindings/pps/pps-gpio.txt new/Documentation/devicetree/bindings/pps/pps-gpio.txt +--- old/Documentation/devicetree/bindings/pps/pps-gpio.txt 2016-09-19 09:51:11.271472335 -0500 ++++ new/Documentation/devicetree/bindings/pps/pps-gpio.txt 2016-09-19 09:49:27.283474197 -0500 +@@ -17,4 +17,5 @@ Example: + gpios = <&gpio2 6 0>; + + assert-falling-edge; ++ capture-clear; + }; +diff -uprN old/drivers/pps/clients/pps-gpio.c new/drivers/pps/clients/pps-gpio.c +--- old/drivers/pps/clients/pps-gpio.c 2016-09-19 09:51:11.271472335 -0500 ++++ new/drivers/pps/clients/pps-gpio.c 2016-09-19 17:09:02.367001869 -0500 +@@ -119,6 +119,8 @@ static int pps_gpio_probe(struct platfor + + if (of_get_property(np, "assert-falling-edge", NULL)) + data->assert_falling_edge = true; ++ if (of_get_property(np, "capture-clear", NULL)) ++ data->capture_clear = true; + } + + /* GPIO setup */ +@@ -208,6 +210,8 @@ static struct platform_driver pps_gpio_d + module_platform_driver(pps_gpio_driver); + MODULE_AUTHOR("Ricardo Martins <rasm@fe.up.pt>"); + MODULE_AUTHOR("James Nuss <jamesnuss@nanometrics.ca>"); ++MODULE_AUTHOR("Gary Miller <gem@rellim.com>"); ++ + MODULE_DESCRIPTION("Use GPIO pin as PPS source"); + MODULE_LICENSE("GPL"); +-MODULE_VERSION("1.0.0"); ++MODULE_VERSION("1.0.1"); diff --git a/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig b/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig index 6dbcf5d..789e890 100644 --- a/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig +++ b/recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig @@ -82,10 +82,16 @@ CONFIG_TICK_CPU_ACCOUNTING=y # # RCU Subsystem # -CONFIG_TINY_RCU=y -# CONFIG_PREEMPT_RCU is not set -# CONFIG_RCU_STALL_COMMON is not set +CONFIG_TREE_PREEMPT_RCU=y +# CONFIG_TINY_RCU is not set +CONFIG_PREEMPT_RCU=y +CONFIG_RCU_STALL_COMMON=y +CONFIG_RCU_FANOUT=32 +CONFIG_RCU_FANOUT_LEAF=16 +# CONFIG_RCU_FANOUT_EXACT is not set # CONFIG_TREE_RCU_TRACE is not set +# CONFIG_RCU_BOOST is not set +# CONFIG_RCU_NOCB_CPU is not set # CONFIG_IKCONFIG is not set CONFIG_LOG_BUF_SHIFT=14 CONFIG_GENERIC_SCHED_CLOCK=y @@ -217,11 +223,7 @@ CONFIG_IOSCHED_CFQ=y # CONFIG_DEFAULT_CFQ is not set CONFIG_DEFAULT_NOOP=y CONFIG_DEFAULT_IOSCHED="noop" -CONFIG_INLINE_SPIN_UNLOCK_IRQ=y -CONFIG_INLINE_READ_UNLOCK=y -CONFIG_INLINE_READ_UNLOCK_IRQ=y -CONFIG_INLINE_WRITE_UNLOCK=y -CONFIG_INLINE_WRITE_UNLOCK_IRQ=y +CONFIG_UNINLINE_SPIN_UNLOCK=y CONFIG_ARCH_SUPPORTS_ATOMIC_RMW=y CONFIG_FREEZER=y @@ -369,9 +371,10 @@ CONFIG_VMSPLIT_3G=y # CONFIG_VMSPLIT_1G is not set CONFIG_PAGE_OFFSET=0xC0000000 CONFIG_ARCH_NR_GPIO=0 -CONFIG_PREEMPT_NONE=y +# CONFIG_PREEMPT_NONE is not set # CONFIG_PREEMPT_VOLUNTARY is not set -# CONFIG_PREEMPT is not set +CONFIG_PREEMPT=y +CONFIG_PREEMPT_COUNT=y CONFIG_HZ_FIXED=100 CONFIG_HZ=100 CONFIG_SCHED_HRTICK=y @@ -2622,6 +2625,7 @@ CONFIG_PANIC_ON_OOPS_VALUE=0 CONFIG_SCHED_DEBUG=y # CONFIG_SCHEDSTATS is not set # CONFIG_TIMER_STATS is not set +CONFIG_DEBUG_PREEMPT=y # # Lock Debugging (spinlocks, mutexes, etc...) @@ -2647,8 +2651,12 @@ CONFIG_DEBUG_BUGVERBOSE=y # # RCU Debugging # +# CONFIG_PROVE_RCU_DELAY is not set # CONFIG_SPARSE_RCU_POINTER is not set # CONFIG_RCU_TORTURE_TEST is not set +CONFIG_RCU_CPU_STALL_TIMEOUT=21 +CONFIG_RCU_CPU_STALL_VERBOSE=y +# CONFIG_RCU_CPU_STALL_INFO is not set # CONFIG_RCU_TRACE is not set # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set # CONFIG_NOTIFIER_ERROR_INJECTION is not set @@ -2664,6 +2672,7 @@ CONFIG_TRACING_SUPPORT=y CONFIG_FTRACE=y # CONFIG_FUNCTION_TRACER is not set # CONFIG_IRQSOFF_TRACER is not set +# CONFIG_PREEMPT_TRACER is not set # CONFIG_SCHED_TRACER is not set # CONFIG_ENABLE_DEFAULT_TRACERS is not set # CONFIG_FTRACE_SYSCALLS is not set diff --git a/recipes-kernel/linux/linux-3.12.27/mtcdt/linux-3.12-mtcdt-device-tree.patch b/recipes-kernel/linux/linux-3.12.27/mtcdt/linux-3.12-mtcdt-device-tree.patch index aa96655..bea818d 100644 --- a/recipes-kernel/linux/linux-3.12.27/mtcdt/linux-3.12-mtcdt-device-tree.patch +++ b/recipes-kernel/linux/linux-3.12.27/mtcdt/linux-3.12-mtcdt-device-tree.patch @@ -1,8 +1,8 @@ Index: linux-3.12.27/arch/arm/boot/dts/mtcdt.dts =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 -+++ linux-3.12.27/arch/arm/boot/dts/mtcdt.dts 2015-01-13 13:58:20.766078428 -0600 -@@ -0,0 +1,278 @@ ++++ linux-3.12.27/arch/arm/boot/dts/mtcdt.dts 2016-09-19 15:34:25.111103538 -0500 +@@ -0,0 +1,279 @@ +/* + * DTS file for Multi-Tech Systems MTCDT Hardware + */ @@ -248,6 +248,7 @@ Index: linux-3.12.27/arch/arm/boot/dts/mtcdt.dts + pps { + compatible = "pps-gpio"; + gpios = <&pioA 29 0>; ++ capture-clear; + }; + + diff --git a/recipes-kernel/linux/linux_3.12.27.bb b/recipes-kernel/linux/linux_3.12.27.bb index dbd6e08..42d1171 100644 --- a/recipes-kernel/linux/linux_3.12.27.bb +++ b/recipes-kernel/linux/linux_3.12.27.bb @@ -25,6 +25,7 @@ COMMON_PATCHES = " \ file://linux-3.12-release-rfcomm-port-fix.patch \ file://linux-3.12-spi-atmel-dma-min.patch \ file://linux-3.12.27-USB-option-reduce-interrupt-urb-logging-verbosity.patch \ + file://linux-3.12-pps-gpio.patch \ " SRC_URI_append_mtcdt = "\ @@ -35,20 +36,11 @@ SRC_URI_append_mtcdt = "\ file://linux-3.12-add-num_accessory_ports-config-option.patch \ " -SRC_URI_append_mtp = "\ - ${COMMON_PATCHES} \ - file://defconfig \ - file://linux-3.12-eeprom-setup-mtcdt.patch \ - file://linux-3.12-mtp-device-tree.patch \ - file://linux-3.12-add-num_accessory_ports-config-option.patch \ - " - SRC_URI[md5sum] = "2f05332bfca89ae1348ae454af2f5ffb" SRC_URI[sha256sum] = "2014c55257dda311779359d6b42931079a687c154777cc528c44e25f262194cd" -COMPATIBLE_MACHINE = "(mtcdt|mtp)" +COMPATIBLE_MACHINE = "(mtcdt)" DTB_APPEND_mtcdt = "mtcdt" -DTB_APPEND_mtp = "mtp" # disable this on purpose for dev purposes do_rm_work() { |