Porting WNDR4300 to ath79

@robimarko?

I dont understand

Just to ask if you can still work wndr4300 to ath79...

I cant since I dont have the device

1 Like

Hello,

For all of you still interested in the topic, NAND driver for ath79 just got accepted into master. Furthermore, I have prepared dts file and successfully build OpenWrt ath79 master for WNDR4300 (v1). No problems so far. So for now it's just polishing of patchset to get it to master officially.

Regards
Michal

Iā€™m guessing this is some SoC-specific NAND driver, as nothing has happened of consequence in months on

(That PR also solves many sysupgrade problems with ar71xx and ath79 related to NAND.)

Yes, this is SoC-specific driver, WNDR4300 has flash memory attached to this subsystem instead of usual SPI solution.

1 Like

@realmicu

Would you be able to test your WNDR4300 build using the changes in PR 2184, or at least examine the kernel config?

In that PR, I've cleaned up the cruft from the long-stale kernel config and just rebased to include

CONFIG_MTD_NAND_AR934X=y

Much of what was in that config I found to be either deprecated, obsolete, or unnecessary. However, I can't confirm what is needed for the NAND driver for the AR934x (as I don't know if it is using software ECC), such as

CONFIG_BCH=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_BCH=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_BCH=y

Clearly obsolete, as not supported by the upstream SPI-NAND framework present in Linux 4.19 and later (which is required for OpenWrt acceptance of support for SPI NAND).

CONFIG_MTD_SPINAND_MT29F=y
CONFIG_MTD_SPINAND_ONDIEECC=y

While it wouldn't surprise me that

CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_ECC=y

are required, I don't know enough about the driver to make an informed decision on those, or the BCH-related ones.



Edit:

I do see in target/linux/ath79/dts/ar934x.dtsi

nand-ecc-mode = "hw";

so I suspect that the BCH code is not necessary at this time.



Current local, based on reading the driver and kconfig:

--- a/target/linux/ath79/nand/config-default
+++ b/target/linux/ath79/nand/config-default
@@ -1,7 +1,9 @@
 CONFIG_BLK_MQ_PCI=y
 CONFIG_LEDS_RESET=y
+CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_AR934X=y
 CONFIG_MTD_NAND_CORE=y
+CONFIG_MTD_NAND_ECC=y
 CONFIG_MTD_SPI_NAND=y
 CONFIG_MTD_UBI=y
 CONFIG_MTD_UBI_BLOCK=y

yielding

$ cat target/linux/ath79/nand/config-default 
CONFIG_BLK_MQ_PCI=y
CONFIG_LEDS_RESET=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_AR934X=y
CONFIG_MTD_NAND_CORE=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_SPI_NAND=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BLOCK=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_MTD_UBI_BEB_LIMIT=20
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
CONFIG_OF_ADDRESS_PCI=y
CONFIG_OF_PCI=y
CONFIG_OF_PCI_IRQ=y
CONFIG_PCI=y
# CONFIG_PCI_AR71XX is not set
CONFIG_PCI_AR724X=y
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
CONFIG_PCI_DOMAINS=y
# CONFIG_PHY_AR7100_USB is not set
CONFIG_PHY_AR7200_USB=y
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y

PR comment added at https://github.com/openwrt/openwrt/pull/2184#pullrequestreview-304748885

Hello Jeff,

WNDR4300 works best with ECC set to HW.
I was curious enough to change ECC from hardware (default) to software but for either of supported SW mode (BCH or Hamming) there were ECC errors logged during boot process. Therefore, even though driver defaults to HW, I explicitly set this also in DTS as a hint.

Here's my config (pushed to openwrt-devel as a part of WNDR4300 patchset):

CONFIG_BCH=y
# CONFIG_MTD_CFI is not set
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_AR934X=y
CONFIG_MTD_NAND_BCH=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_NAND_ECC_BCH=y
CONFIG_MTD_SPINAND_MT29F=y
CONFIG_MTD_SPINAND_ONDIEECC=y
# CONFIG_MTD_SPLIT_SEAMA_FW is not set
# CONFIG_MTD_SPLIT_TPLINK_FW is not set
# CONFIG_MTD_TPLINK_PARTS is not set
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_BLOCK=y
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_UBIFS_FS=y
# CONFIG_UBIFS_FS_ADVANCED_COMPR is not set
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_LZO_COMPRESS=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_ZLIB_DEFLATE=y
CONFIG_ZLIB_INFLATE=y
# CONFIG_IP17XX_PHY is not set
# CONFIG_RTL8306_PHY is not set
# CONFIG_RTL8366_SMI is not set
CONFIG_BLK_MQ_PCI=y
CONFIG_PCI=y
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_AR724X=y
# CONFIG_PCI_AR71XX is not set
# CONFIG_CAN_C_CAN_PCI is not set
# CONFIG_KSZ884X_PCI is not set
# CONFIG_NE2K_PCI is not set
# CONFIG_MISDN_HFCPCI is not set
# CONFIG_SERIAL_8250_PCI is not set
# CONFIG_SND_PCI is not set

("not set" PHY, SMI and PCI settings from above config are for keeping LZMA-compressed kernel size under 2 Megabytes)

I will test your config on my router, just please clarify that you want to include CONFIG_PHY_AR7200_USB directly in the kernel, as for now system builds it as part of kmod package.

Regards
Michal

1 Like

Thanks, removing it seems reasonable. It looks like they are all disabled in the "top-level" config on master at this time

target/linux/ath79/config-4.19

# CONFIG_PHY_AR7100_USB is not set
# CONFIG_PHY_AR7200_USB is not set
# CONFIG_PHY_ATH79_USB is not set

I'll remove from my config and test a build on the GL-AR300M and GL-AR750S when I'm back with the devices in hand and determine how best to manage the USB on the NAND variants, consistent with the existing "generic" builds.

Edit:

I didn't think I was losing my mind. They appear to be built into the "generic" target, but not the "tiny" target.

target/linux/ath79/generic/config-default

CONFIG_PHY_AR7100_USB=y
CONFIG_PHY_AR7200_USB=y

Fresh builds, remembering to remove ./tmp/ this time

1,959,688 from "my" config
1,948,137 removing "unneeded" kernel config
11,551 savings

2 MB = 2,097,152

I agree that there is going to be a problem in the not-too-distant future with devices that only permit a 2 MB kernel. 137,464 bytes (6.5%) isn't a lot of headroom and 149,015 isn't much better.

For reference, prior to the raw-NAND support, my NAND-aware kernel was running 1,920,760 bytes.

    ath79: NAND: disable some kernel options as per realmicu suggestions
    
    Did not remove CONFIG_UBIFS_FS_ADVANCED_COMPR=y
    
    Removed:
    
     # CONFIG_MTD_CFI is not set
     # CONFIG_MTD_SPLIT_SEAMA_FW is not set
     # CONFIG_MTD_SPLIT_TPLINK_FW is not set
     # CONFIG_MTD_TPLINK_PARTS is not set
     # CONFIG_IP17XX_PHY is not set
     # CONFIG_RTL8306_PHY is not set
     # CONFIG_RTL8366_SMI is not set
     # CONFIG_PCI_AR71XX is not set
     # CONFIG_CAN_C_CAN_PCI is not set
     # CONFIG_KSZ884X_PCI is not set
     # CONFIG_NE2K_PCI is not set
     # CONFIG_MISDN_HFCPCI is not set
     # CONFIG_SERIAL_8250_PCI is not set
     # CONFIG_SND_PCI is not set

Hi Jeff,

Tomorrow I will try to compile system with combined kernel config (changes yours and mine) minus software ECC.

I agree that there is going to be a problem in the not-too-distant future with devices that only permit a 2 MB kernel. 137,464 bytes (6.5%) isn't a lot of headroom and 149,015 isn't much better.

That's correct, for WNDR4300 I use Netgear GPL u-boot sources as reference. Apparently it does not limit compressed kernel (+fake rootfs) to 2 MB but I will test it anyway - one day it surely will grow over this number, especially when more NAND devices appear in ath79.

Cheers
Michal

1 Like

Hello Jeff,

My WNDR4300 works OK with following kernel config:

target/linux/ath79/nand/config-default:

CONFIG_LEDS_RESET=y
CONFIG_MTD_NAND=y
CONFIG_MTD_NAND_AR934X=y
CONFIG_MTD_NAND_CORE=y
CONFIG_MTD_NAND_ECC=y
CONFIG_MTD_SPI_NAND=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_BLOCK=y
# CONFIG_MTD_UBI_FASTMAP is not set
# CONFIG_MTD_UBI_GLUEBI is not set
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_UBIFS_FS=y
CONFIG_UBIFS_FS_LZO=y
CONFIG_UBIFS_FS_ZLIB=y
CONFIG_UBIFS_FS_ADVANCED_COMPR=y
CONFIG_BLK_MQ_PCI=y
CONFIG_OF_ADDRESS_PCI=y
CONFIG_OF_PCI=y
CONFIG_OF_PCI_IRQ=y
CONFIG_PCI=y
CONFIG_PCI_DISABLE_COMMON_QUIRKS=y
CONFIG_PCI_DOMAINS=y
CONFIG_PCI_AR724X=y
# CONFIG_PCI_AR71XX is not set
# CONFIG_PHY_AR7100_USB is not set
CONFIG_REGULATOR=y
CONFIG_REGULATOR_FIXED_VOLTAGE=y

Amazingly, kernel is still under 2 MB so no need to change default partition layout in dts (probably recently upgraded toolchain helped a little).

Regards
Michal

2 Likes

Please submit patch thz

Hello,

It's already in master branch so you can use it without any further patching.

Regards
Michal

1 Like

Hello. I'm using ATH79 and it works great. Is there any information about the introduction to the stable version of 19.07?

Recently added devices probably won't be added to 19.07, which was branched six months ago. I still haven't read anything definitive about "20.01", but my guess is that the project isn't going to be anywhere close to their stated goal of releases every six months.

Yesterday I ported my old .config to the new ath79 target and now I'm successfully running a smooth master build. Thank you!

Once thing (I think) I noticed: There's not USB/uhci support in the default config? Or did it just get disabled with the oldconfig merging / target selection? I had to explicitly enable it to get the port working. If not-a-bug: sorry for the spam. :wink:

Anyways, great success, guys!

Hello!

Glad you enjoying this software!
On my WNDR4300 I hadn't any problems with USB - and AFAIK UHCI is for USB v1 on Intel chips only, not Atheros. USB support should come automatically with kmod-usb2 package in default install. Which config option exactly have you enabled to get your USB working ?

Regards
Micu

is it possible to add wndr4300sw to the list of profiles? the wndr4300sw is exactly the same hardware as the wndr4300v1 except for the board id. thank you and best regards.