Commit Graph

230 Commits (1634461bd208f4bd108ea5c3d3f1cf9eb56d4a7e)

Author SHA1 Message Date
Christian Lamparter 5d5c0b0582 apm821xx: wndr4700: restore sd-card media detection
This was not converted to the new, dt-based board name.

Fixes: e90dc8d272 ("apm821xx: convert to device-tree board detection")
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter a2266a6d42 apm821xx: shuffle helper scripts to the front
In a patch for the ath79, Mathias Kresin mentioned that
helper scripts should be in front of the device targets.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter d82d84694e apm821xx: add support for the Netgear WNDAP620 and WNDAP660
This patch adds support for the Netgear WNDAP620 and WNDAP660,
they are similar devices, but due to the LAN LED configuration,
the switch setup and WIFI configuration each gets a different
device target.

Hardware Highlights WNDAP620:
CPU: AMCC PowerPC APM82181 at 1000 MHz
DRAM:  128 MB, 2 x 64 MiB DDR2 Hynix H5PS5162GF
CPU: AMCC PowerPC APM82181 at 1000 MHz
FLASH: 32 MiB, NAND SLC, Hynix HY27US08561A
Ethernet: RealTek RTL8363SB 2x2-Port Switch PHY - Only 1 GBit Port (POE)
Wifi: Atheros AR9380 minipcie - Dual-Band - 3x3:3
Serial: console port with RJ45 Interface (9600-N-8-1)
LEDS: Power, LAN-Activity, dual color LAN-Linkspeed, 2.4GHz, 5GHz LEDs
Button: Soft Reset Button
Antennae: 3 internal dual-band antennae + 3 x RSMA for external antennaes

Hardware Highlights WNDAP660:
CPU: AMCC PowerPC APM82181 at 1000 MHz + 2 Heatsinks
DRAM:  256 MB, 2 x 128 MiB DDR2
FLASH: 32 MiB, NAND SLC, Hynix HY27US08561A
Ethernet: RealTek RTL8363SB 2x2-Port Switch PHY (POE)
Wifi1: Atheros AR9380 minipcie - Dual-Band - 3x3:3
Wifi2: Atheros AR9380 minipcie - Dual-Band - 3x3:3
Serial: console port with RJ45 Interface (9600-N-8-1)
LEDS: Power, LAN-Activity, 2x dual color LAN-Linkspeed, 2.4GHz, 5GHz LEDs
Button: Soft Reset Button
Antennae: 6 internal dual-band antennae + 3 x RSMA for external antennaes

Flashing requirements:

 - needs a tftp server at 192.168.1.10/serverip.
 - special 8P8C(aka RJ45)<->D-SUB9 Console Cable
   ("Cisco Console Cable"). Note: Both WNDAP6x0 have
   a MAX3232 transceivers, hence no need for any separate
   CMOS/TTL level shifters.

External Antenna:
The antennae mux is controlled by GPIO 11 and GPIO14. Valid Configurations:
 = Config# = | = GPIO 11 = | = GPIO 14 = |  ===== Description =====
      1.     |   1 / High  |  0 / Low    | Use the internal antennae (default)
      2.     |   0 / Low   |  1 / High   | Use the external antennae

The external antennaes are only meant for the 2.4 GHz band.

One-way Flashing instructions via u-boot:

 0. connect the serial cable to the RJ45 Console Port
    Note: This requires a poper RS232 and not a TTL/USB adaptor.

 1. power up the AP and interrupt the u-boot process at

    'Hit any key to stop autoboot'

 2. setup serverip and ipaddr env settings
    Enter the following commands into the u-boot shell
    # setenv ipaddr 192.168.1.1
    # setenv serverip 192.168.1.10

 3. download the factory.img image to the AP
    Enter the following commands into the u-boot shell

    # tftp ${kernel_addr_r} openwrt-apm821xx-nand-netgear_wndap660-squashfs-factory.img

 4. verfiy image integrity
    Enter the following commands into the u-boot shell

    # crc32 $fileaddr $filesize

    If the calculated crc32 checksum does not match, go back to step 3.

 5. flash the image
    Enter the following commands into the u-boot shell

    # nand erase 0x110000 0x1bd0000
    # nand write ${kernel_addr_r} 0x110000 ${filesize}

 6. setup uboot environment
    Enter the following commands into the u-boot shell

    # setenv bootargs
    # setenv fileaddr
    # setenv filesize
    # setenv addroot 'setenv bootargs ${bootargs} root=/dev/ubiblock0_0'
    # setenv owrt_boot 'nboot ${kernel_addr_r} nand0 0x110000; run addroot; run addtty; bootm ${kernel_addr_r}'
    # setenv bootcmd 'run owrt_boot'
    # saveenv

 7. boot
    # run bootcmd

Booting initramfs instructions via u-boot:

 Follow steps 0 - 2 from above.

 3. boot initramfs
    Enter the following commands into the u-boot shell

    # tftp ${kernel_addr_r} openwrt-apm821xx-nand-netgear_wndap660-initramfs-kernel.bin
    # run addtty
    # bootm ${kernel_addr_r}

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter fb4bed5fe9 apm821xx: import gpio-export DT code from lantiq
This will come in handy for the Netgear WNDAP620's antennae mux.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter f6968952df apm821xx: MR24: add to uboot-envtools
This patch adds the complicated u-boot
environment access settings for to the
MR24 target.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Koen Vandeputte bc3d47cd12 kernel: bump 4.14 to 4.14.78
Refreshed all patches.

Remove upstreamed:
- 050-net-emac-fix-fixed-link-setup-for-the-RTL8363SB-swit.patch

Compile-tested on: cns3xxx, imx6
Runtime-tested on: cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Christian Lamparter fc70276e6c apm821xx: add disk-activity triggers via DT.
The WNDR4700 and the MBL have a dedicated HDD activity LED.
This patch adds the default led triggers to the DTS and
removes the entries in 01_leds.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 1d5d77612f apm821xx: apm82181.dtsi overhaul
- order entries by mmio address where possible

 - switch to lower-case address values

 - comment on BSP u-boot behaviour in regards to
   what it edits and look for

 - annotate irq lines with the help of interrupt-names

 - remove deprecated "device_type" properties
   The pci and network device_type had to stay since
   they are required by the drivers and u-boot.
   the cpu and memory device_types will remain as well
   as they are still part of the DT Spec.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 9ca82c2374 apm821xx: force WNDR4700 console to 115200n8
With the upcoming 4.19 release, the serial console on the
Netgear WNDR4700 would no longer work as it is never really
set and always relied on the kernel's serial code not to
change the baud rate.

On the stock firmware, Netgear forced the console setting
through a custom CONFIG_CMDLINE in their kernel to 115200.
Normally, they should have done it in a different way and
just passed the baudrate through a "console=..." kernel
parameter via the bootargs in the "/chosen" dt node.
But in their default u-boot bootcmd setting, they somehow
forgot to add the "run addtty", so there's no easy way to
pass the baudrate from u-boot to the kernel. So it has
to be forced as otherwise it ends up as 9600 baud.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 68bb91018d apm821xx: set uart compatible to ns16750
The APM821XX/PPC460EX datasheet mentions:
"Register compatibility with 16750 register set"

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Mathias Kresin 80c61c161a treewide: use wpad-basic for not small flash targets
Add out of the box support for 802.11r and 802.11w to all targets not
suffering from small flash.

Signed-off-by: Mathias Kresin <dev@kresin.me>

Mathias did all the heavy lifting on this, but I'm the one who should
get shouted at for committing.

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
6 years ago
Koen Vandeputte 0d0bd8e6da kernel: bump 4.14 to 4.14.76
Refreshed all patches.

