openwrtv3/target/linux
Kevin Darbyshire-Bryant f2107fc328 ramips: improve Xiaomi Mi Router 3G support
This commit improves support for the Xiaomi Mi Router 3G originally
added in commit 6e283cdc0d

Improvements:

- Remove software watchdog as hardware watchdog now working as per
  commit 3fbf3ab44f for all mt7621
  devices.

- Reset button polarity corrected - length of press determines reboot
  (short press) vs. reset to defaults (long press) behaviour.

- Enable GPIO amber switch port LEDs on board rear - lit indicates 1Gbit
  link and blink on activity.  Green LEDs driven directly by switch
  indicating any link speed and tx activity.

- USB port power on/off GPIO exposed as 'usbpower'

- Add access to uboot environment settings for checking/setting uboot
  boot order preference from user space.

Changes:

- Front LED indicator is physically made of independent Yellow/Amber,
  Red & Blue LEDs combined via a plastic 'lightpipe' to a front panel
  indicator, hence the colour behaviour is similar to an RGB LED. RGB
  LEDs are not supported at this time because they produce colour results
  that do not then match colour labels, e.g. enabling 'mir3g:red' and
  'mir3g:blue' would result in a purple indicator and we have no such
  label for purple.
  The yellow, red & blue LEDs have been split out as individual yellow,
  red & blue status LEDs, with yellow being the default status LED as
  before and with red's WAN and blue's USB default associations removed.

- Swapped order of vlan interfaces (eth0.1 & eth0.2) to match stock vlan
  layout. eth0.1 is LAN, eth0.2 is WAN

- Add 'lwlll' vlan layout to mt7530 switch driver to prevent packet
  leakage between kernel switch init and uci swconfig

uboot behaviour & system 'recovery'

uboot expects to find bootable kernels at nand addresses 0x200000 &
0x600000 known by uboot as "system 1" and "system 2" respectively.
uboot chooses which system to hand control to based on 3 environment
variables: flag_last_success, flag_try_sys1_failed & flag_try_sys2_failed

last_success represents a preference for a particular system and is set
to 0 for system 1, set to 1 for system 2.  last_success is considered *if*
and only if both try_sys'n'_failed flags are 0 (ie. unset) If *either*
failed flags are set then uboot will attempt to hand control to the
non failed system. If both failed flags are set then uboot will check
the uImage CRC of system 1 and hand control to it if ok.  If the uImage
CRC of system is not ok, uboot will hand control to system 2
irrespective of system 2's uImage CRC.

NOTE: uboot only ever sets failed flags, it *never* clears them. uboot
sets a system's failed flag if that system's was selected for boot but
the uImage CRC is incorrect.

Fortunately with serial console access, uboot provides the ability to
boot an initramfs image transferred via tftp, similarly an image may
be flashed to nand however it will flash to *both* kernels so a backup
of stock kernel image is suggested. Note that the suggested install
procedure below set's system 1's failed flag (stock) thus uboot ignores
the last_success preference and boots LEDE located in system 2.

Considerable thought has gone into whether LEDE should replace both
kernels, only one (and which one) etc. LEDE kernels do not include a
minimal rootfs and thus unlike the stock kernel cannot include a
method of controlling uboot environment variables in the event of
rootfs mount failure. Similarly uboot fails to provide an external
mechanism for indicating boot system failure.

Installation - from stock.

Installation through telnet/ssh:
- copy lede-ramips-mt7621-mir3g-squashfs-kernel1.bin and
  lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin to usb disk or wget it
  from LEDE download site to /tmp
- switch to /extdisks/sda1/ (if copied to USB drive) or to /tmp if
  wgetted from LEDE download site
- run: mtd write lede-ramips-mt7621-mir3g-squashfs-kernel1.bin kernel1
- run: mtd write lede-ramips-mt7621-mir3g-squashfs-rootfs0.bin rootfs0
- run: nvram set flag_try_sys1_failed=1
- run: nvram commit
- run: reboot

Recovery - to stock.

Assuming you used the above installation instructions you will have a
stock kernel image in system 1. If it can be booted then it may be used
to perform a stock firmware recovery, thus erasing LEDE completely. From
a 'working' LEDE state (even failsafe)

Failsafe only:
- run: mount_root
- run: sh /etc/uci-defaults/30_uboot-envtools
Then do the steps for 'All'

All:
- run: fw_setenv flag_try_sys2_failed 1
- run: reboot

The board will reboot into system 1 (stock basic kernel) and wait with
system red light slowly blinking for a FAT formatted usb stick with a
recovery image to be inserted.  Press and hold the reset button for
around 1 second. Status LED will turn yellow during recovery and blue
when recovery complete.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
2017-09-28 09:20:36 +02:00
..
adm5120 treewide: populate boardname and model earlier 2017-07-15 23:13:34 +02:00
adm8668 build: fix subtarget descriptions 2016-09-04 13:35:11 +02:00
apm821xx kernel: update kernel 4.9 to version 4.9.40 2017-07-28 22:46:17 +02:00
ar7 ar7: add NULL clock fix send upstream 2017-07-29 09:24:17 +02:00
ar71xx ar71xx: fix MAC addresses on TP-Link TL-WR1043ND v4 2017-09-11 19:47:19 +02:00
arc770 treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
archs38 treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
armvirt armvirt: Enable CONFIG_ARM_PMU 2017-09-16 16:38:10 -07:00
at91 at91: Add UBI parameters for sama5d4. 2017-09-20 09:01:09 +02:00
ath25 kernel: cleanup CONFIG_SCHED_HRTICK 2017-06-29 04:46:59 +02:00
au1000 kernel: update kernel 3.18 to version 3.18.43 2016-10-24 20:25:14 +03:00
bcm53xx kernel: update 4.4 to 4.4.86 2017-09-05 08:43:39 +02:00
brcm47xx Revert "brcm47xx: Fix sysupgrade with E1200v1" 2017-09-25 23:09:33 +02:00
brcm63xx kernel: update 4.4 to 4.4.86 2017-09-05 08:43:39 +02:00
brcm2708 brcm2708: bcm2710: do not activate neon-vfpv4 manually 2017-08-26 12:35:44 +02:00
cns3xxx cns3xxx: fix GPIO controller interrupt enable 2017-09-11 17:03:21 +02:00
gemini kernel: use .patch extension for all patches 2017-06-27 06:37:46 +02:00
generic kernel: update 4.9 to 4.9.52 2017-09-28 00:27:50 +03:00
imx6 imx6: add driver for temp/voltage monitoring 2017-08-18 18:47:11 +02:00
ipq806x kernel: update 4.9 to 4.9.50 2017-09-18 04:35:57 +03:00
ixp4xx treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
kirkwood treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
lantiq kernel: update 4.9 to 4.9.51 2017-09-20 23:50:55 +03:00
layerscape layerscape: do not add custom CFLAGS. 2017-08-26 12:36:02 +02:00
malta kernel: cleanup CONFIG_SCHED_HRTICK 2017-06-29 04:46:59 +02:00
mcs814x treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
mediatek kernel: update 4.9 to 4.9.51 2017-09-20 23:50:55 +03:00
mpc85xx treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
mvebu kernel: update 4.9 to 4.9.51 2017-09-20 23:50:55 +03:00
mxs treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
octeon treewide: use only board_name function to get name 2017-07-15 23:13:34 +02:00
omap kernel: cleanup CONFIG_SCHED_HRTICK 2017-06-29 04:46:59 +02:00
omap24xx treewide: use only board_name function to get name 2017-07-15 23:13:34 +02:00
orion treewide: use only board_name function to get name 2017-07-15 23:13:34 +02:00
oxnas kernel: update kernel 4.4 to version 4.4.79 2017-07-28 22:46:26 +02:00
pistachio kernel: update 4.9 to 4.9.44 2017-08-17 12:34:34 +02:00
ppc40x treewide: drop target board_name functions 2017-07-15 23:13:34 +02:00
ppc44x ppc44x: mark as broken 2017-01-10 12:49:34 +01:00
ramips ramips: improve Xiaomi Mi Router 3G support 2017-09-28 09:20:36 +02:00
rb532 rb532: drop 4.4 support 2017-09-18 15:22:16 +03:00
sunxi sunxi: add Olimex A20-OLinuXino-LIME2-eMMC 2017-09-24 16:28:28 +02:00
uml kernel: update kernel 4.4 to version 4.4.79 2017-07-28 22:46:26 +02:00
x86 kernel: add packaging for Xeon iTCO watchdog timer 2017-09-17 00:08:00 +02:00
xburst xburst: enable high-res timers, refresh kernel config 2017-06-07 18:31:10 +02:00
zynq treewide: use only board_name function to get name 2017-07-15 23:13:34 +02:00
Makefile