Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ar71xx: add support for Gainstrong MiniBox V3.2 #645

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants
@p4u
Copy link
Contributor

commented Jan 12, 2018

Adds MiniBox V3.2 ar71xx target (QCA99531 + QCA9887)
Info: http://oolite.cn/minibox-v3-2-qca9531-qca9887-module-pin-specification.html
Reference patch: http://oolite.cn/wp-content/uploads/2017/09/minibox_v3_cc15.05_20160325.patch
Installation: Upload firmware to uboot via HTTP at 192.168.1.1 (press button for 5 seconds)

Signed-off-by: Pau Escrich p4u@dabax.net

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Jan 12, 2018

model="OOLITE"
[ "$hwid" = "3c00010c" -a "$mid" = "00000001" ] && {
model="MINIBOX_V3.2"
hwver=""

This comment has been minimized.

Copy link
@blogic

blogic Jan 17, 2018

Contributor

set it to v3.2

This comment has been minimized.

Copy link
@danielg4

danielg4 Jan 22, 2018

Contributor

This was my fault. I supplied these lines when responding to a request for help programmatically differentiating this device from the Oolite and the MiniBox v1. On second glance, it appears this code may not be even called, because MIPS_MACHINE does not yield a string having "TP-LINK " in front of it. IIRC, it had some use relating to the OEM firmware's flashing function.

model="MINIBOX_V1"
hwver=""
;;

This comment has been minimized.

Copy link
@blogic

blogic Jan 17, 2018

Contributor

and v1 here

This comment has been minimized.

Copy link
@danielg4

danielg4 Jan 22, 2018

Contributor

This line also.

static const char *gs_minibox_v3_part_probes[] = {
"tp-link",
NULL,
};

This comment has been minimized.

Copy link
@blogic

blogic Jan 17, 2018

Contributor

this whole file uses spaces and not tabs for indenting. please use tabs

@p4u p4u force-pushed the p4u:add_target_minibox_v3.2 branch from 40bb9b3 to 5fe871a Jan 28, 2018

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Jan 28, 2018

I fixed the requested changes. But now there is a conflict in the merging. Kernel config files has changed in openwrt/master branch.

Is there an elegant way to solve this without recreating the whole patch?

@danielg4

This comment has been minimized.

Copy link
Contributor

commented Jan 28, 2018

Have you tried "git rebase" to restage your changes onto the current master?

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Jan 28, 2018

I've tried

git remote add official <openwrt_source_url>
git fetch official
git merge official/master
-> solve conflicts and merge
git rebase official/master
-> big mess of conflicts again, no way to have a clean single commit from my PR

@danielg4

This comment has been minimized.

Copy link
Contributor

commented Jan 28, 2018

Don't use "git merge" when working with github. You have to undo that.

ar71xx: add support for Gainstrong MiniBox V3.2
Adds MiniBox V3.2 ar71xx target (QCA99531 + QCA9887)
Info: http://oolite.cn/minibox-v3-2-qca9531-qca9887-module-pin-specification.html
Reference patch: http://oolite.cn/wp-content/uploads/2017/09/minibox_v3_cc15.05_20160325.patch
Installation: Upload firmware to uboot via HTTP at 192.168.1.1 (press button for 5 seconds)

Signed-off-by: Pau Escrich <p4u@dabax.net>

@p4u p4u force-pushed the p4u:add_target_minibox_v3.2 branch from 5fe871a to 3fb37b4 Jan 29, 2018

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Jan 29, 2018

Great, rebase and fix conflicts worked!

Now it's ready to be merged.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Feb 1, 2018

ping @blogic

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Feb 1, 2018

Wait! i've compiled this last version and it does not work

Find attach the serial console output.

I'll look at this afterwars, but any help is welcome.

minibox_output.txt

@blogic

This comment has been minimized.

Copy link
Contributor

commented Feb 13, 2018

@p4u enable the symbol inside target/linux/ar71xx/generic/config-default ... your mach file is currently not being built into the kernel

@p4u p4u force-pushed the p4u:add_target_minibox_v3.2 branch from 3fb37b4 to ade1684 Feb 13, 2018

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2018

Thanks @blogic the kernel config was lost after the rebase with OpenWRT/master branch

I've updated the PR. I've just tested and works as expected. So it might be merged if no other changes requested.

Thanks.

@p4u p4u force-pushed the p4u:add_target_minibox_v3.2 branch from ade1684 to 3fb37b4 Mar 5, 2018

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Mar 5, 2018

I've rebased and fixed conflicts.

However I don't know why the PR is not getting updated (at least until now).

Here the new version of the commit

p4u@3fb37b4

I'm getting a bit tired of rebasing... this might be merged already.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Mar 15, 2018

@pepe2k made some commits changing the behaviour of Gainstrong device

907d674#diff-f2e8b3d101abc0946e31748fec7f17b0

I'm not sure how to proceed. @pepe2k can you make the proper modifications to include also miniBox v3.2 base on the work I did or give me the instructions for recreating the PR?

I'd like to see minibox v3.2 supported as soon as possible, it's a great device.

Thanks

@aparcar

This comment has been minimized.

Copy link
Member

commented Oct 30, 2018

@p4u @blogic hey how to proceed regarding this issue?

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

Tested @dangowrt rebase commit but got kernel panic.

[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 124872K/131072K available (3158K kernel code, 169K rwdata, 796K rodata, 284K init, 213K bss, 6200K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS:51
[    0.000000] Clocks: CPU:550.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6950037990 ns
[    0.000010] sched_clock: 32 bits at 275MHz, resolution 3ns, wraps every 7809031678ns
[    0.008270] Calibrating delay loop... 366.18 BogoMIPS (lpj=1830912)
[    0.071081] pid_max: default: 32768 minimum: 301
[    0.076089] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.083073] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.094024] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.104457] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.111639] NET: Registered protocol family 16
[    0.118192] MIPS: machine is Generic AR71XX/AR724X/AR913X based board
[    0.146018] clocksource: Switched to clocksource MIPS
[    0.152718] NET: Registered protocol family 2
[    0.158345] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.165717] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.172503] TCP: Hash tables configured (established 1024 bind 1024)
[    0.179351] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.185532] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.192521] NET: Registered protocol family 1
[    0.202900] Crashlog allocated RAM at address 0x3f00000
[    0.210333] workingset: timestamp_bits=30 max_order=15 bucket_order=0
[    0.225216] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.231421] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.253478] io scheduler noop registered
[    0.257693] io scheduler deadline registered (default)
[    0.263470] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    0.270717] console [ttyS0] disabled
[    0.294668] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A
[    0.303793] console [ttyS0] enabled
[    0.303793] console [ttyS0] enabled
[    0.311354] bootconsole [early0] disabled
[    0.311354] bootconsole [early0] disabled
[    0.322154] libphy: Fixed MDIO Bus: probed
[    0.330655] NET: Registered protocol family 10
[    0.349751] NET: Registered protocol family 17
[    0.354524] 8021q: 802.1Q VLAN Support v1.8
[    0.361981] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.369800] Please append a correct "root=" boot option; here are the available partitions:
[    0.378442] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.389757] Rebooting in 1 seconds..
@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

Wait! i've compiled this last version and it does not work

Find attach the serial console output.

I'll look at this afterwars, but any help is welcome.

minibox_output.txt

Same problem. The symbol is not being build.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

This patch fixes de problem.

diff --git a/target/linux/ar71xx/generic/config-default b/target/linux/ar71xx/generic/config-default
index da331d3..e5cee89 100644
--- a/target/linux/ar71xx/generic/config-default
+++ b/target/linux/ar71xx/generic/config-default
@@ -103,6 +103,7 @@ CONFIG_ATH79_MACH_GL_MIFI=y
 CONFIG_ATH79_MACH_GL_USB150=y
 CONFIG_ATH79_MACH_GS_OOLITE_V1=y
 CONFIG_ATH79_MACH_GS_OOLITE_V5_2=y
+CONFIG_ATH79_MACH_GS_MINIBOX_V32=y
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y
 CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y
@dangowrt

This comment has been minimized.

Copy link
Member

commented Nov 5, 2018

This patch fixes de problem.

diff --git a/target/linux/ar71xx/generic/config-default b/target/linux/ar71xx/generic/config-default
index da331d3..e5cee89 100644
--- a/target/linux/ar71xx/generic/config-default
+++ b/target/linux/ar71xx/generic/config-default
@@ -103,6 +103,7 @@ CONFIG_ATH79_MACH_GL_MIFI=y
 CONFIG_ATH79_MACH_GL_USB150=y
 CONFIG_ATH79_MACH_GS_OOLITE_V1=y
 CONFIG_ATH79_MACH_GS_OOLITE_V5_2=y
+CONFIG_ATH79_MACH_GS_MINIBOX_V32=y
 CONFIG_ATH79_MACH_HIWIFI_HC6361=y
 CONFIG_ATH79_MACH_HORNET_UB=y
 CONFIG_ATH79_MACH_JA76PF=y

Done. See https://git.openwrt.org/?p=openwrt/staging/dangole.git;a=blobdiff;f=target/linux/ar71xx/generic/config-default;h=25b58ae91e9919fce6f63f9b8fb2adef8239ef82;hp=26717b107c75c1c0ecb622140339446a1566ac97;hb=8c3f669172b97dfc738e1f6cc22bcbe161c5015a;hpb=860de2e1aa9deac7dce76b7f85cb5fcfbba00468

Please re-test and report back.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

Everything works quite fine now. The only proplem I found is the serial console, I can see Uboot and the begining of OpenWRT kernel loading but afterwars I loose the output. Probably the Serial device is wrong, I think it was fixed somewhere in the old patches. I'll take a look afterwars.

Anyway it's probably good enough to be merged.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

By the way, two of the four devices I'm using for testing have no MAC address in the 5GHz radio EPROM. Using "option macaddr blah" in /etc/config/wireless seem to work but the WiFi device is not working properly.

I'd like to think this is just a corner case and I got bad luck when buying the devices (from a wrong batch). Not sure if something can be done from the OS level.

@dangowrt

This comment has been minimized.

Copy link
Member

commented Nov 5, 2018

Hopefully fixed the console, see
https://git.openwrt.org/?p=openwrt/staging/dangole.git;a=blob;f=target/linux/ar71xx/image/generic.mk;h=0c8c5c6b344434322706c7a4bd3d17e8c1549e09;hb=0c8c5c6b344434322706c7a4bd3d17e8c1549e09#l905
which was

 CONSOLE := ttyS0,115200

in the original patch and had to be

 CONSOLE := ttyATH0,115200

Missing 5GHz MAC looks like missing EEPROM data hence probably incorrectly flashed devices.
Please retry if my updated branch now works including the serial console.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

Regarding the serial console issue:

In the filesystem I see /dev/ttyS0 and it was changed from ttyATH0 to ttyS0 following @pepe2k recommendation (see lede-project/source#1578)

So I think the serial device is actually ttyS0 (if I don't remember wrong it used to work). I'll try now a firmware with the CONSOLE line removed (as it is in Oolite v5.2 which is almost the same hardware) and report back.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

By the way, which ath10 driver should be used? The standard or -ct one? Should I run some tests to figure out?

@dangowrt

This comment has been minimized.

Copy link
Member

commented Nov 5, 2018

According to the bootlog the console should indeed by ttyS0,115200 which is the default and we should just drop that line entirely. Can you try that and report whether that fixes it?

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 5, 2018

According to the bootlog the console should indeed by ttyS0,115200 which is the default and we should just drop that line entirely. Can you try that and report whether that fixes it?

Confirmed, removing the CONSOLE line fixes de problem :)

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 6, 2018

So, everything works good now. Just the EEPROM missing mac problem in some devices, but I think this is not an OpenWRT issue. Just in case it might be useful, the logread information regarding ath10k driver.

Mon Nov  5 21:24:19 2018 kern.info kernel: [   12.197625] ath10k_pci 0000:00:00.0: pci irq legacy oper_irq_mode 1 irq_mode 0 reset_mode 0
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   12.479380] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/pre-cal-pci-0000:00:00.0.bin failed with error -2
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   12.490503] ath10k_pci 0000:00:00.0: Falling back to user helper
Mon Nov  5 21:24:19 2018 kern.err kernel: [   12.592057] firmware ath10k!pre-cal-pci-0000:00:00.0.bin: firmware_loading_store: map pages failed
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   12.601845] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/cal-pci-0000:00:00.0.bin failed with error -2
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   12.612601] ath10k_pci 0000:00:00.0: Falling back to user helper
Mon Nov  5 21:24:19 2018 kern.err kernel: [   12.806212] firmware ath10k!cal-pci-0000:00:00.0.bin: firmware_loading_store: map pages failed
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   12.815666] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/QCA9887/hw1.0/firmware-6.bin failed with error -2
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   12.826781] ath10k_pci 0000:00:00.0: Falling back to user helper
Mon Nov  5 21:24:19 2018 kern.err kernel: [   13.020657] firmware ath10k!QCA9887!hw1.0!firmware-6.bin: firmware_loading_store: map pages failed
Mon Nov  5 21:24:19 2018 kern.info kernel: [   13.040419] ath10k_pci 0000:00:00.0: qca9887 hw1.0 target 0x4100016d chip_id 0x004000ff sub 0000:0000
Mon Nov  5 21:24:19 2018 kern.info kernel: [   13.050055] ath10k_pci 0000:00:00.0: kconfig debug 0 debugfs 1 tracing 0 dfs 1 testmode 1
Mon Nov  5 21:24:19 2018 kern.info kernel: [   13.065217] ath10k_pci 0000:00:00.0: firmware ver 10.2.4-1.0-00041 api 5 features no-p2p,ignore-otp,skip-clock-init,mfp,allows-mesh-bcast crc32 3587a422
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   13.174702] ath10k_pci 0000:00:00.0: Direct firmware load for ath10k/QCA9887/hw1.0/board-2.bin failed with error -2
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   13.185539] ath10k_pci 0000:00:00.0: Falling back to user helper
Mon Nov  5 21:24:19 2018 kern.err kernel: [   13.308055] firmware ath10k!QCA9887!hw1.0!board-2.bin: firmware_loading_store: map pages failed
Mon Nov  5 21:24:19 2018 kern.info kernel: [   13.325401] ath10k_pci 0000:00:00.0: board_file api 1 bmi_id N/A crc32 546cca0d
Mon Nov  5 21:24:19 2018 kern.err kernel: [   13.354858] ath10k_pci 0000:00:00.0: failed to read device EEPROM at 0000
Mon Nov  5 21:24:19 2018 kern.warn kernel: [   13.361892] ath10k_pci 0000:00:00.0: failed to read calibration data from EEPROM: -22
Mon Nov  5 21:24:19 2018 kern.info kernel: [   14.478574] ath10k_pci 0000:00:00.0: htt-ver 2.1 wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.616730] ath: EEPROM regdomain: 0x0
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.616740] ath: EEPROM indicates default country code should be used
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.616744] ath: doing EEPROM country->regdmn map search
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.616759] ath: country maps to regdmn code: 0x3a
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.616766] ath: Country alpha2 being used: US
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.616770] ath: Regpair used: 0x3a
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.787862] ath: EEPROM regdomain: 0x0
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.787876] ath: EEPROM indicates default country code should be used
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.787880] ath: doing EEPROM country->regdmn map search
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.787900] ath: country maps to regdmn code: 0x3a
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.787906] ath: Country alpha2 being used: US
Mon Nov  5 21:24:19 2018 kern.debug kernel: [   14.787910] ath: Regpair used: 0x3a

@danielg4

This comment has been minimized.

Copy link
Contributor

commented Nov 6, 2018

So, everything works good now. Just the EEPROM missing mac problem in some devices, but I think this is not an OpenWRT issue. Just in case it might be useful, the logread information regarding ath10k driver.

It most likely is an OpenWrt issue. Many ath10k devices have calibration partitions which must be manually loaded through scripts.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 6, 2018

It most likely is an OpenWrt issue. Many ath10k devices have calibration partitions which must be manually loaded through scripts.

You probably right

[   42.604526] ath10k_pci 0000:00:00.0: unable to read from the device (-145)
[   42.611652] ath10k_pci 0000:00:00.0: could not read board ext data addr (-145)
[   42.619153] ath10k_pci 0000:00:00.0: could not push board ext data (-145)
[   42.626183] ath10k_pci 0000:00:00.0: failed to download calibration data from EEPROM: -145
@dangowrt

This comment has been minimized.

Copy link
Member

commented Nov 13, 2018

Regarding the ath10k eeprom data: please retry with my updated staging tree which now tries to grab the eeprom data from flash just it works on other oolite devices. If that works we are ready for merge.

@dangowrt

This comment has been minimized.

Copy link
Member

commented Nov 13, 2018

Otherwise please try editing target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata until we get it to work.

@p4u

This comment has been minimized.

Copy link
Contributor Author

commented Nov 15, 2018

Regarding the ath10k eeprom data: please retry with my updated staging tree which now tries to grab the eeprom data from flash just it works on other oolite devices. If that works we are ready for merge.

Confirmed, it works :) Great work @dangowrt

@dangowrt

This comment has been minimized.

Copy link
Member

commented Nov 15, 2018

cherry-pick and fixed up 15f16bf

@dangowrt dangowrt closed this Nov 15, 2018

friendlyarm pushed a commit to friendlyarm/openwrt that referenced this pull request Apr 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.