// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
/*
 * Copyright (C) 2025-2026 Marek Vasut <marex@nabladev.com>
 */

/ {
	aliases {
		mmc0 = &sdmmc2;
		mmc1 = &sdmmc3;
		serial0 = &usart6;
		serial1 = &uart8;
		eeprom0 = &eeprom0;
		eeprom0wl = &eeprom0wl;
		rtc0 = &rv3032;
		rtc1 = &rtc;
	};

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

	memory@80000000 {
		device_type = "memory";
		reg = <0x0 0x80000000 0x1 0x0>;
	};

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		/* Internal RAM reserved memory declaration */
		tfa_bl31: tfa-bl31@a000000 {
			reg = <0x0 0xa000000 0x0 0x20000>;
			no-map;
		};

		hpdma1_lli: hpdma1-lli@a020000 {
			reg = <0x0 0xa020000 0x0 0xf0f0>;
			no-map;
		};

		hpdma2_lli: hpdma2-lli@a02f0f0 {
			reg = <0x0 0xa02f0f0 0x0 0xf0f0>;
			no-map;
		};

		hpdma3_lli: hpdma3-lli@a03e1e0 {
			reg = <0x0 0xa03e1e0 0x0 0x1e20>;
			no-map;
		};

		bsec_mirror: bsec-mirror@a040000 {
			reg = <0x0 0xa040000 0x0 0x1000>;
			no-map;
		};

		scmi_cid2_s: scmi-cid2-s@a041000 {
			reg = <0x0 0xa041000 0x0 0x1000>;
			no-map;
		};

		scmi_cid2_ns: scmi-cid2-ns@a042000 {
			reg = <0x0 0xa042000 0x0 0x1000>;
			no-map;
		};

		cm33_sram1: cm33-sram1@a043000 {
			reg = <0x0 0xa043000 0x0 0x1d000>;
			no-map;
		};

		cm33_sram2: cm33-sram2@a060000 {
			reg = <0x0 0xa060000 0x0 0x20000>;
			no-map;
		};

		cm33_retram: cm33-retram@a080000 {
			reg = <0x0 0xa080000 0x0 0x1f000>;
			no-map;
		};

		ddr_param: ddr-param@a09f000 {
			reg = <0x0 0xa09f000 0x0 0x1000>;
			no-map;
		};

		cm0_cube_fw: cm0-cube-fw@200C0000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x200C0000 0x0 0x4000>;
			no-map;
		};

		cm0_cube_data: cm0-cube-data@200C4000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x200C4000 0x0 0x2000>;
			no-map;
		};

		ipc_shmem_2: ipc-shmem-2@200C6000{
			compatible = "shared-dma-pool";
			reg = <0x0 0x200C6000 0x0 0x2000>;
			no-map;
		};

		/* Backup RAM reserved memory declaration */
		bl31_lowpower: bl31-lowpower@42000000 {
			reg = <0x0 0x42000000 0x0 0x1000>;
			no-map;
		};

		tfm_its: tfm-its@42001000 {
			reg = <0x0 0x42001000 0x0 0x1000>;
			no-map;
		};

		/* Octo Memory Manager reserved memory declaration */
		mm_ospi1: mm-ospi@60000000 {
			reg = <0x0 0x60000000 0x0 0x10000000>;
			no-map;
		};

		/* DDR reserved memory declaration */
		tfm_code: tfm-code@80000000 {
			reg = <0x0 0x80000000 0x0 0x100000>;
			no-map;
		};

		cm33_cube_fw: cm33-cube-fw@80100000 {
			reg = <0x0 0x80100000 0x0 0x800000>;
			no-map;
		};

		tfm_data: tfm-data@80900000 {
			reg = <0x0 0x80900000 0x0 0x100000>;
			no-map;
		};

		cm33_cube_data: cm33-cube-data@80a00000 {
			reg = <0x0 0x80a00000 0x0 0x800000>;
			no-map;
		};

		ipc_shmem_1: ipc-shmem-1@81200000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x81200000 0x0 0xf8000>;
			no-map;
		};

		vdev0vring0: vdev0vring0@812f8000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x812f8000 0x0 0x1000>;
			no-map;
		};

		vdev0vring1: vdev0vring1@812f9000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x812f9000 0x0 0x1000>;
			no-map;
		};

		vdev0buffer: vdev0buffer@812fa000 {
			compatible = "shared-dma-pool";
			reg = <0x0 0x812fa000 0x0 0x6000>;
			no-map;
		};

		spare1: spare1@81300000 {
			reg = <0x0 0x81300000 0x0 0xcc0000>;
			no-map;
		};

		bl31_context: bl31-context@81fc0000 {
			reg = <0x0 0x81fc0000 0x0 0x40000>;
			no-map;
		};

		op_tee: op-tee@82000000 {
			reg = <0x0 0x82000000 0x0 0x2000000>;
			no-map;
		};

		gpu_reserved: gpu-reserved@fa800000 {
			reg = <0x0 0xfa800000 0x0 0x4000000>;
			no-map;
		};

		ltdc_sec_layer: ltdc-sec-layer@fe800000 {
			reg = <0x0 0xfe800000 0x0 0x800000>;
			no-map;
		};

		ltdc_sec_rotation: ltdc-sec-rotation@ff000000 {
			reg = <0x0 0xff000000 0x0 0x1000000>;
			no-map;
		};

		/* global autoconfigured region for contiguous allocations */
		linux,cma {
			compatible = "shared-dma-pool";
			reusable;
			alloc-ranges = <0 0x80000000 0 0x80000000>;
			size = <0x0 0x8000000>;
			alignment = <0x0 0x2000>;
			linux,cma-default;
		};
	};

	sdio_pwrseq: sdio-pwrseq {
		compatible = "mmc-pwrseq-simple";
		post-power-on-delay-ms = <50>;
		reset-gpios = <&ioexp 3 GPIO_ACTIVE_LOW>;
	};
};

