Porting guide ar71xx to ath79?

How do you boot with initramfs?

I wrote an example earlier, look up

Usually tft followed by bootm, if on uboot. You can write the short command, and see for what file name and address is searching

Ok, now i got all that. Booted all different ways. I will try to figure out the problem.
But it must be in the kernel itself. The dts seem to be good. Everything works.
But the boot process seem to be to fast to init everything from the flash.

When I flash the firmware to 1043nd v1 I get

overlayfs: upper fs does not support tmpfile.

Maybe someone knows what does this mean?

And what is really funny if you build with Wi-Fi enabled by default, it works OK. So no serial is needed any more to play with the device.

1 Like

May I ask how do you enable wifi bu default?

I'll change the qss button to enable wifi

1 Like

See the patch earlier. Just comment out one line.

1 Like

Thanks for the link!

Still ready! To test for dir505

Made a dts for DIR825b1. I didn't try to build. Any critics?

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

#include "ar7100.dtsi"

/ {
	compatible = "dlink,dir825b1", "qca,ar7161";
	model = "D-Link DIR825B1";

	aliases {
		led-status = &power_orange;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	extosc: ref {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-output-names = "ref";
		clock-frequency = <40000000>;
	};

	leds {
		compatible = "gpio-leds";
		blue_usb {
			label = "d-link:blue:usb";
			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		orange_power {
			label = "d-link:orange:power";
			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		blue_power {
			label = "d-link:blue:power";
			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		
		blue_wps {
			label = "d-link:blue:wps";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		orange_planet {
			label = "d-link:orange:planet";
			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		blue_planet {
			label = "d-link:blue:planet";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};
	};

	keys {
		compatible = "gpio-keys";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
		};

		wps {
			label = "wps";
			linux,code = <KEY_WPS_BUTTON>;
			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
		};
	};

	rtl8366s {
		compatible = "realtek,rtl8366s";
		gpio-sda = <&gpio 5 GPIO_ACTIVE_HIGH>;
		gpio-sck = <&gpio 7 GPIO_ACTIVE_HIGH>;
	};
};

&usb {
	status = "okay";

	hub_port: port@1 {
		reg = <1>;
		#trigger-source-cells = <0>;
	};
};

&usb_phy {
	status = "okay";
};

&spi {
	status = "okay";
	num-cs = <1>;

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "m25p80";
		reg = <0>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
			label = "u-boot";
			reg = <0x000000 0x040000>;
			read-only;
			};

			partition@1 {
			label = "config"
			reg = <0x040000 0x010000>;
			read-only;
			};

			partition@2 {
			label = "firmware";
			reg = <0x050000 0x610000>;
			};

			caldata: partition@3 {
			label = "caldata";
			reg = <0x660000 0x010000>;
			read-only;
			};

			partition@4 {
			label = "unknown";
			reg = <0x670000 0x190000>;
			read-only;
			};
		};
	};
};

&eth0 {
	status = "okay";

	mtd-mac-address = <&caldata 0xffa0>;

	phy-mask = <0x10>;

	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

&eth1 {
	status = "okay";

	mtd-mac-address = <&caldata 0xffb4>;

	phy-mask = <0x10>;

};

&wmac0 {
	status = "okay";
	mtd-cal-data = <&caldata 0x1000>;
	mtd-mac-address = <&caldata 0xffa0>;
};

&wmac1 {
	status = "okay";
	mtd-cal-data = <&caldata 0x5000>;
	mtd-mac-address = <&caldata 0xffb4>;
	mtd-mac-address-increment = <1>;
};

This will throw an error... If you want to assign this to your led, you need:

		power_orange: orange_power {
			label = "d-link:orange:power";
			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

This one is useless if you do not assign it to an led.

Oops, forgot to label it, thx.

I planned to add

trigger-sources = <&hub_port>;

later.

Ok.

You should add:

&pll {
    clocks = <&extosc>;
}

To get your fixed clock assigned to the pll controller.

Add these fixes and also enabled PCIE to get wireless working (maybe).

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

#include "ar7100.dtsi"

/ {
	compatible = "dlink,dir825b1", "qca,ar7161";
	model = "D-Link DIR825B1";

	aliases {
		led-status = &orange_power;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	extosc: ref {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-output-names = "ref";
		clock-frequency = <40000000>;
	};

	leds {
		compatible = "gpio-leds";
		blue_usb {
			label = "d-link:blue:usb";
			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		orange_power: orange_power {
			label = "d-link:orange:power";
			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		blue_power {
			label = "d-link:blue:power";
			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		
		blue_wps {
			label = "d-link:blue:wps";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		orange_planet {
			label = "d-link:orange:planet";
			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		blue_planet {
			label = "d-link:blue:planet";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};
	};

	keys {
		compatible = "gpio-keys";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
		};

		wps {
			label = "wps";
			linux,code = <KEY_WPS_BUTTON>;
			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
		};
	};

	rtl8366s {
		compatible = "realtek,rtl8366s";
		gpio-sda = <&gpio 5 GPIO_ACTIVE_HIGH>;
		gpio-sck = <&gpio 7 GPIO_ACTIVE_HIGH>;
	};
};

&usb {
	status = "okay";

	hub_port: port@1 {
		reg = <1>;
		#trigger-source-cells = <0>;
	};
};

&usb_phy {
	status = "okay";
};

&pcie0 {
	status = "okay";
};

&uart {
	status = "okay";
};

&pll {
    clocks = <&extosc>;
};

&spi {
	status = "okay";
	num-cs = <1>;

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "m25p80";
		reg = <0>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
			label = "u-boot";
			reg = <0x000000 0x040000>;
			read-only;
			};

			partition@1 {
			label = "config"
			reg = <0x040000 0x010000>;
			read-only;
			};

			partition@2 {
			label = "firmware";
			reg = <0x050000 0x610000>;
			};

			caldata: partition@3 {
			label = "caldata";
			reg = <0x660000 0x010000>;
			read-only;
			};

			partition@4 {
			label = "unknown";
			reg = <0x670000 0x190000>;
			read-only;
			};
		};
	};
};

&eth0 {
	status = "okay";

	mtd-mac-address = <&caldata 0xffa0>;

	phy-mask = <0x10>;

	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

&eth1 {
	status = "okay";

	mtd-mac-address = <&caldata 0xffb4>;

	phy-mask = <0x10>;

};

&wmac0 {
	status = "okay";
	mtd-cal-data = <&caldata 0x1000>;
	mtd-mac-address = <&caldata 0xffa0>;
};

&wmac1 {
	status = "okay";
	mtd-cal-data = <&caldata 0x5000>;
	mtd-mac-address = <&caldata 0xffb4>;
	mtd-mac-address-increment = <1>;
};

ar71xx does not have cpu/soc integrated wifi...
So there will be no wmacX and will therefore also not compile.
If you have two wireless card, this are both attached on the pci bus...

Take a look into this file to get a feeling how to load the "firmware" from the mtd device and here on how to define the mac address for a pci attached wireless device...

Oh, this is really helpful. Thanks!

@juppin And do I need rtl8266s initvals? And how to add them?

@juppin Does this look better?

// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
/dts-v1/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

#include "ar7100.dtsi"

/ {
	compatible = "dlink,dir825b1", "qca,ar7161";
	model = "D-Link DIR825B1";

	aliases {
		led-status = &orange_power;
	};

	chosen {
		bootargs = "console=ttyS0,115200";
	};

	extosc: ref {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-output-names = "ref";
		clock-frequency = <40000000>;
	};

	leds {
		compatible = "gpio-leds";
		blue_usb {
			label = "d-link:blue:usb";
			gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
			default-state = "off";
			trigger-sources = <&hub_port>;
		};

		orange_power: orange_power {
			label = "d-link:orange:power";
			gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
		};

		blue_power {
			label = "d-link:blue:power";
			gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		
		blue_wps {
			label = "d-link:blue:wps";
			gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		orange_planet {
			label = "d-link:orange:planet";
			gpios = <&gpio 6 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};

		blue_planet {
			label = "d-link:blue:planet";
			gpios = <&gpio 11 GPIO_ACTIVE_LOW>;
			default-state = "off";
		};
	};

	ath9k-leds {
		compatible = "gpio-leds";

		wlan2g {
			label = "ath9k-phy0";
			gpios = <&ath9k-0 0 GPIO_ACTIVE_LOW>;
			default-state = "off";
			linux,default-trigger = "phy0tpt";
		};

		wlan5g {
			label = "ath9k-phy1";
			gpios = <&ath9k-1 0 GPIO_ACTIVE_LOW>;
			default-state = "off";
			linux,default-trigger = "phy1tpt";
		};		

	};

	keys {
		compatible = "gpio-keys";
		#address-cells = <1>;
		#size-cells = <0>;
		poll-interval = <20>;

		reset {
			label = "reset";
			linux,code = <KEY_RESTART>;
			gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
		};

		wps {
			label = "wps";
			linux,code = <KEY_WPS_BUTTON>;
			gpios = <&gpio 8 GPIO_ACTIVE_LOW>;
		};
	};

	rtl8366s {
		compatible = "realtek,rtl8366s";
		gpio-sda = <&gpio 5 GPIO_ACTIVE_HIGH>;
		gpio-sck = <&gpio 7 GPIO_ACTIVE_HIGH>;
	};
};

&usb {
	status = "okay";

	hub_port: port@1 {
		reg = <1>;
		#trigger-source-cells = <0>;
	};
};

&usb_phy {
	status = "okay";
};

&pcie0 {
	status = "okay";

	ath9k-0: wifi@168c, 0029 {
		compatible = "pci168c,0029";
		reg = <0x0000 0 0 1 1>;
		mtd-mac-address = <&caldata 0xffa0>;
		qca,no-eeprom;
		#gpio-cells = <2>;
		gpio-controller;
	};

	ath9k-1: wifi@168c, 0029 {
		compatible = "pci168c,0029";
		reg = <0x0000 0 0 1 2>;
		mtd-mac-address = <&caldata 0xffb4>;
		mtd-mac-address-increment = <1>;
		qca,no-eeprom;
		#gpio-cells = <2>;
		gpio-controller;
	};
};

&uart {
	status = "okay";
};

&pll {
    clocks = <&extosc>;
};

&spi {
	status = "okay";
	num-cs = <1>;

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "m25p80";
		reg = <0>;
		spi-max-frequency = <25000000>;

		partitions {
			compatible = "fixed-partitions";
			#address-cells = <1>;
			#size-cells = <1>;

			partition@0 {
			label = "u-boot";
			reg = <0x000000 0x040000>;
			read-only;
			};

			partition@1 {
			label = "config"
			reg = <0x040000 0x010000>;
			read-only;
			};

			partition@2 {
			label = "firmware";
			reg = <0x050000 0x610000>;
			};

			caldata: partition@3 {
			label = "caldata";
			reg = <0x660000 0x010000>;
			read-only;
			};

			partition@4 {
			label = "unknown";
			reg = <0x670000 0x190000>;
			read-only;
			};
		};
	};
};

&eth0 {
	status = "okay";

	mtd-mac-address = <&caldata 0xffa0>;

	phy-mask = <0x10>;

	fixed-link {
		speed = <1000>;
		full-duplex;
	};
};

&eth1 {
	status = "okay";

	mtd-mac-address = <&caldata 0xffb4>;

	phy-mask = <0x10>;

};