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: Rework MikroTik RB SPI-NOR support and add several devices #800

Closed
wants to merge 8 commits into
base: master
from

Conversation

Projects
None yet
4 participants
@f00b4r0
Contributor

f00b4r0 commented Feb 7, 2017

This series of commits rewrite from scratch the way MikroTik RouterBOARDs with SPI NOR are supported in LEDE.

This is a resubmit of https://patchwork.ozlabs.org/patch/724226/ and following, and an alternative to #778

A single image (initramfs and sysupgrade) is generated that supports the already supported hAP lite (tested on actual hardware), as well as the mAP lite (tested on actual hardware), hAP (tested on actual hardware by @adron-s), hEX PoE lite (tested on actual hardware by @joaochainho) and hEX lite. The code is documented and kept as compact as possible.

A penultimate commit offers basic kernel-only support for 3 more untested devices (cAP, mAP and wAP): network interfaces should work correctly, as well as LEDs, but GPIO buttons (if any) will not be supported.
The rationale is to give the opportunity for beta testers with this hardware to report a successful boot of their devices and help make them fully supported. There is no risk of bricking the devices since the image cannot be flashed from RouterOS, but instead from a previously netbooted LEDE initramfs.

The last commit in this series offers a switch to firmware mtdsplit system, enabling more efficient use of the flash space. This commit has been tested on actual hardware.

  • mAP lite fully working
  • hAP lite fully working
  • hEX (PoE) lite / hAP fully working
  • Serial support enabled
  • Code for cAP / mAP / wAP added
  • Add mtdsplit support
@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 7, 2017

Contributor

Hi @f00b4r0, I have a RB750UPr2 and I'll be glad to help with some testing if necessary.

Contributor

joaochainho commented Feb 7, 2017

Hi @f00b4r0, I have a RB750UPr2 and I'll be glad to help with some testing if necessary.

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 9, 2017

Contributor

Hello @f00b4r0
I'm trying to build from your rbspi branch but I'm getting this error.

make -C /media/NixStuff/DEV/LEDE/rb750r2/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_mikrotik/linux-4.4.47 HOSTCFLAGS="-O2 -I/media/NixStuff/DEV/LEDE/rb750r2/staging_dir/host/include -I/media/NixStuff/DEV/LEDE/rb750r2/staging_dir/host/usr/include  -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="mips-openwrt-linux-musl-" ARCH="mips" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="" KBUILD_BUILD_HOST="" KBUILD_BUILD_TIMESTAMP="Tue Feb  7 22:57:41 2017" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/media/NixStuff/DEV/LEDE/rb750r2/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  CC="mips-openwrt-linux-musl-gcc" all modules
make[5]: Entering directory '/media/NixStuff/DEV/LEDE/rb750r2/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_mikrotik/linux-4.4.47'
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      arch/mips/ath79/mach-rbspi.o
In file included from arch/mips/ath79/machtypes.h:15:0,
                 from arch/mips/ath79/mach-rbspi.c:40:
arch/mips/ath79/mach-rbspi.c:463:51: error: 'rbxap_generic_setup' undeclared here (not in a function)
 MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAPL, "cap-hb", rbxap_generic_setup);
                                                   ^
./arch/mips/include/asm/mips_machine.h:48:16: note: in definition of macro 'MIPS_MACHINE_NONAME'
  .mach_setup = _setup,    \
                ^
arch/mips/ath79/mach-rbspi.c:448:20: error: 'rbspi_generic_setup' defined but not used [-Werror=unused-function]
 static void __init rbspi_generic_setup(void)
                    ^
cc1: all warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'arch/mips/ath79/mach-rbspi.o' failed
make[7]: *** [arch/mips/ath79/mach-rbspi.o] Error 1
scripts/Makefile.build:403: recipe for target 'arch/mips/ath79' failed
make[6]: *** [arch/mips/ath79] Error 2
Makefile:961: recipe for target 'arch/mips' failed

Am I missing something?
TIA

Contributor

joaochainho commented Feb 9, 2017

Hello @f00b4r0
I'm trying to build from your rbspi branch but I'm getting this error.

make -C /media/NixStuff/DEV/LEDE/rb750r2/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_mikrotik/linux-4.4.47 HOSTCFLAGS="-O2 -I/media/NixStuff/DEV/LEDE/rb750r2/staging_dir/host/include -I/media/NixStuff/DEV/LEDE/rb750r2/staging_dir/host/usr/include  -Wall -Wmissing-prototypes -Wstrict-prototypes" CROSS_COMPILE="mips-openwrt-linux-musl-" ARCH="mips" KBUILD_HAVE_NLS=no KBUILD_BUILD_USER="" KBUILD_BUILD_HOST="" KBUILD_BUILD_TIMESTAMP="Tue Feb  7 22:57:41 2017" KBUILD_BUILD_VERSION="0" HOST_LOADLIBES="-L/media/NixStuff/DEV/LEDE/rb750r2/staging_dir/host/lib" CONFIG_SHELL="bash" V=''  CC="mips-openwrt-linux-musl-gcc" all modules
make[5]: Entering directory '/media/NixStuff/DEV/LEDE/rb750r2/build_dir/target-mips_24kc_musl-1.1.16/linux-ar71xx_mikrotik/linux-4.4.47'
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CC      arch/mips/ath79/mach-rbspi.o
In file included from arch/mips/ath79/machtypes.h:15:0,
                 from arch/mips/ath79/mach-rbspi.c:40:
arch/mips/ath79/mach-rbspi.c:463:51: error: 'rbxap_generic_setup' undeclared here (not in a function)
 MIPS_MACHINE_NONAME(ATH79_MACH_RB_CAPL, "cap-hb", rbxap_generic_setup);
                                                   ^
./arch/mips/include/asm/mips_machine.h:48:16: note: in definition of macro 'MIPS_MACHINE_NONAME'
  .mach_setup = _setup,    \
                ^
arch/mips/ath79/mach-rbspi.c:448:20: error: 'rbspi_generic_setup' defined but not used [-Werror=unused-function]
 static void __init rbspi_generic_setup(void)
                    ^
cc1: all warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'arch/mips/ath79/mach-rbspi.o' failed
make[7]: *** [arch/mips/ath79/mach-rbspi.o] Error 1
scripts/Makefile.build:403: recipe for target 'arch/mips/ath79' failed
make[6]: *** [arch/mips/ath79] Error 2
Makefile:961: recipe for target 'arch/mips' failed

Am I missing something?
TIA

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 9, 2017

Contributor

My bad, I made a mistake when I pushed the last commit. Fixed now

Contributor

f00b4r0 commented Feb 9, 2017

My bad, I made a mistake when I pushed the last commit. Fixed now

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 9, 2017

Contributor

@joaochainho Could you test with the change I suggested in my previous comment please? That would be very helpful! For the rb750r2 you would need to change line 427 in rb750r2_setup() to:
ath79_gpio_output_select(RB952_GPIO_SSR_CS, AR934X_GPIO_OUT_SPI_CS0);
Thanks

Contributor

f00b4r0 commented Feb 9, 2017

@joaochainho Could you test with the change I suggested in my previous comment please? That would be very helpful! For the rb750r2 you would need to change line 427 in rb750r2_setup() to:
ath79_gpio_output_select(RB952_GPIO_SSR_CS, AR934X_GPIO_OUT_SPI_CS0);
Thanks

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 9, 2017

Contributor

@f00b4r0 thanks for your quick reply. I will soon test it and will give you feedback 👍

Contributor

joaochainho commented Feb 9, 2017

@f00b4r0 thanks for your quick reply. I will soon test it and will give you feedback 👍

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 9, 2017

Contributor

@f00b4r0
I successfully managed to generate the firmware and boot my RB750UPr2 via netbook/tftp.
However, when I try to flash the firmware via sysupgrade, I get this error:

root@LEDE:~# sysupgrade -n /tmp/lede-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin 
Image metadata not found
Invalid sysupgrade file.
Image check 'platform_check_image' failed.

Also noticed that the serial port console output stops at this point:


OpenWrt kernel loader for AR7XXX/AR9XXX
Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
Decompressing kernel... done!
Starting kernel at 80060000...

[    0.000000] Linux version 4.4.47 (jlchainho@STSLAB) (gcc version 5.4.0 (LEDE GCC 5.4.0 r3322-76f5141) ) #0 Thu Feb 9 15:37:30 2017
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
...
[    0.000000] Kernel command line: no-uart no-nand parts=1 boot_part_size=16777216 gpio=8525375 HZ=325000000 mem=64M kmac=E4:8D:8C:99:18:31 board=750-hb hw_opt=0008400D boot=0 mlc=8 rootfstype=squashfs noinitrd
...
[    2.658925] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    2.666566] console [ttyS0] disabled
[    2.690789] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A

I attached the full bootleg output. Hope it's useful.
rb750upr2_netboot_bootlog.txt

Contributor

joaochainho commented Feb 9, 2017

@f00b4r0
I successfully managed to generate the firmware and boot my RB750UPr2 via netbook/tftp.
However, when I try to flash the firmware via sysupgrade, I get this error:

root@LEDE:~# sysupgrade -n /tmp/lede-ar71xx-mikrotik-rb-nor-flash-16M-squashfs-sysupgrade.bin 
Image metadata not found
Invalid sysupgrade file.
Image check 'platform_check_image' failed.

Also noticed that the serial port console output stops at this point:


OpenWrt kernel loader for AR7XXX/AR9XXX
Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
Decompressing kernel... done!
Starting kernel at 80060000...

[    0.000000] Linux version 4.4.47 (jlchainho@STSLAB) (gcc version 5.4.0 (LEDE GCC 5.4.0 r3322-76f5141) ) #0 Thu Feb 9 15:37:30 2017
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] SoC: Qualcomm Atheros QCA9533 ver 2 rev 0
...
[    0.000000] Kernel command line: no-uart no-nand parts=1 boot_part_size=16777216 gpio=8525375 HZ=325000000 mem=64M kmac=E4:8D:8C:99:18:31 board=750-hb hw_opt=0008400D boot=0 mlc=8 rootfstype=squashfs noinitrd
...
[    2.658925] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
[    2.666566] console [ttyS0] disabled
[    2.690789] serial8250.0: ttyS0 at MMIO 0x18020000 (irq = 11, base_baud = 1562500) is a 16550A

I attached the full bootleg output. Hope it's useful.
rb750upr2_netboot_bootlog.txt

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 9, 2017

Contributor

@joaochainho Thanks for the feedback, very helpful. Your log shows that I need to rework the SPI code for these devices, I'll update my branch soon.
As for the sysupgrade failure, I understand where it comes from: your machine identifies as "RouterBOARD 750UP r2" but the scripts are looking for "RouterBOARD 750 r2". I will fix that too.
Regarding the serial output that stops, I'm not sure what's causing it. Is your serial port set to 1562500 bauds?

Contributor

f00b4r0 commented Feb 9, 2017

@joaochainho Thanks for the feedback, very helpful. Your log shows that I need to rework the SPI code for these devices, I'll update my branch soon.
As for the sysupgrade failure, I understand where it comes from: your machine identifies as "RouterBOARD 750UP r2" but the scripts are looking for "RouterBOARD 750 r2". I will fix that too.
Regarding the serial output that stops, I'm not sure what's causing it. Is your serial port set to 1562500 bauds?

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 9, 2017

Contributor

@joaochainho Your device is the hEX PoE lite, not the hEX lite, correct?

Contributor

f00b4r0 commented Feb 9, 2017

@joaochainho Your device is the hEX PoE lite, not the hEX lite, correct?

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 9, 2017

Contributor

Regarding the serial output that stops, I'm not sure what's causing it. Is your serial port set to 1562500 bauds?

Yes, I set the baudrate to 115200. BTW the output I used to show where it stopped was from the serial port itself. I think the serial port settings are missing from the kernel command line args.

[    0.000000] Kernel command line: no-uart <----

Your device is the hEX PoE lite, not the hEX lite, correct?

Yes. https://routerboard.com/RB750UPr2

Contributor

joaochainho commented Feb 9, 2017

Regarding the serial output that stops, I'm not sure what's causing it. Is your serial port set to 1562500 bauds?

Yes, I set the baudrate to 115200. BTW the output I used to show where it stopped was from the serial port itself. I think the serial port settings are missing from the kernel command line args.

[    0.000000] Kernel command line: no-uart <----

Your device is the hEX PoE lite, not the hEX lite, correct?

Yes. https://routerboard.com/RB750UPr2

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 9, 2017

Contributor

OK so the "no-uart" on the command line explains why the output stops. That's not a bug :)
As it stands the patch does not properly support your device. I'm going to fix that, stay tuned :)

Contributor

f00b4r0 commented Feb 9, 2017

OK so the "no-uart" on the command line explains why the output stops. That's not a bug :)
As it stands the patch does not properly support your device. I'm going to fix that, stay tuned :)

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 9, 2017

Contributor

Thanks, glad to help :) 👍
BTW I had this device running OpenWrt (trunk r49119) for quite a while. It was a tricky business but I managed to get everything working (buttons, LEDs, USB port, USB power GPIO).
I followed the instructions in https://wiki.openwrt.org/toh/mikrotik/rb750_r2.

I noticed that the LEDs and USB port aren't being detected yet. No LEDs listed in /sys/class/leds/.

root@LEDE:~# lsusb 
unable to initialize libusb: -99

I think the ethernet ports are switched. I get DHCP from port 1 (WAN) and not from port 2 to 5 (LAN).

root@LEDE:~# swconfig list
Found: switch0 - eth1

root@LEDE:~# swconfig dev switch0 show
Global attributes:
	enable_vlan: 0
Port 0:
	pvid: 0
	link: port:0 link:up speed:1000baseT half-duplex 
...

Here's the output from another identical device. Notice how port0 is set up differently speed:1000baseT half-duplex vs speed:1000baseT full-duplex txflow reflow.

root@ROUTER_1:~# swconfig list
Found: switch0 - eth0
root@ROUTER_1:~# swconfig dev switch0 show
Global attributes:
	enable_vlan: 1
Port 0:
	pvid: 1
	link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
...

I went through the patches and found how ethernet and USB were set up.

/* LAN */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_eth1_data.duplex = DUPLEX_FULL;
ath79_switch_data.phy_poll_mask |= BIT(4);
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
ath79_register_eth(1);

/* WAN */
ath79_switch_data.phy4_mii_en = 1;
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ath79_eth0_data.duplex = DUPLEX_FULL;
ath79_eth0_data.speed = SPEED_100;
ath79_eth0_data.phy_mask = BIT(4);
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
ath79_register_eth(0);

/* USB */
ath79_register_usb();
Contributor

joaochainho commented Feb 9, 2017

Thanks, glad to help :) 👍
BTW I had this device running OpenWrt (trunk r49119) for quite a while. It was a tricky business but I managed to get everything working (buttons, LEDs, USB port, USB power GPIO).
I followed the instructions in https://wiki.openwrt.org/toh/mikrotik/rb750_r2.

I noticed that the LEDs and USB port aren't being detected yet. No LEDs listed in /sys/class/leds/.

root@LEDE:~# lsusb 
unable to initialize libusb: -99

I think the ethernet ports are switched. I get DHCP from port 1 (WAN) and not from port 2 to 5 (LAN).

root@LEDE:~# swconfig list
Found: switch0 - eth1

root@LEDE:~# swconfig dev switch0 show
Global attributes:
	enable_vlan: 0
Port 0:
	pvid: 0
	link: port:0 link:up speed:1000baseT half-duplex 
...

Here's the output from another identical device. Notice how port0 is set up differently speed:1000baseT half-duplex vs speed:1000baseT full-duplex txflow reflow.

root@ROUTER_1:~# swconfig list
Found: switch0 - eth0
root@ROUTER_1:~# swconfig dev switch0 show
Global attributes:
	enable_vlan: 1
Port 0:
	pvid: 1
	link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
...

I went through the patches and found how ethernet and USB were set up.

/* LAN */
ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_GMII;
ath79_eth1_data.duplex = DUPLEX_FULL;
ath79_switch_data.phy_poll_mask |= BIT(4);
ath79_init_mac(ath79_eth1_data.mac_addr, mac, 1);
ath79_register_eth(1);

/* WAN */
ath79_switch_data.phy4_mii_en = 1;
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII;
ath79_eth0_data.duplex = DUPLEX_FULL;
ath79_eth0_data.speed = SPEED_100;
ath79_eth0_data.phy_mask = BIT(4);
ath79_init_mac(ath79_eth0_data.mac_addr, mac, 0);
ath79_register_eth(0);

/* USB */
ath79_register_usb();
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 9, 2017

Contributor

@joaochainho I've reworked the code and now it should work correctly: on your device, you should see the LEDs work properly, the SPI flash should work correctly as well as USB and PoE out. Please test and send me the bootlog :)

If it works fine I'll add back the extra devices (cAP/wAP/mAP) which I have temporarily removed for now.

Also I don't understand whether the network problems you have are with the current patchset or something you did yourself? The code you tested had no correct network configuration for your device. Please boot the current code and send me the output of swconfig list and swconfig dev switch0 show. Thanks

Contributor

f00b4r0 commented Feb 9, 2017

@joaochainho I've reworked the code and now it should work correctly: on your device, you should see the LEDs work properly, the SPI flash should work correctly as well as USB and PoE out. Please test and send me the bootlog :)

If it works fine I'll add back the extra devices (cAP/wAP/mAP) which I have temporarily removed for now.

Also I don't understand whether the network problems you have are with the current patchset or something you did yourself? The code you tested had no correct network configuration for your device. Please boot the current code and send me the output of swconfig list and swconfig dev switch0 show. Thanks

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

Hi @f00b4r0 , I'm trying the latest patches (r3322-5b532d7) but I can't get DHCP from any port.
I wil try to enable the serial port console so I can see what's happening.

Contributor

joaochainho commented Feb 10, 2017

Hi @f00b4r0 , I'm trying the latest patches (r3322-5b532d7) but I can't get DHCP from any port.
I wil try to enable the serial port console so I can see what's happening.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

Hi @joaochainho , thanks for the feedback. Does it look like the device is alive? Do you have LED activity? (in particular is the USR LED blinking at about 1Hz?)
Also, are you using RouterBOOT or some other bootloader?

Contributor

f00b4r0 commented Feb 10, 2017

Hi @joaochainho , thanks for the feedback. Does it look like the device is alive? Do you have LED activity? (in particular is the USR LED blinking at about 1Hz?)
Also, are you using RouterBOOT or some other bootloader?

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

Hi @f00b4r0 I have LED activity and the USR LED blinking at about 1Hz 👍
I managed enable the serial port console. Here's the patch.

diff --git a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
index b5f4616..f1cadf4 100644
--- a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
+++ b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
@@ -1,12 +1,13 @@
 --- a/arch/mips/ath79/prom.c
 +++ b/arch/mips/ath79/prom.c
-@@ -136,6 +136,18 @@ void __init prom_init(void)
+@@ -136,6 +136,19 @@ void __init prom_init(void)
  		initrd_end = initrd_start + fw_getenvl("initrd_size");
  	}
  #endif
 +
 +	if (strstr(arcs_cmdline, "board=750Gr3") ||
 +	    strstr(arcs_cmdline, "board=750i") ||
++	    strstr(arcs_cmdline, "board=750-hb") ||
 +	    strstr(arcs_cmdline, "board=411") ||
 +	    strstr(arcs_cmdline, "board=433") ||
 +	    strstr(arcs_cmdline, "board=450") ||

Couldn't figure out why DHCP isn't working but I'll keep looking into it.
Here's the swconfig output. Shouldn't eth1 be WAN and eth0 be LAN?

root@LEDE:/# swconfig list
Found: switch0 - eth1
root@LEDE:/# swconfig dev switch0 show
Global attributes:
	enable_vlan: 0
Port 0:
	pvid: 0
	link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
Port 1:
	pvid: 0
	link: port:1 link:down
Port 2:
	pvid: 0
	link: port:2 link:down
Port 3:
	pvid: 0
	link: port:3 link:down
Port 4:
	pvid: 0
	link: port:4 link:down
VLAN 0:
	vid: 0
	ports: 0 1 2 3 4 

Here's also the list of detected LEDs. BTW what's the rb:blue:wlan LED?

root@LEDE:/# ls /sys/class/leds/
rb:blue:wlan    rb:green:port2  rb:green:port4  rb:green:user
rb:green:port1  rb:green:port3  rb:green:port5

Sysupgrade is working fine now. I attached also the whole sysupgrade log and partition info.
Great work BTW :)

rb750upr2_netboot_bootlog.txt
rb750upr2_sysupgrade.txt

Contributor

joaochainho commented Feb 10, 2017

Hi @f00b4r0 I have LED activity and the USR LED blinking at about 1Hz 👍
I managed enable the serial port console. Here's the patch.

diff --git a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
index b5f4616..f1cadf4 100644
--- a/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
+++ b/target/linux/ar71xx/patches-4.4/701-MIPS-ath79-add-routerboard-detection.patch
@@ -1,12 +1,13 @@
 --- a/arch/mips/ath79/prom.c
 +++ b/arch/mips/ath79/prom.c
-@@ -136,6 +136,18 @@ void __init prom_init(void)
+@@ -136,6 +136,19 @@ void __init prom_init(void)
  		initrd_end = initrd_start + fw_getenvl("initrd_size");
  	}
  #endif
 +
 +	if (strstr(arcs_cmdline, "board=750Gr3") ||
 +	    strstr(arcs_cmdline, "board=750i") ||
++	    strstr(arcs_cmdline, "board=750-hb") ||
 +	    strstr(arcs_cmdline, "board=411") ||
 +	    strstr(arcs_cmdline, "board=433") ||
 +	    strstr(arcs_cmdline, "board=450") ||

Couldn't figure out why DHCP isn't working but I'll keep looking into it.
Here's the swconfig output. Shouldn't eth1 be WAN and eth0 be LAN?

root@LEDE:/# swconfig list
Found: switch0 - eth1
root@LEDE:/# swconfig dev switch0 show
Global attributes:
	enable_vlan: 0
Port 0:
	pvid: 0
	link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
Port 1:
	pvid: 0
	link: port:1 link:down
Port 2:
	pvid: 0
	link: port:2 link:down
Port 3:
	pvid: 0
	link: port:3 link:down
Port 4:
	pvid: 0
	link: port:4 link:down
VLAN 0:
	vid: 0
	ports: 0 1 2 3 4 

Here's also the list of detected LEDs. BTW what's the rb:blue:wlan LED?

root@LEDE:/# ls /sys/class/leds/
rb:blue:wlan    rb:green:port2  rb:green:port4  rb:green:user
rb:green:port1  rb:green:port3  rb:green:port5

Sysupgrade is working fine now. I attached also the whole sysupgrade log and partition info.
Great work BTW :)

rb750upr2_netboot_bootlog.txt
rb750upr2_sysupgrade.txt

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

Hi @joaochainho , this is very helpful. I'll make the serial enable patch separate, and will add other devices to it. Good catch.

As far as I can tell from the bootlog, everything is working as expected, which is great!
About the network issues, can you send the output of ifconfig -a and cat /etc/config/network?

To answer your questions:

  • eth0 is WAN and eth1 is LAN, this is normal. The swconfig output looks normal assuming you haven't connected anything to the LAN ports
  • The rb:blue:wlan LED is there because the hEX shares the same configuration as the hAP as far as LEDs are considered, the only difference being that the WLAN LED is not soldered on the hEX PCB. This LED is not configured in UCI, but it does appear in /sys/ even though it is not physically there, this is expected.
Contributor

f00b4r0 commented Feb 10, 2017

Hi @joaochainho , this is very helpful. I'll make the serial enable patch separate, and will add other devices to it. Good catch.

As far as I can tell from the bootlog, everything is working as expected, which is great!
About the network issues, can you send the output of ifconfig -a and cat /etc/config/network?

To answer your questions:

  • eth0 is WAN and eth1 is LAN, this is normal. The swconfig output looks normal assuming you haven't connected anything to the LAN ports
  • The rb:blue:wlan LED is there because the hEX shares the same configuration as the hAP as far as LEDs are considered, the only difference being that the WLAN LED is not soldered on the hEX PCB. This LED is not configured in UCI, but it does appear in /sys/ even though it is not physically there, this is expected.
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

@joaochainho another test you could run for me is:

echo none > /sys/class/leds/rb\:green\:user/trigger
echo 0 > /sys/class/leds/rb\:green\:user/brightness     # USR LED should be OFF now
echo 255 > /sys/class/leds/rb\:green\:user/brightness     # USR LED should be ON now

Please report if the states are inverted, I suspect they might be. Thanks!

Contributor

f00b4r0 commented Feb 10, 2017

@joaochainho another test you could run for me is:

echo none > /sys/class/leds/rb\:green\:user/trigger
echo 0 > /sys/class/leds/rb\:green\:user/brightness     # USR LED should be OFF now
echo 255 > /sys/class/leds/rb\:green\:user/brightness     # USR LED should be ON now

Please report if the states are inverted, I suspect they might be. Thanks!

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

Hi @f00b4r0 , sorry I was unable to give you feedback sooner. Just finished to test with the latest commits (r3323-9b7ae50).

I checked the swconfig output and each port state is OK when connecting devices to the ethernet ports.

root@LEDE:~# swconfig dev switch0 show
Global attributes:
	enable_vlan: 0
Port 0:
	pvid: 0
	link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
Port 1:
	pvid: 0
	link: port:1 link:up speed:100baseT full-duplex auto <-- Port #5
Port 2:
	pvid: 0
	link: port:2 link:down
