// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
/*
 * Device Tree Overlay for the RZ/G2L(C) Solidrun SOM eMMC
 *
 * Copyright (C) 2024 SolidRun Ltd.
 */

/dts-v1/;
/plugin/;

#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/rzg2l-pinctrl.h>

&reg_pmic_ldo1 {
	/*
	 * This ldo can switch mmc host controller io voltage between
	 * 1.8V and 3.3V. The eMMC IO voltage however is supplied from
	 * reg_pmic_buck3 which is fixed at 1.8V.
	 * Lower this ldo maximum voltage to 1.8V to prevent setting 3.3V.
	 */
	regulator-max-microvolt = <1800000>;
};

&sdhi0 {
	/*
	 * Host controller and eMMC have separate io voltage regulators:
	 * reg_pmic_ldo1 (1.8V/3.3V); reg_pmic_buck3 (1.8V only).
	 * Link to the switchable regulator ensuring that it gets configured.
	 */
	vqmmc-supply = <&reg_pmic_ldo1>;
	bus-width = <8>;
	cap-mmc-hw-reset;
	mmc-hs200-1_8v;
	mux-states = <&sdhi0_mux 0>;
	non-removable;
	no-sdio;
	pinctrl-0 = <&sdhi0_8bit_uhs_pins>, <&sdhi0_rst_pins>;
	pinctrl-1 = <&sdhi0_8bit_uhs_pins>, <&sdhi0_rst_pins>;
	pinctrl-names = "default", "state_uhs";
	vmmc-supply = <&reg_pmic_buck4>;
	/* emmc io voltage is hard-wired for 1.8V, disable sd modes */
	no-sd;
	status = "okay";
};