linux/arch/arm/boot/dts/st/stm32mp135f-dhcor-dhsbc.dts

// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
 * Copyright (C) 2024 Marek Vasut <[email protected]>
 *
 * DHCOR STM32MP13 variant:
 * DHCR-STM32MP135F-C100-R051-EE-F0409-SPI4-RTC-WBT-I-01LG
 * DHCOR PCB number: 718-100 or newer
 * DHSBC PCB number: 719-100 or newer
 */

/dts-v1/;

#include <dt-bindings/regulator/st,stm32mp13-regulator.h>
#include "stm32mp135.dtsi"
#include "stm32mp13xf.dtsi"
#include "stm32mp13xx-dhcor-som.dtsi"

/ {
	model = "DH electronics STM32MP135F DHCOR DHSBC";
	compatible = "dh,stm32mp135f-dhcor-dhsbc",
		     "dh,stm32mp135f-dhcor-som",
		     "st,stm32mp135";

	aliases {
		ethernet0 = &ethernet1;
		ethernet1 = &ethernet2;
		serial2 = &usart1;
		serial3 = &usart2;
	};

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

&adc_1 {
	pinctrl-names = "default";
	pinctrl-0 = <&adc1_pins_a &adc1_usb_cc_pins_b>;
	vdda-supply = <&vdd_adc>;
	vref-supply = <&vdd_adc>;
	status = "okay";

	adc1: adc@0 {
		status = "okay";

		/*
		 * Type-C USB_PWR_CC1 & USB_PWR_CC2 on in2 & in11.
		 * Use at least 5 * RC time, e.g. 5 * (Rp + Rd) * C:
		 * 5 * (5.1 + 47kOhms) * 5pF => 1.3us.
		 * Use arbitrary margin here (e.g. 5us).
		 *
		 * The pinmux pins must be set as ANALOG, use datasheet
		 * DS13483 Table 7. STM32MP135C/F ball definitions to
		 * find out which 'pin name' maps to which 'additional
		 * functions', which lists the mapping between pin and
		 * ADC channel. In this case, PA5 maps to ADC1_INP2 and
		 * PF13 maps to ADC1_INP11 .
		 */
		channel@2 {
			reg = <2>;
			st,min-sample-time-ns = <5000>;
		};

		channel@11 {
			reg = <11>;
			st,min-sample-time-ns = <5000>;
		};

		/* Expansion connector: INP12:pin29 */
		channel@12 {
			reg = <12>;
			st,min-sample-time-ns = <5000>;
		};
	};
};

&ethernet1 {
	phy-handle = <&ethphy1>;
	phy-mode = "rgmii-id";
	pinctrl-0 = <&eth1_rgmii_pins_a>;
	pinctrl-1 = <&eth1_rgmii_sleep_pins_a>;
	pinctrl-names = "default", "sleep";
	st,ext-phyclk;
	status = "okay";

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";

		ethphy1: ethernet-phy@1 {
			/* RTL8211F */
			compatible = "ethernet-phy-id001c.c916";
			interrupt-parent = <&gpiog>;
			interrupts = <12 IRQ_TYPE_LEVEL_LOW>;
			reg = <1>;
			reset-assert-us = <15000>;
			reset-deassert-us = <55000>;
			reset-gpios = <&gpioa 11 GPIO_ACTIVE_LOW>;
		};
	};
};

&ethernet2 {
	phy-handle = <&ethphy2>;
	phy-mode = "rgmii-id";
	pinctrl-0 = <&eth2_rgmii_pins_a>;
	pinctrl-1 = <&eth2_rgmii_sleep_pins_a>;
	pinctrl-names = "default", "sleep";
	st,ext-phyclk;
	status = "okay";

	mdio {
		#address-cells = <1>;
		#size-cells = <0>;
		compatible = "snps,dwmac-mdio";

		ethphy2: ethernet-phy@1 {
			/* RTL8211F */
			compatible = "ethernet-phy-id001c.c916";
			interrupt-parent = <&gpiog>;
			interrupts = <15 IRQ_TYPE_LEVEL_LOW>;
			reg = <1>;
			reset-assert-us = <15000>;
			reset-deassert-us = <55000>;
			reset-gpios = <&gpiog 8 GPIO_ACTIVE_LOW>;
		};
	};
};