Compile-tested on: ar71xx, cns3xxx, imx6
Runtime-tested on: ar71xx, cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Christian Lamparter 64756a9a30 apm821xx: net: emac: fix fixed-link setup for the RTL8363SB switch
On the Netgear WNDAP620, the emac ethernet isn't receiving nor
xmitting any frames from/to the RTL8363SB (identifies itself
as a RTL8367RB).

This is caused by hardware not knowing the right forced link
settings (speed, duplex, pause, etc.) settings.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter c417aee9f1 apm821xx: fix dtc compiler warnings for MX60(W) and MR24's dts files
This patch fixes some of the dtc warnings:

MR24:
"reg" property in [...]mdio/phy@1 has invalid length (4 bytes)
Node [...]button@1 has a unit name, but no reg property
Relying on default #address-cells value for [...]phy@1
Relying on default #size-cells value for [...]phy@1

MX60(W):
Node [..]nand/all has a reg or ranges property, but no unit name
Node [..]button@1 has a unit name, but no reg property

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 2a926b1a0a apm821xx: remove wd, mybooklive-duo leftovers
The unification of the My Book Live Single and duo image in
commit 9b47aa93c7 ("apm821xx: unify My Book Live Single + Duo images")
made the wd,mybooklive-duo obsolete in most places and can
be removed.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 63a7cf6791 treewide: replace 'linux, stdout-path' with 'stdout-path'
This follows a similar upstream patch by Rob Herring:

|commit 78e5dfea84dc15d69940831b3981b3014d17222e
|Author: Rob Herring <robh@kernel.org>
|Date:   Wed Feb 28 16:44:06 2018 -0600
|    powerpc: dts: replace 'linux,stdout-path' with 'stdout-path'
|
|    'linux,stdout-path' has been deprecated for some time in favor of
|    'stdout-path'. Now dtc will warn on occurrences of 'linux,stdout-path'.
|    Search and replace all the of occurrences with 'stdout-path'.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Koen Vandeputte e9d92bf1e1 kernel: bump 4.14 to 4.14.72
Refreshed all patches.

Removed upstreamed:
- 203-MIPS-ath79-fix-restart.patch
- 0013-MIPS-ath79-fix-system-restart.patch
- 180-earlycon-initialize-port-uartclk-based-on-clock-frequency-property.patch
- 181-earlycon-remove-hardcoded-port-uartclk-initialization-in-of_setup_earlycon. patch
- 700-1-6-e1000e-Remove-Other-from-EIAC.patch
- 700-2-6-Partial-revert-e1000e-Avoid-receiver-overrun-interrupt-bursts.patch
- 700-3-6-e1000e-Fix-queue-interrupt-re-raising-in-Other-interrupt.patch
- 700-4-6-e1000e-Avoid-missed-interrupts-following-ICR-read.patch

Compile-tested on: cns3xxx, imx6
Runtime-tested on: cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Freddy Leitner 7aa5dc46ee apm821xx: MBL: load kernel/dtb from SATA 0:1 first
This remedies an issue with the MBL Duo if both disks are inserted
and contain OpenWrt. kernel and dtb would be loaded from SATA 1:1
while rootfs (/dev/sda2) would be mounted on SATA 0:1.

Such a mix&match would obviously only work if both OpenWrt versions/
builds are identical, and especially fail after sysupgrade upgraded
the system disk on SATA 0:1.

The fallback to SATA 1:1 needs to be kept for MBL Single (only has
SATA 1:1) and MBL Duo with one disk inserted on SATA 1:1. To speed
up booting in those cases, the unneccesarily doubled "sata init"
will only be called once. (In theory it could be omitted completely
since the on-flash boot script already initializes SATA to load the
on-disk boot script.)

Tested on MBL Duo (all possible combination of disks) and MBL Single

Acked-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Freddy Leitner <hello@square.wf>
6 years ago
Paul Wassi e348ccc4e6 treewide: fix some cosmetic glitches in dts files
- fix single spaces hidden by a tab
- replace indentation with spaces by tabs
- make empty lines empty
- drop trailing whitespace
- drop unnecessary blank lines

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Paul Wassi <p.wassi@gmx.at>
6 years ago
Mathias Kresin dd448cd276 treewide: fix upgrade led handling
The upgrade led is only used if a running led is defined. If no running
led is defined, the upgrade led is ignored and upgrade isn't indicated
at all.

Instead, turn off the running led prior to turning the upgrade led on.
In most cases there isn't any visual change, but it allows to use an
independent led for upgrade indication.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Stijn Tintel 22b9f99b87 kernel: bump 4.14 to 4.14.59
Drop patch that was superseded upstream:
ramips/0036-mtd-fix-cfi-cmdset-0002-erase-status-check.patch

Drop upstreamed patches:
- apm821xx/020-0001-crypto-crypto4xx-remove-bad-list_del.patch
- apm821xx/020-0011-crypto-crypto4xx-fix-crypto4xx_build_pdr-crypto4xx_b.patch
- ath79/0011-MIPS-ath79-fix-register-address-in-ath79_ddr_wb_flus.patch
- brcm63xx/001-4.15-08-bcm63xx_enet-correct-clock-usage.patch
- brcm63xx/001-4.15-09-bcm63xx_enet-do-not-write-to-random-DMA-channel-on-B.patch
- generic/backport/080-net-convert-sock.sk_wmem_alloc-from-atomic_t-to-refc.patch
- generic/pending/170-usb-dwc2-Fix-DMA-alignment-to-start-at-allocated-boun.patch
- generic/pending/900-gen_stats-fix-netlink-stats-padding.patch

In 4.14.55, a patch was introduced that breaks ext4 images in some
cases. The newly introduced patch
backport-4.14/500-ext4-fix-check-to-prevent-initializing-reserved-inod.patch
addresses this breakage.

Fixes the following CVEs:
- CVE-2018-10876
- CVE-2018-10877
- CVE-2018-10879
- CVE-2018-10880
- CVE-2018-10881
- CVE-2018-10882
- CVE-2018-10883

Compile-tested: ath79, octeon, x86/64
Runtime-tested: ath79, octeon, x86/64

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Christian Lamparter b70d3557e0 apm821xx: clean up gpio-hogs
convert the usb and both sata port power related gpio-hogs to
what they really are: fixed-regulators.

The ethernet phy-reset gpio-hog is replaced by a proper
upstream (4.15+) reset-gpios property in the mdio-node.
So this will work eventually.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter cff6548948 apm821xx: split MBL's rootfs.img.gz into a sysupgrade and factory image
@vahid-dan reported a issue with extracting the rpi images with
Gnome's Archive Manager:
"Ubuntu Archive Manager cannot extract the file and it just
throws a general error message: "An error occurred while
extracting files".
<https://forum.lede-project.org/t/corrupted-pre-built-v18-06-0-rc2-image-for-rpi>

The MBL's rootfs.img.gz image is generated in much the same way.
Hence this patch preemptively splits the rootfs.img.gz image into
a sysupgrade and a factory image.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter aed4799d6d apm821xx: build squashfs-rootfs images for the MBL
This patch adds support for squashfs as the root filesystem.

advantages:
 - migrate from a existing -ext4 installation and back
   with the sysupgrade utility
 - existing partition layout will not be lost during switch
 - slightly smaller image size as compared to the -ext4 image.

