/*
 * Copyright 2013 Sascha Hauer, Pengutronix
 *
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */

&ecspi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ecspi1>;
	fsl,spi-num-chipselects = <1>;
	cs-gpios = <&gpio3 19 0>;
	status = "okay";

	flash: m25p80@0 {
		compatible = "m25p80";
		spi-max-frequency = <40000000>;
		reg = <0>;
	};
};

&fec {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_enet>;
	phy-mode = "rgmii";
};

&iomuxc {
	imx6qdl-tqma6x {
		pinctrl_ecspi1: ecspi1grp {
			fsl,pins = <
				MX6QDL_PAD_EIM_D17__ECSPI1_MISO	0x100b1
				MX6QDL_PAD_EIM_D18__ECSPI1_MOSI	0x100b1
				MX6QDL_PAD_EIM_D16__ECSPI1_SCLK	0x100b1
			>;
		};

		pinctrl_enet: enetgrp {
			fsl,pins = <
				MX6QDL_PAD_RGMII_RXC__RGMII_RXC		0x100b1
				MX6QDL_PAD_RGMII_RD0__RGMII_RD0		0x100b1
				MX6QDL_PAD_RGMII_RD1__RGMII_RD1		0x100b1
				MX6QDL_PAD_RGMII_RD2__RGMII_RD2		0x100b1
				MX6QDL_PAD_RGMII_RD3__RGMII_RD3		0x100b1
				MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL	0x100b1
				MX6QDL_PAD_RGMII_TXC__RGMII_TXC		0x100b1
				MX6QDL_PAD_RGMII_TD0__RGMII_TD0		0x100b1
				MX6QDL_PAD_RGMII_TD1__RGMII_TD1		0x100b1
				MX6QDL_PAD_RGMII_TD2__RGMII_TD2		0x100b1
				MX6QDL_PAD_RGMII_TD3__RGMII_TD3		0x100b1
				MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL	0x100b1
				MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK	0x100b1
				MX6QDL_PAD_ENET_MDIO__ENET_MDIO		0x1b0b0
				MX6QDL_PAD_ENET_MDC__ENET_MDC		0x1b0b0
				MX6QDL_PAD_GPIO_16__ENET_REF_CLK	0x4001b0a8
			>;
		};

		pinctrl_i2c1: i2c1grp {
			fsl,pins = <
				MX6QDL_PAD_CSI0_DAT8__I2C1_SDA		0x4001b8b1
				MX6QDL_PAD_CSI0_DAT9__I2C1_SCL		0x4001b8b1
			>;
		};

		pinctrl_i2c3: i2c3grp {
			fsl,pins = <
				MX6QDL_PAD_GPIO_3__I2C3_SCL		0x4001b8b1
				MX6QDL_PAD_GPIO_6__I2C3_SDA		0x4001b8b1
			>;
		};

		pinctrl_usdhc3: usdhc3grp {
			fsl,pins = <
				MX6QDL_PAD_SD4_CMD__SD4_CMD		0x17059
				MX6QDL_PAD_SD4_CLK__SD4_CLK		0x10059
				MX6QDL_PAD_SD4_DAT0__SD4_DATA0		0x17059
				MX6QDL_PAD_SD4_DAT1__SD4_DATA1		0x17059
				MX6QDL_PAD_SD4_DAT2__SD4_DATA2		0x17059
				MX6QDL_PAD_SD4_DAT3__SD4_DATA3		0x17059
				MX6QDL_PAD_SD3_DAT4__SD3_DATA4		0x17059
				MX6QDL_PAD_SD3_DAT5__SD3_DATA5		0x17059
				MX6QDL_PAD_SD3_DAT6__SD3_DATA6		0x17059
				MX6QDL_PAD_SD3_DAT7__SD3_DATA7		0x17059
			>;
		};
	};
};

&ocotp {
	barebox,provide-mac-address = <&fec 0x620>;
};

&i2c1 {
	status = "okay";
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c1>;
};

&i2c3 {
	status = "okay";
	clock-frequency = <100000>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2c3>;

	pmic: pf0100@08 {
		compatible = "pf0100-regulator";
		reg = <0x08>;
		interrupt-parent = <&gpio6>;
		interrupts = <10 8>;

		regulators {
			reg_vddcore: sw1ab {
				regulator-min-microvolt = <300000>;
				regulator-max-microvolt = <1875000>;
				regulator-always-on;
			};

			reg_vddsoc: sw1c {
				regulator-min-microvolt = <300000>;
				regulator-max-microvolt = <1875000>;
				regulator-always-on;
			};

			reg_gen_3v3: sw2 {
				regulator-min-microvolt = <800000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
			};

			reg_ddr_1v5a: sw3a {
				regulator-min-microvolt = <400000>;
				regulator-max-microvolt = <1975000>;
				regulator-always-on;
			};

			reg_ddr_1v5b: sw3b {
				regulator-min-microvolt = <400000>;
				regulator-max-microvolt = <1975000>;
				regulator-always-on;
			};

			reg_ddr_vtt: sw4 {
				regulator-min-microvolt = <400000>;
				regulator-max-microvolt = <1975000>;
				regulator-always-on;
			};

			reg_5v_600mA: swbst {
				regulator-min-microvolt = <5000000>;
				regulator-max-microvolt = <5150000>;
				regulator-always-on;
			};

			reg_snvs_3v: vsnvs {
				regulator-min-microvolt = <1500000>;
				regulator-max-microvolt = <3000000>;
				regulator-always-on;
			};

			reg_vrefddr: vrefddr {
				regulator-min-microvolt = <750000>;
				regulator-max-microvolt = <750000>;
				regulator-always-on;
			};

			reg_vgen1_1v5: vgen1 {
				regulator-min-microvolt = <800000>;
				regulator-max-microvolt = <1550000>;
				/* not used */
			};

			reg_vgen2_1v2_eth: vgen2 {
				regulator-min-microvolt = <800000>;
				regulator-max-microvolt = <1550000>;
				regulator-always-on;
			};

			reg_vgen3_2v8: vgen3 {
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
			};

			reg_vgen4_1v8: vgen4 {
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
			};

			reg_vgen5_1v8_eth: vgen5 {
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
			};

			reg_vgen6_3v3: vgen6 {
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;
			};
		};
	};

	sensor2: lm75@48 {
		compatible = "lm75";
		reg = <0x48>;
	};

	eeprom: m24c64@50 {
		compatible = "st,24c64", "at24";
		reg = <0x50>;
	};
};

&usdhc3 { /* eMMC */
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usdhc3>;
	non-removable;
	bus-width = <8>;
	status = "okay";
};
