linux/arch/arm64/boot/dts/marvell/cn9130-cf-base.dts

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2024 Josua Mayer <[email protected]>
 *
 * DTS for SolidRun CN9130 Clearfog Base.
 *
 */

/dts-v1/;

#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>

#include "cn9130.dtsi"
#include "cn9130-sr-som.dtsi"
#include "cn9130-cf.dtsi"

/ {
	model = "SolidRun CN9130 Clearfog Base";
	compatible = "solidrun,cn9130-clearfog-base",
		     "solidrun,cn9130-sr-som", "marvell,cn9130";

	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-0 = <&rear_button_pins>;
		pinctrl-names = "default";

		button-0 {
			/* The rear SW3 button */
			label = "Rear Button";
			gpios = <&cp0_gpio1 31 GPIO_ACTIVE_LOW>;
			linux,can-disable;
			linux,code = <BTN_0>;
		};
	};

	rfkill-m2-gnss {
		compatible = "rfkill-gpio";
		label = "m.2 GNSS";
		radio-type = "gps";
		/* rfkill-gpio inverts internally */
		shutdown-gpios = <&expander0 9 GPIO_ACTIVE_HIGH>;
	};

	/* M.2 is B-keyed, so w-disable is for WWAN */
	rfkill-m2-wwan {
		compatible = "rfkill-gpio";
		label = "m.2 WWAN";
		radio-type = "wwan";
		/* rfkill-gpio inverts internally */
		shutdown-gpios = <&expander0 8 GPIO_ACTIVE_HIGH>;
	};
};

/* SRDS #3 - SGMII 1GE */
&cp0_eth1 {
	phy = <&phy1>;
	phys = <&cp0_comphy3 1>;
	phy-mode = "sgmii";
	status = "okay";
};

&cp0_eth2_phy {
	/*
	 * Configure LEDs default behaviour:
	 * - LED[0]: link/activity: On/blink (green)
	 * - LED[1]: link is 100/1000Mbps: On (yellow)
	 * - LED[2]: high impedance (floating)
	 */
	marvell,reg-init = <3 16 0xf000 0x0a61>;

	leds {
		#address-cells = <1>;
		#size-cells = <0>;

		led@0 {
			reg = <0>;
			color = <LED_COLOR_ID_GREEN>;
			function = LED_FUNCTION_WAN;
			default-state = "keep";
		};

		led@1 {
			reg = <1>;
			color = <LED_COLOR_ID_YELLOW>;
			function = LED_FUNCTION_WAN;
			default-state = "keep";
		};
	};
};

&cp0_gpio1 {
	sim-select-hog {
		gpio-hog;
		gpios = <27 GPIO_ACTIVE_HIGH>;
		output-high;
		line-name = "sim-select";
	};
};

&cp0_mdio {
	phy1: ethernet-phy@1 {
		reg = <1>;
		/*
		 * Configure LEDs default behaviour:
		 * - LED[0]: link/activity: On/blink (green)
		 * - LED[1]: link is 100/1000Mbps: On (yellow)
		 * - LED[2]: high impedance (floating)
		 *
		 * Configure LEDs electrical polarity
		 * - on-state: low
		 * - off-state: high (not hi-z, to avoid residual glow)
		 */
		marvell,reg-init = <3 16 0xf000 0x0a61>,
				   <3 17 0x003f 0x000a>;

		leds {
			#address-cells = <1>;
			#size-cells = <0>;

			led@0 {
				reg = <0>;
				color = <LED_COLOR_ID_GREEN>;
				function = LED_FUNCTION_LAN;
				default-state = "keep";
			};

			led@1 {
				reg = <1>;
				color = <LED_COLOR_ID_YELLOW>;
				function = LED_FUNCTION_LAN;
				default-state = "keep";
			};
		};
	};
};

&cp0_pinctrl {
	pinctrl-0 = <&sim_select_pins>;
	pintrl-names = "default";

	rear_button_pins: cp0-rear-button-pins {
		marvell,pins = "mpp31";
		marvell,function = "gpio";
	};

	sim_select_pins: cp0-sim-select-pins {
		marvell,pins = "mpp27";
		marvell,function = "gpio";
	};
};

/*
 * SRDS #4 - USB 3.0 host on M.2 connector
 * USB-2.0 Host on Type-A connector
 */
&cp0_usb3_1 {
	phys = <&cp0_comphy4 1>, <&cp0_utmi1>;
	phy-names = "comphy", "utmi";
	dr_mode = "host";
	status = "okay";
};

&expander0 {
	m2-full-card-power-off-hog {
		gpio-hog;
		gpios = <2 GPIO_ACTIVE_LOW>;
		output-low;
		line-name = "m2-full-card-power-off";
	};

	m2-reset-hog {
		gpio-hog;
		gpios = <10 GPIO_ACTIVE_LOW>;
		output-low;
		line-name = "m2-reset";
	};
};