&gpioa {
	gpio-line-names = "", "", "", "",
			  "", "DHSBC_USB_PWR_CC1", "", "",
			  "", "", "", "DHSBC_nETH1_RST",
			  "", "DHCOR_HW-CODING_0", "", "";
};

&gpiob {
	gpio-line-names = "", "", "", "",
			  "", "", "", "DHCOR_BT_HOST_WAKE",
			  "", "", "", "",
			  "", "DHSBC_nTPM_CS", "", "";
};

&gpioc {
	gpio-line-names = "", "", "", "DHSBC_USB_5V_MEAS",
			  "", "", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&gpiod {
	gpio-line-names = "", "", "", "",
			  "", "DHCOR_RAM-CODING_0", "", "",
			  "", "DHCOR_RAM-CODING_1", "", "",
			  "", "", "", "";
};

&gpioe {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "", "DHSBC_nTPM_RST", "", "",
			  "DHSBC_nTPM_PIRQ", "", "DHCOR_WL_HOST_WAKE", "";
};

&gpiof {
	gpio-line-names = "", "", "DHSBC_USB_PWR_nFLT", "",
			  "", "", "", "",
			  "", "", "", "",
			  "DHCOR_WL_REG_ON", "DHSBC_USB_PWR_CC2", "", "";
};

&gpiog {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "DHSBC_nETH2_RST", "DHCOR_BT_DEV_WAKE", "", "",
			  "DHSBC_ETH1_INTB", "", "", "DHSBC_ETH2_INTB";
};

&gpioi {
	gpio-line-names = "DHCOR_RTC_nINT", "DHCOR_HW-CODING_1",
			  "DHCOR_BT_REG_ON", "DHCOR_PMIC_nINT",
			  "DHSBC_BOOT0", "DHSBC_BOOT1",
			  "DHSBC_BOOT2", "DHSBC_USB-C_DATA_VBUS";
};

&i2c1 { /* Expansion connector: SDA:pin27 SCL:pin28 */
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c1_pins_a>;
	pinctrl-1 = <&i2c1_sleep_pins_a>;
	i2c-scl-rising-time-ns = <96>;
	i2c-scl-falling-time-ns = <3>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
};

&i2c5 { /* Expansion connector: SDA:pin3 SCL:pin5 */
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c5_pins_b>;
	pinctrl-1 = <&i2c5_sleep_pins_b>;
	i2c-scl-rising-time-ns = <96>;
	i2c-scl-falling-time-ns = <3>;
	clock-frequency = <400000>;
	status = "okay";
	/* spare dmas for other usage */
	/delete-property/dmas;
	/delete-property/dma-names;
};

&m_can1 { /* Expansion connector: TX:pin16 RX:pin18 */
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&m_can1_pins_a>;
	pinctrl-1 = <&m_can1_sleep_pins_a>;
	status = "okay";
};

&m_can2 { /* Expansion connector: TX:pin22 RX:pin26 */
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&m_can2_pins_a>;
	pinctrl-1 = <&m_can2_sleep_pins_a>;
	status = "okay";
};

&pwr_regulators {
	vdd-supply = <&vdd>;
	vdd_3v3_usbfs-supply = <&vdd_usb>;
	status = "okay";
};

&sai1 { /* Expansion connector: SCK-A:pin12 FS-A:pin35 SD-A:pin38 SD-B:pin40 */
	clocks = <&rcc SAI1>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
	clock-names = "pclk", "x8k", "x11k";
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&sai1a_pins_a &sai1b_pins_a>;
	pinctrl-1 = <&sai1a_sleep_pins_a &sai1b_sleep_pins_a>;
};

&scmi_voltd {
	status = "disabled";
};

&spi2 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi2_pins_a>;
	pinctrl-1 = <&spi2_sleep_pins_a>;
	cs-gpios = <&gpiob 13 0>;
	status = "okay";

	st33htph: tpm@0 {
		compatible = "st,st33htpm-spi", "tcg,tpm_tis-spi";
		reg = <0>;
		spi-max-frequency = <24000000>;
	};
};

