// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * Copyright (c) 2020 Engicam srl
 * Copyright (c) 2020 Amarula Solutions
 * Copyright (c) 2020 Amarula Solutions(India)
 */

/ {
	aliases {
		mmc1 = &sdmmc;
		mmc2 = &sdio;
	};

	vcc5v0_sys: vcc5v0-sys {
		compatible = "regulator-fixed";
		regulator-name = "vcc5v0_sys";	/* +5V */
		regulator-always-on;
		regulator-boot-on;
		regulator-min-microvolt = <5000000>;
		regulator-max-microvolt = <5000000>;
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		clocks = <&xin32k>;
		clock-names = "ext_clock";
		post-power-on-delay-ms = <80>;
		pinctrl-names = "default";
		pinctrl-0 = <&wifi_enable_h>;
	};

	vcc3v3_btreg: vcc3v3-btreg {
		compatible = "regulator-gpio";
		enable-active-high;
		pinctrl-names = "default";
		pinctrl-0 = <&bt_enable_h>;
		regulator-name = "btreg-gpio-supply";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		states = <3300000 0x0>;
	};

	vcc3v3_rf_aux_mod: vcc3v3-rf-aux-mod {
		compatible = "regulator-fixed";
		regulator-name = "vcc3v3_rf_aux_mod";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vcc5v0_sys>;
	};

	xin32k: xin32k {
		compatible = "fixed-clock";
		#clock-cells = <0>;
		clock-frequency = <32768>;
		clock-output-names = "xin32k";
	};
};

&sdio {
	#address-cells = <1>;
	#size-cells = <0>;
	bus-width = <4>;
	clock-frequency = <50000000>;
	cap-sdio-irq;
	cap-sd-highspeed;
	keep-power-in-suspend;
	mmc-pwrseq = <&sdio_pwrseq>;
	non-removable;
	sd-uhs-sdr104;
	status = "okay";

	brcmf: wifi@1 {
		compatible = "brcm,bcm4329-fmac";
		reg = <1>;
	};
};

&gmac {
	clock_in_out = "output";
	phy-supply = <&vcc_3v3>;	/* +3V3_SOM */
	snps,reset-active-low;
	snps,reset-delays-us = <0 50000 50000>;
	snps,reset-gpio = <&gpio2 RK_PB5 GPIO_ACTIVE_HIGH>;
	status = "okay";
};

&pwm0 {
	status = "okay";
};

&sdmmc {
	cap-sd-highspeed;
	card-detect-delay = <800>;
	vmmc-supply = <&vcc_3v3>;	/* +3V3_SOM */
	vqmmc-supply = <&vcc_3v3>;
	status = "okay";
};

&u2phy {
	status = "okay";

	u2phy_host: host-port {
		status = "okay";
	};

	u2phy_otg: otg-port {
		status = "okay";
	};
};

&uart2 {
	pinctrl-0 = <&uart2m1_xfer>;
	status = "okay";
};

&usb20_otg {
	status = "okay";
};

&usb_host0_ehci {
	status = "okay";
};

&usb_host0_ohci {
	status = "okay";
};