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

/dts-v1/;

#define STRINGIZE(s) #s
#define LAN_LABEL(p, s) STRINGIZE(p ## s)
#define SWITCH_PORT_LABEL(n) LAN_LABEL(lan, n)

#define INTERNAL_PHY(n) \
	phy##n: ethernet-phy@##n { \
		reg = <##n>; \
		compatible = "ethernet-phy-ieee802.3-c22"; \
		phy-is-integrated; \
	};

#define EXTERNAL_PHY(n) \
	phy##n: ethernet-phy@##n { \
		reg = <##n>; \
		compatible = "ethernet-phy-ieee802.3-c22"; \
	};

#define EXTERNAL_SFP_PHY(n) \
	phy##n: ethernet-phy@##n { \
		compatible = "ethernet-phy-ieee802.3-c22"; \
		sfp; \
		media = "fibre"; \
		reg = <##n>; \
	};

#define EXTERNAL_SFP_PHY_FULL(n, s) \
	phy##n: ethernet-phy@##n { \
		compatible = "ethernet-phy-ieee802.3-c22"; \
		sfp = <&sfp##s>; \
		reg = <##n>; \
	};

#define SWITCH_PORT(p, l, m) \
	port##p: port@##p { \
		reg = <##p>; \
		label = SWITCH_PORT_LABEL(l) ; \
		phy-handle = <&phy##p>; \
		phy-mode = #m ; \
	};

#define SWITCH_PORT_SDS(p, l, s, m) \
	port##p: port@##p { \
		reg = <##p>; \
		label = SWITCH_PORT_LABEL(l) ; \
		pcs-handle = <&serdes##s>; \
		phy-handle = <&phy##p>; \
		phy-mode = #m ; \
	};

#define SWITCH_SFP_PORT(n, s, m) \
	port##n: port@##n { \
		reg = <##n>; \
		label = SWITCH_PORT_LABEL(s) ; \
		phy-handle = <&phy##n>; \
		phy-mode = #m ; \
		fixed-link { \
			speed = <1000>; \
			full-duplex; \
		}; \
	};

// LED Set mode definitions
#define RTL93XX_LED_SET_NONE        (0)
#define RTL93XX_LED_SET_10G         (1 << 0)
#define RTL93XX_LED_SET_5G          (1 << 1)
#define RTL93XX_LED_SET_2P5G        (1 << 3)
#define RTL93XX_LED_SET_1G          (1 << 5)
#define RTL93XX_LED_SET_100M        (1 << 7)
#define RTL93XX_LED_SET_10M         (1 << 8)
#define RTL93XX_LED_SET_LINK        (1 << 9)
#define RTL93XX_LED_SET_LINK_BLINK  (1 << 10)
#define RTL93XX_LED_SET_ACT         (1 << 11)
#define RTL93XX_LED_SET_RX          (1 << 12)
#define RTL93XX_LED_SET_TX          (1 << 13)
#define RTL93XX_LED_SET_COLLISION   (1 << 14)
#define RTL93XX_LED_SET_DUPLEX      (1 << 15)
