Porting guide ar71xx to ath79?

1000 Mbit. I know is wrong that's why I am asking for fix it :slight_smile:

So you need to build with the existing fix in PR, or wait till the fix is merged.

I see you built from the new branch )) and got it broken again...because this branch fixes only the IRQ problem.

@yabba235 For those who can't apply patches, I pushed a merged branch for ar71xx.
I'll remove it as soon as it is merged.

WZR-HP-AG300H has two flash devices and concatenates them at startup and treats them as a single mtd device. This method is implemented by the ath79_register_m25p80_multi function in dev-m25p80.c in ar71xx, but it is probably not yet implemented in ath79.
Therefore, even if you write to Flash, it may not be able to start normally.

picture:

This problem occurs with three buffalo devices in ar71xx and their derived models.
e.g.:

  • supported in ar71xx

    • WZR-HP-AG300H
    • WZR-HP-G300NH2
    • WZR-HP-G450H
  • derived models

    • BHR-4GRV (ā‰’WZR-HP-G450H, wired router)
    • WZR-450HP (=WZR-HP-G450H)

Other than buffalo devices, it seems to occur also in the following models:

  • ALFA Network AP120C
  • Qihoo C301
1 Like

Thanks for the information. That gives some sense to what I read in the mach file.

Indeed the device got caught in a boot loop, but I'm not sure if I did anything else wrong. Compiling the image with make defconfig should boot, right?

The WZR-HP-G450H seems to have support in ath79, I assume it boots?

It is not guaranteed. There were some devices that were added long ago and didn't boot.
E.g it could boot from initramfs.

Why the device should not boot?
In worst case you could only use one spi flash for the firmware partition.
The kernel is loaded always from the same address on one of the nor chips.

If anyone will add of support for the mtdconcat driver it should be also possible to use two physical spi nor chips as one virtual.

I see. Also, it does not even list any mtd partitions.

@musashino: It indeed looks like mtdconcat is not yet implemented for ath79.

Looks to me like this should be done in the spi-ath79 driver, right?

No, the spi driver has nothing to do with that...
It should be done in the mtd driver and not specific for ath79.
I would say this should be implemented in a generic way to use it with any platform.

I see, makes sense. I've never dug this deep into kernel sources, so I'm kinda new to this ļæ¼;)
The physmap driver implements concatenation of multiple devices, but I wasn't yet able to figure if that could be of any help.
I guess I'll let this go for now... ļæ¼:)

So the right place would be the spi-nor driver? Or is this still the wrong level? I can't seem to find a central mtd driver.

I donĀ“t know...
I think it could be added directly in mtdconcat.c or probably there should be added a new "virtual" device in drivers/mtd/devices/.
The main problem will be to define a very generic dts definition for the new virtual mtd concat device.

Maybe I'm thinking to simple, but can this not simply be a list of references to devices defined elsewhere in the device tree?

I would imagine this to look something like this:

&spi {
  flash0 : flash@0 {
    ...
  };
  flash1 : flash@1 {
    ...
  };
};
virtual {
  concat = <&flash0 &flash1>;

  partitions {
    ...
  };
};

Probably something like this could be sufficient.
DonĀ“t think you are thinking to simple :slight_smile:
Probably iĀ“m thinking to complex :wink:

Currently i take a short look into the driver drivers/mtd/maps/physmap_of_core.c...
Wonder if we can use this for exactly this use case???

Edit: ItĀ“s a bit confusing the physmap driver, a simple probe function in mtdconcat.c shouldnĀ“t be that hard to implement...

Yeah, I've been staring at those physmap_of files for the last two hours, but I'm afraid so far I'm reaching my limits here. As far as I can tell, these maps drivers are for memory-mapped chips only.

This sounds right. To be honest, I'm a bit puzzled why something like this doesn't already exist :slight_smile:

Nope, take a look into kernel binding documentation Documentation/devicetree/bindings/mtd/mtd-physmap.txt
ItĀ“s also for "jedec-flash", but couldnĀ“t figure out for what use case... I think itĀ“s for memory mapped devices...

No one needed it on dts based devices so far as we have big flash chips in the year 2018 and the driver is very old...

Sorry, but now wif won't start:

Sun Aug 19 09:52:44 2018 daemon.notice netifd: radio1 (4380): Could not find PHY for device 'radio1'
Sun Aug 19 09:52:44 2018 daemon.notice netifd: radio0 (4379): Could not find PHY for device 'radio0'
Sun Aug 19 09:52:50 2018 daemon.notice netifd: radio1 (4417): WARNING: Variable 'data' does not exist or is not an array/object
Sun Aug 19 09:52:50 2018 daemon.notice netifd: radio0 (4416): WARNING: Variable 'data' does not exist or is not an array/object

Eth1 works, interrups looks good:

cat /proc/interrupts
           CPU0       
  3:          0      MIPS   3  ehci_hcd:usb1
  4:      33833      MIPS   4  19000000.eth
  5:       3712      MIPS   5  1a000000.eth
  7:     100163      MIPS   7  timer
  8:         15      MISC   3  ttyS0
 11:          0      MISC   6  ohci_hcd:usb2

but wifi dont work :frowning:

@yabba235 Everything should work now.
Wait a bit till it is merged. Maybe I did something wrong.

And also after the first flash it never works. Run wifi or reboot.

Wifi or reboot i made first, but this not help.
Something is wrong.
Whit bad irq map all working good, with good - not. :thinking:

Is there a way to use ath79 for Netgear WNDR 3700v4? Can i upgrade kernel version to 4.14?