disadvantages:
 - needs f2fs + tools. This is because fstools rootdisk.c decides based
   on the partition size (currently root partitions > 100 MiB) f2fs is
   used as the rootfs_data filesystem.
 - rootfs_data is placed into the rootfs partition after the squashfs.
   This makes it difficult for tools that expect a /dev/sda${X} device.
   It also makes it difficult for data recovery tools as they might not
   expect to find a embedded partition or will be slightly confused.
   ... or will not support f2fs.

For people with existing build configurations: make sure to include mkf2fs
and f2fsck packages into the image. Otherwise the new -squashfs image will
only boot from the ram-overlay.

Note:
All overlay data (configurations/all installed packages/...) will be
placed in inside the rootfs partition (i.e. /dev/sda2) just after the
squashfs image.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 9b47aa93c7 apm821xx: unify My Book Live Single + Duo images
By takimata:
"Come to think of it, an MBL Single board boots up just fine on an
MBL Duo image, and the MBL Single board identifies completely
identical to the MBL Duo
(Board: Apollo-3G - APM82181 Board, 2*SATA, 1*USB).
I wonder if there is any downside to just using the MBL Duo firmware
on a MBL Single. I wonder if the two firmwares could even be unified."

<https://forum.lede-project.org/t/wd-mybook-live-duo-two-disks/16195/9>

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter c3f9a1ac0e apm821xx: attempt to fix sata access freezes
The original vendor's driver programmed the dma controller's
AHB HPROT values to enable bufferable, privileged mode. This
along with the "same priorty for both channels" could very
well fix the freezes that have been reported on the forum by
@ticerex and @takimata.

<https://forum.lede-project.org/t/wd-mybook-live-duo-two-disks/16195/46>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 12b80f1cab apm821xx: fix usb-otg on 4.14
Starting with 4.14, the "amcc,dwc-otg" needs to be used
in order to get the usb-otg to work.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Stijn Tintel e52f3e9b13 kernel: bump 4.14 to 4.14.48
Remove upstreamed patches:
generic/pending/101-clocksource-mips-gic-timer-fix-clocksource-counter-w.patch
generic/pending/103-MIPS-c-r4k-fix-data-corruption-related-to-cache-coherence.patch
generic/pending/182-net-qmi_wwan-add-BroadMobi-BM806U-2020-2033.patch
lantiq/0025-MIPS-lantiq-gphy-Remove-reboot-remove-reset-asserts.patch
Update patches that no longer apply:
generic/pending/811-pci_disable_usb_common_quirks.patch
ath79/0009-MIPS-ath79-add-lots-of-missing-registers.patch

Fixes CVE-2018-6412.

Compile-tested: octeon, x86/64.
Runtime-tested: octeon, x86/64.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Sergey Ryazanov 67a3cdcbb0 kernel: enable THIN_ARCHIVES by default
THIN_ARCHIVES option is enabled by default in the kernel configuration
and no one target config disables it. So enable it by default and remove
this symbol from target specific configs to keep them light.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov bdc2b58c4b kernel: enable FUTEX_PI by default
New FUTEX_PI configuration symbol enabled if FUTEX and RT_MUTEX symbols
are enabled. Both of these symbols are enabled by default in the
generic config, so enable FUTEX_PI by default too to keep platform
specific configs minimal.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov a08b0d0c31 kernel: enable EXPORTFS by default
OVERLAY_FS config symbol selects EXPORTFS since 4.12 kernel, we have
OVERLAY_FS enabled by default, so enable EXPORTFS in the generic config
of 4.14 and remove this option from platform specific configs.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov 978543a246 kernel: disable DRM_LIB_RANDOM by default
DRM_LIB_RANDOM config symbol selected only by DRM_DEBUG_MM_SELFTEST
which is disable by default, so disable DRM_LIB_RANDOM by default too.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov ead26e9db6 kernel: disable DMA_{NOOP|VIRT}_OPS by default
These options do not used by any supported arch, so disable them by
default to make arch configs a bit more clean.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Sergey Ryazanov f928c338ad kernel: disable ARCH_WANTS_THP_SWAP by default
Only one arch (x86_64) enables this option. So disable
ARCH_WANTS_THP_SWAP by default and remove referencies to it from all
configs (except x86_64) to make them clean.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
6 years ago
Christian Lamparter 16e39624b7 apm821xx: backport and reassign crypto4xx patches
This patch backports several patches that went upstream into
Herbert Xu's cryptodev-2.6 tree:

crypto: Use zeroing memory allocator instead of allocator/memset
crypto: crypto4xx - performance optimizations
crypto: crypto4xx - convert to skcipher
crypto: crypto4xx - avoid VLA use
crypto: crypto4xx - add aes-ctr support
crypto: crypto4xx - properly set IV after de- and encrypt
crypto: crypto4xx - extend aead fallback checks
crypto: crypto4xx - put temporary dst sg into request ctx

The older, outstanding patches from 120-wxyz series have been
upstreamed as well and therefore they have been reassigned to
fit into the series.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter e6e51ce87f apm821xx: don't select swconfig for the MR24
The swconfig package is part of the DEFAULT_PACKAGES list in
the apm821xx's nand subtarget. It's enabled by default because
the MX60(W) and WNDR4700 need it for their initramfs. However
the package is not necessary for the MR24's sysupgrade image, as
the MR24 does not have a switch.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Koen Vandeputte e2aa0c3f8b kernel: bump 4.14 to 4.14.41
Refreshed all patches

Dropped upstreamed patches:
522-PCI-aardvark-fix-logic-in-PCI-configuration-read-write-functions.patch
523-PCI-aardvark-set-PIO_ADDR_LS-correctly-in-advk_pcie_rd_conf.patch
525-PCI-aardvark-use-isr1-instead-of-isr0-interrupt-in-legacy-irq-mode.patch
527-PCI-aardvark-fix-PCIe-max-read-request-size-setting.patch

updated patches:
524-PCI-aardvark-set-host-and-device-to-the-same-MAX-payload-size.patch
030-USB-serial-option-fix-dwm-158-3g-modem-interface.patch

Added new ARM64 symbol: CONFIG_ARM64_ERRATUM_1024718

Compile-tested on: cns3xxx, imx6, mvebu (arm64), x86_64
Runtime-tested on: cns3xxx, imx6, x86_64

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
6 years ago
Mathias Kresin 74a0d8cd92 build: consolidate fake uImage header build commands
Merge the two existing functions and use a parameter for the type
header field.

It updates the syntax of the former mpc85xx fake ramdisk header
command to be compatible with mkimage from u-boot 2018.03 and fixes the
build error spotted by the build bot.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Christian Lamparter c61c709f4e apm821xx: Force Ethernet PHYID on MX60/MX60W
The MX60's uboot disables all the PHYs before starting linux.
This causes the PHY/switch detection code to malfunction
almost all of the time. To get around this, set a compatible
flag to force PHYID.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
6 years ago
Christian Lamparter c555b524c7 apm821xx: increase WNDR4700's dtb+kernel partition to 3.5 MiB
This patch cleans and reworks the WNDR4700 dts to increase the
now combined dtb+kernel partition to 3.5 MiB. This has become
necessary due to the switch to GCC 7.3 and the ever increasing
kernel binary size.

The dtb+kernel partition was combined in order to finally
fix the problem with out-of-sync device-trees. From now
on, the kernel and device-tree will always be updated together.

Upgrade Note:
Existing installations will have to use the TFTP firmware
recovery option in order to install the update. Affected users
are advised to make a backup of their existing configuration
prior to running sysupgrade:
<https://openwrt.org/docs/guide-user/installation/generic.backup#backup_openwrt_configuration>
Due to the repartitioning of the NAND, the generated backup
should be placed on either the internal HDD, an attached
USB-Stick or on another PC (externally).