Port 3:
	pvid: 0
	link: port:3 link:down
Port 4:
	pvid: 0
	link: port:4 link:down
VLAN 0:
	vid: 0
	ports: 0 1 2 3 4 

Now I already can get DHCP on all LAN ports. Here are the network settings.

root@LEDE:~# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr E4:8D:8C:99:18:32  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e68d:8cff:fe99:1832/64 Scope:Link
          inet6 addr: fd72:cb9c:1aa1::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4537 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3559 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:693976 (677.7 KiB)  TX bytes:1474774 (1.4 MiB)

eth0      Link encap:Ethernet  HWaddr E4:8D:8C:99:18:31  
          inet addr:192.168.100.205  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::e68d:8cff:fe99:1831/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3829 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4013 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1546687 (1.4 MiB)  TX bytes:687120 (671.0 KiB)
          Interrupt:4 

eth1      Link encap:Ethernet  HWaddr E4:8D:8C:99:18:32  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4537 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3553 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:757494 (739.7 KiB)  TX bytes:1474098 (1.4 MiB)
          Interrupt:5 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:1389 (1.3 KiB)  TX bytes:1389 (1.3 KiB)

root@LEDE:~# brctl show
bridge name	bridge id		STP enabled	interfaces
br-lan		7fff.e48d8c991832	no		eth1
root@LEDE:~# cat /etc/config/network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd72:cb9c:1aa1::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option ifname 'eth0'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth0'
	option proto 'dhcpv6'

The LEDs from all 5 ethernet ports are always on and the USR LED keeps blinking.
The USR LED tests' outcome is the opposite.

echo none > /sys/class/leds/rb\:green\:user/trigger # LED stops blinking
echo 0 > /sys/class/leds/rb\:green\:user/brightness  # LED ON
echo 255 > /sys/class/leds/rb\:green\:user/brightness  # LED OFF

Regarding the USB port, I connected several USB devices but none is detected/listed.
I found the the USB power is not enabled. Checked the voltage on the USB port itself (=0V).
How to enable the USB power?

root@LEDE:~# lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Contributor

joaochainho commented Feb 10, 2017

Hi @f00b4r0 , sorry I was unable to give you feedback sooner. Just finished to test with the latest commits (r3323-9b7ae50).

I checked the swconfig output and each port state is OK when connecting devices to the ethernet ports.

root@LEDE:~# swconfig dev switch0 show
Global attributes:
	enable_vlan: 0
Port 0:
	pvid: 0
	link: port:0 link:up speed:1000baseT full-duplex txflow rxflow 
Port 1:
	pvid: 0
	link: port:1 link:up speed:100baseT full-duplex auto <-- Port #5
Port 2:
	pvid: 0
	link: port:2 link:down
Port 3:
	pvid: 0
	link: port:3 link:down
Port 4:
	pvid: 0
	link: port:4 link:down
VLAN 0:
	vid: 0
	ports: 0 1 2 3 4 

Now I already can get DHCP on all LAN ports. Here are the network settings.

root@LEDE:~# ifconfig -a
br-lan    Link encap:Ethernet  HWaddr E4:8D:8C:99:18:32  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::e68d:8cff:fe99:1832/64 Scope:Link
          inet6 addr: fd72:cb9c:1aa1::1/60 Scope:Global
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4537 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3559 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:693976 (677.7 KiB)  TX bytes:1474774 (1.4 MiB)

eth0      Link encap:Ethernet  HWaddr E4:8D:8C:99:18:31  
          inet addr:192.168.100.205  Bcast:192.168.100.255  Mask:255.255.255.0
          inet6 addr: fe80::e68d:8cff:fe99:1831/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3829 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4013 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1546687 (1.4 MiB)  TX bytes:687120 (671.0 KiB)
          Interrupt:4 

eth1      Link encap:Ethernet  HWaddr E4:8D:8C:99:18:32  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4537 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3553 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:757494 (739.7 KiB)  TX bytes:1474098 (1.4 MiB)
          Interrupt:5 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:1389 (1.3 KiB)  TX bytes:1389 (1.3 KiB)

root@LEDE:~# brctl show
bridge name	bridge id		STP enabled	interfaces
br-lan		7fff.e48d8c991832	no		eth1
root@LEDE:~# cat /etc/config/network 

config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option ula_prefix 'fd72:cb9c:1aa1::/48'

config interface 'lan'
	option type 'bridge'
	option ifname 'eth1'
	option proto 'static'
	option ipaddr '192.168.1.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option ifname 'eth0'
	option proto 'dhcp'

config interface 'wan6'
	option ifname 'eth0'
	option proto 'dhcpv6'

The LEDs from all 5 ethernet ports are always on and the USR LED keeps blinking.
The USR LED tests' outcome is the opposite.

echo none > /sys/class/leds/rb\:green\:user/trigger # LED stops blinking
echo 0 > /sys/class/leds/rb\:green\:user/brightness  # LED ON
echo 255 > /sys/class/leds/rb\:green\:user/brightness  # LED OFF

Regarding the USB port, I connected several USB devices but none is detected/listed.
I found the the USB power is not enabled. Checked the voltage on the USB port itself (=0V).
How to enable the USB power?

root@LEDE:~# lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

@joaochainho Thanks for the feedback.
So, if I read you right, networking is working as expected (except the LEDs)?
About the USR LED test, thanks for reporting, I will fix the code.

Regarding the port LEDs and USB port problem, that suggests the SSR is not working as expected (port LEDS and USB power toggle are connected to a separate Serial Shift Register device: if it doesn't operate correctly the port LEDs and USB will not work).

First I'd like to make sure that the SSR driver is working, can you look in /sys/bus/spi/devices/ and make sure you have both spi0.0 and spi0.1. If you do, then

cd /sys/bus/spi/devices/spi0.1
ls -l      #paste the output of this command please

Thanks!

Contributor

f00b4r0 commented Feb 10, 2017

@joaochainho Thanks for the feedback.
So, if I read you right, networking is working as expected (except the LEDs)?
About the USR LED test, thanks for reporting, I will fix the code.

Regarding the port LEDs and USB port problem, that suggests the SSR is not working as expected (port LEDS and USB power toggle are connected to a separate Serial Shift Register device: if it doesn't operate correctly the port LEDs and USB will not work).

First I'd like to make sure that the SSR driver is working, can you look in /sys/bus/spi/devices/ and make sure you have both spi0.0 and spi0.1. If you do, then

cd /sys/bus/spi/devices/spi0.1
ls -l      #paste the output of this command please

Thanks!

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

@joaochainho also please post the content of cat /sys/kernel/debug/gpio. Thanks!

Contributor

f00b4r0 commented Feb 10, 2017

@joaochainho also please post the content of cat /sys/kernel/debug/gpio. Thanks!

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

OK I think I know what's going on.
In rbspi_952_750r2_setup(), can you change:

        /* set the correct CS pin on the SoC */
        ath79_gpio_output_select(RB952_GPIO_SSR_CS, QCA953X_GPIO_OUT_MUX_SPI_CS0);

To:

        /* set the correct CS pin on the SoC */
        ath79_gpio_direction_select(RB952_GPIO_SSR_CS, true);
        ath79_gpio_output_select(RB952_GPIO_SSR_CS, QCA953X_GPIO_OUT_MUX_SPI_CS0);

And retest? Thanks!

Contributor

f00b4r0 commented Feb 10, 2017

OK I think I know what's going on.
In rbspi_952_750r2_setup(), can you change:

        /* set the correct CS pin on the SoC */
        ath79_gpio_output_select(RB952_GPIO_SSR_CS, QCA953X_GPIO_OUT_MUX_SPI_CS0);

To:

        /* set the correct CS pin on the SoC */
        ath79_gpio_direction_select(RB952_GPIO_SSR_CS, true);
        ath79_gpio_output_select(RB952_GPIO_SSR_CS, QCA953X_GPIO_OUT_MUX_SPI_CS0);

And retest? Thanks!

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

Hi @f00b4r0
Yes I think the networking is OK, only the LEDs aren't.
Both spi0.0 and spi0.1 are present. Here are their contents.

root@LEDE:~# ls /sys/bus/spi/devices/
spi0.0  spi0.1

root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.0# ls -l
lrwxrwxrwx    1 root     root             0 Feb 10 20:05 driver -> ../../../../../../bus/spi/drivers/m25p80
-r--r--r--    1 root     root          4096 Feb 10 20:05 modalias
drwxr-xr-x   18 root     root             0 Jan  1  1970 mtd
drwxr-xr-x    2 root     root             0 Feb 10 20:05 statistics
lrwxrwxrwx    1 root     root             0 Feb 10 20:05 subsystem -> ../../../../../../bus/spi
-rw-r--r--    1 root     root          4096 Feb 10 20:05 uevent
root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.0# cat modalias 
spi:m25p80

root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.1# ls -l
lrwxrwxrwx    1 root     root             0 Feb 10 20:00 driver -> ../../../../../../bus/spi/drivers/74x164
drwxr-xr-x    4 root     root             0 Jan  1  1970 gpio
-r--r--r--    1 root     root          4096 Feb 10 20:00 modalias
drwxr-xr-x    2 root     root             0 Feb 10 20:00 statistics
lrwxrwxrwx    1 root     root             0 Feb 10 20:00 subsystem -> ../../../../../../bus/spi
-rw-r--r--    1 root     root          4096 Feb 10 20:00 uevent
root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.1# cat modalias 
spi:74x164

And the GPIO info.

root@LEDE:~# 
root@LEDE:~# cat /sys/kernel/debug/gpio
GPIOs 0-17, platform/ath79-gpio, ath79:
 gpio-4   (                    |rb:green:user       ) out lo    
 gpio-14  (                    |POE power           ) out lo    
 gpio-16  (                    |Reset button        ) in  hi    

GPIOs 40-47, spi/spi0.1, 74x164, can sleep:
 gpio-40  (                    |rb:green:port1      ) out lo    
 gpio-41  (                    |rb:green:port2      ) out hi    
 gpio-42  (                    |rb:green:port3      ) out hi    
 gpio-43  (                    |rb:green:port4      ) out hi    
 gpio-44  (                    |rb:green:port5      ) out lo    
 gpio-45  (                    |sysfs               ) out hi    
 gpio-46  (                    |rb:blue:wlan        ) out hi    

I'm going to test these latest changes to the CS pin on the SoC 👍

Contributor

joaochainho commented Feb 10, 2017

Hi @f00b4r0
Yes I think the networking is OK, only the LEDs aren't.
Both spi0.0 and spi0.1 are present. Here are their contents.

root@LEDE:~# ls /sys/bus/spi/devices/
spi0.0  spi0.1

root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.0# ls -l
lrwxrwxrwx    1 root     root             0 Feb 10 20:05 driver -> ../../../../../../bus/spi/drivers/m25p80
-r--r--r--    1 root     root          4096 Feb 10 20:05 modalias
drwxr-xr-x   18 root     root             0 Jan  1  1970 mtd
drwxr-xr-x    2 root     root             0 Feb 10 20:05 statistics
lrwxrwxrwx    1 root     root             0 Feb 10 20:05 subsystem -> ../../../../../../bus/spi
-rw-r--r--    1 root     root          4096 Feb 10 20:05 uevent
root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.0# cat modalias 
spi:m25p80

root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.1# ls -l
lrwxrwxrwx    1 root     root             0 Feb 10 20:00 driver -> ../../../../../../bus/spi/drivers/74x164
drwxr-xr-x    4 root     root             0 Jan  1  1970 gpio
-r--r--r--    1 root     root          4096 Feb 10 20:00 modalias
drwxr-xr-x    2 root     root             0 Feb 10 20:00 statistics
lrwxrwxrwx    1 root     root             0 Feb 10 20:00 subsystem -> ../../../../../../bus/spi
-rw-r--r--    1 root     root          4096 Feb 10 20:00 uevent
root@LEDE:/sys/devices/platform/ath79-spi/spi_master/spi0/spi0.1# cat modalias 
spi:74x164

And the GPIO info.

root@LEDE:~# 
root@LEDE:~# cat /sys/kernel/debug/gpio
GPIOs 0-17, platform/ath79-gpio, ath79:
 gpio-4   (                    |rb:green:user       ) out lo    
 gpio-14  (                    |POE power           ) out lo    
 gpio-16  (                    |Reset button        ) in  hi    

GPIOs 40-47, spi/spi0.1, 74x164, can sleep:
 gpio-40  (                    |rb:green:port1      ) out lo    
 gpio-41  (                    |rb:green:port2      ) out hi    
 gpio-42  (                    |rb:green:port3      ) out hi    
 gpio-43  (                    |rb:green:port4      ) out hi    
 gpio-44  (                    |rb:green:port5      ) out lo    
 gpio-45  (                    |sysfs               ) out hi    
 gpio-46  (                    |rb:blue:wlan        ) out hi    

I'm going to test these latest changes to the CS pin on the SoC 👍

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

OK this looks good! Not sure why gpio-45 doesn't show "USB Power" but in any case this all looks good. I hope my suggested fix will work! 😅

Contributor

f00b4r0 commented Feb 10, 2017

OK this looks good! Not sure why gpio-45 doesn't show "USB Power" but in any case this all looks good. I hope my suggested fix will work! 😅

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

I forgot to mention that the file to edit is target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c :)

Contributor

f00b4r0 commented Feb 10, 2017

I forgot to mention that the file to edit is target/linux/ar71xx/files/arch/mips/ath79/mach-rbspi.c :)

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

No problem, I got there quickly ;)
New image being compiled ATM.

Contributor

joaochainho commented Feb 10, 2017

No problem, I got there quickly ;)
New image being compiled ATM.

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

Just tested the changes. All ethernet LEDs still are ON, the USR LED keeps blinking and the brightness value still is inverted.

Contributor

joaochainho commented Feb 10, 2017

Just tested the changes. All ethernet LEDs still are ON, the USR LED keeps blinking and the brightness value still is inverted.

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

Don't know if helps but this the /etc/config/system contents.

root@LEDE:~# cat /etc/config/system 

config system
	option hostname 'LEDE'
	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.lede.pool.ntp.org'
	list server '1.lede.pool.ntp.org'
	list server '2.lede.pool.ntp.org'
	list server '3.lede.pool.ntp.org'

config gpio_switch 'usb_power_switch'
	option name 'USB Power Switch'
	option gpio_pin '45'
	option value '1'

config gpio_switch 'poe_passthrough'
	option name 'PoE Passthrough'
	option gpio_pin '14'
	option value '0'

config led 'led_user'
	option name 'USER'
	option sysfs 'rb:green:user'
	option trigger 'timer'
	option delayon '1000'
	option delayoff '1000'

config led 'led_port1'
	option name 'port1'
	option sysfs 'rb:green:port1'
	option trigger 'netdev'
	option mode 'link tx rx'
	option dev 'eth0'

config led 'led_port2'
	option name 'port2'
	option sysfs 'rb:green:port2'
	option trigger 'switch0'
	option port_mask '0x10'

config led 'led_port3'
	option name 'port2'
	option sysfs 'rb:green:port3'
	option trigger 'switch0'
	option port_mask '0x08'

config led 'led_port4'
	option name 'port3'
	option sysfs 'rb:green:port4'
	option trigger 'switch0'
	option port_mask '0x04'

config led 'led_port5'
	option name 'port5'
	option sysfs 'rb:green:port5'
	option trigger 'switch0'
	option port_mask '0x02'
Contributor

joaochainho commented Feb 10, 2017

Don't know if helps but this the /etc/config/system contents.

root@LEDE:~# cat /etc/config/system 

config system
	option hostname 'LEDE'
	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.lede.pool.ntp.org'
	list server '1.lede.pool.ntp.org'
	list server '2.lede.pool.ntp.org'
	list server '3.lede.pool.ntp.org'

config gpio_switch 'usb_power_switch'
	option name 'USB Power Switch'
	option gpio_pin '45'
	option value '1'

config gpio_switch 'poe_passthrough'
	option name 'PoE Passthrough'
	option gpio_pin '14'
	option value '0'

config led 'led_user'
	option name 'USER'
	option sysfs 'rb:green:user'
	option trigger 'timer'
	option delayon '1000'
	option delayoff '1000'

config led 'led_port1'
	option name 'port1'
	option sysfs 'rb:green:port1'
	option trigger 'netdev'
	option mode 'link tx rx'
	option dev 'eth0'

config led 'led_port2'
	option name 'port2'
	option sysfs 'rb:green:port2'
	option trigger 'switch0'
	option port_mask '0x10'

config led 'led_port3'
	option name 'port2'
	option sysfs 'rb:green:port3'
	option trigger 'switch0'
	option port_mask '0x08'

config led 'led_port4'
	option name 'port3'
	option sysfs 'rb:green:port4'
	option trigger 'switch0'
	option port_mask '0x04'

config led 'led_port5'
	option name 'port5'
	option sysfs 'rb:green:port5'
	option trigger 'switch0'
	option port_mask '0x02'
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

USR LED still inverted is expected, that's a different fix that I'm going to push.
I'll push a another patch for you to test as well in minute. thanks!

Contributor

f00b4r0 commented Feb 10, 2017