&spi3 { /* Expansion connector: MOSI:pin19 MISO:pin21 SCK:pin22 nCS:pin24 */
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&spi3_pins_a>;
	pinctrl-1 = <&spi3_sleep_pins_a>;
	cs-gpios = <&gpiof 3 0>;
	status = "disabled";
};

&timers5 { /* Expansion connector: CH3:pin31 */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";

	pwm {
		pinctrl-0 = <&pwm5_pins_a>;
		pinctrl-1 = <&pwm5_sleep_pins_a>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@4 {
		status = "okay";
	};
};

&timers13 { /* Expansion connector: CH1:pin32 */
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";

	pwm {
		pinctrl-0 = <&pwm13_pins_a>;
		pinctrl-1 = <&pwm13_sleep_pins_a>;
		pinctrl-names = "default", "sleep";
		status = "okay";
	};
	timer@12 {
		status = "okay";
	};
};

&usart1 { /* Expansion connector: RX:pin33 TX:pin37 */
	pinctrl-names = "default", "sleep", "idle";
	pinctrl-0 = <&usart1_pins_b>;
	pinctrl-1 = <&usart1_sleep_pins_b>;
	pinctrl-2 = <&usart1_idle_pins_b>;
	status = "okay";
};

&usart2 { /* Expansion connector: RX:pin10 TX:pin8 RTS:pin11 CTS:pin36 */
	pinctrl-names = "default", "sleep", "idle";
	pinctrl-0 = <&usart2_pins_b>;
	pinctrl-1 = <&usart2_sleep_pins_b>;
	pinctrl-2 = <&usart2_idle_pins_b>;
	uart-has-rtscts;
	status = "okay";
};

&usbh_ehci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbh_ohci {
	phys = <&usbphyc_port0>;
	status = "okay";
};

&usbotg_hs {
	dr_mode = "peripheral";
	phys = <&usbphyc_port1 0>;
	phy-names = "usb2-phy";
	usb33d-supply = <&usb33>;
	status = "okay";
};

&usbphyc {
	status = "okay";
	vdda1v1-supply = <&reg11>;
	vdda1v8-supply = <&reg18>;
};

&usbphyc_port0 {
	phy-supply = <&vdd_usb>;
	st,current-boost-microamp = <1000>;
	st,decrease-hs-slew-rate;
	st,tune-hs-dc-level = <2>;
	st,enable-hs-rftime-reduction;
	st,trim-hs-current = <11>;
	st,trim-hs-impedance = <2>;
	st,tune-squelch-level = <1>;
	st,enable-hs-rx-gain-eq;
	st,no-hs-ftime-ctrl;
	st,no-lsfs-sc;
	connector {
		compatible = "usb-a-connector";
		vbus-supply = <&vbus_sw>;
	};
};

&usbphyc_port1 {
	phy-supply = <&vdd_usb>;
	st,current-boost-microamp = <1000>;
	st,decrease-hs-slew-rate;
	st,tune-hs-dc-level = <2>;
	st,enable-hs-rftime-reduction;
	st,trim-hs-current = <11>;
	st,trim-hs-impedance = <2>;
	st,tune-squelch-level = <1>;
	st,enable-hs-rx-gain-eq;
	st,no-hs-ftime-ctrl;
	st,no-lsfs-sc;
	connector {
		compatible = "gpio-usb-b-connector", "usb-b-connector";
		vbus-gpios = <&gpioi 7 GPIO_ACTIVE_HIGH>;
		label = "Type-C";
		self-powered;
		type = "micro";
	};
};