162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * Copyright (C) 2013,2014 Russell King
362306a36Sopenharmony_ci *
462306a36Sopenharmony_ci * This file is dual-licensed: you can use it either under the terms
562306a36Sopenharmony_ci * of the GPL or the X11 license, at your option. Note that this dual
662306a36Sopenharmony_ci * licensing only applies to this file, and not this project as a
762306a36Sopenharmony_ci * whole.
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci *  a) This file is free software; you can redistribute it and/or
1062306a36Sopenharmony_ci *     modify it under the terms of the GNU General Public License
1162306a36Sopenharmony_ci *     version 2 as published by the Free Software Foundation.
1262306a36Sopenharmony_ci *
1362306a36Sopenharmony_ci *     This file is distributed in the hope that it will be useful,
1462306a36Sopenharmony_ci *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1562306a36Sopenharmony_ci *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1662306a36Sopenharmony_ci *     GNU General Public License for more details.
1762306a36Sopenharmony_ci *
1862306a36Sopenharmony_ci * Or, alternatively,
1962306a36Sopenharmony_ci *
2062306a36Sopenharmony_ci *  b) Permission is hereby granted, free of charge, to any person
2162306a36Sopenharmony_ci *     obtaining a copy of this software and associated documentation
2262306a36Sopenharmony_ci *     files (the "Software"), to deal in the Software without
2362306a36Sopenharmony_ci *     restriction, including without limitation the rights to use,
2462306a36Sopenharmony_ci *     copy, modify, merge, publish, distribute, sublicense, and/or
2562306a36Sopenharmony_ci *     sell copies of the Software, and to permit persons to whom the
2662306a36Sopenharmony_ci *     Software is furnished to do so, subject to the following
2762306a36Sopenharmony_ci *     conditions:
2862306a36Sopenharmony_ci *
2962306a36Sopenharmony_ci *     The above copyright notice and this permission notice shall be
3062306a36Sopenharmony_ci *     included in all copies or substantial portions of the Software.
3162306a36Sopenharmony_ci *
3262306a36Sopenharmony_ci *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
3362306a36Sopenharmony_ci *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
3462306a36Sopenharmony_ci *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
3562306a36Sopenharmony_ci *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
3662306a36Sopenharmony_ci *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
3762306a36Sopenharmony_ci *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
3862306a36Sopenharmony_ci *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
3962306a36Sopenharmony_ci *     OTHER DEALINGS IN THE SOFTWARE.
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci#include <dt-bindings/gpio/gpio.h>
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci/ {
4462306a36Sopenharmony_ci	vcc_3v3: regulator-vcc-3v3 {
4562306a36Sopenharmony_ci		compatible = "regulator-fixed";
4662306a36Sopenharmony_ci		regulator-always-on;
4762306a36Sopenharmony_ci		regulator-name = "vcc_3v3";
4862306a36Sopenharmony_ci		regulator-min-microvolt = <3300000>;
4962306a36Sopenharmony_ci		regulator-max-microvolt = <3300000>;
5062306a36Sopenharmony_ci	};
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci&fec {
5462306a36Sopenharmony_ci	pinctrl-names = "default";
5562306a36Sopenharmony_ci	pinctrl-0 = <&pinctrl_microsom_enet_ar8035>;
5662306a36Sopenharmony_ci	phy-mode = "rgmii-id";
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci	/*
5962306a36Sopenharmony_ci	 * The PHY seems to require a long-enough reset duration to avoid
6062306a36Sopenharmony_ci	 * some rare issues where the PHY gets stuck in an inconsistent and
6162306a36Sopenharmony_ci	 * non-functional state at boot-up. 10ms proved to be fine .
6262306a36Sopenharmony_ci	 */
6362306a36Sopenharmony_ci	phy-reset-duration = <10>;
6462306a36Sopenharmony_ci	phy-reset-gpios = <&gpio4 15 GPIO_ACTIVE_LOW>;
6562306a36Sopenharmony_ci	status = "okay";
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci	mdio {
6862306a36Sopenharmony_ci		#address-cells = <1>;
6962306a36Sopenharmony_ci		#size-cells = <0>;
7062306a36Sopenharmony_ci
7162306a36Sopenharmony_ci		/*
7262306a36Sopenharmony_ci		 * The PHY can appear at either address 0 or 4 due to the
7362306a36Sopenharmony_ci		 * configuration (LED) pin not being pulled sufficiently.
7462306a36Sopenharmony_ci		 */
7562306a36Sopenharmony_ci		ethernet-phy@0 {
7662306a36Sopenharmony_ci			reg = <0>;
7762306a36Sopenharmony_ci			qca,clk-out-frequency = <125000000>;
7862306a36Sopenharmony_ci			qca,smarteee-tw-us-1g = <24>;
7962306a36Sopenharmony_ci		};
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci		ethernet-phy@4 {
8262306a36Sopenharmony_ci			reg = <4>;
8362306a36Sopenharmony_ci			qca,clk-out-frequency = <125000000>;
8462306a36Sopenharmony_ci			qca,smarteee-tw-us-1g = <24>;
8562306a36Sopenharmony_ci		};
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci		/*
8862306a36Sopenharmony_ci		 * ADIN1300 (som rev 1.9 or later) is always at address 1. It
8962306a36Sopenharmony_ci		 * will be enabled automatically by U-Boot if detected.
9062306a36Sopenharmony_ci		 */
9162306a36Sopenharmony_ci		ethernet-phy@1 {
9262306a36Sopenharmony_ci			reg = <1>;
9362306a36Sopenharmony_ci			adi,phy-output-clock = "125mhz-free-running";
9462306a36Sopenharmony_ci			status = "disabled";
9562306a36Sopenharmony_ci		};
9662306a36Sopenharmony_ci	};
9762306a36Sopenharmony_ci};
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci&iomuxc {
10062306a36Sopenharmony_ci	microsom {
10162306a36Sopenharmony_ci		pinctrl_microsom_enet_ar8035: microsom-enet-ar8035 {
10262306a36Sopenharmony_ci			fsl,pins = <
10362306a36Sopenharmony_ci				MX6QDL_PAD_ENET_MDIO__ENET_MDIO		0x1b8b0
10462306a36Sopenharmony_ci				MX6QDL_PAD_ENET_MDC__ENET_MDC		0x1b0b0
10562306a36Sopenharmony_ci				/* AR8035 reset */
10662306a36Sopenharmony_ci				MX6QDL_PAD_KEY_ROW4__GPIO4_IO15		0x130b0
10762306a36Sopenharmony_ci				/* AR8035 interrupt */
10862306a36Sopenharmony_ci				MX6QDL_PAD_DI0_PIN2__GPIO4_IO18		0x1b0b0
10962306a36Sopenharmony_ci				/* GPIO16 -> AR8035 25MHz */
11062306a36Sopenharmony_ci				MX6QDL_PAD_GPIO_16__ENET_REF_CLK	0x4001b0b0
11162306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_TXC__RGMII_TXC		0x13030
11262306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_TD0__RGMII_TD0		0x1b030
11362306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_TD1__RGMII_TD1		0x1b030
11462306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_TD2__RGMII_TD2		0x1b030
11562306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_TD3__RGMII_TD3		0x1b030
11662306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL	0x1b030
11762306a36Sopenharmony_ci				/* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
11862306a36Sopenharmony_ci				MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK	0x0a0b1
11962306a36Sopenharmony_ci				/* AR8035 pin strapping: IO voltage: pull up */
12062306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_RXC__RGMII_RXC		0x1b030
12162306a36Sopenharmony_ci				/* AR8035 pin strapping: PHYADDR#0: pull down */
12262306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_RD0__RGMII_RD0		0x13030
12362306a36Sopenharmony_ci				/* AR8035 pin strapping: PHYADDR#1: pull down */
12462306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_RD1__RGMII_RD1		0x13030
12562306a36Sopenharmony_ci				/* AR8035 pin strapping: MODE#1: pull up */
12662306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_RD2__RGMII_RD2		0x1b030
12762306a36Sopenharmony_ci				/* AR8035 pin strapping: MODE#3: pull up */
12862306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_RD3__RGMII_RD3		0x1b030
12962306a36Sopenharmony_ci				/* AR8035 pin strapping: MODE#0: pull down */
13062306a36Sopenharmony_ci				MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL	0x13030
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci				/*
13362306a36Sopenharmony_ci				 * As the RMII pins are also connected to RGMII
13462306a36Sopenharmony_ci				 * so that an AR8030 can be placed, set these
13562306a36Sopenharmony_ci				 * to high-z with the same pulls as above.
13662306a36Sopenharmony_ci				 * Use the GPIO settings to avoid changing the
13762306a36Sopenharmony_ci				 * input select registers.
13862306a36Sopenharmony_ci				 */
13962306a36Sopenharmony_ci				MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25	0x03000
14062306a36Sopenharmony_ci				MX6QDL_PAD_ENET_RXD0__GPIO1_IO27	0x03000
14162306a36Sopenharmony_ci				MX6QDL_PAD_ENET_RXD1__GPIO1_IO26	0x03000
14262306a36Sopenharmony_ci			>;
14362306a36Sopenharmony_ci		};
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci		pinctrl_microsom_uart1: microsom-uart1 {
14662306a36Sopenharmony_ci			fsl,pins = <
14762306a36Sopenharmony_ci				MX6QDL_PAD_CSI0_DAT10__UART1_TX_DATA	0x1b0b1
14862306a36Sopenharmony_ci				MX6QDL_PAD_CSI0_DAT11__UART1_RX_DATA	0x1b0b1
14962306a36Sopenharmony_ci			>;
15062306a36Sopenharmony_ci		};
15162306a36Sopenharmony_ci	};
15262306a36Sopenharmony_ci};
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci&uart1 {
15562306a36Sopenharmony_ci	pinctrl-names = "default";
15662306a36Sopenharmony_ci	pinctrl-0 = <&pinctrl_microsom_uart1>;
15762306a36Sopenharmony_ci	status = "okay";
15862306a36Sopenharmony_ci};
159