USR LED still inverted is expected, that's a different fix that I'm going to push.
I'll push a another patch for you to test as well in minute. thanks!

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

@joaochainho OK I've reread the SPI driver and I think I know why this doesn't work. Give me a minute to submit a test patch

Contributor

f00b4r0 commented Feb 10, 2017

@joaochainho OK I've reread the SPI driver and I think I know why this doesn't work. Give me a minute to submit a test patch

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

@joaochainho 64a1dea (sorry I had to amend again I just kept having a fat-finger problem) is a quick hack to test please. If it works, I'll refactor the code one last time. Thanks!

Contributor

f00b4r0 commented Feb 10, 2017

@joaochainho 64a1dea (sorry I had to amend again I just kept having a fat-finger problem) is a quick hack to test please. If it works, I'll refactor the code one last time. Thanks!

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

No worries ;) I'm going to test it in a moment.

Contributor

joaochainho commented Feb 10, 2017

No worries ;) I'm going to test it in a moment.

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

All ethernet port LEDs are working fine now! 👍

Contributor

joaochainho commented Feb 10, 2017

All ethernet port LEDs are working fine now! 👍

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 10, 2017

Contributor

Awesome!
I will rework the code. I have a few more changes to make to save space on the flash chip. I'll probably commit those tomorrow cause it's late here 😛
Thanks a lot for your help!

Contributor

f00b4r0 commented Feb 10, 2017

Awesome!
I will rework the code. I have a few more changes to make to save space on the flash chip. I'll probably commit those tomorrow cause it's late here 😛
Thanks a lot for your help!

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 10, 2017

Contributor

You're welcome :) I'm glad to help.

Contributor

joaochainho commented Feb 10, 2017

You're welcome :) I'm glad to help.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 11, 2017

Contributor

OK, I think we're good to go. I've reworked the code one last time and I am now happy with it. Everything works, and the devices appear to boot normally from either the regular or backup bootloader.
However, for sysupgrade to work, #809 must be applied first.
@joaochainho if you want to flash this code, make sure you do it from the same initramfs, and not from your previously flashed version: I have moved the MTD partitions. The upside is you now get 12MB of overlay, instead of under 8MB previously 😃

Contributor

f00b4r0 commented Feb 11, 2017

OK, I think we're good to go. I've reworked the code one last time and I am now happy with it. Everything works, and the devices appear to boot normally from either the regular or backup bootloader.
However, for sysupgrade to work, #809 must be applied first.
@joaochainho if you want to flash this code, make sure you do it from the same initramfs, and not from your previously flashed version: I have moved the MTD partitions. The upside is you now get 12MB of overlay, instead of under 8MB previously 😃

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 11, 2017

Contributor

@f00b4r0 I went to check again how LEDs and GPIOs are working and I bring good news.

  • USR LED: OK, state is consistent with brightness value (0->OFF, 255->ON)
  • USB power: OK, default state is ON, value=0 -> power OFF, USB devices are being detected.

Regarding PoE, I was unable to check it. I don't have another MikroTik device available until Monday.

Contributor

joaochainho commented Feb 11, 2017

@f00b4r0 I went to check again how LEDs and GPIOs are working and I bring good news.

  • USR LED: OK, state is consistent with brightness value (0->OFF, 255->ON)
  • USB power: OK, default state is ON, value=0 -> power OFF, USB devices are being detected.

Regarding PoE, I was unable to check it. I don't have another MikroTik device available until Monday.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 11, 2017

Contributor

@joaochainho Cool! That confirms that everything is working correctly then. I have confirmed the GPIO number for the PoE output with the mikrotik kernel patch, so I have reasons to believe that it'll work too. I think the code is now ready and that PR is good for a merge. Let's see what LEDE upstream says 😉

Contributor

f00b4r0 commented Feb 11, 2017

@joaochainho Cool! That confirms that everything is working correctly then. I have confirmed the GPIO number for the PoE output with the mikrotik kernel patch, so I have reasons to believe that it'll work too. I think the code is now ready and that PR is good for a merge. Let's see what LEDE upstream says 😉

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 13, 2017

Contributor

Hi @f00b4r0 I checked if PoE is working but unfortunately is not.
I ran this command, to no avail. I can't power up any device through any of the LAN ports.

root@LEDE:~# echo 1 > /sys/class/gpio/gpio14/value 

I tested with another two MikroTik RB750UP devices (NAND flash) and noticed something odd. PoE is working with an old OpenWrt version (trunk r41992, YAFFS) but the other with a recent LEDE version (r3009-968fa53, UBIFS) isn't.
The contents of /sys/class/gpio/ is the same on both devices.

--w-------    1 root     root          4096 Jan  1  1970 export
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip0 -> ../../devices/platform/ath79-gpio/gpio/gpiochip0
--w-------    1 root     root          4096 Jan  1  1970 unexport

Could I be missing something?

Contributor

joaochainho commented Feb 13, 2017

Hi @f00b4r0 I checked if PoE is working but unfortunately is not.
I ran this command, to no avail. I can't power up any device through any of the LAN ports.

root@LEDE:~# echo 1 > /sys/class/gpio/gpio14/value 

I tested with another two MikroTik RB750UP devices (NAND flash) and noticed something odd. PoE is working with an old OpenWrt version (trunk r41992, YAFFS) but the other with a recent LEDE version (r3009-968fa53, UBIFS) isn't.
The contents of /sys/class/gpio/ is the same on both devices.

--w-------    1 root     root          4096 Jan  1  1970 export
lrwxrwxrwx    1 root     root             0 Jan  1  1970 gpiochip0 -> ../../devices/platform/ath79-gpio/gpio/gpiochip0
--w-------    1 root     root          4096 Jan  1  1970 unexport

Could I be missing something?

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

Hi @joaochainho so there are two sides to your question:

  1. you have to bear in mind that this is a sort of "passive PoE": the device will send out the same voltage as the one applied to it, this is non-standard and most true PoE (802.3af/at) devices will not work with this.
  2. I am not sure how the gpio switches are managed in LEDE. What did you do to trigger the USB power? I would expect this to work the same. Your listing of /sys/class/gpio/ doesn't show the gpio folder, so clearly you can't echo 1 > /sys/class/gpio/gpio14/value like this? It's also possible that the gpio is "active low", in which case a value of 0 would turn it on (and I would have to update the code).
Contributor

f00b4r0 commented Feb 13, 2017

Hi @joaochainho so there are two sides to your question:

  1. you have to bear in mind that this is a sort of "passive PoE": the device will send out the same voltage as the one applied to it, this is non-standard and most true PoE (802.3af/at) devices will not work with this.
  2. I am not sure how the gpio switches are managed in LEDE. What did you do to trigger the USB power? I would expect this to work the same. Your listing of /sys/class/gpio/ doesn't show the gpio folder, so clearly you can't echo 1 > /sys/class/gpio/gpio14/value like this? It's also possible that the gpio is "active low", in which case a value of 0 would turn it on (and I would have to update the code).

f00b4r0 added some commits Feb 7, 2017

ar71xx: add support for RB mAP L-2nD
This patch adds support for the MikroTik RouterBOARD mAP lite
https://routerboard.com/RBmAPL-2nD

