Skip to content

ath79: support Meraki MR18 and Z1 #12517

New issue

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

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

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from

Conversation

Leo-PL
Copy link
Contributor

@Leo-PL Leo-PL commented May 1, 2023

Bring back Cisco Meraki MR18 and Z1 from long limbo after ar71xx removal. Based largely on @chunkeey's work, fixing only a few typos, but with added fix for potentially affected Mikrotik devices using SW ECC for their NAND flash. Installation is the same as it was in ar71xx.

Leo-PL and others added 5 commits May 2, 2023 00:57
Two Mikrotik board families (SXT 5nD R2 and Routerboard 92x are using
software ECC on NAND. Some of them use chips capable of subpage write,
others do not - within the same family, and a common block size is
required for UBI, to avoid mounting errors. Set the ECC step size
explicitly for them to 2048B, so UBI can mount existing volumes without
problems, at the same time allowing to unlocking subpage write functionality,
reuqired for Meraki MR18.

Fixes: 6561ca1 ("ath79: ar934x: fix mounting issues if subpage is not supported")
Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
This is necessary to support the Meraki MR18 and likely Z1
as well.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
This sort of reverts Koen Vandeputte's commit
6561ca1 ("ath79: ar934x: fix mounting issues if subpage is not supported")

since it does not work on the MR18 as the UBI is coming from
Meraki in that way and it used to work with AR71XX before.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Specifications:

SOC:	Atheros AR9344 @ 560MHz
RAM:	2x Winbond W9751G6KB-25 (128 MiB)
FLASH:	Hynix H27U1G8F2BTR (128 MiB)
WIFI1:	Atheros AR9340 5.0GHz (SoC)
WIFI2:	Atheros AR9280 2.4GHz
SWITCH:	Atheros AR8236 (5x Gigabit (1x WAN, 4x LAN)
LED:	1x Power-LED, 1 x RGB Tricolor-LED
INPUT:	One Reset Button
USB:	One USB 2.0 Port
UART:	JP1 on PCB (Labeled UART), 3.3v-Level, 115200n8
        (GND, TX, RX, VCC - GND is next to the UART silk screen)

Flashing Instructions:

Since this device is brought over from an old AR71xx, there's
already a wiki-page with detailed instructions:
<https://openwrt.org/toh/meraki/z1>

The gist:
1. Get a root-shell on the device (see wiki). (needs UART access)
2. make a backup (to a PC/safe location) of the existing Meraki
   firmware.
3. copy over the OpenWrt initramfs kernel for the Z1.
   This gets written into the kernel NAND partition.
   (Verify that written image is complete!)

After the following reboot and successfull boot of the staging
OpenWrt initramfs image:

4. copy over the sysupgrade.bin for the router and use sysupgrade
   to make the installation permanent.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Specifications:

SOC:    Atheros/Qualcomm QCA9557-AT4A @ 720MHz
RAM:    2x Winbond W9751G6KB-25 (128 MiB)
FLASH:  Hynix H27U1G8F2BTR-BC TSOP48 ONFI NAND (128 MiB)
WIFI1:  Atheros AR9550 5.0GHz (SoC)
WIFI2:  Atheros AR9582-AR1A 2.4GHz
WIFI2:  Atheros AR9582-AR1A 2.4GHz + 5GHz
PHYETH: Atheros AR8035-A, 802.3af PoE capable Atheros (1x Gigabit LAN)
LED:    1x Power-LED, 1 x RGB Tricolor-LED
INPUT:  One Reset Button
UART:   JP1 on PCB (Labeled UART), 3.3v-Level, 115200n8
        (VCC, RX, TX, GND - VCC is closest to the boot set jumper
	 under the console pins.)

Flashing instructions:

Depending on the installed firmware, there fastly different methods
to flash a MR18. These have been documented on:
<https://openwrt.org/toh/meraki/mr18>

Note: upgrades from AR71XX are possible, but require the force
sysupgrade option.

The LEDs has changed since AR71XX. The white LED is now used during
the boot and when upgrading instead of the green tricolor LED.

Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
@github-actions github-actions bot added kernel pull request/issue with Linux kernel related changes target/ath79 pull request/issue for ath79 target labels May 1, 2023
@Leo-PL Leo-PL marked this pull request as ready for review May 8, 2023 17:49
@Leo-PL Leo-PL changed the title [RFT] ath79: support Meraki MR18 ath79: support Meraki MR18 and Z1 May 8, 2023
@chunkeey
Copy link
Member

chunkeey commented May 8, 2023 via email

@Leo-PL
Copy link
Contributor Author

Leo-PL commented May 8, 2023

Okay, feel free to not include Z1 - I pulled it in because it was easier to cherry-pick changes for MR18 from your staging tree.

@chunkeey
Copy link
Member

chunkeey commented May 13, 2023

Merged without Z1 for now. Thanks!

(Edit: I'm interested in backporting this too. Let's give this like a month and if nobody says anything. The MR18 could get a 22.03 release too... It would be great since maybe 22.03 could still support produce an ath79 initramfs.)

@chunkeey chunkeey closed this May 13, 2023
@Leo-PL
Copy link
Contributor Author

Leo-PL commented May 13, 2023

Should work without a hitch, I was able to run this ath79 board on MR18 before 22.03 got branched off as well.

@chunkeey
Copy link
Member

Should work without a hitch, I was able to run this ath79 board on MR18 before 22.03 got branched off as well.

True, it's been running for a long time here as well. I'm worried about the NAND changes. Another NAND device could have sneaked by.

@Leo-PL
Copy link
Contributor Author

Leo-PL commented May 14, 2023

I checked that while backporting for my own use - only those two Mikrotiks are affected. If no ECC mode is set, it defaults to hw. And IIRC no new Mikrotik NAND devices were added from 21.02 until migration to yafut.

@Leo-PL
Copy link
Contributor Author

Leo-PL commented May 14, 2023

@chunkeey I just checked downloads.openwrt.org for an image for MR18 and strangely, I found no initramfs image. It might be worth to check buildbot logs to see why it happened. Maybe it'll appear on next build, though.

@xback
Copy link
Contributor

xback commented May 24, 2023

Just tested todays master on a large set of various rb922 boards.

Found one:

[    1.610391] UBI: auto-attach mtd2
[    1.613782] ubi0: attaching mtd2
[    1.618041] ubi0 error: validate_ec_hdr: bad VID header offset 2048, expected 512
[    1.625656] ubi0 error: validate_ec_hdr: bad EC header
[    1.630899] Erase counter header dump:
[    1.634702]  magic          0x55424923
[    1.638511]  version        1
[    1.641522]  ec             1
[    1.644530]  vid_hdr_offset 2048
[    1.647812]  data_offset    4096
[    1.651079]  image_seq      341407690
[    1.654792]  hdr_crc        0xa75ed772
[    1.658603] erase counter header hexdump:
[    1.662699] CPU: 0 PID: 1 Comm: swapper Not tainted 5.15.112 #0
[    1.668715] Stack : 00000000 00000000 80c19c8c 80990000 807e0000 8071e834 80c37520 807e1da3
[    1.677232]         809932d4 00000001 55424923 800ba08c 20303020 00000001 80c19c48 c4895742
[    1.685733]         00000000 00000000 8071e834 80c19ae0 ffffefff 00000000 00000000 ffffffea
[    1.694247]         0000007c 80c19aec 0000007c 807e6f58 818c9600 80e34000 00000000 80e34000
[    1.702762]         00000000 55424923 818cb014 818c9200 00000018 803e229c 00000000 80990000
[    1.711274]         ...
[    1.713762] Call Trace:
[    1.716241] [<80066b30>] show_stack+0x28/0xf0
[    1.720702] [<804587d8>] validate_ec_hdr+0xc0/0x118
[    1.725660] [<804594a8>] ubi_io_read_ec_hdr+0x20c/0x26c
[    1.730976] [<8045eba0>] ubi_attach+0x2f4/0x1538
[    1.735674] [<80452f58>] ubi_attach_mtd_dev+0x530/0xbf8
[    1.741008] [<8087bc1c>] ubi_init+0x320/0x3bc
[    1.745442] [<80060638>] do_one_initcall+0x50/0x1b8
[    1.750407] [<808670b4>] kernel_init_freeable+0x1d0/0x26c
[    1.755896] [<8067dd80>] kernel_init+0x20/0x108
[    1.760518] [<80061ed8>] ret_from_kernel_thread+0x14/0x1c
[    1.765999] 
[    1.767522] ubi0 error: ubi_io_read_ec_hdr: validation failed for PEB 0
[    1.774239] ubi0 error: ubi_attach_mtd_dev: failed to attach mtd2, error -22
[    1.781468] UBI error: cannot attach mtd2

@Leo-PL
Copy link
Contributor Author

Leo-PL commented May 24, 2023

This begs the question, if ath79 NAND driver actually respects the nand-ecc-step-size property. I'll take a look into the kernel soon.

@xback
Copy link
Contributor

xback commented May 24, 2023

I went through the code and think I noticed another issue also.

The check now for 2048 is within ecc_engine_host condition, not within ecc_engine_soft.

So on todays driver, it simply does not enter that branch afaict.

I hope to dig a little bit deeper on Friday when I'm back at the office.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel pull request/issue with Linux kernel related changes target/ath79 pull request/issue for ath79 target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants