Support for Mikrotik RB3011UiAS-RM?

USB works, usb-power-off is on GPIO 2

root@OpenWrt:/sys/class/gpio# echo 2 > export
root@OpenWrt:/sys/class/gpio# echo out > gpio2/direction 
root@OpenWrt:/sys/class/gpio# [ 74.082191] usb 1-1: USB disconnect, device number 2
root@OpenWrt:/sys/class/gpio# echo 0 > gpio2/value

root@OpenWrt:/sys/class/gpio# echo 1 > gpio2/value
root@OpenWrt:/sys/class/gpio# [ 86.462170] usb 1-1: new high-speed USB device number 3 using xhci-hcd
root@OpenWrt:/sys/class/gpio# lsusb
Bus 003 Device 001: ID 1d6b:0002
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 04e8:6860
Bus 004 Device 001: ID 1d6b:0003
Bus 002 Device 001: ID 1d6b:0003

Here is updated DTS file, only need to finish WiFi.

/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2019, David Hutchison <dhutchison@bluemesh.net>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 *
 */

#include "qcom-ipq4019.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/soc/qcom,tcsr.h>

/ {
	model = "Mikrotik RouterBOARD hAP AC2";
	compatible = "mikrotik,rbd52g";

	memory {
		device_type = "memory";
		reg = <0x80000000 0x08000000>; /* 128MB */
	};

	reserved-memory {
                #address-cells = <1>;
                #size-cells = <1>;
                ranges;
                rsvd1@87000000 {
                        /* Reserved for other subsystem */
                        reg = <0x87000000 0x500000>;
                        no-map;
                };
                wifi_dump@87500000 {
                        reg = <0x87500000 0x600000>;
                        no-map;
                };

                rsvd2@87B00000 {
                        /* Reserved for other subsystem */
                        reg = <0x87B00000 0x500000>;
                        no-map;
                };
	};

	chosen {
		stdout-path = "serial0:115200n8";
	};

	aliases {
		led-boot = &user;
		led-failsafe = &user;
		led-running = &user;
		led-upgrade = &user;
	};

	soc {
		mdio@90000 {
			status = "okay";
		};

		counter@4a1000 {
			compatible = "qcom,qca-gcnt";
			reg = <0x4a1000 0x4>;
		};

		tcsr@1949000 {
			compatible = "qcom,tcsr";
			reg = <0x1949000 0x100>;
			qcom,wifi_glb_cfg = <TCSR_WIFI_GLB_CFG>;
		};

		tcsr@194b000 {
			/* select hostmode */
			compatible = "qcom,tcsr";
			reg = <0x194b000 0x100>;
			qcom,usb-hsphy-mode-select = <TCSR_USB_HSPHY_HOST_MODE>;
			status = "okay";
		};

		ess_tcsr@1953000 {
			compatible = "qcom,tcsr";
			reg = <0x1953000 0x1000>;
			qcom,ess-interface-select = <TCSR_ESS_PSGMII>;
		};

		tcsr@1957000 {
			compatible = "qcom,tcsr";
			reg = <0x1957000 0x100>;
			qcom,wifi_noc_memtype_m0_m2 = <TCSR_WIFI_NOC_MEMTYPE_M0_M2>;
		};

		crypto@8e3a000 {
			status = "okay";
		};

		wifi@a000000 {
                        status = "ok";
                };

                wifi@a800000 {
                        status = "ok";
                };

		usb2@60f8800 {
                        status = "okay";
                };

                usb3@8af8800 {
                        status = "okay";
                };

		watchdog@b017000 {
			status = "okay";
		};

		ess-switch@c000000 {
			status = "okay";
		};

		edma@c080000 {
			status = "okay";
		};
	};

	keys {
		compatible = "gpio-keys";

		reset {
			label = "reset";
			gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
		
		mode {
			label = "mode";
			gpios = <&tlmm 5 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_RESTART>;
		};
	};

	leds {
		compatible = "gpio-leds";

		power: power {
			label = "rbd52g:green:power";
			gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>;
			default-state = "keep";
			panic-indicator;
		};

		user: user {
			label = "rbd52g:green:user";
			gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
		};
	};
};

&tlmm {
	serial_pins: serial_pinmux {
		mux {
			pins = "gpio60", "gpio61";
			function = "blsp_uart0";
			bias-disable;
		};
	};

	spi_0_pins: spi-0-pinmux {
		pinmux {
			function = "blsp_spi0";
			pins = "gpio55", "gpio56", "gpio57";
			bias-disable;
		};

		pinmux_cs {
			function = "gpio";
			pins = "gpio54";
			bias-disable;
			output-high;
		};
	};
};

&blsp_dma {
	status = "okay";
};

&blsp1_spi1 {
	pinctrl-0 = <&spi_0_pins>;
	pinctrl-names = "default";
	cs-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
	status = "okay";

	m25p80@0 {
		reg = <0>;
		compatible = "jedec,spi-nor";
		spi-max-frequency = <24000000>;

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

			partition0@0 {
				label = "RouterBoot";
				reg = <0x80000 0xe000>;
				read-only;
			};

			partition1@8e000 {
				label = "hard_config";
				reg = <0x8e000 0x01000>;
			};

			partition2@90000 {
				label = "dts_config";
				reg = <0x90000 0x10000>;
				read-only;
			};

			partition3@bd000 {
				label = "soft_config";
				reg = <0xbd000 0x01000>;
			};

			partition4@1000000 {
				compatible = "mikrotik,minor";
				label = "firmware";
				reg = <0x100000 0xf00000>;
			};
		};
	};
};

&blsp1_uart1 {
	pinctrl-0 = <&serial_pins>;
	pinctrl-names = "default";
	status = "okay";
};

&cryptobam {
	status = "okay";
};

&usb3_hs_phy {
	status = "okay";
};

&usb3_ss_phy {
        status = "okay";
};

&usb2_hs_phy {
	status = "okay";
};
1 Like