Specifications:
- SoC: Qualcomm QCA9533 (650MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Wireless: builtin QCA9533, 2x2:2
- Ethernet: 1x100M

This is another 16M SPI NOR mikrotik device. The machine file is named
mach-rbspi.c because I plan to add support for several of the other spi-based
RouterBOARD devices in subsequent patches: they share most of the hardware
and thus the same codebase.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
ar71xx: provide support for RB-941-2nD via mach-rbspi.c
This patch implements support for the hAP lite in mach-rbspi.c

hAP lite was supported via mach-rb941.c, so this file is removed
as well as the corresponding build bits.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
ar71xx: add support for RB951Ui-2nD
This patch adds support for the MikroTik RouterBOARD hAP
https://routerboard.com/RB951Ui-2nD

Specifications:
- SoC: Qualcomm QCA9531 (650MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Wireless: builtin QCA9531, 2x2:2
- Ethernet: 5x100M (1 PoE in, 1 PoE out)
- USB: Type A

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
ar71xx: add support for RB750UPr2
This patch adds support for the MikroTik RouterBOARD hEX PoE lite
https://routerboard.com/RB750UPr2

Specifications:
- SoC: Qualcomm QCA9531 (650MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Ethernet: 5x100M (1 PoE in, 1 PoE out)
- USB: Type A

This ethernet router is based on the same platform as the wireless router hAP.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
ar71xx: add support for RB750r2
This patch adds support for the MikroTik RouterBOARD hEX lite
https://routerboard.com/RB750r2

Specifications:
- SoC: Qualcomm QCA9531 (850MHz)
- RAM: 64MB
- Storage: 16MB NOR SPI flash
- Ethernet: 5x100M (1 PoE in)

This ethernet router is based on the same platform as the hEX PoE lite (it
shares the same board identifier), but has no USB and no PoE out.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
ar71xx: add new SPI NOR RB devices to the list of serial-enable patch
Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
ar71xx: add preliminary kernel support for several RB SPI NOR devices
The cAP 2nD, mAP 2nD and wAP 2nD apparently all share the same QCA953x/SPI-NOR
platform.

This patch adds preliminary kernel support based on init data used in
Mikrotik's linux-3.3.5 kernel patch. Since this is totally experimental and
untested, the necessary glue in base-files has not been added, the code is
provided as a starting point in case somebody with that hardware wants to help
getting it supported.

The cAP lite (cAPL 2nD) should also be supported once it is determined whether
or not it uses the same board identifier as the mAP lite.

Code has been successfully built and has no side effect (no impact on already
supported devices).

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 13, 2017

Contributor

Hi @f00b4r0 , I'm using only Mikrotik devices (RB750UPr2, RB750UP, RB450G) with their original 24V power supply.
Regarding your comments, the RB750UP devices (not RB750UPr2 which is a completely different device) don't have any GPIO listed, so PoE should be somehow enabled by default. BTW I think theses routers don't have any GPIO to control USB power. The pin is only connected to a pull-up resistor.
So can the different behaviour with two identical devices be due to different initialisations? Maybe something changed on the transition from YAFFS to UBIFS?
The RB750UPr2, which is the device you have been working on, allows to control the USB power (GPIO45). I tested it and it working fine 👍

root@LEDE:~# echo 0 > /sys/class/gpio/gpio45/value # USB ON, USB devices detected
root@LEDE:~# echo 1 > /sys/class/gpio/gpio45/value # USB OFF

I noticed you have since made changes to the code. Let me test them and see if anything is different Ok?

Contributor

joaochainho commented Feb 13, 2017

Hi @f00b4r0 , I'm using only Mikrotik devices (RB750UPr2, RB750UP, RB450G) with their original 24V power supply.
Regarding your comments, the RB750UP devices (not RB750UPr2 which is a completely different device) don't have any GPIO listed, so PoE should be somehow enabled by default. BTW I think theses routers don't have any GPIO to control USB power. The pin is only connected to a pull-up resistor.
So can the different behaviour with two identical devices be due to different initialisations? Maybe something changed on the transition from YAFFS to UBIFS?
The RB750UPr2, which is the device you have been working on, allows to control the USB power (GPIO45). I tested it and it working fine 👍

root@LEDE:~# echo 0 > /sys/class/gpio/gpio45/value # USB ON, USB devices detected
root@LEDE:~# echo 1 > /sys/class/gpio/gpio45/value # USB OFF

I noticed you have since made changes to the code. Let me test them and see if anything is different Ok?

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

Sure. I was about to rebase this branch to current master but I'll wait :)

OK understood now. I'm using the same initialization procedure for UBS and PoE control. The only possible difference I can imagine is as I said if the PoE is "active low" meaning the states would be inverted, and setting the gpio to 0 would then turn it on. Have you checked that?

Thanks!

Contributor

f00b4r0 commented Feb 13, 2017

Sure. I was about to rebase this branch to current master but I'll wait :)

OK understood now. I'm using the same initialization procedure for UBS and PoE control. The only possible difference I can imagine is as I said if the PoE is "active low" meaning the states would be inverted, and setting the gpio to 0 would then turn it on. Have you checked that?

Thanks!

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 13, 2017

Contributor

Yes, I've tested all combinations. PoE always off.

echo 1 > active_low
echo 0 > active_low
echo 1 > value
echo 0 > value
Contributor

joaochainho commented Feb 13, 2017

Yes, I've tested all combinations. PoE always off.

echo 1 > active_low
echo 0 > active_low
echo 1 > value
echo 0 > value
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

OK. I've checked OpenWRT's code and I don't see anything obvious. There's one last thing we can get out of the way to make sure we've tried everything:
in rbspi_952_750r2_setup(), line 542 (after rbspi_network_setup(flags, 1, 5);), add the following two lines and rebuild/retest:

ath79_gpio_direction_select(RB952_GPIO_POE_POWER, true);
ath79_gpio_output_select(RB952_GPIO_POE_POWER, AR934X_GPIO_OUT_GPIO);

The first line forces the gpio as output (I would expect this line not to be necessary with gpio_request_one() but I might be wrong). The second line clears any possible function multiplexing assigned to that particular GPIO by e.g. the bootloader, and makes it a regular gpio.

Let me know if that makes any difference. Thanks!

Contributor

f00b4r0 commented Feb 13, 2017

OK. I've checked OpenWRT's code and I don't see anything obvious. There's one last thing we can get out of the way to make sure we've tried everything:
in rbspi_952_750r2_setup(), line 542 (after rbspi_network_setup(flags, 1, 5);), add the following two lines and rebuild/retest:

ath79_gpio_direction_select(RB952_GPIO_POE_POWER, true);
ath79_gpio_output_select(RB952_GPIO_POE_POWER, AR934X_GPIO_OUT_GPIO);

The first line forces the gpio as output (I would expect this line not to be necessary with gpio_request_one() but I might be wrong). The second line clears any possible function multiplexing assigned to that particular GPIO by e.g. the bootloader, and makes it a regular gpio.

Let me know if that makes any difference. Thanks!

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 13, 2017

Contributor

Hi @f00b4r0 I think something is broken with the latest commits.

[    0.745066] bootconsole [early0] disabled
[    0.756937] m25p80 spi0.0: found w25q128, expected m25p80
[    0.762608] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.767473] Creating 7 MTD partitions on "spi0.0":
[    0.772440] 0x000000000000-0x00000000e000 : "routerboot"
[    0.780523] 0x00000000e000-0x00000000f000 : "hard_config"
[    0.787797] 0x00000000f000-0x000000010000 : "bios"
[    0.794479] 0x000000010000-0x00000001f000 : "routerboot2"
[    0.801809] 0x00000001f000-0x000000020000 : "soft_config"
[    0.809159] 0x000000020000-0x000000200000 : "kernel"
[    0.815998] 0x000000200000-0x000001000000 : "rootfs"
[    0.822873] mtd: device 6 (rootfs) set to be root filesystem
[    0.828847] mtdsplit: no squashfs found in "rootfs"
[    0.857314] libphy: ag71xx_mdio: probed
[    1.451312] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    1.461501] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.050909] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.094286] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.103194] NET: Registered protocol family 10
[    2.112662] NET: Registered protocol family 17
[    2.117349] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.130574] 8021q: 802.1Q VLAN Support v1.8
[    2.140553] List of all partitions:
[    2.144190] 1f00              56 mtdblock0  (driver?)
[    2.149491] 1f01               4 mtdblock1  (driver?)
[    2.154714] 1f02               4 mtdblock2  (driver?)
[    2.159949] 1f03              60 mtdblock3  (driver?)
[    2.165170] 1f04               4 mtdblock4  (driver?)
[    2.170405] 1f05            1920 mtdblock5  (driver?)
[    2.175626] 1f06           14336 mtdblock6  (driver?)
[    2.180854] No filesystem could mount root, tried:  squashfs
[    2.186713] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,6)
[    2.196114] Rebooting in 1 seconds..
Contributor

joaochainho commented Feb 13, 2017

Hi @f00b4r0 I think something is broken with the latest commits.

[    0.745066] bootconsole [early0] disabled
[    0.756937] m25p80 spi0.0: found w25q128, expected m25p80
[    0.762608] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.767473] Creating 7 MTD partitions on "spi0.0":
[    0.772440] 0x000000000000-0x00000000e000 : "routerboot"
[    0.780523] 0x00000000e000-0x00000000f000 : "hard_config"
[    0.787797] 0x00000000f000-0x000000010000 : "bios"
[    0.794479] 0x000000010000-0x00000001f000 : "routerboot2"
[    0.801809] 0x00000001f000-0x000000020000 : "soft_config"
[    0.809159] 0x000000020000-0x000000200000 : "kernel"
[    0.815998] 0x000000200000-0x000001000000 : "rootfs"
[    0.822873] mtd: device 6 (rootfs) set to be root filesystem
[    0.828847] mtdsplit: no squashfs found in "rootfs"
[    0.857314] libphy: ag71xx_mdio: probed
[    1.451312] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd042, driver=Generic PHY]
[    1.461501] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
[    2.050909] ag71xx-mdio.1: Found an AR934X built-in switch
[    2.094286] eth1: Atheros AG71xx at 0xba000000, irq 5, mode:GMII
[    2.103194] NET: Registered protocol family 10
[    2.112662] NET: Registered protocol family 17
[    2.117349] bridge: automatic filtering via arp/ip/ip6tables has been deprecated. Update your scripts to load br_netfilter if you need this.
[    2.130574] 8021q: 802.1Q VLAN Support v1.8
[    2.140553] List of all partitions:
[    2.144190] 1f00              56 mtdblock0  (driver?)
[    2.149491] 1f01               4 mtdblock1  (driver?)
[    2.154714] 1f02               4 mtdblock2  (driver?)
[    2.159949] 1f03              60 mtdblock3  (driver?)
[    2.165170] 1f04               4 mtdblock4  (driver?)
[    2.170405] 1f05            1920 mtdblock5  (driver?)
[    2.175626] 1f06           14336 mtdblock6  (driver?)
[    2.180854] No filesystem could mount root, tried:  squashfs
[    2.186713] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,6)
[    2.196114] Rebooting in 1 seconds..
@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

Did you boot from initramfs and flash from that initramfs first? As I said in a previous comment, I have reordered the MTD partitions. You cannot flash the current code from one of the previous images.

Contributor

f00b4r0 commented Feb 13, 2017

Did you boot from initramfs and flash from that initramfs first? As I said in a previous comment, I have reordered the MTD partitions. You cannot flash the current code from one of the previous images.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

I'm going to try to add support for mtdsplit next, so that we don't have to deal with fixed-size partitions anymore. Expect more breakage ;)

Contributor

f00b4r0 commented Feb 13, 2017

I'm going to try to add support for mtdsplit next, so that we don't have to deal with fixed-size partitions anymore. Expect more breakage ;)

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 13, 2017

Contributor

Hi @f00b4r0 I tested the mods you suggested in rbspi_952_750r2_setup() (r3324-15d4f26) but I still can't enable PoE and I still get the same error after sysupgrade. I did boot from initramfs from the same build.

Contributor

joaochainho commented Feb 13, 2017

Hi @f00b4r0 I tested the mods you suggested in rbspi_952_750r2_setup() (r3324-15d4f26) but I still can't enable PoE and I still get the same error after sysupgrade. I did boot from initramfs from the same build.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

Refresh the code, I have rebased on current master which has the fix for sysupgrade. I bet that when you ran sysupgrade you didn't get any message about writing to kernel and rootfs partitions. There was a bug that was fixed by 33154ea.

As for PoE, I'm out of ideas. I don't know what's wrong. The fact that you mention that your 750UP also doesn't have working PoE output with LEDE might suggest this problem may not be related to my code...

Contributor

f00b4r0 commented Feb 13, 2017

Refresh the code, I have rebased on current master which has the fix for sysupgrade. I bet that when you ran sysupgrade you didn't get any message about writing to kernel and rootfs partitions. There was a bug that was fixed by 33154ea.

As for PoE, I'm out of ideas. I don't know what's wrong. The fact that you mention that your 750UP also doesn't have working PoE output with LEDE might suggest this problem may not be related to my code...

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 13, 2017

Contributor

As for PoE, I'm out of ideas. I don't know what's wrong. The fact that you mention that your 750UP also doesn't have working PoE output with LEDE might suggest this problem may not be related to my code...

Yes I agree. That's why I suggested some change from YAFFS to UBIFS. I will try to build an image still with YAFFS+wget2nand and see what comes up.
Meanwhile I will try the latest changes.

Contributor

joaochainho commented Feb 13, 2017

As for PoE, I'm out of ideas. I don't know what's wrong. The fact that you mention that your 750UP also doesn't have working PoE output with LEDE might suggest this problem may not be related to my code...

Yes I agree. That's why I suggested some change from YAFFS to UBIFS. I will try to build an image still with YAFFS+wget2nand and see what comes up.
Meanwhile I will try the latest changes.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 13, 2017

Contributor

Yes I agree. That's why I suggested some change from YAFFS to UBIFS. I will try to build an image still with YAFFS+wget2nand and see what comes up.

I don't think that the filesystem has anything to do with this, but what do I know 😜

Contributor

f00b4r0 commented Feb 13, 2017

Yes I agree. That's why I suggested some change from YAFFS to UBIFS. I will try to build an image still with YAFFS+wget2nand and see what comes up.

I don't think that the filesystem has anything to do with this, but what do I know 😜

ar71xx: Add mtdsplit support for Mikrotik NOR firmware
The RouterBOOT bootloader does not care where the kernel lives in the SPI
flash, all that matters is that the kernel is wrapped in the custom yaffs
container as generated by kernel2minor.

This container has a fixed signature as follows:
00000000  00 00 00 01 00 00 00 01  ff ff 6b 65 72 6e 65 6c  |..........kernel|

This patch adds mtdsplit support for identifying that signature and
triggering the search for the rootfs. It makes it possible to make more
efficicent use of the flash space.

The kernel and rootfs partitions are no longer hard coded in mach-rbspi.c,
instead a global firmware partition is defined.

Signed-off-by: Thibaut VARENE <hacks@slashdirt.org>
@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Feb 14, 2017

Contributor

Hi @f00b4r0 it looks like the PoE issue might be related to RouterOS, not LEDE.
http://wiki.mikrotik.com/wiki/Manual:PoE-Out
I'm going to install RouterOS again, try the instructions above and install LEDE afterwards.

Contributor

joaochainho commented Feb 14, 2017

Hi @f00b4r0 it looks like the PoE issue might be related to RouterOS, not LEDE.
http://wiki.mikrotik.com/wiki/Manual:PoE-Out
I'm going to install RouterOS again, try the instructions above and install LEDE afterwards.

@f00b4r0

This comment has been minimized.

Show comment
Hide comment
@f00b4r0

f00b4r0 Feb 14, 2017

Contributor

That's interesting thanks! By the way, the last commit enables mtdsplit (dynamic partitioning of the flash). This must be flashed from the corresponding initramfs too.

Contributor

f00b4r0 commented Feb 14, 2017

That's interesting thanks! By the way, the last commit enables mtdsplit (dynamic partitioning of the flash). This must be flashed from the corresponding initramfs too.

@nbd168

This comment has been minimized.

Show comment
Hide comment
@nbd168

nbd168 Feb 14, 2017

Contributor

As discussed on IRC, I merged all except for the last one to my staging tree. Please open up a new pull request for the last patch.

Contributor

nbd168 commented Feb 14, 2017

As discussed on IRC, I merged all except for the last one to my staging tree. Please open up a new pull request for the last patch.

@nbd168 nbd168 closed this Feb 14, 2017

@f00b4r0 f00b4r0 deleted the f00b4r0:rbspi branch Feb 15, 2017

@robimarko

This comment has been minimized.

Show comment
Hide comment
@robimarko

robimarko Oct 1, 2017

Contributor

Sorry to update this closed PR.
@joaochainho Did you get POE working at all?

Contributor

robimarko commented Oct 1, 2017

Sorry to update this closed PR.
@joaochainho Did you get POE working at all?

@joaochainho

This comment has been minimized.

Show comment
Hide comment
@joaochainho

joaochainho Oct 1, 2017

Contributor

Hi @robimarko
Unfortunately I didn't get PoE working. But I can't rely solely on the the device I have because I don't know if I already broke something.
I was hoping to have a brand-new device for testing but I still hadn't the chance.
BTW I have tried it on a RB951Ui-2nD (hAP) and PoE GPIO works fine there :)

Contributor

joaochainho commented Oct 1, 2017

Hi @robimarko
Unfortunately I didn't get PoE working. But I can't rely solely on the the device I have because I don't know if I already broke something.
I was hoping to have a brand-new device for testing but I still hadn't the chance.
BTW I have tried it on a RB951Ui-2nD (hAP) and PoE GPIO works fine there :)

@robimarko

This comment has been minimized.

Show comment
Hide comment
@robimarko

robimarko Oct 1, 2017

Contributor

@joaochainho
Ok,I will try on Powerbox.
But it looks like temperature,voltage and current measurments are done using ATtiny 146 MCU that is on RB750 r2 series board.
it looks like it is connected by SPI to QCA955X series SoC.

There is SPI configuration for it in GPL sources.
So it would be great to see what traffic there is between that MCU and SoC

Contributor

robimarko commented Oct 1, 2017

@joaochainho
Ok,I will try on Powerbox.
But it looks like temperature,voltage and current measurments are done using ATtiny 146 MCU that is on RB750 r2 series board.
it looks like it is connected by SPI to QCA955X series SoC.

There is SPI configuration for it in GPL sources.
So it would be great to see what traffic there is between that MCU and SoC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment