GobiSerial and GobiNet on TX1

Hello all,

I’ve purchased a MC7304 sierra to test 4G on TX1,

but I encounter some problems when I want to compile the GobiSerial and GobiNet drivers.

GobiSerial:

make
make -C /lib/modules/3.10.96-tegra/build M=/home/ubuntu/S2.25N2.36/GobiSerial modules
make[1]: Entering directory `/usr/src/linux-headers-3.10.96-tegra'
  CC [M]  /home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.o
/home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.c:219:2: warning: #warning "Assuming disc_mutex is locked external to the module" [-Wcpp]
 #warning "Assuming disc_mutex is locked external to the module"
  ^
/home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.c:316:4: warning: initialization from incompatible pointer type [enabled by default]
    .resume = usb_serial_generic_resume,
    ^
/home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.c:316:4: warning: (near initialization for ‘GobiDriver.resume’) [enabled by default]
/home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.c:317:4: warning: initialization from incompatible pointer type [enabled by default]
    .reset_resume = usb_serial_generic_resume,
    ^
/home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.c:317:4: warning: (near initialization for ‘GobiDriver.reset_resume’) [enabled by default]
scripts/basic/fixdep: 1: scripts/basic/fixdep: Syntax error: "(" unexpected
make[2]: *** [/home/ubuntu/S2.25N2.36/GobiSerial/GobiSerial.o] Error 2
make[1]: *** [_module_/home/ubuntu/S2.25N2.36/GobiSerial] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.10.96-tegra'
make: *** [all] Error 2

GobiNet:

make -C /lib/modules/3.10.96-tegra/build M=/home/ubuntu/S2.25N2.36/GobiNet modules
make[1]: Entering directory `/usr/src/linux-headers-3.10.96-tegra'
  CC [M]  /home/ubuntu/S2.25N2.36/GobiNet/GobiUSBNet.o
scripts/basic/fixdep: 1: scripts/basic/fixdep: Syntax error: "(" unexpected
make[2]: *** [/home/ubuntu/S2.25N2.36/GobiNet/GobiUSBNet.o] Error 2
make[1]: *** [_module_/home/ubuntu/S2.25N2.36/GobiNet] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.10.96-tegra'
make: *** [all] Error 2

Can you help me ?

Thanks

What kind of compile environment are you using (e.g., cross compile, and which compilers)? Which L4T version (head -n 1 /etc/nv_tegra_release)?

It’s quite possible that the driver won’t work with this kernel, but kernel compile on a JTX1 can get complicated because of the need for two compilers (32-bit and 64-bit are both needed). It is unlikely a standard “make” command will suffice for this.

Hello , thank you for your reply ,

the output of (head -n 1 /etc/nv_tegra_release) :

R24 (release), REVISION: 1.0, GCID: 7164062, BOARD: t210ref, EABI: aarch64, DATE: Tue May 17 23:37:30 UTC 2016

I compile just with this makefile :

obj-m := GobiSerial.o
KDIR := /lib/modules/$(shell uname -r)/build
PWD := $(shell pwd)
OUTPUTDIR=/lib/modules/`uname -r`/kernel/drivers/usb/serial/

all: clean
        $(MAKE) -C $(KDIR) M=$(PWD) modules

And I use linux headers /lib/modules/3.10.96-tegra/ directly from the TX1. Are you saying that I need to cross compile from a development PC ?

Cross compile would be needed…there are ways to set up native, but cross compile is better.

The reason for this is that the compilers support only one architecture, but the ARMv8-a CPU supports two architectures. One is the 64-bit environment everyone knows about, the other is a 32-bit compatibility mode. If we were talking about a desktop PC, compilers are available which simultaneously support i686 and x86_64…without this, any compatibility of 32-bit on a desktop would also require two compilers. The ARM compilers have not had time to integrate two compilers into one (and I don’t know if it will ever happen). Thus, you need a 32-bit ARMv7 cross compiler and a complete 64-bit ARMv8-a cross tool chain. Make sure you can compile a complete kernel with this, then try just the module. There are a lot of threads on the topic, plus the documentation can be downloaded and not only has the instructions, it also has a known-working set of cross compilers.

If you have Ubuntu 14LTS you can probably just use the package manager to add the correct cross compilers to your desktop host. Under other distributions you can sometimes use Linaro tool chains, or compile the crosstool ng which comes with the R24.1 documentation (look for the “baggage” directory).

Once you have your compilers, here is an example of compile details (adjust for your compiler names and directories…create the output directories):

export CROSS_COMPILE=/usr/local/aarch64-unknown-linux-gnu/crosstool-ng-4.8.2/bin/aarch64-unknown-linux-gnu-
export CROSS32CC=/usr/local/arm-unknown-linux-gnueabi/crosstool-ng-4.8.2/bin/arm-unknown-linux-gnueabi-gcc
export ARCH=arm64
export TEGRA_KERNEL_OUT=~/L4T/build/stage
export TEGRA_MODULES_OUT=~/L4T/build/modules
# cd to kernel source, or adjust for module build.
# Put config files in $TEGRA_KERNEL_OUT, make sure CONFIG_LOCALVERSION matches the running kernel...optionally:
make O=$TEGRA_KERNEL_OUT tegra21_defconfig
make O=$TEGRA_KERNEL_OUT menuconfig
make -j4 O=$TEGRA_KERNEL_OUT zImage
make -j4 O=$TEGRA_KERNEL_OUT modules
make O=$TEGRA_KERNEL_OUT modules_install INSTALL_MOD_PATH=$TEGRA_MODULES_OUT

NOTE: In R24.1 there are some adjustments needed:

NOTE: drivers/base/Kconfig, line 234, missing double quote to close string.
NOTE: May need to edit "drivers/platform/tegra/tegra21_clocks.c:1065"
      c->state = ((!is_lp_cluster()) == (c->u.cpu.mode == MODE_G)) ? ON : OFF;
NOTE: toplevel Makefile, KBUILD_CFLAGS_KERNEL := -fomit-frame-pointer

Hello linuxdev !, all is ok!
thanks a lot !

Hello,
sorry but I’ve speak too fast.

When I do a modprobe, I’ve got these warning messages with the GobiNet.ko from /var/log/syslog after enabled it when the correct command.

Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837686] ------------[ cut here ]------------
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837703] WARNING: at /dvs/git/dirty/git-master_linux/kernel/drivers/base/power/runtime.c:881 pm_runtime_usage_cnt_dec+0x2c/0x98()
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837709] Modules linked in: GobiNet(O) GobiSerial(O) bcmdhd rfcomm bnep cfg80211 bluedroid_pm [last unloaded: GobiNet]
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837734] CPU: 2 PID: 922 Comm: NetworkManager Tainted: G        W  O 3.10.96-tegra #1
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837740] Call trace:
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837748] [<ffffffc000089d28>] dump_backtrace+0x0/0xf4
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837754] [<ffffffc00008a028>] show_stack+0x14/0x1c
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837761] [<ffffffc0002f76dc>] dump_stack+0x20/0x28
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837769] [<ffffffc0000a71a8>] warn_slowpath_common+0x78/0x9c
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837775] [<ffffffc0000a7294>] warn_slowpath_null+0x18/0x20
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837781] [<ffffffc0004e9d80>] pm_runtime_usage_cnt_dec+0x2c/0x98
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837787] [<ffffffc0004ea8ac>] __pm_runtime_idle+0x48/0x94
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837794] [<ffffffc000623028>] usb_autopm_put_interface+0x38/0x40
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837804] [<ffffffbffd0cb264>] GobiUSBNetOpen+0xdc/0x120 [GobiNet]
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837810] [<ffffffc00093d344>] __dev_open+0xa4/0x104
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837817] [<ffffffc00093d5b8>] __dev_change_flags+0xa8/0x128
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837822] [<ffffffc00093d6c0>] dev_change_flags+0x1c/0x5c
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837829] [<ffffffc00094b550>] do_setlink+0x23c/0x598
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837834] [<ffffffc00094bcc0>] rtnl_newlink+0x22c/0x444
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837840] [<ffffffc00094bfd8>] rtnetlink_rcv_msg+0x100/0x150
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837846] [<ffffffc000967710>] netlink_rcv_skb+0x80/0xf0
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837852] [<ffffffc00094ba68>] rtnetlink_rcv+0x24/0x34
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837858] [<ffffffc000964908>] netlink_unicast_kernel+0x44/0x94
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837864] [<ffffffc000967168>] netlink_unicast+0x98/0x134
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837870] [<ffffffc000967524>] netlink_sendmsg+0x274/0x2d0
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837876] [<ffffffc0009234fc>] sock_sendmsg+0xa4/0xc4
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837882] [<ffffffc000924694>] ___sys_sendmsg+0x298/0x2bc
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837888] [<ffffffc000926670>] __sys_sendmsg+0x40/0x68
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837894] [<ffffffc000926748>] SyS_sendmsg+0xb0/0x150
Aug  9 14:23:22 tegra-ubuntu kernel: [ 4334.837898] ---[ end trace cabd23c36af1c226 ]---

