aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ramips
Commit message (Collapse)AuthorAgeFilesLines
...
* ramips: add support for Ubiquiti UniFi 6 LiteDavid Bauer2021-01-059-76/+478
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hardware -------- MediaTek MT7621AT 256M DDR3 32M SPI-NOR MediaTek MT7603 2T2R 802.11n 2.4GHz MediaTek MT7915 2T2R 802.11ax 5GHz Not Working ----------- - Bluetooth (connected to UART3) UART ---- UART is located in the lower left corner of the board. Pinout is 0 - 3V3 (don't connect) 1 - RX 2 - TX 3 - GND Console is 115200 8N1. Boot ---- 1. Connect to the serial console and connect power. 2. Double-press ESC when prompted 3. Set the fdt address $ fdt addr $(fdtcontroladdr) 4. Remove the signature node from the control FDT $ fdt rm /signature 5. Transfer and boot the OpenWrt initramfs image to the device. Make sure to name the file C0A80114.img and have it reachable at 192.168.1.1/24 $ tftpboot; bootm Installation ------------ 1. Connect to the booted device at 192.168.1.20 using username/password "ubnt". 2. Update the bootloader environment. $ fw_setenv devmode TRUE $ fw_setenv boot_openwrt "fdt addr \$(fdtcontroladdr); fdt rm /signature; bootubnt" $ fw_setenv bootcmd "run boot_openwrt" 3. Transfer the OpenWrt sysupgrade image to the device using SCP. 4. Check the mtd partition number for bs / kernel0 / kernel1 $ cat /proc/mtd 5. Set the bootselect flag to boot from kernel0 $ dd if=/dev/zero bs=1 count=1 of=/dev/mtdblock4 6. Write the OpenWrt sysupgrade image to both kernel0 as well as kernel1 $ dd if=openwrt.bin of=/dev/mtdblock6 $ dd if=openwrt.bin of=/dev/mtdblock7 7. Reboot the device. It should boot into OpenWrt. Below are the original installation instructions prior to the discovery of "devmode=TRUE". They are not required for installation and are documentation only. The bootloader employs signature verification on the FIT image configurations. This way, booting unauthorized image without patching the bootloader is not possible. Manually configuring the bootcmd in the U-Boot envronment won't work, as this is restored to the default value if modified. The bootloader is made up of three different parts. 1. The SPL performing early board initialization and providing a XModem recovery in case the PBL is missing 2. The PBL being the primary U-Boot application and containing the control FDT. It is LZMA packed with a uImage header. 3. A Ubiquiti standalone U-Boot application providing the main boot routine as well as their recovery mechanism. In a perfect world, we would only replace the PBL, as the SPL does not perform checks on the PBLs integrity. However, as the PBL is in the same eraseblock as the SPL, we need to at least rewrite both. The bootloader will only verify integrity in case it has a "signature" node in it's control device-tree. Renaming the signature node to something else will prevent this from happening. Warning: These instructions are based on the firmware intially shipped with the device and potentially brick your device in a way it can only be recovered using a SPI flasher. Only (!) proceed if you understand this! 1. Extract the bootloader from the U-Boot partition using the OpenWrt initramfs image. 2. Split the bootloader into it's 3 components: $ dd if=bootloader.bin of=spl.bin bs=1 skip=0 count=45056 $ dd if=bootloader.bin of=pbl.uimage bs=1 skip=45056 count=143360 $ dd if=bootloader.bin of=ubnt.uimage bs=1 skip=188416 3. Strip the uImage header from the PBL $ dd if=pbl.uimage of=pbl.lzma bs=64 skip=1 4. Decompress the PBL $ lzma -d pbl.lzma --single-stream The decompressed PBL sha256sum should be d8b406c65240d260cf15be5f97f40c1d6d1b6e61ec3abed37bb841c90fcc1235 5. Open the decompressed PBL using your favorite hexeditor. Locate the control FDT at offset 0x4CED0 (0xD00DFEED). At offset 0x4D5BC, the label for the signature node is located. Rename the "signature" string at this offset to "signaturr". The patched PBL sha256sum should be d028e374cdb40ba44b6e3cef2e4e8a8c16a3b85eb15d9544d24fdd10eed64c97 6. Compress the patched PBL $ lzma -z pbl --lzma1=dict=67108864 The resulting pbl.lzma file should have the sha256sum 7ae6118928fa0d0b3fe4ff81abd80ecfd9ba2944cb0f0a462b6ae65913088b42 7. Create the PBL uimage $ SOURCE_DATE_EPOCH=1607909492 mkimage -A mips -O u-boot -C lzma -n "U-Boot 2018.03 [UniFi,v1.1.40.71]" -a 84000000 -e 84000000 -T firmware -d pbl.lzma patched_pbl.uimage The resulting patched_pbl.uimage should have the sha256sum b90d7fa2dcc6814180d3943530d8d6b0d6a03636113c94e99af34f196d3cf2ce 8. Reassemble the complete bootloader $ dd if=patched_pbl.uimage of=aligned_pbl.uimage bs=143360 count=1 conv=sync $ cat spl.bin > patched_uboot.bin $ cat aligned_pbl.uimage >> patched_uboot.bin $ cat ubnt.uimage >> patched_uboot.bin The resulting patched_uboot.bin should have the sha256sum 3e1186f33b88a525687285c2a8b22e8786787b31d4648b8eee66c672222aa76b 9. Transfer your patched bootloader to the device. Also install the kmod-mtd-rw package using opkg and load it. $ insmod mtd-rw.ko i_want_a_brick=1 Write the patched bootloader to mtd0 $ mtd write patched_uboot.bin u-boot 10. Erase the kernel1 partition, as the bootloader might otherwise decide to boot from there. $ mtd erase kernel1 11. Transfer the OpenWrt sysupgrade image to the device and install using sysupgrade. FIT configurations ------------------ In the future, the MT7621 UniFi6 family can be supported by a single OpenWrt image. config@1: U6 Lite config@2: U6 IW config@3: U6 Mesh config@4: U6 Extender config@5: U6 LR-EA (Early Access - GA is MT7622) Signed-off-by: David Bauer <mail@david-bauer.net>
* treewide: use more descriptive names for concatenated partitionsAdrian Schmutzler2020-12-272-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | A few devices in ath79 and ramips use mtd-concat to concatenate individual partitions into a bigger "firmware" or "ubi" partition. However, the original partitions are still present and visible, and one can write to them directly although this might break the actual virtual, concatenated partition. As we cannot do much about the former, let's at least choose more descriptive names than just "firmwareX" in order to indicate the concatenation to the user. He might be less tempted into overwriting a "fwconcat1" than a "firmware1", which might be perceived as an alternate firmware for dual boot etc. This applies the new naming consistently for all relevant devices, i.e. fwconcatX for virtual "firmware" members and ubiconcatX for "ubi" members. While at it, use DT labels and label property consistently, and also use consistent zero-based indexing. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for ELECOM WRC-1167GST2INAGAKI Hiroshi2020-12-222-0/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ELECOM WRC-1167GST2 is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on MT7621A. Specification: - SoC : MediaTek MT7621A - RAM : DDR3 256 MiB - Flash : SPI-NOR 32 MiB - WLAN : 2.4/5 GHz 2T2R (MediaTek MT7615D) - Ethernet : 10/100/1000 Mbps x5 - Switch : MediaTek MT7530 (SoC) - LED/keys : 6x/6x (2x buttons, 1x slide-switch) - UART : through-hole on PCB - J4: 3.3V, GND, TX, RX from ethernet port side - 57600n8 - Power : 12VDC, 1A MAC addresses: LAN : 04:AB:18:**:**:07 (Factory, 0xE000 (hex)) WAN : 04:AB:18:**:**:08 (Factory, 0xE006 (hex)) 2.4 GHz : 04:AB:18:**:**:09 (none) 5 GHz : 04:AB:18:**:**:0A (none) Flash instruction using factory image: 1. Boot WRC-1167GST2 normally 2. Access to "http://192.168.2.1/" and open firmware update page ("ファームウェア更新") 3. Select the OpenWrt factory image and click apply ("適用") button 4. Wait ~150 seconds to complete flashing Notes: - there is no way to configure the correct MAC address for secondary phy (5GHz) on MT7615D - Wi-Fi band on primary phy (2.4GHz) cannot be limitted by specifying ieee80211-freq-limit (fail to register secondary phy due to error) - mtd-mac-address in the wifi node is required for using mtd-mac-address-increment Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> [rebase onto split DTSI] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for ELECOM WRC-1167GS2-BINAGAKI Hiroshi2020-12-224-1/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ELECOM WRC-1167GS2-B is a 2.4/5 GHz band 11ac (Wi-Fi 5) router, based on MT7621A. Specification: - SoC : MediaTek MT7621A - RAM : DDR3 128 MiB - Flash : SPI-NOR 16 MiB - WLAN : 2.4/5 GHz 2T2R (MediaTek MT7615D) - Ethernet : 10/100/1000 Mbps x5 - Switch : MediaTek MT7530 (SoC) - LED/keys : 6x/6x (2x buttons, 1x slide-switch) - UART : through-hole on PCB - J4: 3.3V, GND, TX, RX from ethernet port side - 57600n8 - Power : 12VDC, 1A MAC addresses: LAN : 04:AB:18:**:**:13 (Factory, 0xFFF4 (hex)) WAN : 04:AB:18:**:**:14 (Factory, 0xFFFA (hex)) 2.4 GHz : 04:AB:18:**:**:15 (none) 5 GHz : 04:AB:18:**:**:16 (Factory, 0x4 (hex)) Flash instruction using factory image: 1. Boot WRC-1167GS2-B normally 2. Access to "http://192.168.2.1/" and open firmware update page ("ファームウェア更新") 3. Select the OpenWrt factory image and click apply ("適用") button 4. Wait ~120 seconds to complete flashing Notes: - there is no way to configure the correct MAC address for secondary phy (5GHz) on MT7615D - Wi-Fi band on primary phy (2.4GHz) cannot be limitted by specifying ieee80211-freq-limit (fail to register secondary phy due to error) - mtd-mac-address in the wifi node is required for using mtd-mac-address-increment Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com> [rebase onto split DTSI patch] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: mt7621: create DTSI for ELECOM WRC GS devices with 2 PCIAdrian Schmutzler2020-12-227-45/+51
| | | | | | | | This creates a dedicated DTSI for ELECOM WRC GS devices with 2 PCI WiFi chips in preparation for the 1 chip - dual radio devices, so the latter can reuse part of the common definitions. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for D-Link DIR-882 R1Andrew Pikler2020-12-228-148/+228
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifications: - SoC: MediaTek MT7621AT - RAM: 128 MB (DDR3) - Flash: 16 MB (SPI NOR) - WiFi: MediaTek MT7615N (x2) - Switch: 1 WAN, 4 LAN (Gigabit) - Ports: 1 USB 2.0, 1 USB 3.0 - Buttons: Reset, WiFi Toggle, WPS - LEDs: Power, Internet, WiFi 2.4G WiFi 5G, USB 2.0, USB 3.0 The R1 revision is identical to the A1 revision except - No Config2 Parition, therefore - factory partition resized to 64k from 128K - Firmware partition offset is 0x50000 not 0x60000 - Firmware partitions size increased by 64K - Firmware partition type is "denx,uimage", not "sge,uimage" - Padding of image creation "uimage-padhdr 96" removed Installation: - Older firmware versions: put the factory image on a USB stick, turn on the telnet console, and flash using the following cmd "fw_updater Linux /mnt/usb_X_X/firmware.bin" - D-Link FailsafeUI: Power down the router, press and hold the reset button, then re-plug it. Keep the reset button pressed until the internet LED stops flashing, then jack into any lan port and manually assign a static IP address in 192.168.0.0/24 other than 192.168.0.0 (e.g. 192.168.0.2) and go to http://192.168.0.1 Flash with the factory image. Signed-off-by: Andrew Pikler <andrew.pikler@gmail.com>
* firmware: add tool for signing d-link ru router factory firmware imagesAndrew Pikler2020-12-221-0/+5
| | | | | | | | Some Russian d-link routers require that their firmware be signed with a salted md5 checksum followed by the bytes 0x00 0xc0 0xff 0xee. This tool signs factory images the OEM's firmware accepts them. Signed-off-by: Andrew Pikler <andrew.pikler@gmail.com>
* ramips: add support for Senao Engenius ESR600HMichael Pratt2020-12-223-6/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | FCC ID: A8J-ESR750H Engenius ESR600H is an indoor wireless router with a gigabit switch, 2.4 GHz and 5 GHz wireless, internal and external antennas, and a USB port. **Specification:** - RT3662F MIPS SOC, 5 GHz WMAC (2x2) - RT5392L PCI on-board, 2.4 GHz (2x2) - AR8327 RGMII, 7-port GbE, 25 MHz clock - 40 MHz reference clock - 8 MB FLASH 25L6406EM2I-12G - 64 MB RAM - UART at J12 (unpopulated) - 2 internal antennas (5 GHz) - 2 external antennas (2.4 GHz) - 9 LEDs, 1 button (power, wps, wifi2g, wifi5g, 5 LAN/WAN) - USB 2 port (GPIO controlled power) **MAC addresses:** MAC Addresses are labeled as WAN and WLAN U-boot environment has the the vendor MAC address for ethernet MAC addresses in "factory" are part of wifi calibration data eth0.2 WAN *:13:e7 u-boot-env wanaddr eth0.1 ---- *:13:e8 u-boot-env wanaddr + 1 phy0 WLAN *:14:b8 factory 0x8004 phy1 ---- *:14:bc factory 0x4 **Installation:** Method 1: Firmware upgrade page OEM webpage at 192.168.0.1 username and password "admin" Navigate to Network Setting --> Tools --> Firmware Click Browse and select the factory.dlf image Click Continue to confirm and wait 6 minutes or more... Method 2: Serial console to load TFTP image: (see TFTP recovery) **Return to OEM:** Unlike most Engenius boards, this does not have a 'failsafe' image the only way to return to OEM is serial access to uboot Unlike most Engenius boards, public images are not available... so the only way to return to OEM is to have a copy of the MTD partition "firmware" BEFORE flashing openwrt. **TFTP recovery:** Unlike most Engenius boards, TFTP is reliable here however it requires serial console access (soldering pins to the UART pinouts) build your own image... with 'ramdisk' selected under 'Target Images' rename initramfs-kernel.bin to 'uImageESR-600H' make the file available on a TFTP server at 192.168.99.8 interrupt boot by holding or pressing '4' in serial console as soon as board is powered on `tftpboot 0x81000000` `bootm 0x81000000` perform a sysupgrade **Format of OEM firmware image:** This Engenius board uses the Senao proprietary header with a unique Product ID. The header for factory.bin is generated by the mksenaofw program included in openwrt. .dlf file extension is also required for OEM software to accept it **Note on using OKLI:** the kernel is now too large for the bootloader to handle so OKLI is used via the `kernel-loader` image command recently in master several other ramips boards have the same problem 'Kernel panic - not syncing: Failed to find ralink,rt3883-sysc node' see commit ad19751edc21ae713bd95df6b93be64bd1e0c612 Signed-off-by: Michael Pratt <mcpratt@pm.me>
* ramips: unify elecom-*-factory for ELECOM WRC-GHBK2-S/GS/GST devicesINAGAKI Hiroshi2020-12-221-16/+5
| | | | | | | | | Most of Build/elecom-wrc-factory and Build/elecom-wrc-gs-factory are nearly equal, Unify those definitions by using "-N" option of mkhash and splitting the appending text at the end of firmware image for WRC-GS/GST devices. Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
* kernel: move some disabled symbols to genericAleksander Jan Bajkowski2020-12-221-3/+0
| | | | | | Move some disabled config options found in lantiq target to generic. Signed-off-by: Aleksander Jan Bajkowski <A.Bajkowski@stud.elka.pw.edu.pl>
* kernel: bump 5.4 to 5.4.85John Audia2020-12-221-2/+2
| | | | | | | | | | | | | All modifications made by update_kernel.sh run in a fresh clone without any existing toolchains. Build system: x86_64 Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711 Run-tested: ipq806x/R7800 No dmesg regressions, everything functional Signed-off-by: John Audia <graysky@archlinux.us>
* treewide: fix initramfs detectionRobert Marko2020-12-201-1/+1
| | | | | | | | | | | | | | | | Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to now use tmpfs, it causes $(rootfs_type) to now return tmpfs when running initramfs image instead of being empty. This broke initramfs detection which is required so that when installing on MikroTik devices firmware partition would first get erased fully before writing. So, lets test for $(rootfs_type) returning "tmpfs" instead. Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail) Signed-off-by: Robert Marko <robimarko@gmail.com>
* ramips: do not enable unused GPIO controllersAdrian Schmutzler2020-12-1727-132/+0
| | | | | | | | Several devices enable GPIO controllers not used in the DTS files. Drop them. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for GL.iNet GL-MT1300Xinfa Deng2020-12-174-0/+165
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GL-MT1300 is a high-performance new generation pocket-sized router that offers a powerful hardware and first-class cybersecurity protocol with unique and modern design. Specifications: - SoC: MT7621A, Dual-Core @880MHz - RAM: 256 MB DDR3 - Flash: 32 MB - Ethernet: 3 x 10/100/1000: 2 x LAN + 1 x WAN - Wireless: 1 x MT7615D Dual-Band 2.4GHz(400Mbps) + 5GHz(867Mbps) - USB: 1 x USB 3.0 port - Slot: 1 x MicroSD card slot - Button: 1 x Reset button - Switch: 1 x Mode switch - LED: 1 x Blue LED + 1 x White LED MAC addresses based on vendor firmware: WAN : factory 0x4000 LAN : Mac from factory 0x4000 + 1 2.4GHz : factory 0x4 5GHz : Mac form factory 0x4 + 1 Flashing instructions: 1.Connect to one of LAN ports. 2.Set the static IP on the PC to 192.168.1.2. 3.Press the Reset button and power the device (do not release the button). After waiting for the blue led to flash 5 times, the white led will come on and release the button. 4.Browse the 192.168.1.1 web page and update firmware according to web tips. 5.The blue led will flash when the firmware is being upgraded. 6.The blue led stops blinking to indicate that the firmware upgrade is complete and U-Boot automatically starts the firmware. For more information on GL-MT1300, see the OFFICIAL GL.iNet website: https://www.gl-inet.com/products/gl-mt1300/ Signed-off-by: Xinfa Deng <xinfa.deng@gl-inet.com> [add input-type for switch, wrap long line in 10_fix_wifi_mac] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* kernel: bump 5.4 to 5.4.83John Audia2020-12-151-1/+1
| | | | | | | | | | | | | | | | | | | Manually merged: layerscape/808-i2c-0011-i2c-imx-support-slave-mode-for-imx-I2C-driver.patch layerscape/808-i2c-0012-i2c-imx-correct-code-of-errata-A-010650-for-layersca.patch Remaining modifications made by update_kernel.sh Build system: x86_64 Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711, x86/64 [*], ramips/mt7621 [*], ath79/tiny [*], ipq40xx [*], octeon [*], realtek [*] Run-tested: ipq806x/R7800, ramips/mt7621 [*], octeon [*], realtek [*] No dmesg regressions, everything functional Signed-off-by: John Audia <graysky@archlinux.us> Tested-by: Stijn Segers <foss@volatilesystems.org> [*]
* ramips: use full names for Xiaomi Mi Router devicesAdrian Schmutzler2020-12-089-28/+30
| | | | | | | | | | This aligns the device/image names of the older Xiaomi Mi Router devices with their "friendly" model and DEVICE_MODEL properties. This also reintroduces consistency with the newer devices already following that scheme. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: mt7628: create shared DTSI for Xiaomi Mi Router 4A/4CAdrian Schmutzler2020-12-083-207/+130
| | | | | | | | | The Xiaomi Mi Router 4A (100M) and 4C are relatively similar in their specs. Create a shared DTSI for them. Partitions are split in preparation for Mi Router 4AC. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: remove redundant status for USB controllersAdrian Schmutzler2020-12-0732-245/+0
| | | | | | | | | | | | | | | | | | mt7621, mt7628an and rt5350 have USB controllers (ehci/ohci or xhci) enabled by default. Thus, this patch drops redundant status=okay statements in derived device DTS files. While at it, also drop an explicit status=okay in mt7621.dtsi, as this is default. Note: For rt5350, about 50 % of the devices enabled ehci/ohci in the DTS files, and there is actually no device actively disabling it. It looks like only a few people are aware that the controllers are enabled by default here. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: simplify status for ehci/ohci on mt7628 TP-Link devicesAdrian Schmutzler2020-12-0716-56/+72
| | | | | | | | | | | | | | At the moment, ehci/ohci is enabled in mt7628an SoC DTSI, then disabled in the TP-Link-specific DTSI files, and finally enabled again in the DTS files of the devices needing it. This on-off-on scheme is hard to grasp on a quick look. Thus, this patch drops the status in the TP-Link-specific DTSI files, having the TP-Link devices treated like the rest of mt7628an DTSes, i.e. ehci/ohci is enabled by default and needs to be disabled explicitly where needed. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: drop redundant status for gpio/gpio0Adrian Schmutzler2020-12-0445-180/+0
| | | | | | | | | | The first gpio controller (gpio or gpio0) is always enabled by default in the SoC DTSI files. No need to set status=okay in the device DTS files a second time. Remove the redundant statements. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for ASUS RT-N56U B1Pavel Chervontsev2020-11-283-0/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Specifications: SoC: MediaTek MT7621ST (880 MHz) FLASH: 16 MiB (Macronix MX25L12835FM2I-10G) RAM: 128 MiB (Nanya NT5CB64M16FP-DH) WiFi: MediaTek MT7603EN bgn 2x2:2 WiFi: MediaTek MT7612EN an 2x2:2 BTN: Reset, WPS LED: - Power - WiFi 2.4 GHz - WiFi 5 GHz - WAN - LAN {1-4} - USB {1-2} UART: UART is present as pin hole next to the aluminium capacitor. 3V3 - RX - GND - TX / 115200-8N1 3V3 is the nearest on the aluminium capacitor and nut hole (pin1). USB: 2 ports POWER: 12VDC, 1.5A (Barrel 5.5x2.1) Installation: Via TFTP: Set your computers IP-Address to 192.168.1.75 Power up the Router with the Reset button pressed. Release the Reset button after 5 seconds. Upload OpenWRT sysupgrade image via TFTP: tftp -4 -v -m binary 192.168.1.1 -c put IMAGE MAC addresses: 0x4 *:98 2g/wan, label 0x22 *:9c 0x28 *:98 0x8004 *:9c 5g/lan Though addresses are written to 0x22 and 0x28, it appears that the vendor firmware actually only uses 0x4 and 0x8004. Thus, we do the same here. Signed-off-by: Pavel Chervontsev <cherpash@gmail.com> [add MAC address overview, add label-mac-device, fix IMAGE_SIZE] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: mt7621: replace missing custom-initramfs-uimageSander Vanheule2020-11-261-1/+1
| | | | | | | | | | custom-initramfs-uimage was replaced by calls to uImage, but apparently mtc_wr1201 was missed in the transistion. Use uImage for this device too. Fixes: 9f574b1b875c "ramips: mt7621: drop custom uImage function" Signed-off-by: Sander Vanheule <sander@svanheule.net>
* treewide: add space before SPDX identifierAdrian Schmutzler2020-11-255-5/+5
| | | | | | | | | | | | | | | | | | | | | Strictly, an SPDX identifier requires a space between the comment marker and the identifier itself. The choice of the comment marker itself is irrelevant. Correct: // SPDX-License-Identifier: GPL-2.0-or-later OR MIT Wrong: //SPDX-License-Identifier: GPL-2.0-or-later OR MIT Fix that in the whole tree (actually, only ramips contained wrong uses). Found by checkpatch.pl Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for Xiaomi Mi Router 4CAtaberk Özen2020-11-254-0/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds support for Xiaomi's Mi Router 4C device. Specifications: - CPU: MediaTek MT7628AN (580MHz) - Flash: 16MB - RAM: 64MB DDR2 - 2.4 GHz: IEEE 802.11b/g/n with Integrated LNA and PA - Antennas: 4x external single band antennas - WAN: 1x 10/100M - LAN: 2x 10/100M - LEDs: 2x yellow/blue. Programmable (labelled as power on case) - Non-programmable (shows WAN activity) - Button: Reset How to install: 1- Use OpenWRTInvasion to gain telnet and ftp access. 2- Push openwrt firmware to /tmp/ using ftp. 3- Connect to router using telnet. (IP: 192.168.31.1 - Username: root - No password) 4- Use command "mtd -r write /tmp/firmware.bin OS1" to flash into the router.. 5- It takes around 2 minutes. After that router will restart itself to OpenWrt. Signed-off-by: Ataberk Özen <ataberkozen123@gmail.com> [wrap commit message, bump PKG_RELEASE for uboot-envtools, remove dts-v1 from DTS, fix LED labels] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: mt7621: drop custom uImage functionSander Vanheule2020-11-251-21/+10
| | | | | | | | Use the mkimage argument overrides provided by uImage to implement the customisations required for the initramfs, instead of the near-identical custom function. Signed-off-by: Sander Vanheule <sander@svanheule.net>
* ramips: add support for TP-Link MR6400 v5Filip Moc2020-11-254-0/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | TL-MR6400v5 is very similar to TL-MR6400v4. Main differences are: - smaller form factor - different LED GPIOs - different switch connections You can flash via tftp recovery: - serve tftp-recovery image as /tp_recovery.bin on 192.168.0.225/24 - connect to any ethernet port - power on the device while holding the reset button - wait at least 8 seconds before releasing reset button Flashing via OEM web interface does not work. LTE module does not support DHCP so it must be configured via QMI. Hardware Specification (v5.0 EU): - SoC: MT7628NN - Flash: Winbond W25Q64JVS (8MiB) - RAM: ESMT M14D5121632A (64MiB) - Wireless: SoC platform only (2.4GHz b/g/n, 2x internal antenna) - Ethernet: 1NIC (4x100M) - WWAN: TP-LINK LTE MODULE (2x external detachable antenna) - Power: DC 9V 0.85A Signed-off-by: Filip Moc <lede@moc6.cz>
* ramips: add license to TP-Link MR6400 v4's DTSFilip Moc2020-11-251-0/+2
| | | | Signed-off-by: Filip Moc <lede@moc6.cz>
* kernel: bump 5.4 to 5.4.79John Audia2020-11-241-6/+4
| | | | | | | | | | | | | | | | | | | | | | | Manually rebased patches: ath79/patches-5.4/910-unaligned_access_hacks.patch bcm27xx/patches-5.4/950-0135-spi-spi-bcm2835-Disable-forced-software-CS.patch bcm27xx/patches-5.4/950-0414-SQUASH-Fix-spi-driver-compiler-warnings.patch ipq806x/patches-5.4/093-4-v5.8-ipq806x-PCI-qcom-Use-bulk-clk-api-and-assert-on-error.patch Removed since could be reverse-applied by quilt and found to be included upstream: ipq806x/patches-5.4/096-PCI-qcom-Make-sure-PCIe-is-reset-before-init-for-rev.patch All modifications made by update_kernel.sh Build system: x86_64 Build-tested: ipq806x/R7800, ath79/generic, bcm27xx/bcm2711 Run-tested: ipq806x/R7800 No dmesg regressions, everything functional Signed-off-by: John Audia <graysky@archlinux.us> [refresh altered targets after rebase] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: phy: at803x: Select SFP interface mode that both sides supports.René van Dorst2020-11-231-16/+35
| | | | | | | | | | | | | | | | Currently sfp_select_interface() return the fastest interface that the sfp modules supports even if the phy don't support that mode. For example an GPON module that support both 2500basex and 1000basex. Currently sfp_select_interface() picks 2500basex instead of 1000basex. So limit the interfaces which both sides supports before calling sfp_select_interface() or return an error if we don't have match. Reviewed-by: John Thomson <git@johnthomson.fastmail.com.au> Tested-by: Braihan Cantera <bcanterac@gmail.com> [MikroTik RB760iGS + Nokia G-010S-A 3FE46541AA SFP] Tested-by: John Thomson <git@johnthomson.fastmail.com.au> [Mikrotik rb760igs + SFP SM/LC, SFP base1000T, SFP+ passive DAC] Signed-off-by: René van Dorst <opensource@vdorst.com>
* ramips: add support for TP-Link MR6400 v4Filip Moc2020-11-234-0/+121
| | | | | | | | | | | | | | | | | | | | | | | You can flash via tftp recovery: - serve tftp-recovery image as /tp_recovery.bin on 192.168.0.225/24 - connect to any ethernet port - power on the device while holding the reset button - wait at least 8 seconds before releasing reset button Flashing via OEM web interface does not work. LTE module does not support DHCP so it must be configured via QMI. Hardware Specification (v4.0 EU): - SoC: MT7628NN - Flash: Winbond W25Q64JVS (8MiB) - RAM: ESMT M14D5121632A (64MiB) - Wireless: SoC platform only (2.4GHz b/g/n, 2x internal antenna) - Ethernet: 1NIC (4x100M) - WWAN: TP-LINK LTE MODULE (2x external detachable antenna) - Power: DC 9V 0.85A Signed-off-by: Filip Moc <lede@moc6.cz>
* ramips: add support for the Hak5 WiFi Pineapple Mark 7Marc Egerton2020-11-183-0/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the WiFi Pineapple Mark 7, a wireless penetration testing tool. Specifications: * SoC: MediaTek MT7628 (580MHz) * RAM: 256MiB (DDR2) * Storage 1: 32MiB NOR (SPI) * Storage 2: 2GB eMMC * Wireless 1: 802.11b/g/n 2.4GHz (Built In) * Wireless 2: 802.11b/g/n 2.4GHz (MT7601) * Wireless 3: 802.11b/g/n 2.4GHz (MT7601) * USB: 1x USB Type-A 2.0 Host Port * Ethernet: 1x USB Type-C AX88772C Ethernet * UART: 57600 8N1 on PCB * Inputs: 1x Reset Button * Outputs: 1x RGB LED * FCCID: 2AA52MK7 Flash Instructions: Original firmware is based on OpenWRT. Use sysupgrade via SSH to flash. Signed-off-by: Marc Egerton <foxtrot@realloc.me> [pepe2k@gmail.com: set only required/used gpio groups to gpio function] Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
* ramips: use m25p,fast-read on Xiaomi Mi Router 4A Gb/3G v2Adrian Schmutzler2020-11-181-0/+1
| | | | | | | | | | | The Xiaomi Mi Router 4A Gigabit model has a race condition on bootup causing the SQUASHFS data errors to appear and create a bootloop scenario. Adding the m25p,fast-read property resolves this issue. Suggested-by: David Bentham <db260179@gmail.com> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: mt7621: fix Telco X1 GPIO switchesDENG Qingfang2020-11-161-1/+1
| | | | | | | The GPIO base of MT7621 GPIO 0~31 is 480 on kernel 5.4 Fix the GPIO numbering. Signed-off-by: DENG Qingfang <dengqf6@mail2.sysu.edu.cn>
* ramips: add Xiaomi Mi Router 4A Gigabit explicitlyAdrian Schmutzler2020-11-125-160/+183
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This device has previously been supported by the image for Xiaomi Mi Router 3G v2. Since this is not obvious, the 4A is marketed as a new major revision and it also seems to have a different bootloader, this will be both more tidy and more helpful for the users. Apart from that, note that there also is a 100M version of the device that uses mt7628 platform, so a specifically named image will also prevent confusion in this area. Specifications: - SoC: MediaTek MT7621 - Flash: 16 MiB NOR SPI - RAM: 128 MiB DDR3 - Ethernet: 3x 10/100/1000 Mbps (switched, 2xLAN + WAN) - WIFI0: MT7603E 2.4GHz 802.11b/g/n - WIFI1: MT7612E 5GHz 802.11ac - Antennas: 4x external (2 per radio), non-detachable - LEDs: Programmable "power" LED (two-coloured, yellow/blue) Non-programmable "internet" LED (shows WAN activity) - Buttons: Reset Installation: Bootloader won't accept any serial input unless "boot_wait" u-boot environment variable is changed to "on". Vendor firmware won't accept any serial input until "uart_en" is set to "1". Using the https://github.com/acecilia/OpenWRTInvasion exploit you can gain access to shell to enable these options: To enable uart keyboard actions - 'nvram set uart_en=1' To make uboot delay boot work - 'nvram set boot_wait=on' Set boot delay to 5 - 'nvram set bootdelay=5' Then run 'nvram commit' to make the changes permanent. Once in the shell (following the OpenWRTInvasion instructions) you can then run the following to flash OpenWrt and then reboot: 'cd /tmp; curl https://downloads.openwrt.org/...-sysupgrade.bin --output firmware.bin; mtd -e OS1 -r write firmware.bin OS1' Suggested-by: David Bentham <db260179@gmail.com> Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: add support for D-Link DIR-2640 A1James McGuire2020-11-114-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for D-Link DIR-2640 A1. Specifications: * Board: AP-MTKH7-0002 * SoC: MediaTek MT7621AT * RAM: 256 MB (DDR3) * Flash: 128 MB (NAND) * WiFi: MediaTek MT7615N (x2) * Switch: 1 WAN, 4 LAN (Gigabit) * Ports: 1 USB 2.0, 1 USB 3.0 * Buttons: Reset, WPS * LEDs: Power (blue/orange), Internet (blue/orange), WiFi 2.4G (blue), WiFi 5G (blue), USB 3.0 (blue), USB 2.0 (blue) Notes: * WiFi 2.4G and WiFi 5G LEDs are wired directly to the wireless chips Installation: * D-Link Recovery GUI: power down the router, press and hold the reset button, then re-plug it. Keep the reset button pressed until the power LED starts flashing orange, manually assign a static IP address under the 192.168.0.xxx subnet (e.g. 192.168.0.2) and go to http://192.168.0.1 * Some modern browsers may have problems flashing via the Recovery GUI, if that occurs consider uploading the firmware through cURL: curl -v -i -F "firmware=@file.bin" 192.168.0.1 MAC addresses: lan factory 0xe000 *:a7 (label) wan factory 0xe006 *:aa 2.4 factory 0xe000 +1 *:a8 5.0 factory 0xe000 +2 *:a9 Seems like vendor didn't replace the dummy entries in the calibration data. Signed-off-by: James McGuire <jamesm51@gmail.com> [fix device definition title] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: fix kernel oops in `mt7621_nfc_write_page_hwecc`Anton Ryzhov2020-11-041-4/+6
| | | | | | | | | | `mt7621_nfc_write_page_hwecc` may be called with `buf=NULL`, but `mt7621_nfc_check_empty_page` always tries to read it. That caused Oops: `Unable to handle kernel paging request at virtual address 00000000` Fixes: FS#3416 Signed-off-by: Anton Ryzhov <anton@ryzhov.me>
* mt7621: mikrotik: use vmlinuz (zBoot ELF)John Thomson2020-10-292-2/+5
| | | | | | | | | | | | - minimal built initramfs: 11MB vmlinux ELF -> 4.5MB vmlinuz - ~5 seconds for kernel decompression, which was equivalent to the additional time to load the uncompressed ELF from SPI NOR. - Removes requirement for lzma-loader, which may have been causing some image builds to fail to boot on Mikrotik mt7621. Fixes: FS#3354 Suggested-by: Thibaut VARÈNE <hacks@slashdirt.org> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
* ramips: add linux zboot supportChuanhong Guo2020-10-291-0/+26
| | | | | | | | linux-mips has zboot code which can create a self-extracting kernel image. This allows enabling kernel zboot support for ramips targets. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* ramips: add support for Wavlink WL-WN530HG4Nuno Goncalves2020-10-273-2/+151
| | | | | | | | | | | | | | | | | | | | | | | | | | Same hardware as Phicomm K2G but different flash layout. Specification: - SoC: MediaTek MT7620A - Flash: 8 MB - RAM: 64 MB - Ethernet: 4 FE ports and 1 GE port (RTL8211F on port 5) - Wireless radio: MT7620 for 2.4G and MT7612E for 5G, both equipped with external PA. - UART: 1 x UART on PCB - 57600 8N1 Flash instruction: To avoid requiring UART for TFTP a dual flash procedure is suggested to install the squashfs image: 1. Rename openwrt-ramips-mt7620-wavlink_wl-wn530hg4-initramfs-kernel.bin to WN530HG4-WAVLINK. 2. Flash this file with the factory web interface. 3. With OpenWRT now running use standard sysupgrade to install the squashfs image. Signed-off-by: Nuno Goncalves <nunojpg@gmail.com> [remove dts-v1, remove model from LED labels, wrap commit message] Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: mt7621: use lzma-loader for U7621-06Jianhui Zhao2020-10-251-0/+2
| | | | | | | The U7621-06 fails to boot if the kernel is large. Enabling lzma-loader resolves the issue. Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
* ramips: add support for TOTOLINK X5000RChuanhong Guo2020-10-252-0/+149
| | | | | | | | | | | | | | | | | | | | | | Specifications: - SoC: MT7621AT - RAM: 256MB - Flash: 16MB (EN25QH128A) - Ethernet: 5xGbE - WiFi: MT7915 2x2 2.4G 573.5Mbps + 2x2 5G 1201Mbps Known issue: MT7915 DBDC variant isn't supported yet. Flash instruction: Upload the sysupgrade firmware to the firmware upgrade page in vendor fw. Other info: MT7915 seems to have two PCIEs connected to MT7621. Card detected on PCIE0 has an ID of 14c3:7916 and the other one on PCIE1 has 14c3:7915. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* ramips: add support for TP-Link RE200 v4Richard Fröhning2020-10-204-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TP-Link RE200 v4 is a wireless range extender with Ethernet and 2.4G and 5G WiFi with internal antennas. It's based on MediaTek MT7628AN+MT7610EN like the v2/v3. Specifications -------------- - MediaTek MT7628AN (580 Mhz) - 64 MB of RAM - 8 MB of FLASH - 2T2R 2.4 GHz and 1T1R 5 GHz - 1x 10/100 Mbps Ethernet - 8x LED (GPIO-controlled), 2x button - UART connection holes on PCB (57600 8n1) There are 2.4G and 5G LEDs in red and green which are controlled separately. MAC addresses ------------- The MAC address assignment matches stock firmware, i.e.: LAN : *:8E 2.4G: *:8D 5G : *:8C MAC address assignment has been done according to the RE200 v2. The label MAC address matches the OpenWrt ethernet address. Installation ------------ Web Interface ------------- It is possible to upgrade to OpenWrt via the web interface. Simply flash the -factory.bin from OEM. In contrast to a stock firmware, this will not overwrite U-Boot. Recovery -------- Unfortunately, this devices does not offer a recovery mode or a tftp installation method. If the web interface upgrade fails, you have to open your device and attach serial console. Instructions for serial console and recovery may be checked out in commit 6d6f36ae787c ("ramips: add support for TP-Link RE200 v2") or on the device's Wiki page. Signed-off-by: Richard Fröhning <misanthropos@gmx.de> [removed empty line, fix commit message formatting] Signed-off-by: David Bauer <mail@david-bauer.net>
* mediatek: rewrite flow offload codeFelix Fietkau2020-10-161-2/+2
| | | | | | | | | The code is now much cleaner and works better than the old code. Preparation for submitting it upstream (though with a different API) Also add back MT7621 support and fix flow table coherence issues on MT7622 Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ramips: drop kernel version switchesAdrian Schmutzler2020-10-093-35/+2
| | | | | | | The ramips target only supports 5.4, so drop all kernel version switches for older kernels there. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: fix logic level for DIR-645 buttonsDavid Bauer2020-10-031-2/+2
| | | | | | | | | | | The D-Link DIR-645 currently uses an incorrect logic level for its buttons. Correct them in order to prevent unintentional activation of failsafe mode. Reported-by: Perry Melange <isprotejesvalkata@gmail.com> Signed-off-by: David Bauer <mail@david-bauer.net>
* ramips: remove set_wifi_led function in 01_ledsAdrian Schmutzler2020-10-026-77/+53
| | | | | | | | | | | | | | | | | | | While we mostly use the ucidef_set_led_* functions directly in 01_leds we still have the set_wifi_led function in parallel for several old devices. This is not only inconsistent with the other definitions, it also links to the wlan0 interface instead of using a phy trigger which would be independent of the interface name (and is used for all newer devices anyway). Apart from that, the standard names "wifi" and "wifi-led" are not very helpful in a world with different radio bands either. Thus, this patch removes the set_wifi_led function and puts the relevant commands into the cases explicitly. This makes the mechanism used more evident and will hopefully lead to some future improvements or at least prevent some copy-pasting of the old setups. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: remove option to set WiFi LED via aliasesAdrian Schmutzler2020-10-027-21/+5
| | | | | | | | | | | | | In ramips, it's not common to use an alias for specifying the WiFi LED; actually only one device uses this mechanism (TL-WR841N v14). Particularly since the WiFi LEDs are typically distinguished between 2.4G and 5G etc. it is also not very useful for this target. Thus, this patch removes the setup lines for this mechanism and converts the TL-WR841N v14 to the normal setup. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: remove model name from LED labelsAdrian Schmutzler2020-10-02379-3123/+1975
| | | | | | | | | | | | | | | | | Like in the previous patch for ath79 target, this will remove the "devicename" from LED labels in ramips as well. The devicename is removed in DTS files and 01_leds, consolidation of definitions into DTSI files is done where (easily) possible, and migration scripts are updated. For the latter, all existing definitions were actually just devicename migrations anyway. Therefore, those are removed and a common migration file is created in target base-files. This is actually another example of how the devicename removal makes things easier. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: merge ethernet setup for RT-AC51U/RT-AC54UAdrian Schmutzler2020-09-283-10/+6
| | | | | | | The ethernet setup/label MAC address for RT-AC51U and RT-AC54U are the same, so move them into the shared DTSI. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* ramips: move dts-v1 statement to top-level DTSI filesAdrian Schmutzler2020-09-25414-695/+33
| | | | | | | | | | | | | | | | | The "/dts-v1/;" identifier is supposed to be present once at the top of a device tree file after the includes have been processed. In ramips, we therefore requested to have in the DTS files so far, and omit it in the DTSI files. However, essentially the syntax of the parent mtxxxx/rtxxxx DTSI files already determines the DTS version, so putting it into the DTS files is just a useless repetition. Consequently, this patch puts the dts-v1 statement into the top-level SoC-based DTSI files, and removes all other occurences. Since the dts-v1 statement needs to be before any other definitions, this also moves the includes accordingly where necessary. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>