Debian 3.18.13-bone70 /drivers/usb/serial/option.c doesn't exist : add support for qmi_wwan

Hi,

Working with a Telit LE910 Cell Module and am trying to get a driver working for usb connection.

I am following the guide provided by Telit

I have loaded the kernel headers and such so that I can see

`

usr/src/linux-headers-3.8.13-bone70/drivers/usb/serial# ls
ezusb_convert.pl Kconfig Makefile Makefile-keyspan_pda_f
`

Did so by doing

apt-cache search linux-headers-3.8.13-bone70 apt-get install linux-headers-3.8.13-bone70

My issues is the guide is asking my to looking in /drivers/usb/serial/option.c

I cannot find option.c ??

https://github.com/beagleboard/linux/blob/3.8/drivers/usb/serial/option.c

It's not a header, so you won't find it in "linux-headers-3.8.13-bone70"

Regards,

Thanks for the clarification Rpbert

What is the proper way to 'retrieve the appropriate kernel source code…" for 3.18.3-bone70?

git clone https://github.com/RobertCNelson/linux-stable-rcn-ee
cd ./linux-stable-rcn-ee
git checkout `uname -r` -b tmp

or if you have an existing linus clone:

git clone --reference <dir_to_linux_git>
https://github.com/RobertCNelson/linux-stable-rcn-ee
cd ./linux-stable-rcn-ee
git checkout `uname -r` -b tmp

uname -r = 3.18.3-bone70 or whatever version...

Regards,

Thanks Robert.

I found the file and everything seams legit. The real issue I was trying to solve was that when plugging this device in to the USB input I was not getting the corresponding /dev/USBX’s.

After doing a

modprobe option echo 1bc7 1201 > /sys/bus/usb-serial/drivers/option1/new_id

I now see my /dev/USB1 thru /dev/USB6

Why do I have to do these manual commands? I guess I can scripts these on boot but is there a better option.

Kind Regards,

Matt

Well, you don't have to run 3.8.x:

https://github.com/beagleboard/linux/blob/4.1.13-ti-r35/drivers/usb/serial/option.c#L266-L274

Run "4.1.13-ti-r35" and it'll just work. :wink:

Regards,

Yes I could but I have a custom device tree written to work in the old world of 3.18.3 Is there a simple way to port that into 4.1.13.ti.r35 ?

There is no porting. You simply compile it with the proper device tree version. Which is different from the version used for 3.8.x.

http://www.embeddedhobbyist.com/2015/09/beaglebone-black-updating-device-tree-files/

Anyway, if you apt-get install linux-image, and it ends up not working for you, simply change the uname-r variable in /boot/uEnv.txt ( to point to your 3.8.x kernel ). And problem solved. After that, an apt-get remove --purge should get rid of all traces of the newer 4.1.x kernel. IF that’s what you want.

Yeap, two options, install 4.1.13.ti.r35

Then use the dtb-rebuilder to build your matching *.dtb and boot with it:

https://github.com/RobertCNelson/dtb-rebuilder/tree/4.1-ti

or use the bb.org-overlays to build a custom *.dtbo overlay

https://github.com/beagleboard/bb.org-overlays

the biggest delta is gpio #'ing but the rest we can help with..

Regards,

OK so I upgraded to 4.1.13.ti.r35

How do I use this rebuilder?

Just to confirm I have a custom .dtbo name BB-APA-01 that loaded on boot where I had it baked into the kernel. I did not add it uEnv.txt but it still loaded.

Here is what I tried to get cape loaded:

root@mmpTestBox:~# dmesg | grep BB-APA
[ 0.000000] Kernel command line: console=ttyO0,115200n8 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-APA-01 root=UUID=38808bbf-7f2e-469d-8ff6-e5eec3303fc9 ro rootfstype=ext4 rootwait fixrtc quiet init=/lib/systemd/systemd
root@mmpTestBox:~# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
root@mmpTestBox:~# sh -c “echo ‘BB-APA-01’ > /sys/devices/platform/bone_capemgr/slots”
root@mmpTestBox:~# cat /sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
root@mmpTestBox:~# dmesg | grep BB-APA-01
[ 0.000000] Kernel command line: console=ttyO0,115200n8 capemgr.disable_partno=BB-BONELT-HDMI,BB-BONELT-HDMIN capemgr.enable_partno=BB-APA-01 root=UUID=38808bbf-7f2e-469d-8ff6-e5eec3303fc9 ro rootfstype=ext4 rootwait fixrtc quiet init=/lib/systemd/systemd
[ 224.000061] bone_capemgr bone_capemgr: part_number ‘BB-APA-01’, version ‘N/A’
[ 224.000251] bone_capemgr bone_capemgr: slot #4: ‘Override Board Name,00A0,Override Manuf,BB-APA-01’

So I was able to to get the custom dtbo loaded after recompiling it with:

`
dtc -O dtb -o BB-APA-01-00A0.dtbo -b 0 -@ BB-APA-02-00A0.dts

`

Did the UARTS get renamed? I also had to remove this from the dts to get it to comiple:

fragment@4 { target = <&uart6>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&uart5_pins>; status = "okay"; }; };

Doesn’t seam to be loading on boot despite having entered it in /boot/uEnv.txt:

`
cape_enable=capemgr.enable_partno=BB-APA-01

`

I can manually load it:

root@mmpTestBox:/sys/class/gpio# cat /sys/devices/platform/bone_capemgr/slots 0: PF---- -1 1: PF---- -1 2: PF---- -1 3: PF---- -1 root@mmpTestBox:/sys/class/gpio# sh -c "echo 'BB-APA-01' > /sys/devices/platform/bone_capemgr/slots" root@mmpTestBox:/sys/class/gpio# cat /sys/devices/platform/bone_capemgr/slots 0: PF---- -1 1: PF---- -1 2: PF---- -1 3: PF---- -1 4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-APA-01

After manually loading it:

Now I have an issued with ADC.setup() from the adafruit library. Wasn’t an issue before I update:

`
/powerMGMT.py", line 46, in shorePowerCheck
ADC.setup()
RuntimeError: Unable to setup ADC system. Possible causes are:

  • A cape with a conflicting pin mapping is loaded
  • A device tree object is loaded that uses the same name for a fragment: helper
    `

Any ideas?

So I was able to to get the custom dtbo loaded after recompiling it with:

dtc -O dtb -o BB-APA-01-00A0.dtbo -b 0 -@ BB-APA-02-00A0.dts

Did the UARTS get renamed? I also had to remove this from the dts to get it
to comiple:

     fragment@4 {
               target = <&uart6>;
               __overlay__ {
                       pinctrl-names = "default";
                       pinctrl-0 = <&uart5_pins>;
                       status = "okay";
               };
       };

Yeap:

https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-UART5-00A0.dts#L44

Doesn't seam to be loading on boot despite having entered it in
/boot/uEnv.txt:

cape_enable=capemgr.enable_partno=BB-APA-01

cape_enable=bone_capemgr.enable_partno=BB-APA-01

I can manually load it:

root@mmpTestBox:/sys/class/gpio# cat
/sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
root@mmpTestBox:/sys/class/gpio# sh -c "echo 'BB-APA-01' >
/sys/devices/platform/bone_capemgr/slots"
root@mmpTestBox:/sys/class/gpio# cat
/sys/devices/platform/bone_capemgr/slots
0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1
4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-APA-01

After manually loading it:

Now I have an issued with ADC.setup() from the adafruit library. Wasn't an
issue before I update:

/powerMGMT.py", line 46, in shorePowerCheck
    ADC.setup()
RuntimeError: Unable to setup ADC system. Possible causes are:
  - A cape with a conflicting pin mapping is loaded
  - A device tree object is loaded that uses the same name for a fragment:
helper

There's a patch in this thread:

https://github.com/adafruit/adafruit-beaglebone-io-python/issues/80#issuecomment-161431164

Regards,

How do I apply this patch?

git clone https://github.com/adafruit/adafruit-beaglebone-io-python

cd ./adafruit-beaglebone-io-python

wget https://gist.githubusercontent.com/grizmio/bc752dd070652f21266b/raw/336b5ab5ad14ef28341edfeff6cbf20d959d2f70/gistfile1.txt

patch -p1 < gistfile1.txt

sudo python setup.py install

Regards,

Thanks that worked to adafruit library working.

Still having an issues getting the device tree to load on boot.

Is there a better way to do this than in /boot/uEnv.txt ? I have this line in there now but it does not seam to do the job as I do not see the overlay loaded after boot in …/slots

`
cape_enable=capemgr.enable_partno=BB-APA-01

`

I can manually load it:

`
root@mmpTestBox:/sys/class/gpio# cat /sys/devices/platform/bone_capemgr/slots

0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1

root@mmpTestBox:/sys/class/gpio# sh -c “echo ‘BB-APA-01’ > /sys/devices/platform/bone_capemgr/slots”
root@mmpTestBox:/sys/class/gpio# cat /sys/devices/platform/bone_capemgr/slots

0: PF---- -1
1: PF---- -1
2: PF---- -1
3: PF---- -1

4: P-O-L- 0 Override Board Name,00A0,Override Manuf,BB-APA-01
`

I believe in the old kernel 3.8.x I fuound a way to bake the overlay kernel. Is this possible in 4.1.x?

The trick is in the "bb-customizations" package:

Encase you don't have it installed:

https://github.com/rcn-ee/repos/blob/master/bb-bb-customizations/suite/jessie/debian/dtbo

if [ ! -x /usr/share/initramfs-tools/hooks/dtbo ] ; then
    sudo chmod +x /usr/share/initramfs-tools/hooks/dtbo
fi

then just:

sudo update-initramfs -u -k $(uname -r)

and it'll be in your initrd.

Regards,

Thanks for bearing with me here.

I did a wget https://github.com/rcn-ee/repos/blob/master/bb-bb-customizations/suite/jessie/debian/dtbo

Now do I add this to the file?

if [ ! -x /usr/share/initramfs-tools/ hooks/dtbo ] ; then sudo chmod +x /usr/share/initramfs-tools/hooks/dtbo fi

and then

`
sudo update-initramfs -u -k $(uname -r)

`

Just to confirm my BB-APA-01-00A0.dtbo is in /lib/firmware and loads manually.

I can see that usr/share/initramfs-tools/hooks/dtbo file matches what you have in the repo

Now do I add this to the file?

if [ ! -x /usr/share/initramfs-tools/ hooks/dtbo ] ; then sudo chmod +x /usr/share/initramfs-tools/hooks/dtbo fi

That’s bash script programmer speak for making that file executable, if it’s not already :wink:

In other words. if the file */usr/share/initramfs-tools/hooks/dtbo *is not already executable run chmod +x on it. OR You could create a bash script, drop that code into it. Make the script executable, then run it. And it’d do it for you. Pick your poison.