Do you have an idea ?
what is /dvs/git/dirty/git-master_linux/kernel/drivers/base/power/runtime.c ???

The directory doesn’t exist.

Also when I compile with the correct cross compiling tool, I got these warning also … It’s normal ?

The modules launch perfectly but I want to be sure if it’s work 100 %.

for GobiSerial:

make[1]: Entering directory `/usr/src/kernel'

  WARNING: Symbol version dump /usr/src/kernel/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.o
/home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.c:219:2: warning: #warning "Assuming disc_mutex is locked external to the module" [-Wcpp]
 #warning "Assuming disc_mutex is locked external to the module"
  ^
/home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.c:316:4: warning: initialization from incompatible pointer type [enabled by default]
    .resume = usb_serial_generic_resume,
    ^
/home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.c:316:4: warning: (near initialization for ‘GobiDriver.resume’) [enabled by default]
/home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.c:317:4: warning: initialization from incompatible pointer type [enabled by default]
    .reset_resume = usb_serial_generic_resume,
    ^
/home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.c:317:4: warning: (near initialization for ‘GobiDriver.reset_resume’) [enabled by default]
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.mod.o
  LD [M]  /home/ubuntu/Drivers_sierra/GobiSerial/GobiSerial.ko
make[1]: Leaving directory `/usr/src/kernel'

for GobiNet :

make[1]: Entering directory `/usr/src/kernel'

  WARNING: Symbol version dump /usr/src/kernel/Module.symvers
           is missing; modules will have no dependencies and modversions.

  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/GobiUSBNet.o
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/QMIDevice.o
/home/ubuntu/Drivers_sierra/GobiNet/QMIDevice.c: In function ‘UserspaceOpen’:
/home/ubuntu/Drivers_sierra/GobiNet/QMIDevice.c:2645:4: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    sQMIDev * pQMIDev = container_of( pInode->i_cdev,
    ^
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/QMI.o
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/usbnet_2_6_32.o
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/usbnet_3_0_6.o
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/usbnet_2_6_35.o
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/usbnet_3_10_21.o
  CC [M]  /home/ubuntu/Drivers_sierra/GobiNet/usbnet_3_12_xx.o
  LD [M]  /home/ubuntu/Drivers_sierra/GobiNet/GobiNet.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/ubuntu/Drivers_sierra/GobiNet/GobiNet.mod.o
  LD [M]  /home/ubuntu/Drivers_sierra/GobiNet/GobiNet.ko
make[1]: Leaving directory `/usr/src/kernel'

Thanks

Just for reference, what was the exact modprobe command you used? Second, did you set CONFIG_LOCALVERSION? You can “grep CONFIG_LOCALVERSION .config” in the directory with configuration if not sure…probably this is ok or you would have had to force module insert.

For actual module, what was the exact directory you put this in? It would be somewhere under “/lib/modules/”.

FYI, the “git” message is about the version of source code used for that part of the error which occurred. You’d need to know the base URL for the git repo to get this under git. The statement says the code block reached is at “drivers/base/power/runtime.c” within kernel source tree, and to refer to that original version if you want to see history.

I have not debugged this at all, but I did notice it is related to power management increment/decrement counters, and that further down in the call stack USB was also referenced. Is this a USB device? Perhaps disabling USB auto-suspend would be a workaround, although probably not since the issue was upon module insert rather than upon any suspend state (though insert during a suspend still makes this possible). See this URL to go to performance mode, most specifically to disable USB auto-suspend temporarily:
http://elinux.org/Jetson/Performance

That URL is for JTK1, but mostly applies to JTX1 as well. Make sure USB auto-suspend is disabled prior to module insert for testing purposes. If this works, you could disable some of the low power scripting and set performance mode in rc.local. Disabling of automatic power scripts is via:

sudo update-rc.d -f ondemand remove

There will probably need to be some debugging for the driver to work…if workarounds succeed it’ll make debugging easier. Also to debug it would be useful to know which exact compilers were used.

Hello linuxdev, thanks for your answer, I will test.

I just stumbled across this error myself using a usb-to-wwan adapter on Tegra SOC:

drivers/base/power/runtime.c:881 pm_runtime_usage_cnt_dec+0x80/0x98()
<4>[02-04 21:10:31.222] Modules linked in: GobiNet sierra
<4>[02-04 21:10:31.222] CPU: 2 PID: 2822 Comm: dhcpcd Tainted: G        W    3.10.24-g196bad6 #1
<4>[02-04 21:10:31.222] [<c0016aec>] (unwind_backtrace+0x0/0x13c) from [<c001325c>] (show_stack+0x18/0x1c)
<4>[02-04 21:10:31.222] [<c001325c>] (show_stack+0x18/0x1c) from [<c0061de8>] (warn_slowpath_common+0x5c/0x74)
<4>[02-04 21:10:31.222] [<c0061de8>] (warn_slowpath_common+0x5c/0x74) from [<c0061eb4>] (warn_slowpath_null+0x24/0x2c)
<4>[02-04 21:10:31.222] [<c0061eb4>] (warn_slowpath_null+0x24/0x2c) from [<c042a43c>] (pm_runtime_usage_cnt_dec+0x80/0x98)
<4>[02-04 21:10:31.222] [<c042a43c>] (pm_runtime_usage_cnt_dec+0x80/0x98) from [<c042a478>] (__pm_runtime_idle+0x24/0x64)
<4>[02-04 21:10:31.222] [<c042a478>] (__pm_runtime_idle+0x24/0x64) from [<bf009098>] (GobiUSBNetOpen+0x98/0x120 [GobiNet])
<4>[02-04 21:10:31.222] [<bf009098>] (GobiUSBNetOpen+0x98/0x120 [GobiNet]) from [<c0780c90>] (__dev_open+0xa0/0x100)
<4>[02-04 21:10:31.222] [<c0780c90>] (__dev_open+0xa0/0x100) from [<c0780ee8>] (__dev_change_flags+0x9c/0x130)
<4>[02-04 21:10:31.222] [<c0780ee8>] (__dev_change_flags+0x9c/0x130) from [<c0780ff8>] (dev_change_flags+0x18/0x50)
<4>[02-04 21:10:31.222] [<c0780ff8>] (dev_change_flags+0x18/0x50) from [<c08117a0>] (devinet_ioctl+0x7c4/0x898)
<4>[02-04 21:10:31.222] [<c08117a0>] (devinet_ioctl+0x7c4/0x898) from [<c0769984>] (sock_ioctl+0x134/0x29c)
<4>[02-04 21:10:31.222] [<c0769984>] (sock_ioctl+0x134/0x29c) from [<c015f590>] (do_vfs_ioctl+0x414/0x5ec)
<4>[02-04 21:10:31.222] [<c015f590>] (do_vfs_ioctl+0x414/0x5ec) from [<c015f7e0>] (SyS_ioctl+0x78/0x88)
<4>[02-04 21:10:31.222] [<c015f7e0>] (SyS_ioctl+0x78/0x88) from [<c000ef40>] (ret_fast_syscall+0x0/0x48)
<4>[02-04 21:10:31.222] ---[ end trace 1b75b31a2719ed24 ]---

I have usb autosuspend =-1 in place and this still happens…

I will try and update the GobiNet drivers and see if this still persists…

Just a thought on something to check…sometimes there is extra firmware to download for the particular hardware, and if the firmware version is out of sync with the driver version you might end up with errors like this even if the hardware and software is otherwise correct.

Thanks for the reply linuxdev. I have loaded the most current firmware thru the sierra tools on windows. There is no firmware in /lib/firmware for the sierra cards. This looks to be an issue with CONFIG_PM on tegra. Im gonna do some more debugging later tonight…

@Linux4all, Did you ever find a solution to this issue?

drivers/base/power/runtime.c:881 pm_runtime_usage_cnt_dec+0x80/0x98()