&arm_wdt {
	timeout-sec = <32>;
	status = "okay";
};

&gpioa {
	gpio-line-names = "", "DHCOS-M", "DHCOS-K", "DHCOS-L",
			  "DHCOS-E", "DHCOS-J", "", "",
			  "DHCOS-D", "", "", "",
			  "", "", "", "";
};

&gpiof {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "", "", "", "",
			  "", "", "", "DHCOS_RAM-CODE_2";
};

&gpiog {
	gpio-line-names = "", "", "", "",
			  "", "", "", "",
			  "", "DHCOS_RAM-CODE_0", "DHCOS_RAM-CODE_1", "",
			  "", "", "DHCOS-F", "DHCOS_HW-CODE_0";
};

&gpioh {
	gpio-line-names = "", "", "DHCOS-I", "DHCOS-N",
			  "", "", "DHCOS-O", "DHCOS-H",
			  "DHCOS-G", "", "", "",
			  "", "", "", "";
};

&gpioi {
	gpio-line-names = "DHCOS_HW-CODE_1", "DHCOS_HW-CODE_2", "", "",
			  "", "", "", "",
			  "", "DHCOS-C", "", "",
			  "", "", "", "";
};

&gpioz {
	gpio-line-names = "", "", "DHCOS-A", "DHCOS-B",
			  "", "", "", "",
			  "", "", "", "",
			  "", "", "", "";
};

&i2c8 {
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&i2c8_pins_b>;
	pinctrl-1 = <&i2c8_sleep_pins_b>;
	i2c-scl-rising-time-ns = <57>;
	i2c-scl-falling-time-ns = <7>;
	clock-frequency = <400000>;
	status = "okay";

	ioexp: gpio@20 {
		compatible = "kinetic,kts1622", "ti,tcal6416";
		reg = <0x20>;
		gpio-controller;
		#gpio-cells = <2>;
		interrupts-extended = <&gpiod 11 IRQ_TYPE_LEVEL_LOW>;
		interrupt-controller;
		#interrupt-cells = <2>;
		wakeup-source;

		gpio-line-names =
			"#ETH1_RST_P0_0", "#ETH0_RST_P0_1",
			"BT_REG_ON_P0_2", "WL_REG_ON_P0_3",
			"USB1_PWR_EN_P0_4", "USB1_PWR_STAT_P0_5",
			"USB0_PWR_EN_P0_6", "USB0_PWR_STAT_P0_7",
			"SDIO0_CD_P1_0", "USB0_SS_SEL_P1_1",
			"#PCIe_RST_1_2", "#PCIe_Wake_P1_3",
			"#QSPI_RST_P1_4", "#CSI0_PWDN_P1_5",
			"#CSI0_RST_P1_6", "#ETH3_RST_P1_7";
	};

	eeprom0: eeprom@50 {
		compatible = "atmel,24c256";	/* ST M24256 */
		reg = <0x50>;
		pagesize = <64>;
	};

	rv3032: rtc@51 {
		compatible = "microcrystal,rv3032";
		reg = <0x51>;
		wakeup-source;
	};

	eeprom0wl: eeprom@58 {
		compatible = "st,24256e-wl";	/* ST M24256E WL page of 0x50 */
		pagesize = <64>;
		reg = <0x58>;
	};
};

&ommanager {
	memory-region = <&mm_ospi1>;
	pinctrl-names = "default", "sleep";
	pinctrl-0 = <&ospi_port1_clk_pins_a
		     &ospi_port1_io03_pins_a
		     &ospi_port1_cs0_pins_a>;
	pinctrl-1 = <&ospi_port1_clk_sleep_pins_a
		     &ospi_port1_io03_sleep_pins_a
		     &ospi_port1_cs0_sleep_pins_a>;
	pinctrl-names = "default", "sleep";
	status = "okay";
};

&ospi1 {
	#address-cells = <1>;
	#size-cells = <0>;
	memory-region = <&mm_ospi1>;
	status = "okay";

	flash0: flash@0 {
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-rx-bus-width = <4>;
		spi-tx-bus-width = <4>;
		spi-max-frequency = <100000000>;
	};
};

&rtc {
	status = "okay";
};

&scmi_regu {
	scmi_vddcore: regulator@b {
		reg = <VOLTD_SCMI_STPMIC2_BUCK2>;
		regulator-name = "vddcore";
	};

	regulator@c {
		reg = <VOLTD_SCMI_STPMIC2_BUCK3>;
		regulator-name = "vddgpu";
		regulator-always-on;
	};

	scmi_v1v8: regulator@e {
		reg = <VOLTD_SCMI_STPMIC2_BUCK5>;
		regulator-name = "v1v8";
		regulator-always-on;
	};

	scmi_v3v3: regulator@10 {
		reg = <VOLTD_SCMI_STPMIC2_BUCK7>;
		regulator-name = "v3v3";
		regulator-always-on;
	};

	scmi_vdd_emmc: regulator@12 {
		reg = <VOLTD_SCMI_STPMIC2_LDO2>;
		regulator-name = "vdd_emmc";
	};

	scmi_vdd3v3_usb: regulator@14 {
		reg = <VOLTD_SCMI_STPMIC2_LDO4>;
		regulator-name = "vdd3v3_usb";
	};

	scmi_vdd_sdcard: regulator@17 {
		reg = <VOLTD_SCMI_STPMIC2_LDO7>;
		regulator-name = "vdd_sdcard";
	};
};

&scmi_vddio3 {
	regulator-always-on;
};

&scmi_vddio4 {
	regulator-always-on;
};

&sdmmc2_b4_pins_a {
	pins2 {
		/delete-property/ bias-disable;
		bias-pull-up;
	};
};

&sdmmc2_b4_od_pins_a {
	pins2 {
		/delete-property/ bias-disable;
		bias-pull-up;
	};
};

&sdmmc2 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc2_b4_pins_a &sdmmc2_d47_pins_a>;
	pinctrl-1 = <&sdmmc2_b4_od_pins_a &sdmmc2_d47_pins_a>;
	pinctrl-2 = <&sdmmc2_b4_sleep_pins_a &sdmmc2_d47_sleep_pins_a>;
	non-removable;
	no-sd;
	no-sdio;
	st,neg-edge;
	bus-width = <8>;
	vmmc-supply = <&scmi_vdd_emmc>;
	vqmmc-supply = <&scmi_vddio2>;
	mmc-ddr-1_8v;
	mmc-hs200-1_8v;
	status = "okay";
};

&sdmmc3 {
	pinctrl-names = "default", "opendrain", "sleep";
	pinctrl-0 = <&sdmmc3_b4_pins_b>;
	pinctrl-1 = <&sdmmc3_b4_od_pins_b>;
	pinctrl-2 = <&sdmmc3_b4_sleep_pins_b>;
	bus-width = <4>;
	keep-power-in-suspend;
	non-removable;
	no-sd;
	no-mmc;
	st,neg-edge;
	vmmc-supply = <&scmi_v3v3>;
	vqmmc-supply = <&scmi_v1v8>;
	mmc-pwrseq = <&sdio_pwrseq>;
	status = "okay";

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

	brcmf: wifi@1 {	/* muRata 2FY */
		reg = <1>;
		compatible = "brcm,bcm4329-fmac";
	};
};

&usart6 {
	pinctrl-names = "default", "idle", "sleep";
	pinctrl-0 = <&usart6_pins_b>;
	pinctrl-1 = <&usart6_idle_pins_b>;
	pinctrl-2 = <&usart6_sleep_pins_b>;
	/delete-property/dmas;
	/delete-property/dma-names;
	status = "okay";
};