Porting guide ar71xx to ath79?

in the end the only way i found to "elegantly" ( for a given definition of elegant ) enable GPIO 26 and 27 by setting MDIO_GPIO_EN bit in the BOOT_STRAP register ( 0x180600AC ) was to add another pinmux entry into ar9330.dtsi with a named node, so that it will not get used unless its explicitly included in the board specific dts.

I added this snippet to ar9330.dtsi

pinmux_mdio: pinmux_mdio@180600ac {
		compatible = "pinctrl-single";
		reg = <0x180600AC 0x4>
		pinctrl-single,bit-per-mux;
		pinctrl-single,register-width = <32>;
		pinctrl-single,function-mask = <0x1>;
		#pinctrl-cells = <2>;

		mdio_gpio: pinmux_mdio_gpio {
			pinctrl-single,bits = <0x0 0x40000 0x40000>;
		};

	};

in the board specific dts one would inlcude this to enable pins 26 and 27 as GPIO.
pinctrl-0 = <&mdio_gpio>;

in a similar manner to using jtag_disable_pins or switch_led_pins to enable the use of GPIO 11, or set GPIOs 13,14,15,16 as Switch LEDs ( this PR sets them as GPIO by default rather than switch controlled )

it seems a bit hackey, but might do a PR to add it to the ar9330.dtsi file, unless there's a way of me adding something to the apb node from the device specific dtsi, but that feels like heading back to the ar71xx way of very large custom board definitions.

1 Like