To manually trigger the firmware recovery, the reset button has
to be pressed (and hold) during boot. U-boot will enter the "Upgrade
Mode" and starts a tftpserver listening on 192.168.1.1 for a
tftp client from one of the four LAN/Ethernet ports to connect and
upload the new system: (enable tftp binary mode!).
openwrt-apm821xx-nand-netgear_wndr4700-squashfs-factory.img

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter e2b35f91b3 apm821xx: switch MR24's initramfs to multi-image method
The recent change to switch to gcc 7.3 broke the image
generation code, as the kernel would no longer fit into
KERNEL_SIZE.

This patch fixes the issue by reworking the initramfs
creation and packaging, which will get rid of the
KERNEL_SIZE check in the process.

This new initramfs can be loaded through the MR24 U-boot
in the following way:

=> setenv ipaddr 192.168.1.1
=> setenv bootargs console=ttyS0,$baudrate
=> tftpboot c00000 192.168.1.2:meraki_mr24-initramfs-kernel.bin
[...]
Load address: 0xc00000
Loading: ################################################ [...]
done
    Bytes transferred = 5952544 (5ad420 hex)
    => bootm $fileaddr
    \## Booting kernel from Legacy Image at 00c00000 ...
    ...

For more information and the latest flashing guide:
please visit the OpenWrt Wiki Page for the MR24:
<https://openwrt.org/toh/meraki/mr24#flashing>

Cc: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
6 years ago
Stijn Segers 41a881a8d9 Kernel: bump 4.14 to 4.14.29
Right patch version this time, sorry!

* Patch 180-usb-xhci-add-support-for-performing-fake-doorbell.patch had to be adjusted slightly because of upstream adapted code.
* Refreshed patches.

Compile-tested: ramips/mt7621, x86/64
Run-tested: ramips/mt7621, x86/64
Signed-off-by: Stijn Segers <foss@volatilesystems.org>
Tested-by: Rosen Penev <rosenp@gmail.com>
6 years ago
Mathias Kresin 9e0d808700 apm821xx: nand remove obsolete kernel config symbol
The missing CONFIG_USB_XHCI_PCI dependency on CONFIG_USB_PCI of the
µPD720201 xhci-pci(e) usb 3.0 chip used by the WNDR4700 was fixed with
6112abf186 ("kernel: enable CONFIG_USB_PCI for PCI usb modules").

Commit c38fb58576 ("kernel: fix disabling common usb quirks on 4.14")
finally fixed the following build error:

drivers/usb/host/xhci-pci.c: In function 'xhci_pci_probe':
drivers/usb/host/xhci-pci.c:749:6: error: implicit declaration of function 'usb_xhci_needs_pci_reset' [-Werror=implicit-function-declaration]
  if (usb_xhci_needs_pci_reset(dev)) {

Hence the CONFIG_USB_PCI symbol isn't required any longer in target kernel
config.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin 188328111b treewide: move nand_do_upgrade call to platform_do_upgrade
Calling nand_do_upgrade() from platform_pre_upgrade() was deprecated
with 30f61a34b4 ("base-files: always use staged sysupgrade").

Update the platform upgrade code to use platform_do_upgrade() for NAND
images as well.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Mathias Kresin c4ac02ffca treewide: remove obsolete sysupgrade watchdog kill
The watchdog kill command was meant for busybox watchdog. Busybox watchdog
was replaced by the procd watchdog mid 2013 with commit df7ce9301a
("busybox: disable the watchdog utility by default"), which makes the kill
command obsolete since quite some time.

Signed-off-by: Mathias Kresin <dev@kresin.me>
6 years ago
Stijn Tintel 3072908d0d kernel: bump 4.14 to 4.14.18
Refresh patches.

Remove upstreamed patches:
- apm821xx/010-crypto-gcm-add-GCM-IV-size-constant.patch
- backport/040-crypto-fix-typo-in-KPP-dependency-of-CRYPTO_ECDH.patch
Remove pending-4.14/650-pppoe_header_pad.patch, it is superseded by
upstream commit d32e5740001972c1bb193dd60af02721d047a17e.
Update patch that no longer applies: hack/204-module_strip.patch

Compile-tested: octeon, x86/64.
Runtime-tested: octeon, x86/64.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Felix Fietkau cde71a543c build: replace uses of OpenWrt with $(VERSION_DIST)
This makes the distribution name more configurable.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
6 years ago
Christian Lamparter 3c94691620 apm821xx: remove kernel 4.9 support
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter e97f92bbf9 apm821xx: switch to 4.14.x kernel
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 780477d17c apm821xx: backport crypto4xx patches from 4.15
This patch backports changes to crypto4xx in order
to get the crypto4xx operational.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter e4371779d2 apm821xx: convert MR24 to use DT PHY defintion
Convert the MR24 to use the DT phy probing and at803x PHY driver.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Christian Lamparter 15faf389ad apm821xx: add linux 4.14 apm821xx patches
This patch updates the apm821xx target to use the 4.14 kernel.

4.14 finally ships with a driver for the WNDR4700's tc654 fan
controller. The custom driver is deprecated in favor of the
upstream driver and the thermal cooling definitions in the DTS
are updated.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
6 years ago
Kevin Darbyshire-Bryant 1d2590f838 kernel: bump 4.9 to 4.9.75
Refresh patches

Fixes:  CVE-2017-5754 aka Meltdown

Tested-on: ar71xx Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
Tested-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
[fix conflict after 4.14 bump]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
Christian Lamparter e90dc8d272 apm821xx: convert to device-tree board detection
This patch converts all apm821xx devices to the device-tree
board-detection method. All instances of the legacy
boardnames (mbl,mr24,...) are converted to "vendor,device"
identifier.

The custom board-detection code in apm821xx.sh is removed as
it no longer serves any purpose.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 213ba77359 apm821xx: enable metadata for packaging
This patch enables metadata-supported image verification
for all apm821xx supported devices. Since this method comes
with a built-in image verification tool (fwtool), the previous
image checks can be removed.

Signed-off-by: Mathias Kresin <dev@kresin.me>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter e6604fab51 apm821xx: align device names with vendor_device format
Currently, the device name handle does not include the
manufacturer. This can make it hard do differentiate
between products from different vendors that have the
same product name. As the handle is used to derive
the image name.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 1adeecf0d3 apm821xx: dts: rename devices dts files to include the manufacturer
This patch rename all the DT source files in order to
match upstream's "manufacturer-device.dts" format.

Please note that the DEVICE_DTB isn't changed. This is
because the u-boot of the MyBook Live defines the
fdt_file variable to be "apollo3g/apollo3g.dtb".

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 70301af915 apm821xx: add product names to the dt compatible for Meraki
Meraki choose to use their product's codename as the main
compatible string. Mathias Kresin commented that this is
a poor choice as this will confuse the users and devs once
the device-tree compatible is used for board-detection and
possible the image name.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 64b36fee8e apm821xx: dts: append SoC compatible to DTS
This patch appends the "apm,bluestone" or "amcc,apollo3g"
machine compatible string to the current device tree source.

Please note that unlike other archs the PPC DT code does
not regard the machine's compatible string as a priority
list. This is explained in the kernel's usage-model.txt as follows:
"PowerPC uses a slightly different scheme where it calls the .probe()
hook from each machine_desc, and the first one returning TRUE is used.
However, this approach does not take into account the priority of the
compatible list, and probably should be avoided for new architecture
support."

For this reason, the "apm,bluestone" compatible string can't be
added to the WNDR4700. As otherwise the target specific pci
fix-up code will get ignored and this causes the ath9k WIFI
to not get initialized.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter e4a50d115f apm821xx: replace DEVICE_{PROFILE|NAME} with BOARD_NAME
This patch sets the BOARD_NAME variable on each affected
apm821xx device. The existing DEVICE_PROFILE and
DEVICE_NAME assignments are deprecated as they no longer
serve any purpose.

The BOARD_NAME variable is used by the sysupgrade-tar
method to specifiy a directory overwrite for the
sysupgrade-$dir directory in the generated tar file.
Keeping the original boardname in this context will be
necessary for targets that utilize the sysupgrade-tar
method. Otherwise, sysupgrade on an previous installation
will not recognize the newly generated images.

This step is necessary since an upcoming patch realigns
the existing shortname for a device with a proper
"manufacturer_device" identifier.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter f895f1e51a apm821xx: replace whitespace with tabs
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 7c2106696d apm821xx: explicitly build the rootfs.img.gz target
The commit 87b668765e
("image: when using the new image build code, gzip ext4 images by default")

forced that all targets that select the ext4 as the root filesystem
to always compress the generated rootfs. This is fine, but this method
doesn't not allow to append the metadata on a per-target base.

Therefore this patch changes the rootfs image production rule to generate
the gzip step manually. This way the metadata can be appended at a later
date.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter cb02a376b3 apm821xx: use x86's upgrade scripts for MyBook Live
Advantages:
 - preserves existing partition layout. On the hard-drive.
   Only the boot and rootfs partition will be overwritten.

Disadvantages:
 - The upgrade process takes much longer to run.
   from 2-3 seconds to 15-25 seconds.

Please note that sysupgrade will refuse to upgrade, if the existing
installation has an incompatible partition layout. Future changes
to the bootfs and/or rootfs partition size will likely cause breakage
to the sysupgrade procedure. In these cases, the ext4-rootfs.img.gz
has to be written manually onto the disk. Please don't forget to backup
your configuration in this cases.

Note2: This patch requires
"base-files: upgrade: make get_partitions() endian agnostic"

Note3: If your current installation does not host the two
changes, sysupgrading will wipe the existing partition
layout. Don't forget to backup your data!

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 0cad9f09be apm821xx: MyBook Live convert to DT PHY
Changes MyBook Live to use DT PHY probing and the broadcom phy driver.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Christian Lamparter 6ad56fb34c apm821xx: convert to dt based diag LED script
Please note that users with a Netgear WNDR4700
will need to update the device-tree partition
manually.

For instructions, please refere to commit 49856a4bb5
("apm821xx: make it possible to update the dtb partition on the WNDR4700")

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
7 years ago
Zoltan HERPAI 7b5c989ab9 merge: targets: update image generation and targets
Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>
7 years ago
Kevin Darbyshire-Bryant 886d66abcd kernel: bump 4.9 to 4.9.57
Refresh patches.
Compile-tested for ar71xx - Archer C7 v2
Runtime-tested on  ar71xx - Archer C7 v2

Fixes the following CVEs:

- CVE-2017-7518
- CVE-2017-0786
- CVE-2017-1000255
- CVE-2017-12188
- CVE-2017-15265

Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk>
7 years ago
Hauke Mehrtens 88f3c63572 kernel: update kernel 4.9 to version 4.9.40
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Mathias Kresin e4e984f2a0 treewide: use only board_name function to get name
Do not parse /tmp/sysinfo/board_name, /proc/cpuinfo or the device tree
compatible string directly. Always use the board_name function to get
the board name.

The admswconfig package still reads /proc/cpuinfo directly. The code
looks somehow broken and the whole adm5120 which uses this package
looks unmaintained. Leave it as it is for now.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin e0b9ec8e96 treewide: drop target board_name functions
They are not used any longer.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin f12a32630f treewide: use the generic board_name function
Use the generic function instead ot the target specific ones.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Mathias Kresin ac3e05c5d7 treewide: populate boardname and model earlier
For targets using the generic board detection and board specific
settings in diag.sh, the board name is still unset at the time the
set_state() provided by diag.sh is called by 10_indicate_preinit.

Change the execution order to ensure the boardname is populated before
required the first time. Do the target specific board detection as
early as possible, directly followed by the generic one to allow a
seamless switch to the generic function for populating /tmp/sysinfo/.

Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Koen Vandeputte cd54b2d42b kernel: update kernel 4.9 to 4.9.37
- Refreshed all patches
- Removed upstreamed
- Adapted 4 patches:

473-fix-marvell-phy-initialization-issues.patch
-----------------------------------------------
Removed hunk 5 which got upstreamed

403-net-phy-avoid-setting-unsupported-EEE-advertisments.patch
404-net-phy-restart-phy-autonegotiation-after-EEE-advert.patch
--------------------------------------------------------------
Adapted these 2 RFC patches, merging the delta's from an upstream commit
(see below) which made it before these 2.

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-
stable.git/commit/?h=v4.9.36&id=97ace183074d306942b903a148aebd5d061758f0

180-usb-xhci-add-support-for-performing-fake-doorbell.patch
-----------------------------------------------------------
- Moved fake_doorbell bitmask due to new item

Compile tested on: cns3xxx, imx6
Run tested on: cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
7 years ago
Stijn Tintel 880f73c327 kernel: cleanup CONFIG_SCHED_HRTICK
Remove CONFIG_SCHED_HRTICK from target configs, as it was added to the
generic config in b47fd76563.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Koen Vandeputte 69649a1b45 kernel: update kernel 4.9 to 4.9.34
- Refreshed all patches
- Adapted 1 (0031-mtd-add-SMEM-parser-for-QCOM-platforms.patch)

Compile tested on: brcm2708, cns3xxx, imx6
Run tested on: brcm2708, cns3xxx, imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
[Compile and run tested on brcm2708]
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
7 years ago
Christian Lamparter 6adc757097 apm821xx: MR24: fix ethernet phy detection on the MR24
To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
This patch fixes a problem where the AR8035 PHY can't be
detected on the Cisco Meraki MR24, when the ethernet cable
is not connected during boot.

Russell Senior reported:
|This appears to be a problem during probing of the AR8035
|phy chip. When ethernet has no link, the phy detection fails,
|and eth0 is not created. Plugging ethernet later has no effect,
|because there is no interface as far as the kernel is
|concerned. The relevant part of the boot log looks like this:
|
|[    0.876611] /plb/opb/emac-rgmii@ef601500: input 0 in RGMII mode
|[    0.882532] /plb/opb/ethernet@ef600c00: reset timeout
|[    0.888546] /plb/opb/ethernet@ef600c00: can't find PHY!
(<https://bugs.lede-project.org/index.php?do=details&task_id=687>)

Fixes FS#687
Cc: Chris Blake <chrisrblake93@gmail.com>
Reported-by: Russell Senior <russell@personaltelco.net>
Fixes: 23fbb5a87c56e98 ("emac: Fix EMAC soft reset on 460EX/GT")
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
7 years ago
Sergey Ryazanov 68e7a2a0b7 kernel: disable CONFIG_SG_POOL by default
CONFIG_SG_POOL symbol is selected only by CONFIG_SCSI, since the last
one is disabled by default then disable CONFIG_SG_POOL by default too.
And explicitly enable it only for platforms that use CONFIG_SCSI.

Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
7 years ago
Hauke Mehrtens 0b17375931 kernel: update kernel 4.9 to 4.9.30
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Koen Vandeputte e842e16f45 kernel: update kernel 4.9 to 4.9.29
- Refresh all patches
- Removed upstreamed
- Adapted 1

Compile tested on: bcm53xx, cns3xxx, imx6, lantiq
Run tested on: cns3xxx & imx6

Signed-off-by: Koen Vandeputte <koen.vandeputte@ncentric.com>
[update from 4.9.28 to 4.9.29]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Chris Blake 8f43ba8c48 apm821xx: Merge the Cisco Meraki MX60 & MX60W
Both of these boards share the same DTS, and hardware. The only
difference would be the PCI-E slot, and ath9k card found on the MX60W.
Due to the similarities, it would be more efficient to merge these
profiles.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
7 years ago
Chris Blake d1c3a9485a apm821xx: Add default packages to NAND target
This moves core router packages to the NAND target, to ensure they are
applied to all images. This change is being done due to an issue found
when flashing the MX60W image, which came without these when built as a
multi image.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
7 years ago
Christian Lamparter cead8f9dfd apm821xx: remove 4.4 kernel support
Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
7 years ago
Hauke Mehrtens 31c6452107 kernel: update kernel 4.4 to 4.4.53
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Felix Fietkau 9467ce42da build: get rid of host.mk
Defined required host related variables in toplevel.mk instead

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
John Crispin 60a52cd4b4 apm821xx: adds missing symbol to v4.9 default config
Signed-off-by: John Crispin <john@phrozen.org>
7 years ago
Christian Lamparter 9a9f2f97e6 apm821xx: add linux 4.9 apm821xx patches
This patch updates the apm821xx target to use the 4.9 kernel.

Signed-off-by: Christian Lamparter <chunkeey@googlemail.com>
7 years ago
Joseph C. Lehner 7d00cfe9bb build: centralize fakeroot code
This patch moves the fakeroot code required by some devices to
`image-commands.mk`.

Create the fakeroot on the fly by using the undocumented -s (skip copy)
parameter of mkimage.

Signed-off-by: Joseph C. Lehner <joseph.c.lehner@gmail.com>
[remove unused NETGEAR_KERNEL_MAGIC, remove workarounds to have a dummy
rootfs for mkimage]
Signed-off-by: Mathias Kresin <dev@kresin.me>
7 years ago
Hauke Mehrtens 5b089e45a6 kernel: update 4.4 kernel to 4.4.42
Refresh patches on all 4.4 supported platforms.
Compile & run tested: lantiq/xrx200

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 years ago
Felix Fietkau 87b668765e image: when using the new image build code, gzip ext4 images by default
This reduces the amount of hacks in the makefile code.

Remove the apm821xx code to do the same - it was broken and left both
compressed and uncompressed images in $(BIN_DIR)

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Felix Fietkau 018d80007e kernel: remove ubifs xz decompression support
It has been unused, and less useful than squashfs for cases where flash
space usage matters.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
7 years ago
Kevin Darbyshire-Bryant 102cb4742c kernel: bump to 4.4.35
Refresh patches on all 4.4 supported platforms.

077-0005-bgmac-stop-clearing-DMA-receive-control-register-rig.patch
removed as now upstream.

Compile & run tested: ar71xx - Archer C7 v2

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
8 years ago
Christian Lamparter 49856a4bb5 apm821xx: make it possible to update the dtb partition on the WNDR4700
Currently, the device-tree partition is marked as read-only.
Hence, userspace tools like mtd can't write into the partition.
This however will be necessary in case the DTB needs to be
updated.

This patch also adds the kernel.dtb image, so the compiled
DTB is exported as a file and available in the binary
directory along the firmware images.

Note: the u-boot does expects the dtb to be a uimage.

To update the dtb manually:
 1. copy the generated dtb to the router.
 2. mtd erase /dev/mtd2
 3. mtd write wndr4700.dtb /dev/mtd2

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Chris Blake f478ec2007 apm821xx: Add support for the Cisco Meraki MX60/MX60W
This patch adds support for the Cisco Meraki MX60/MX60W Security
Appliance. Flashing information can be found at
https://github.com/riptidewave93/LEDE-MX60

Specs are as follows:
AppliedMicro APM82181 SoC at 800MHz
1GiB NAND - Samsung K9K8G08U0D
512MB DDR RAM - 4x Nanya NT5TU128M8GE-AC
Atheros AR8327-BL1A Gigabit Ethernet Switch
1x USB 2.0 Port

More info can be found at https://wiki.openwrt.org/toh/meraki/mx60

Cc: Christian Lamparter <chunkeey@gmail.com>

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
8 years ago
Stijn Tintel 8e47655d4e kernel: update kernel 4.4 to version 4.4.32
Refresh patches for all targets that support kernel 4.4.
Compile-tested on all targets that use kernel 4.4 and aren't marked broken.
Runtime-tested on ar71xx, octeon.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
8 years ago
Christian Lamparter b9f609161d apm821xx: remove replaced netgear, wndr4700-usb dwc2 definiton
This special dwc2 device definition for the Netgear WNDR4700
has been replaced by amcc,usb-otg-405ex.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter ebaa82a2ca apm821xx: consolidate apm821xx device trees files
This patch moves the common SoC device tree entries
from the currently four supported platforms into a
common apm82181.dtsi.

Furthermore, this patch also changes the GPIO, IRQ and
input definitions of the supported platforms to use the
defined dt-bindings macros for GPIO_ACTIVE_LOW|HIGH,
KEY_WPS|RESTART|*, IRQ_TYPE_* when it's appropriate.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter 3a112113e7 apm821xx: add amcc, usb-otg-405ex devicetree definition
This patch adds support for the amcc,usb-otg-405ex device
which is found in all APM82181 SoCs.
Note: The system can't use the generic "snps,dwc2" compatible
because of the special ahbcfg configuration. The default
GAHBCFG_HBSTLEN_INCR4 of snps,dwc2 can cause a system hang
when the USB and SATA is used concurrently.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter b5638bb64e apm821xx: redo WAN green and yellow LEDs
Because the WAN port is handled by the internal AR8327N switch, the
device should use swconfig_leds trigger to handle the link activity
of the WAN LED. This has the added bonus that the WAN LED will now
go dark if there's no ethernet cable connected to the WAN port.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter 8f2c2f94cf apm821xx: add back end-of-UBI marker for the WNDR4700 and MR24
The patch "build: drop UBI EOF marker from images by default"
(commit d27bce8d28) removed the
end-of-UBI marker. Without this marker, the boards will panic
during boot:

[    1.683458] ubi0: attaching mtd4
[    1.696181] ubi0 warning: scan_peb: valid VID header but corrupted EC header at PEB 31
[    1.704367] ubi0 error: scan_peb: bad image sequence number 549886691 in PEB 32, expected 184585623
[    1.713377] Erase counter header dump:
[    1.717110]  magic          0x55424923
[    1.720843]  version        1
[    1.723797]  ec             0
[    1.726752]  vid_hdr_offset 512
[    1.729880]  data_offset    2048
[    1.733094]  image_seq      549886691
[    1.736740]  hdr_crc        0x92ba8130
[    1.740472] erase counter header hexdump:
[    1.744493] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd4, error -22
[    1.751528] UBI error: cannot attach mtd4
[    1.755373] hctosys: unable to open rtc device (rtc0)
[    1.761130] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    1.768604] Please append a correct "root=" boot option; here are the available partitions:
[...]
[    1.856992] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    1.866519] Rebooting in 1 seconds..Auto calibration ---

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Rafał Miłecki c9fdb23345 apm821xx: fix USB LED trigger for WNDR4700
The old usbdev trigger never supported assigning more than 1 USB port.
This code we got was never working as expected and it was missing 2 more
ports. Switch to usbport to have LED working with all ports.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
Tested-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Rafał Miłecki 0658527e1e switch to the new usbport LED trigger
This makes init.d script handle existing UCI entries using the new
trigger. It also switches all targets to use its package.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
8 years ago
Christian Lamparter 4fc48a8cf2 apm821xx: replace recovery image for the MBL with initramfs
The patch "images: bump default rootfs size to 256 MB"
a1f83bad60 caused a crash
during boot for the recovery images. This is because
both variants of the MyBook Live only have 256MB of RAM
and for the recovery option, the ext4 rootfs was simply
stored in the RAMDISK.

