Help installing EC25 Drivers

Hi I'm a total newb to OpenWRT but would appreciate any help possible.

I'm testing an OEM 4G/Router i received that had an old version of OpenWRT without any instruction from the manufacturer.

The old version was:
OpenWRT Firmware Version: G4-OPEN-7620A-V01 R02 006
OpenWRT Barrier Breaker 14.07

After much trial and error I upgraded the firmware and thought I bricked the device but after connecting via JTAG/Serial I'm able to communicate with the device and was able to flash various images.

openwrt-19.07.2-ramips-mt7620-wrtnode-squashfs-sysupgrade

The issue im have is that i cannot get the 4G module to be seen by the system. It's a PCIe EC25-AF module that works with the previous firmware.

I tried following the tutorial at: https://openwrt.org/docs/guide-user/network/wan/wwan/ltedongle but had no success and never see the device under /dev/cdc-wdm0 or lsusb

here is the output to cat /sys/kernel/debug/usb/devices:

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 4.14
S:  Manufacturer=Linux 4.14.171 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=101c0000.ehci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12   MxCh= 1
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0001 Rev= 4.14
S:  Manufacturer=Linux 4.14.171 ohci_hcd
S:  Product=Generic Platform OHCI controller
S:  SerialNumber=101c1000.ohci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

If i flash the old image here is the output:
T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12   MxCh= 1
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0001 Rev= 3.10
S:  Manufacturer=Linux 3.10.49 ohci_hcd
S:  Product=Generic Platform OHCI Controller
S:  SerialNumber=101c1000.ohci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   2 Ivl=255ms

T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=1d6b ProdID=0002 Rev= 3.10
S:  Manufacturer=Linux 3.10.49 ehci_hcd
S:  Product=EHCI Host Controller
S:  SerialNumber=101c0000.ehci
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms

T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=480  MxCh= 0
D:  Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=2c7c ProdID=0125 Rev= 3.18
S:  Manufacturer=Quectel
S:  Product=EC25-AF
C:* #Ifs= 5 Cfg#= 1 Atr=a0 MxPwr=500mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=83(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=85(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option
E:  Ad=87(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option
E:  Ad=89(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
E:  Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

If that device is a Quectel EC25 (I do not know about "-AF" that you mentioned) then you may want to look at my posts regarding the Hnet HW-C108 in the thread
https://forum.openwrt.org/t/new-battery-power-router/52799/8

thanks will do ... the ... the AF is just the band support that changes for north america.... thanks for the tip

tried the c108 fw and it doesnt seem to load ... I just get gibberish on the jtag serial console after loading it via tftp.

There may be a GPIO that controls the power supply to the modem card. With the 19.07 OpenWrt you have USB drivers but no device signed onto the bus.

i think you might be right ... any advice on how I can tackle that.... I do have the old working firmware I can flash back to .... Is there something I can run on that to check this?

Check if the power supply pins on the PCIe socket are powered up. If they are with stock firmware but not with OpenWrt you can use OpenWrt to manually set the GPIOs one at a time to see which one it is.

Thanks for your help... to clarify ... Do you mean with a multi-meter or can I do this with a GPIO command?

Use a multimeter to see if the modem is powered up. To enable a GPIO pin to userspace and set its logic level, do this:

cd /sys/class/gpio
echo 0 > export
echo out > gpio0/direction
echo 1 > gpio0/value
echo 0 > gpio0/value

If you get an error on the export, the GPIO is already claimed by the kernel for a LED or some other function (which may or may not be appropriate for your board). If the GPIO doesn't seem to do anything, echo its number to unexport and try the next one.

thanks ... this is all new to me .. i'll dig in and report back, much appreciated

I flashed the old version back and do have the following results for ls of GPIO so maybe we're onto something.

root@G4:/sys/class/gpio# ls
3g_power    gpiochip0   gpiochip40  unexport
export      gpiochip24  gpiochip72  usb_hub

and within the 3g_power directory:

root@G4:/sys/devices/10000000.palmbus/10000660.gpio/gpio/3g_power# ls
active_low  device      subsystem   uevent      value

Do ls -l see if 3g_power is a symlink to one of the numbered ones.

There is also something about a usb_hub, which may be another chip, although the USB status shows the modem is connected directly to the internal root hub in the SoC.

looks like it ... can i copy / learn anything from here to apply on the newer version of openwrt

root@G4:/sys/class/gpio# ls -l
lrwxrwxrwx    1 root     root             0 Jan  1  1970 3g_power -> ../../devices/10000000.palmbus/10000660.gpio/gpio/3g_power
--w-------    1 root     root          4096 Jan  1  1970 export
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip0 -> ../../devices/10000000.palmbus/10000600.gpio/gpio/gpiochip0
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip24 -> ../../devices/10000000.palmbus/10000638.gpio/gpio/gpiochip24
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip40 -> ../../devices/10000000.palmbus/10000660.gpio/gpio/gpiochip40
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip72 -> ../../devices/10000000.palmbus/10000688.gpio/gpio/gpiochip72
--w-------    1 root     root          4096 Jan  1  1970 unexport
lrwxrwxrwx    1 root     root             0 Jan  1  1970 usb_hub -> ../../devices/10000000.palmbus/10000600.gpio/gpio/usb_hub

So by comparing the addresses it looks like 3g_power is gpiochip40 (10000660) and usb_hub is gpiochip0 (10000600).

Now flash back to OpenWrt 19 and try manually setting those.

flashed back and tried this with no success ...

root@OpenWrt:/sys/class/gpio# echo "0" > /sys/class/gpio/export
root@OpenWrt:/sys/class/gpio# echo "out" > /sys/class/gpio/gpio0/direction
root@OpenWrt:/sys/class/gpio# echo "1" > /sys/class/gpio/gpio0/value

but i dug into rc.d and found this in init.d on the old image ... a shell script called hxusbdongled

here are the contents ...

https://pastebin.com/gUjatxx8

The 3G power is going to be GPIO port 40, not 0.

i figured that but got an access denied when trying with 40 vs 4

That means that the kernel configuration (dts file) of the OpenWrt 19 firmware you flashed has attached port 40 to some other function.

Check /etc/config/system for possibly a config related to that, or you may have to look in the source code.

Nothing out of the ordinary in system

config system
	option hostname 'OpenWrt'
	option timezone 'UTC'
	option ttylogin '0'
	option log_size '64'
	option urandom_seed '0'

config timeserver 'ntp'
	option enabled '1'
	option enable_server '0'
	list server '0.openwrt.pool.ntp.org'
	list server '1.openwrt.pool.ntp.org'
	list server '2.openwrt.pool.ntp.org'
	list server '3.openwrt.pool.ntp.org'

confirmed via multi-meter VCC is not getting to the modem on the new version ... sent 1 to pin 40 using the utility script mentioned here : https://openwrt.org/docs/techref/hardware/port.gpio still no voltage and when i use the script to read the input value it's still returns a 0.

tried a bunch of other ways without luck setting 40 to high I was able to set 0 to high but that didnt help

root@OpenWrt:~# cat /sys/class/gpio/gpio0/direction
in
root@OpenWrt:~# cat /sys/class/gpio/gpio0/value
0
root@OpenWrt:~# cat /sys/class/gpio/gpio0/direction
in
root@OpenWrt:~# echo 1 > /sys/class/gpio/gpio0/value
ash: write error: Operation not permitted
root@OpenWrt:~# echo out > /sys/class/gpio/gpio0/direction
root@OpenWrt:~# echo 1 > /sys/class/gpio/gpio0/value
root@OpenWrt:~# cat /sys/class/gpio/gpio0/direction
out
root@OpenWrt:~# cat /sys/class/gpio/gpio0/value
1
root@OpenWrt:~# echo out > /sys/class/gpio/gpio40/direction
root@OpenWrt:~# echo 1 > /sys/class/gpio/gpio40/value
root@OpenWrt:~# cat /sys/class/gpio/gpio40/value
0
root@OpenWrt:~# echo out > /sys/class/gpio/gpio40/direction
root@OpenWrt:~# cat /sys/class/gpio/gpio40/direction
out
root@OpenWrt:~# echo 1 > /sys/class/gpio/gpio40/value
root@OpenWrt:~# cat /sys/class/gpio/gpio40/value
0
root@OpenWrt:~# echo out > /sys/class/gpio/gpio/direction
gpio0/       gpio40/      gpiochip0/   gpiochip24/  gpiochip40/  gpiochip72/
root@OpenWrt:~# echo out > /sys/class/gpio/gpiochip40/direction
-ash: can't create /sys/class/gpio/gpiochip40/direction: Permission denied
root@OpenWrt:~#