// SPDX-License-Identifier: GPL-2.0
/*
 * Pinctrl dts file for HiSilicon Poplar board
 *
 * Copyright (c) 2016-2018 HiSilicon Technologies Co., Ltd.
 */

#include <dt-bindings/pinctrl/hisi.h>

/* value, enable bits, disable bits, mask */
#define PINCTRL_PULLDOWN(value, enable, disable, mask) \
	(value << 13) (enable << 13) (disable << 13) (mask << 13)
#define PINCTRL_PULLUP(value, enable, disable, mask) \
	(value << 12) (enable << 12) (disable << 12) (mask << 12)
#define PINCTRL_SLEW_RATE(value, mask)	  (value << 8) (mask << 8)
#define PINCTRL_DRV_STRENGTH(value, mask) (value << 4) (mask << 4)

&pmx0 {
	emmc_pins_1: emmc-pins-1 {
		pinctrl-single,pins = <
			0x000 MUX_M2
			0x004 MUX_M2
			0x008 MUX_M2
			0x00c MUX_M2
			0x010 MUX_M2
			0x014 MUX_M2
			0x018 MUX_M2
			0x01c MUX_M2
			0x024 MUX_M2
		>;
		pinctrl-single,bias-pulldown = <
			PINCTRL_PULLDOWN(0, 1, 0, 1)
		>;
		pinctrl-single,bias-pullup = <
			PINCTRL_PULLUP(0, 1, 0, 1)
		>;
		pinctrl-single,slew-rate = <
			PINCTRL_SLEW_RATE(1, 1)
		>;
		pinctrl-single,drive-strength = <
			PINCTRL_DRV_STRENGTH(0xb, 0xf)
		>;
	};

	emmc_pins_2: emmc-pins-2 {
		pinctrl-single,pins = <
			0x028 MUX_M2
		>;
		pinctrl-single,bias-pulldown = <
			PINCTRL_PULLDOWN(0, 1, 0, 1)
		>;
		pinctrl-single,bias-pullup = <
			PINCTRL_PULLUP(0, 1, 0, 1)
		>;
		pinctrl-single,slew-rate = <
			PINCTRL_SLEW_RATE(1, 1)
		>;
		pinctrl-single,drive-strength = <
			PINCTRL_DRV_STRENGTH(0x9, 0xf)
		>;
	};

	emmc_pins_3: emmc-pins-3 {
		pinctrl-single,pins = <
			0x02c MUX_M2
		>;
		pinctrl-single,bias-pulldown = <
			PINCTRL_PULLDOWN(0, 1, 0, 1)
		>;
		pinctrl-single,bias-pullup = <
			PINCTRL_PULLUP(0, 1, 0, 1)
		>;
		pinctrl-single,slew-rate = <
			PINCTRL_SLEW_RATE(1, 1)
		>;
		pinctrl-single,drive-strength = <
			PINCTRL_DRV_STRENGTH(3, 3)
		>;
	};

	emmc_pins_4: emmc-pins-4 {
		pinctrl-single,pins = <
			0x030 MUX_M2
		>;
		pinctrl-single,bias-pulldown = <
			PINCTRL_PULLDOWN(1, 1, 0, 1)
		>;
		pinctrl-single,bias-pullup = <
			PINCTRL_PULLUP(0, 1, 0, 1)
		>;
		pinctrl-single,slew-rate = <
			PINCTRL_SLEW_RATE(1, 1)
		>;
		pinctrl-single,drive-strength = <
			PINCTRL_DRV_STRENGTH(3, 3)
		>;
	};
};