This patch replaces recovery image for the MBL with an
initramfs kernel.

In order to boot the initramfs (for recovery or development):

0. copy the initramfs and device tree into tftp's server directory
   # cp *-initramfs-kernel.bin to /tftp-server/mbl.bin
   # cp *-ext4-kernel.dtb to /tftp-server/fdt.bin

1. Connect the MyBook Live (Duo) serial port.
   (Warning! Use a 3.3v level shifter).

2. Hit Enter during u-boot and insert these three lines:
   # setenv serverip 192.168.1.254; setenv ipaddr 192.168.1.1;
   # tftp ${kernel_addr_r} mbl.bin; tftp ${fdt_addr_r} fdt.bin
   # run addtty addmisc; bootm ${kernel_addr_r} - ${fdt_addr_r}

   Where 192.168.1.254 is your TFTP server.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Álvaro Fernández Rojas d14c28fc80 kernel: update kernel 4.4 to version 4.4.20
Refresh patches for all targets that support kernel 4.4.
Compile-tested on brcm2708 only.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
8 years ago
Mathias Kresin a499d0a6b5 image: specify max image size in Kilobyte/Megabyte
Use the k and m unit suffix to be consistent with the blocksize.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin e7ec7a08aa image: use k as unit suffix for blocksize
Use k as unit suffix for kilobyte to have a the same unit regardless of
the used filesystem.

Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Mathias Kresin d7b6f0ea88 apm821xx: image: add support for k unit suffix to boot-img
Signed-off-by: Mathias Kresin <dev@kresin.me>
8 years ago
Christian Lamparter e9f86c6cac apm821xx: backport generic HDD led-triggers for WNDR4700 and MBL
This patch backports the new generic HDD/SDD led-trigger
from 4.8-rc1.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter f7c1d9c8a5 apm821xx: detect sd-card media changes for the WNDR4700
The insertion or removal of the sd-card cannot be detected
by the hardware itself. This is by design. To workaround this,
for the WNDR4700 unload/load the dwc2 module in case the
the special SD CARD GPIO line is low/high.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter 78e63ce7e3 apm821xx: add size check for initramfs kernel for the Meraki MR24
Russell Senior reported an issue with the MR24 initramfs kernels:
> ## Booting kernel from Legacy Image at 00c10000 ...
>   Image Name:   POWERPC LEDE Linux-4.4.19
>   Created:      2016-08-31  11:57:05 UTC
>   Image Type:   PowerPC Linux Kernel Image (gzip compressed)
>   Data Size:    2155723 Bytes = 2.1 MiB
>   Load Address: 00000000
>   Entry Point:  00000000
>   Verifying Checksum ... OK
>Wrong Ramdisk Image Format
>Ramdisk image is corrupt or invalid

For the MR24, the kernel is uploaded to 0x10000. The ramdisk starts
at 0x200000. This leaves the kernel with just 0x1f0000 bytes = 1984kb.
This patch adds a size check so the image creation script will abort
instead of producing a unbootable initramfs image. A separate patch
"apm821xx: Fix initramfs image for the Meraki MR24" which fixed the
reported issue was submitted earlier.

Cc: Russell Senior <russell@personaltelco.net>
Cc: Chris Blake <chrisrblake93@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
riptidewave93 bc36678bdb apm821xx: Fix initramfs image for the Meraki MR24
When gzip is used, our kernel is too large and this causes the ramdisk
to be at the wrong offset. Fix by moving to lzma.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
8 years ago
Felix Fietkau aa53f78038 build: fix subtarget descriptions
Move Target/Description above the target.mk include

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Stijn Tintel 8072264b96 kernel: update kernel 4.4 to version 4.4.19
Refresh patches for all targets that support kernel 4.4.
Compile-tested on all targets that use kernel 4.4 and aren't marked broken.
Runtime-tested on ar71xx, octeon and x86/64.

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
8 years ago
Jo-Philipp Wich 4d9fc1bd44 apm821xx: fix IB image building
Change the image build code to generate the DTB files as part of the kernel
build phase in order to fix the image build in the ImageBuilder environment.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Felix Fietkau 63b525dd6b image: add a helper variable for getting kernel/rootfs from within image Build/* templates
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Jo-Philipp Wich db49dd894e build: rename sysupgrade-nand to sysupgrade-tar
Now that the "sysupgrade-nand" step is used by non-NAND targets as well,
rename it to "sysupgrade-tar" to make it more generic.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
8 years ago
Felix Fietkau 119b4422f8 apm821xx: only attempt to mount /boot on MyBook Live
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Christian Lamparter 3f506bdbb0 apm821xx: fix atheros PCIe cards on the MR24
The consolidation of the MR24 and WNDR4700 subtargets
into the nand subtarget broke MR24's atheros wlan.
This was because the wndr4700's board code used a
pci_fixup routines to supply the ath9k module with
the calibration data.

This is not necessary on the MR24 as it has standard
mini-pcie ports. Hence the two AR9380 mini-pcie cards
do not need any calibration data overrides.

Cc: chrisrblake93@gmail.com
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter 08257a4053 apm821xx: use lzma compression for the initramfs images
The MR24's u-boot takes it sweet time decompressing the
LZMA-packed initramfs image. A user reported that
compared to the old gzip method in v2: it "takes a ton
longer to decompress like 4\x the old boot time for
decompression".

This patch also fixes a issue with the WNDR4700's initramfs
image getting to big and causing the following u-boot crash
during the decompression:

"Uncompressing Multi-File Image ... Error: inflate() returned -5
out-of-mem or overwrite error - must RESET board to recover"

This patch fixes both issues by reverting the MR24's initramfs
compression method back to gzip. And choosing to compress the
initramfs within the initramfs image as LZMA by default.

Cc: chrisrblake93@gmail.com
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Felix Fietkau 07577c5ebe tools: bring back genext2fs for apm821xx
This reverts commit 8c68c104ea.
It is used for apm821xx, which needs ext2 (not ext4) images for some
devices.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 39429b3d20 apm821xx: rework image build code for MyBook Live
Eliminate redundant mkfs calls, preparation for upcoming image build
core rework

Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 3886644632 apm821xx: add DEVICE_DTS_DIR variable, remove redundant DEVICE_VARS entry
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Felix Fietkau 44c39d5812 apm821xx: add missing default profiles for subtargets
Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 years ago
Christian Lamparter 9e0fd1b52a apm821xx: add support for the Netgear Centria N900 WNDR4700/WNDR4720
This patch adds support for Netgear Centria N900 WNDR4700/WNDR4720

hardware highlights:

CPU:	AMCC PowerPC APM82181 Rev. E at 1000 MHz (PLB=166, OPB=83, EBC=83 MHz)
	Security support, Boot ROM Location NAND wo/ECC 2k page (8 bits)
	32 kB I-Cache 32 kB D-Cache, 256 kB L2-Cache, 32 kB OnChip Memory
Board:	AMCC APM82181 Evaluation Board, PCIE0/SATA1, 1*USB OTG
DRAM:	256 MB (ECC not enabled, 500 Mb/s, 32-bit, CL3)
NAND:	128 MiB (SLC, erase size: 128 KiB, page size: 2048, OOB size: 64)
ETH:	Atheros AR8327N Gigabit Switch (4 x LAN, 1 x WAN)
USB:	2 x 3.0 (Renesas uPD720202K8-711-BAA-A, firmware not included)
SATA:	1 x SATA-II 3.5" Hard Drive Bay for HDDs (DesignWare SATA).
WLAN1:	Atheros AR9380 5GHz 802.11an 3:3x3
WLAN2:	Atheros AR9581 2.4GHz 802.11bgn 3:3x3
SDCARD:	GL827L SD/MMC/MS Flash Card Reader (on internal dwc2 USB 2.0 host)
I2C:	GMT G781 (i2c-0 @ 0x4d - lm90 compatible temperature sensor)
	TC654    (i2c-0 @ 0x1b - Dual PWM fan Speed controller)

WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!

INFO: Since this device only has a NAND chip. I opted for going with
root.squashfs in a UBI volume. There's no squashfs/jffs2 image.

This target produces three images.
  a. netgear factory image
     This image can be used to flash the Netgear WNDR4700 via the
     firmware recovery mechanism and the web admin site.

     The bootloader can be instructed to do a firmware recovery via the
     # fw_recovery
     command. It will start a tftp server and listen on 192.168.1.1
     (the ipaddr variable in u-boot) for incoming, binary tftp clients.
     The firmware recovery mechanism is also started if any of the flash
     content which contains the kernel, device-tree definitions or the
     (fake)rootfs fails to verify or load.

  b. sysupgrade.tar image for sysupgrade
     An sysupgrade will replace the entire current LEDE installation
     with a newer version. This does include the kernel and the ubi rootfs
     partition. The configuration can be carried over automatically as well
     if desired.

     simply copy the sysupgrade.tar to a the WNDR4700 running LEDE and run:

     root@lede:~# sysupgrade sysupgrade.tar

     and let it reboot.

     Note: The devicetree flash area is NOT updated. Until the devicetree
	   definition is stable, this can lead to all sorts of hardware
	   detection problems! So make sure, if you experience issues: try
	   the fw_recovery. If you are unsure whenever this affects you:
	   test if you can reproduce your issue with the initramfs method.
	   As it will always have up-to-date device-tree definitions.

  c. initramfs image for TFTP (for development and testing)
     To use the initramfs method, follow the following steps:
       1) Move the "lede-apm821xx-netgear-WNDR4700-initramfs-kernel.bin"
	  file to to the root directory of your TFTP server.

       2) rename it to wndr4700.bin

       3) On the WNDR4700 - Hit Enter during u-boot and insert:
	  # tftp 400000 wndr4700.bin; run addtty; bootm 400000 -

     This will boot the LEDE image.

     Note: The default tftp server is 192.168.1.7, if you want to change it:
     # setenv serverip 192.168.8.7;

     Note2: The default address for the WNDR4700 is 192.168.1.1:
     # setenv ipaddr 192.168.8.8;

     Note: Connect you tftp server on the last LAN port (not the WAN)

Note: The firmware for the USB 3.0 Host chip is not included anymore.
Therefore the two USB 3.0 ports will not work without the
uPD7070x-firmware package installed.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter 47eeb9f857 apm821xx: lm90 add thermal sensor interface support for device tree
From 912-hwmon-lm90-expose-to-thermal-fw-via-DT.patch:
"This patch adds to lm90 temperature sensor the possibility
to expose itself as thermal zone device, registered on the
thermal framework.

The thermal zone is built only if a device tree node
describing a thermal zone for this sensor is present
inside the lm90 DT node. Otherwise, the driver behavior
will be the same."

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter b46e2a6d95 apm821xx: tc654: add driver for Microchip TC654/TC655 PWM fan controllers
This patch adds a hwmon driver for the Microchip TC654 and TC655
Dual SMBus PWM Fan Speed Controllers with Fan Fault detection.

The chip is described in the DS2001734C Spec Document from Microchip.
It supports:
	- Shared PWM Fan Drive for two fans
	- Provides RPM
	- automatic PWM controller (needs additional
	  NTC/PTC Thermistors.)
	- Overtemperature alarm (when using NTC/PTC
	  Thermistors)

The TC654 is used by the Netgear WNDR47X0 to control its
system fan.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter dc7efaefb5 apm821xx: add support for the Western Digital MyBook Live Series
Hardware Highlights:

This patch adds support for Western Digital MyBook Live Series:
CPU: AMCC PowerPC  UNKNOWN (PVR=12c41c83) at 800 MHz (PLB=200, OPB=100, EBC=100 MHz)
     32 kB I-Cache 32 kB D-Cache, 256 kB L2-Cache, 32 kB OnChip Memory
Board: Apollo-3G - APM82181 Board, 1*SATA
DRAM:  256 MB (2x NT5TU64M16GG-AC)
FLASH: 512 kB (SST 39VF040)
Ethernet: 1xRGMII - 1 Gbit - Broadcom PHY BCM54610

WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!

The MyBook Live Duo additionally features a 1x USB 2.0 host port
and can support a second hard-drive.

This target produces two images for a target.
 1. ext4 image
    The extracted/raw image can be directly installed on
    the internal HDD via "dd if=img.ext4 of=/dev/sdX".

    This can either be done in place with the stock MyBook Live
    firmware via ssh. Or by removing the HDD and writing the image
    with a different PC.

    The the compressed images are useful for sysupgrade.

 2. recovery.tar image for TFTP and Serial.

    extract the recovery.tar to a TFTP server directory.

    On the MyBook Live (Duo) serial port - Hit Enter during u-boot and insert:
    # setenv serverip 192.168.1.254; setenv ipaddr 192.168.1.1; run net_self

    Where 192.168.1.254 is your TFTP server.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter d37d16488c apm821xx: sata_dwc_460ex: backport fixes and cleanups from 4.7
This patch fixes the sata_dwc_460ex SATA driver which is used
by the SATA controllers in the MyBook Live Series and WNDR4700.

The code was backported from the upstream kernel.
It can be dropped completely on 4.7+.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Christian Lamparter ea91ee13a7 apm821xx: dw_dmac: backport fixes and cleanups from 4.7
This patch fixes the dw_dmac dma engine which is used
by the SATA controllers in the MyBook Live Series and WNDR4700.

The code was backported from the upstream kernel.
It can be dropped completely on 4.7+.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
8 years ago
Chris Blake a57d6e2d47 apm821xx: add support for the Cisco Meraki MR24
This patch adds support for the Cisco Meraki MR24 Access point
to the apm821xx target.

Board:		MR24 - Meraki MR24 Cloud Managed Access Point
CPU:		APM82181 SoC 800 MHz (PLB=200 OPB=100 EBC=100)
Flash size:	32MiB
RAM Size:	128MiB
Wireless:	Atheros AR9380 5.0GHz + Atheros AR9380 2.4GHz
Ethernet ports:	1x Gigabit Atheros AR8035

WARNING: The serial port needs a TTL/RS-232 v3.3 level converter!

For flashing instructions, visit:
<https://github.com/riptidewave93/Openwrt-MR24/blob/master/README.md#flashing>

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
8 years ago
Chris Blake 3827ce2c3d apm821xx: add support for the apm821xx device target
This adds a new target for PowerPC APM82181 and APM82161
(464-based) boards, as well as adds support for the booke-wdt
watchdog package.

Signed-off-by: Chris Blake <chrisrblake93@gmail.com>
8 years ago