code:
// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * at91-sam9_l9260.dts - Device Tree file for Olimex SAM9-L9260 board
 *
 *  Copyright (C) 2016 Raashid Muhammed <raashidmuhammed@zilogic.com>
 */
/dts-v1/;
#include "at91sam9260.dtsi"

/ {
	model = "Olimex sam9-l9260";
	compatible = "olimex,sam9-l9260", "atmel,at91sam9260", "atmel,at91sam9";

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

	memory@20000000 {
		reg = <0x20000000 0x4000000>;
	};

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <18432000>;
		};
	};

	ahb {
		apb {
			tcb0: timer@fffa0000 {
				timer@0 {
					compatible = "atmel,tcb-timer";
					reg = <0>, <1>;
				};

				timer@2 {
					compatible = "atmel,tcb-timer";
					reg = <2>;
				};
			};

			mmc0: mmc@fffa8000 {
				pinctrl-0 = <
					&pinctrl_board_mmc0
					&pinctrl_mmc0_clk
					&pinctrl_mmc0_slot1_cmd_dat0
					&pinctrl_mmc0_slot1_dat1_3>;
				pinctrl-names = "default";
				status = "okay";

				slot@1 {
					reg = <1>;
					bus-width = <4>;
					cd-gpios = <&pioC 8 GPIO_ACTIVE_HIGH>;
					wp-gpios = <&pioC 4 GPIO_ACTIVE_HIGH>;
				};
			};

			macb0: ethernet@fffc4000 {
				pinctrl-0 = <&pinctrl_macb_rmii &pinctrl_macb_rmii_mii_alt>;
				phy-mode = "mii";
				#address-cells = <1>;
				#size-cells = <0>;
				status = "okay";

				ethernet-phy@1 {
					reg = <0x1>;
				};
			};

			spi0: spi@fffc8000 {
				cs-gpios = <&pioC 11 0>, <0>, <0>, <0>;
				status = "okay";

				flash@0 {
					compatible = "atmel,at45", "atmel,dataflash";
					spi-max-frequency = <15000000>;
					reg = <0>;
				};
			};

			dbgu: serial@fffff200 {
				status = "okay";
			};

			pinctrl@fffff400 {
				mmc0 {
					pinctrl_board_mmc0: mmc0-board {
						atmel,pins =
							<AT91_PIOC 8 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH	/* CD pin */
							 AT91_PIOC 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;	/* WP pin */
					};
				};
			};
		};

		nand0: nand@40000000 {
			nand-bus-width = <8>;
			nand-ecc-mode = "soft";
			nand-on-flash-bbt;
			status = "okay";
		};

		usb0: ohci@500000 {
			status = "okay";
		};

	};

	i2c-gpio-0 {
		status = "okay";
	};

	leds {
		compatible = "gpio-leds";

		pwr_led {
			label = "sam9-l9260:yellow:pwr";
			gpios = <&pioA 9 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "cpu0";
		};

		status_led {
			label = "sam9-l9260:green:status";
			gpios = <&pioA 6 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "timer";
		};
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sam9x60ek.dts - Device Tree file for Microchip SAM9X60-EK board
 *
 * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries
 *
 * Author: Sandeep Sheriker M <sandeepsheriker.mallikarjun@microchip.com>
 */
/dts-v1/;
#include "sam9x60.dtsi"
#include <dt-bindings/input/input.h>

/ {
	model = "Microchip SAM9X60-EK";
	compatible = "microchip,sam9x60ek", "microchip,sam9x60", "atmel,at91sam9";

	aliases {
		i2c0 = &i2c0;
		i2c1 = &i2c1;
		serial1 = &uart1;
	};

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

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <24000000>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio_default>;

		button-1 {
			label = "SW1";
			gpios = <&pioD 18 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_PROG1>;
			wakeup-source;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_gpio_leds>;
		status = "okay"; /* Conflict with pwm0. */

		red {
			label = "red";
			gpios = <&pioB 11 GPIO_ACTIVE_HIGH>;
		};

		green {
			label = "green";
			gpios = <&pioB 12 GPIO_ACTIVE_HIGH>;
		};

		blue {
			label = "blue";
			gpios = <&pioB 13 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};

	vdd_1v8: fixed-regulator-vdd_1v8 {
		compatible = "regulator-fixed";
		regulator-name = "VDD_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-always-on;
	};

	vdd_1v15: fixed-regulator-vdd_1v15 {
		compatible = "regulator-fixed";
		regulator-name = "VDD_1V15";
		regulator-min-microvolt = <1150000>;
		regulator-max-microvolt = <1150000>;
		regulator-always-on;
	};

	vdd1_3v3: fixed-regulator-vdd1_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDD1_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
	};

	vdd2_3v3: regulator-fixed-vdd2_3v3 {
		compatible = "regulator-fixed";
		regulator-name = "VDD2_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
	};
};

&adc {
	vddana-supply = <&vdd1_3v3>;
	vref-supply = <&vdd1_3v3>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_adc_default &pinctrl_adtrg_default>;
	status = "okay";
};

&can0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_can0_rx_tx>;
	status = "disabled"; /* Conflict with dbgu. */
};

&can1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_can1_rx_tx>;
	status = "okay";
};

&classd {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_classd_default>;
	atmel,pwm-type = "diff";
	atmel,non-overlap-time = <10>;
	status = "okay";
};

&dbgu {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_dbgu>;
	status = "okay"; /* Conflict with can0. */
};

&ebi {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_ebi_addr_nand &pinctrl_ebi_data_0_7>;
	status = "okay";

	nand_controller: nand-controller {
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_nand_oe_we &pinctrl_nand_cs &pinctrl_nand_rb>;
		status = "okay";

		nand@3 {
			reg = <0x3 0x0 0x800000>;
			rb-gpios = <&pioD 5 GPIO_ACTIVE_HIGH>;
			cs-gpios = <&pioD 4 GPIO_ACTIVE_HIGH>;
			nand-bus-width = <8>;
			nand-ecc-mode = "hw";
			nand-ecc-strength = <8>;
			nand-ecc-step-size = <512>;
			nand-on-flash-bbt;
			label = "atmel_nand";

			partitions {
				compatible = "fixed-partitions";
				#address-cells = <1>;
				#size-cells = <1>;

				at91bootstrap@0 {
					label = "at91bootstrap";
					reg = <0x0 0x40000>;
				};

				uboot@40000 {
					label = "u-boot";
					reg = <0x40000 0xc0000>;
				};

				ubootenvred@100000 {
					label = "U-Boot Env Redundant";
					reg = <0x100000 0x40000>;
				};

				ubootenv@140000 {
					label = "U-Boot Env";
					reg = <0x140000 0x40000>;
				};

				dtb@180000 {
					label = "device tree";
					reg = <0x180000 0x80000>;
				};

				kernel@200000 {
					label = "kernel";
					reg = <0x200000 0x600000>;
				};

				rootfs@800000 {
					label = "rootfs";
					reg = <0x800000 0x1f800000>;
				};
			};
		};
	};
};

&flx0 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
	status = "okay";

	i2c0: i2c@600 {
		compatible = "microchip,sam9x60-i2c";
		reg = <0x600 0x200>;
		interrupts = <5 IRQ_TYPE_LEVEL_HIGH 7>;
		#address-cells = <1>;
		#size-cells = <0>;
		clocks = <&pmc PMC_TYPE_PERIPHERAL 5>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_flx0_default>;
		atmel,fifo-size = <16>;
		i2c-analog-filter;
		i2c-digital-filter;
		i2c-digital-filter-width-ns = <35>;
		status = "okay";

		eeprom@53 {
			compatible = "atmel,24c02";
			reg = <0x53>;
			pagesize = <16>;
			status = "okay";
		};
	};
};

&flx4 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
	status = "disabled";

	spi0: spi@400 {
		compatible = "microchip,sam9x60-spi", "atmel,at91rm9200-spi";
		reg = <0x400 0x200>;
		interrupts = <13 IRQ_TYPE_LEVEL_HIGH 7>;
		clocks = <&pmc PMC_TYPE_PERIPHERAL 13>;
		clock-names = "spi_clk";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_flx4_default>;
		atmel,fifo-size = <16>;
		#address-cells = <1>;
		#size-cells = <0>;
		status = "disabled";
	};
};

&flx5 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
	status = "okay";

	uart1: serial@200 {
		compatible = "microchip,sam9x60-dbgu", "microchip,sam9x60-usart", "atmel,at91sam9260-dbgu", "atmel,at91sam9260-usart";
		reg = <0x200 0x200>;
		atmel,usart-mode = <AT91_USART_MODE_SERIAL>;
		interrupts = <14 IRQ_TYPE_LEVEL_HIGH 7>;
		dmas = <&dma0
			(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
			 AT91_XDMAC_DT_PERID(10))>,
		       <&dma0
			(AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
			 AT91_XDMAC_DT_PERID(11))>;
		dma-names = "tx", "rx";
		clocks = <&pmc PMC_TYPE_PERIPHERAL 14>;
		clock-names = "usart";
		pinctrl-0 = <&pinctrl_flx5_default>;
		pinctrl-names = "default";
		atmel,use-dma-rx;
		atmel,use-dma-tx;
		status = "okay";
	};
};

&flx6 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
	status = "okay";

	i2c1: i2c@600 {
		compatible = "microchip,sam9x60-i2c";
		reg = <0x600 0x200>;
		interrupts = <9 IRQ_TYPE_LEVEL_HIGH 7>;
		#address-cells = <1>;
		#size-cells = <0>;
		clocks = <&pmc PMC_TYPE_PERIPHERAL 9>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_flx6_default>;
		atmel,fifo-size = <16>;
		i2c-analog-filter;
		i2c-digital-filter;
		i2c-digital-filter-width-ns = <35>;
		status = "okay";

		gpio_exp: mcp23008@20 {
			compatible = "microchip,mcp23008";
			reg = <0x20>;
		};
	};
};

&gpbr {
	status = "okay";
};

&i2s {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_i2s_default>;
	#sound-dai-cells = <0>;
	status = "disabled"; /* Conflict with QSPI. */
};

&macb0 {
	phy-mode = "rmii";
	#address-cells = <1>;
	#size-cells = <0>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_macb0_rmii>;
	status = "okay";

	ethernet-phy@0 {
		reg = <0x0>;
	};
};

&pinctrl {
	adc {
		pinctrl_adc_default: adc_default {
			atmel,pins = <AT91_PIOB 15 AT91_PERIPH_A AT91_PINCTRL_NONE>;
		};

		pinctrl_adtrg_default: adtrg_default {
			atmel,pins = <AT91_PIOB 18 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>;
		};
	};

	dbgu {
		pinctrl_dbgu: dbgu-0 {
			atmel,pins = <AT91_PIOA 9 AT91_PERIPH_A AT91_PINCTRL_PULL_UP
				      AT91_PIOA 10 AT91_PERIPH_A AT91_PINCTRL_NONE>;
		};
	};

	i2s {
		pinctrl_i2s_default: i2s {
			atmel,pins =
				<AT91_PIOB 19 AT91_PERIPH_B AT91_PINCTRL_NONE		/* I2SCK */
				 AT91_PIOB 20 AT91_PERIPH_B AT91_PINCTRL_NONE		/* I2SWS */
				 AT91_PIOB 21 AT91_PERIPH_B AT91_PINCTRL_NONE		/* I2SDIN */
				 AT91_PIOB 22 AT91_PERIPH_B AT91_PINCTRL_NONE		/* I2SDOUT */
				 AT91_PIOB 23 AT91_PERIPH_B AT91_PINCTRL_NONE>;		/* I2SMCK */
		};
	};

	qspi {
		pinctrl_qspi: qspi {
			atmel,pins =
				<AT91_PIOB 19 AT91_PERIPH_A AT91_PINCTRL_SLEWRATE_DIS
				 AT91_PIOB 20 AT91_PERIPH_A AT91_PINCTRL_SLEWRATE_DIS
				 AT91_PIOB 21 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOB 22 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOB 23 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOB 24 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_SLEWRATE_DIS)>;
		};
	};

	nand {
		pinctrl_nand_oe_we: nand-oe-we-0 {
			atmel,pins =
				<AT91_PIOD 0 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 1 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>;
		};

		pinctrl_nand_rb: nand-rb-0 {
			atmel,pins =
				<AT91_PIOD 5 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
		};

		pinctrl_nand_cs: nand-cs-0 {
			atmel,pins =
				<AT91_PIOD 4 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
		};
	};

	ebi {
		pinctrl_ebi_data_0_7: ebi-data-lsb-0 {
			atmel,pins =
				<AT91_PIOD 6 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 7 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 8 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 9 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 10 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 11 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 12 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 13 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>;
		};

		pinctrl_ebi_data_0_15: ebi-data-msb-0 {
			atmel,pins =
				<AT91_PIOD 6 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 7 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 8 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 9 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 10 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 11 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 12 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 13 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 14 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 15 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 16 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 17 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 18 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 19 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 20 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOD 21 AT91_PERIPH_A AT91_PINCTRL_NONE>;
		};

		pinctrl_ebi_addr_nand: ebi-addr-0 {
			atmel,pins =
				<AT91_PIOD 2 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)
				 AT91_PIOD 3 AT91_PERIPH_A (AT91_PINCTRL_NONE | AT91_PINCTRL_SLEWRATE_DIS)>;
		};
	};

	flexcom {
		pinctrl_flx0_default: flx0_twi {
			atmel,pins =
				<AT91_PIOA 0 AT91_PERIPH_A AT91_PINCTRL_PULL_UP
				 AT91_PIOA 1 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>;
		};

		pinctrl_flx4_default: flx4_spi {
			atmel,pins =
				<AT91_PIOA 11 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOA 12 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOA 13 AT91_PERIPH_A AT91_PINCTRL_NONE
				 AT91_PIOA 14 AT91_PERIPH_A AT91_PINCTRL_NONE>;
		};

		pinctrl_flx5_default: flx_uart {
			atmel,pins =
				<AT91_PIOA 7 AT91_PERIPH_C AT91_PINCTRL_NONE
				 AT91_PIOA 8 AT91_PERIPH_B AT91_PINCTRL_NONE
				 AT91_PIOA 21 AT91_PERIPH_B AT91_PINCTRL_NONE
				 AT91_PIOA 22 AT91_PERIPH_B AT91_PINCTRL_NONE>;
		};

		pinctrl_flx6_default: flx6_twi {
			atmel,pins =
				<AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_PULL_UP
				 AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>;
		};
	};

	classd {
		pinctrl_classd_default: classd {
			atmel,pins =
				<AT91_PIOA 24 AT91_PERIPH_C AT91_PINCTRL_PULL_UP
				 AT91_PIOA 25 AT91_PERIPH_C AT91_PINCTRL_PULL_DOWN
				 AT91_PIOA 26 AT91_PERIPH_C AT91_PINCTRL_PULL_UP
				 AT91_PIOA 27 AT91_PERIPH_C AT91_PINCTRL_PULL_DOWN>;
		};
	};

	can0 {
		pinctrl_can0_rx_tx: can0_rx_tx {
			atmel,pins =
				<AT91_PIOA 9 AT91_PERIPH_B AT91_PINCTRL_NONE	/* CANRX0 */
				 AT91_PIOA 10 AT91_PERIPH_B AT91_PINCTRL_NONE	/* CANTX0 */
				 AT91_PIOD 20 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_DOWN	/* Enable CAN0 mux */
				 AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_DOWN>;	/* Enable CAN Transceivers */
		};
	};

	can1 {
		pinctrl_can1_rx_tx: can1_rx_tx {
			atmel,pins =
				<AT91_PIOA 6 AT91_PERIPH_B AT91_PINCTRL_NONE	/* CANRX1 RXD1 */
				 AT91_PIOA 5 AT91_PERIPH_B AT91_PINCTRL_NONE	/* CANTX1 TXD1 */
				 AT91_PIOD 19 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_DOWN	/* Enable CAN1 mux */
				 AT91_PIOD 21 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_DOWN>;	/* Enable CAN Transceivers */
		};
	};

	macb0 {
		pinctrl_macb0_rmii: macb0_rmii-0 {
			atmel,pins =
				<AT91_PIOB 0 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB0 periph A */
				 AT91_PIOB 1 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB1 periph A */
				 AT91_PIOB 2 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB2 periph A */
				 AT91_PIOB 3 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB3 periph A */
				 AT91_PIOB 4 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB4 periph A */
				 AT91_PIOB 5 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB5 periph A */
				 AT91_PIOB 6 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB6 periph A */
				 AT91_PIOB 7 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB7 periph A */
				 AT91_PIOB 9 AT91_PERIPH_A AT91_PINCTRL_NONE	/* PB9 periph A */
				 AT91_PIOB 10 AT91_PERIPH_A AT91_PINCTRL_NONE>;	/* PB10 periph A */
		};
	};

	pwm0 {
		pinctrl_pwm0_0: pwm0_0 {
			atmel,pins = <AT91_PIOB 11 AT91_PERIPH_B AT91_PINCTRL_NONE>;
		};

		pinctrl_pwm0_1: pwm0_1 {
			atmel,pins = <AT91_PIOB 12 AT91_PERIPH_B AT91_PINCTRL_NONE>;
		};

		pinctrl_pwm0_2: pwm0_2 {
			atmel,pins = <AT91_PIOB 13 AT91_PERIPH_B AT91_PINCTRL_NONE>;
		};

		pinctrl_pwm0_3: pwm0_3 {
			atmel,pins = <AT91_PIOB 14 AT91_PERIPH_B AT91_PINCTRL_NONE>;
		};
	};

	sdmmc0 {
		pinctrl_sdmmc0_default: sdmmc0 {
			atmel,pins =
				<AT91_PIOA 17 AT91_PERIPH_A (AT91_PINCTRL_DRIVE_STRENGTH_HI)				/* PA17 CK  periph A with pullup */
				 AT91_PIOA 16 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA16 CMD periph A with pullup */
				 AT91_PIOA 15 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA15 DAT0 periph A */
				 AT91_PIOA 18 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA18 DAT1 periph A with pullup */
				 AT91_PIOA 19 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA19 DAT2 periph A with pullup */
				 AT91_PIOA 20 AT91_PERIPH_A (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)>;	/* PA20 DAT3 periph A with pullup */
		};
		pinctrl_sdmmc0_cd: sdmmc0_cd {
			atmel,pins =
				<AT91_PIOA 23 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};
	};

	sdmmc1 {
		pinctrl_sdmmc1_default: sdmmc1 {
			atmel,pins =
				<AT91_PIOA 13 AT91_PERIPH_B (AT91_PINCTRL_DRIVE_STRENGTH_HI)				/* PA13 CK periph B */
				 AT91_PIOA 12 AT91_PERIPH_B (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA12 CMD periph B with pullup */
				 AT91_PIOA 11 AT91_PERIPH_B (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA11 DAT0 periph B with pullup */
				 AT91_PIOA  2 AT91_PERIPH_B (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA2 DAT1 periph B with pullup */
				 AT91_PIOA  3 AT91_PERIPH_B (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)	/* PA3 DAT2 periph B with pullup */
				 AT91_PIOA  4 AT91_PERIPH_B (AT91_PINCTRL_PULL_UP | AT91_PINCTRL_DRIVE_STRENGTH_HI)>;	/* PA4 DAT3 periph B with pullup */
		};
	};

	gpio_keys {
		pinctrl_key_gpio_default: pinctrl_key_gpio {
			atmel,pins = <AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};
	};

	usb0 {
		pinctrl_usba_vbus: usba_vbus {
			atmel,pins = <AT91_PIOB 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};
	};

	usb1 {
		pinctrl_usb_default: usb_default {
			atmel,pins = <AT91_PIOD 15 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
				      AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};
	};

	leds {
		pinctrl_gpio_leds: gpio_leds {
			atmel,pins = <AT91_PIOB 11 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
				      AT91_PIOB 12 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
				      AT91_PIOB 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};
	};
}; /* pinctrl */

&pwm0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm0_0 &pinctrl_pwm0_1 &pinctrl_pwm0_2 &pinctrl_pwm0_3>;
	status = "disabled"; /* Conflict with leds. */
};

&sdmmc0 {
	bus-width = <4>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sdmmc0_default &pinctrl_sdmmc0_cd>;
	status = "okay";
	cd-gpios = <&pioA 23 GPIO_ACTIVE_LOW>;
	disable-wp;
};

&sdmmc1 {
	bus-width = <4>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sdmmc1_default>;
	no-1-8-v;
	non-removable;
	status = "disabled"; /* Conflict with flx4. */
};

&qspi {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_qspi>;
	status = "okay"; /* Conflict with i2s. */

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		spi-tx-bus-width = <4>;
		spi-rx-bus-width = <4>;
		m25p,fast-read;

		at91bootstrap@0 {
			label = "qspi: at91bootstrap";
			reg = <0x0 0x40000>;
		};

		bootloader@40000 {
			label = "qspi: bootloader";
			reg = <0x40000 0xc0000>;
		};

		bootloaderenvred@100000 {
			label = "qspi: bootloader env redundant";
			reg = <0x100000 0x40000>;
		};

		bootloaderenv@140000 {
			label = "qspi: bootloader env";
			reg = <0x140000 0x40000>;
		};

		dtb@180000 {
			label = "qspi: device tree";
			reg = <0x180000 0x80000>;
		};

		kernel@200000 {
			label = "qspi: kernel";
			reg = <0x200000 0x600000>;
		};
	};
};

&rtt {
	atmel,rtt-rtc-time-reg = <&gpbr 0x0>;
	status = "okay";
};

&shutdown_controller {
	debounce-delay-us = <976>;
	status = "okay";

	input@0 {
		reg = <0>;
	};
};

&tcb0 {
	timer0: timer@0 {
		compatible = "atmel,tcb-timer";
		reg = <0>;
	};

	timer1: timer@1 {
		compatible = "atmel,tcb-timer";
		reg = <1>;
	};
};

&usb0 {
	atmel,vbus-gpio = <&pioB 16 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usba_vbus>;
	status = "okay";
};

&usb1 {
	num-ports = <3>;
	atmel,vbus-gpio = <0
			   &pioD 15 GPIO_ACTIVE_HIGH
			   &pioD 16 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usb_default>;
	status = "okay";
};

&usb2 {
	status = "okay";
};

&watchdog {
	status = "okay";
};

repo_name: angery/linux


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sama5d27_som1.dtsi - Device Tree file for SAMA5D27 SoM1 board
 *
 *  Copyright (c) 2017, Microchip Technology Inc.
 *                2017 Cristian Birsan <cristian.birsan@microchip.com>
 *                2017 Claudiu Beznea <claudiu.beznea@microchip.com>
 */
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/gpio/gpio.h>

/ {
	model = "Atmel SAMA5D27 SoM1";
	compatible = "atmel,sama5d27-som1", "atmel,sama5d27", "atmel,sama5d2", "atmel,sama5";

	aliases {
		i2c0 = &i2c0;
	};

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <24000000>;
		};
	};

	ahb {
		sdmmc0: sdio-host@a0000000 {
			microchip,sdcal-inverted;
		};

		apb {
			qspi1: spi@f0024000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_qspi1_default>;

				flash@0 {
					#address-cells = <1>;
					#size-cells = <1>;
					compatible = "jedec,spi-nor";
					reg = <0>;
					spi-max-frequency = <80000000>;
					spi-tx-bus-width = <4>;
					spi-rx-bus-width = <4>;
					m25p,fast-read;

					at91bootstrap@0 {
						label = "at91bootstrap";
						reg = <0x00000000 0x00040000>;
					};

					bootloader@40000 {
						label = "bootloader";
						reg = <0x00040000 0x000c0000>;
					};

					bootloaderenvred@100000 {
						label = "bootloader env redundant";
						reg = <0x00100000 0x00040000>;
					};

					bootloaderenv@140000 {
						label = "bootloader env";
						reg = <0x00140000 0x00040000>;
					};

					dtb@180000 {
						label = "device tree";
						reg = <0x00180000 0x00080000>;
					};

					kernel@200000 {
						label = "kernel";
						reg = <0x00200000 0x00600000>;
					};
				};
			};

			macb0: ethernet@f8008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_macb0_default>;
				#address-cells = <1>;
				#size-cells = <0>;
				phy-mode = "rmii";

				ethernet-phy@7 {
					reg = <0x7>;
					interrupt-parent = <&pioA>;
					interrupts = <PIN_PD31 IRQ_TYPE_LEVEL_LOW>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_macb0_phy_irq>;
				};
			};

			i2c0: i2c@f8028000 {
				dmas = <0>, <0>;
				pinctrl-names = "default", "gpio";
				pinctrl-0 = <&pinctrl_i2c0_default>;
				pinctrl-1 = <&pinctrl_i2c0_gpio>;
				sda-gpios = <&pioA PIN_PD21 GPIO_ACTIVE_HIGH>;
				scl-gpios = <&pioA PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
				status = "okay";

				at24@50 {
					compatible = "atmel,24c02";
					reg = <0x50>;
					pagesize = <8>;
				};
			};

			pinctrl@fc038000 {
				pinctrl_i2c0_default: i2c0_default {
					pinmux = <PIN_PD21__TWD0>,
						 <PIN_PD22__TWCK0>;
					bias-disable;
				};

				pinctrl_i2c0_gpio: i2c0_gpio {
					pinmux = <PIN_PD21__GPIO>,
						 <PIN_PD22__GPIO>;
					bias-disable;
				};

				pinctrl_qspi1_default: qspi1_default {
					sck_cs {
						pinmux = <PIN_PB5__QSPI1_SCK>,
							 <PIN_PB6__QSPI1_CS>;
						bias-disable;
					};

					data {
						pinmux = <PIN_PB7__QSPI1_IO0>,
							 <PIN_PB8__QSPI1_IO1>,
							 <PIN_PB9__QSPI1_IO2>,
							 <PIN_PB10__QSPI1_IO3>;
						bias-pull-up;
					};
				};

				pinctrl_macb0_default: macb0_default {
					pinmux = <PIN_PD9__GTXCK>,
						 <PIN_PD10__GTXEN>,
						 <PIN_PD11__GRXDV>,
						 <PIN_PD12__GRXER>,
						 <PIN_PD13__GRX0>,
						 <PIN_PD14__GRX1>,
						 <PIN_PD15__GTX0>,
						 <PIN_PD16__GTX1>,
						 <PIN_PD17__GMDC>,
						 <PIN_PD18__GMDIO>;
					bias-disable;
				};

				pinctrl_macb0_phy_irq: macb0_phy_irq {
					pinmux = <PIN_PD31__GPIO>;
					bias-disable;
				};
			};
		};
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sama5d27_som1_ek.dts - Device Tree file for SAMA5D27-SOM1-EK board
 *
 *  Copyright (c) 2017, Microchip Technology Inc.
 *                2016 Nicolas Ferre <nicolas.ferre@atmel.com>
 *                2017 Cristian Birsan <cristian.birsan@microchip.com>
 *                2017 Claudiu Beznea <claudiu.beznea@microchip.com>
 */
/dts-v1/;
#include "at91-sama5d27_som1.dtsi"
#include <dt-bindings/mfd/atmel-flexcom.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>

/ {
	model = "Atmel SAMA5D27 SOM1 EK";
	compatible = "atmel,sama5d27-som1-ek", "atmel,sama5d27-som1", "atmel,sama5d27", "atmel,sama5d2", "atmel,sama5";

	aliases {
		serial0 = &uart1;	/* DBGU */
		serial1 = &uart4;	/* mikro BUS 1 */
		serial2 = &uart2;	/* mikro BUS 2 */
		i2c1 = &i2c1;
		i2c2 = &i2c3;
	};

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

	ahb {
		usb0: gadget@300000 {
			atmel,vbus-gpio = <&pioA PIN_PD20 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usba_vbus>;
			status = "okay";
		};

		usb1: ohci@400000 {
			num-ports = <3>;
			atmel,vbus-gpio = <0 /* &pioA PIN_PD20 GPIO_ACTIVE_HIGH */
					   &pioA PIN_PA27 GPIO_ACTIVE_HIGH
					   0
					  >;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usb_default>;
			status = "okay";
		};

		usb2: ehci@500000 {
			status = "okay";
		};

		sdmmc0: sdio-host@a0000000 {
			bus-width = <8>;
			mmc-ddr-3_3v;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc0_default>;
			status = "okay";
		};

		sdmmc1: sdio-host@b0000000 {
			bus-width = <4>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc1_default>;
			status = "okay";
		};

		apb {
			isc: isc@f0008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_isc_base &pinctrl_isc_data_8bit &pinctrl_isc_data_9_10 &pinctrl_isc_data_11_12>;
			};

			qspi1: spi@f0024000 {
				status = "okay";
			};

			spi0: spi@f8000000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_spi0_default>;
				status = "okay";
			};

			macb0: ethernet@f8008000 {
				status = "okay";
			};

			tcb0: timer@f800c000 {
				timer0: timer@0 {
					compatible = "atmel,tcb-timer";
					reg = <0>;
				};

				timer1: timer@1 {
					compatible = "atmel,tcb-timer";
					reg = <1>;
				};
			};

			uart1: serial@f8020000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart1_default>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};

			uart2: serial@f8024000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_mikrobus2_uart>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};

			pwm0: pwm@f802c000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_mikrobus1_pwm &pinctrl_mikrobus2_pwm>;
				status = "disabled"; /* Conflict with leds. */
			};

			flx1: flexcom@f8038000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
				status = "okay";

				i2c3: i2c@600 {
					dmas = <0>, <0>;
					i2c-analog-filter;
					i2c-digital-filter;
					i2c-digital-filter-width-ns = <35>;
					pinctrl-names = "default", "gpio";
					pinctrl-0 = <&pinctrl_mikrobus_i2c>;
					pinctrl-1 = <&pinctrl_i2c3_gpio>;
					sda-gpios = <&pioA PIN_PA24 GPIO_ACTIVE_HIGH>;
					scl-gpios = <&pioA PIN_PA23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
					status = "okay";
				};
			};

			shdwc@f8048010 {
				debounce-delay-us = <976>;
				atmel,wakeup-rtc-timer;

				input@0 {
					reg = <0>;
				};
			};

			watchdog@f8048040 {
				status = "okay";
			};

			uart3: serial@fc008000 {
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart3_default>;
				status = "disabled"; /* Conflict with isc. */
			};

			uart4: serial@fc00c000 {
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_mikrobus1_uart>;
				status = "okay";
			};

			flx3: flexcom@fc014000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
				status = "disabled";

				uart8: serial@200 {
					dmas = <0>, <0>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx3_default>;
					status = "disabled"; /* Conflict with isc. */
				};

				spi5: spi@400 {
					dmas = <0>, <0>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx3_default>;
					status = "disabled"; /* Conflict with isc. */
				};
			};

			flx4: flexcom@fc018000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
				status = "okay";

				uart9: serial@200 {
					dmas = <0>, <0>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx4_default>;
					status = "disabled"; /* Conflict with spi6 and i2c6. */
				};

				spi6: spi@400 {
					dmas = <0>, <0>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_mikrobus_spi &pinctrl_mikrobus1_spi_cs &pinctrl_mikrobus2_spi_cs>;
					status = "okay"; /* Conflict with uart5 and i2c6. */
				};

				i2c6: i2c@600 {
					dmas = <0>, <0>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx4_default>;
					status = "disabled"; /* Conflict with uart5 and spi6. */
				};
			};

			i2c1: i2c@fc028000 {
				dmas = <0>, <0>;
				i2c-analog-filter;
				i2c-digital-filter;
				i2c-digital-filter-width-ns = <35>;
				pinctrl-names = "default", "gpio";
				pinctrl-0 = <&pinctrl_i2c1_default>;
				pinctrl-1 = <&pinctrl_i2c1_gpio>;
				sda-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_HIGH>;
				scl-gpios = <&pioA PIN_PD5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
				status = "okay";
			};

			adc: adc@fc030000 {
				vddana-supply = <&vddana>;
				vref-supply = <&advref>;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_mikrobus1_an &pinctrl_mikrobus2_an>;

				status = "okay";
			};

			pinctrl@fc038000 {

				pinctrl_can1_default: can1_default {
					pinmux = <PIN_PC26__CANTX1>,
						 <PIN_PC27__CANRX1>;
					bias-disable;
				};

				pinctrl_flx3_default: flx3_default {
					pinmux = <PIN_PC20__FLEXCOM3_IO0>,
						 <PIN_PC19__FLEXCOM3_IO1>,
						 <PIN_PC18__FLEXCOM3_IO2>,
						 <PIN_PC21__FLEXCOM3_IO3>,
						 <PIN_PC22__FLEXCOM3_IO4>;
					bias-disable;
				};

				pinctrl_i2c1_default: i2c1_default {
					pinmux = <PIN_PD4__TWD1>,
						 <PIN_PD5__TWCK1>;
					bias-disable;
				};

				pinctrl_i2c1_gpio: i2c1_gpio {
                                        pinmux = <PIN_PD4__GPIO>,
                                                 <PIN_PD5__GPIO>;
                                        bias-disable;
                                };

				pinctrl_isc_base: isc_base {
					pinmux = <PIN_PC21__ISC_PCK>,
						 <PIN_PC22__ISC_VSYNC>,
						 <PIN_PC23__ISC_HSYNC>,
						 <PIN_PC24__ISC_MCK>;
					bias-disable;
				};

				pinctrl_isc_data_8bit: isc_data_8bit {
					pinmux = <PIN_PC20__ISC_D11>,
						 <PIN_PC19__ISC_D10>,
						 <PIN_PC18__ISC_D9>,
						 <PIN_PC17__ISC_D8>,
						 <PIN_PC16__ISC_D7>,
						 <PIN_PC15__ISC_D6>,
						 <PIN_PC14__ISC_D5>,
						 <PIN_PC13__ISC_D4>;
					bias-disable;
				};

				pinctrl_isc_data_9_10: isc_data_9_10 {
					pinmux = <PIN_PC12__ISC_D3>,
						 <PIN_PC11__ISC_D2>;
					bias-disable;
				};

				pinctrl_isc_data_11_12: isc_data_11_12 {
					pinmux = <PIN_PC10__ISC_D1>,
						 <PIN_PC9__ISC_D0>;
					bias-disable;
				};

				pinctrl_key_gpio_default: key_gpio_default {
					pinmux = <PIN_PA29__GPIO>;
					bias-pull-up;
				};

				pinctrl_led_gpio_default: led_gpio_default {
					pinmux = <PIN_PA10__GPIO>,
						 <PIN_PB1__GPIO>,
						 <PIN_PA31__GPIO>;
					bias-pull-up;
				};

				pinctrl_sdmmc0_default: sdmmc0_default {
					cmd_data {
						pinmux = <PIN_PA1__SDMMC0_CMD>,
							 <PIN_PA2__SDMMC0_DAT0>,
							 <PIN_PA3__SDMMC0_DAT1>,
							 <PIN_PA4__SDMMC0_DAT2>,
							 <PIN_PA5__SDMMC0_DAT3>,
							 <PIN_PA6__SDMMC0_DAT4>,
							 <PIN_PA7__SDMMC0_DAT5>,
							 <PIN_PA8__SDMMC0_DAT6>,
							 <PIN_PA9__SDMMC0_DAT7>;
						bias-disable;
					};

					ck_cd_vddsel {
						pinmux = <PIN_PA0__SDMMC0_CK>,
							 <PIN_PA11__SDMMC0_VDDSEL>,
							 <PIN_PA13__SDMMC0_CD>;
						bias-disable;
					};
				};

				pinctrl_sdmmc1_default: sdmmc1_default {
					cmd_data {
						pinmux = <PIN_PA28__SDMMC1_CMD>,
							 <PIN_PA18__SDMMC1_DAT0>,
							 <PIN_PA19__SDMMC1_DAT1>,
							 <PIN_PA20__SDMMC1_DAT2>,
							 <PIN_PA21__SDMMC1_DAT3>;
						bias-disable;
					};

					conf-ck_cd {
						pinmux = <PIN_PA22__SDMMC1_CK>,
							 <PIN_PA30__SDMMC1_CD>;
						bias-disable;
					};
				};

				pinctrl_spi0_default: spi0_default {
					pinmux = <PIN_PA14__SPI0_SPCK>,
						 <PIN_PA15__SPI0_MOSI>,
						 <PIN_PA16__SPI0_MISO>,
						 <PIN_PA17__SPI0_NPCS0>;
					bias-disable;
				};

				pinctrl_uart1_default: uart1_default {
					pinmux = <PIN_PD2__URXD1>,
						 <PIN_PD3__UTXD1>;
					bias-disable;
				};

				pinctrl_uart3_default: uart3_default {
					pinmux = <PIN_PC12__URXD3>,
						 <PIN_PC13__UTXD3>;
					bias-disable;
				};

				pinctrl_usb_default: usb_default {
					pinmux = <PIN_PA27__GPIO>,
						 <PIN_PD19__GPIO>;
					bias-disable;
				};

				pinctrl_usba_vbus: usba_vbus {
					pinmux = <PIN_PD20__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus1_an: mikrobus1_an {
					pinmux = <PIN_PD25__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus2_an: mikrobus2_an {
					pinmux = <PIN_PD26__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus1_rst: mikrobus1_rst {
					pinmux = <PIN_PB2__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus2_rst: mikrobus2_rst {
					pinmux = <PIN_PA26__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus1_spi_cs: mikrobus1_spi_cs {
					pinmux = <PIN_PD0__FLEXCOM4_IO4>;
					bias-disable;
				};

				pinctrl_mikrobus2_spi_cs: mikrobus2_spi_cs {
					pinmux = <PIN_PC31__FLEXCOM4_IO3>;
					bias-disable;
				};

				pinctrl_mikrobus_spi: mikrobus_spi {
					pinmux = <PIN_PC28__FLEXCOM4_IO0>,
						 <PIN_PC29__FLEXCOM4_IO1>,
						 <PIN_PC30__FLEXCOM4_IO2>;
					bias-disable;
				};

				pinctrl_mikrobus1_pwm: mikrobus1_pwm {
					pinmux = <PIN_PB1__PWML1>;
					bias-disable;
				};

				pinctrl_mikrobus2_pwm: mikrobus2_pwm {
					pinmux = <PIN_PA31__PWML0>;
					bias-disable;
				};

				pinctrl_mikrobus1_int: mikrobus1_int {
					pinmux = <PIN_PB0__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus2_int: mikrobus2_int {
					pinmux = <PIN_PA25__GPIO>;
					bias-disable;
				};

				pinctrl_mikrobus1_uart: mikrobus1_uart {
					pinmux = <PIN_PB3__URXD4>,
						 <PIN_PB4__UTXD4>;
					bias-disable;
				};

				pinctrl_mikrobus2_uart: mikrobus2_uart {
					pinmux = <PIN_PD23__URXD2>,
						 <PIN_PD24__UTXD2>;
					bias-disable;
				};

				pinctrl_mikrobus_i2c: mikrobus1_i2c {
					pinmux = <PIN_PA24__FLEXCOM1_IO0>,
						 <PIN_PA23__FLEXCOM1_IO1>;
					bias-disable;
				};

				pinctrl_i2c3_gpio: i2c3_gpio {
					pinmux = <PIN_PA24__GPIO>,
						 <PIN_PA23__GPIO>;
					bias-disable;
				};

				pinctrl_flx4_default: flx4_uart_default {
					pinmux = <PIN_PC28__FLEXCOM4_IO0>,
						 <PIN_PC29__FLEXCOM4_IO1>,
						 <PIN_PC30__FLEXCOM4_IO2>,
						 <PIN_PC31__FLEXCOM4_IO3>,
						 <PIN_PD0__FLEXCOM4_IO4>;
					bias-disable;
				};
			};

			can1: can@fc050000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_can1_default>;
				status = "okay";
			};
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio_default>;

		button {
			label = "USER";
			gpios = <&pioA PIN_PA29 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_PROG1>;
			wakeup-source;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led_gpio_default>;
		status = "okay"; /* Conflict with pwm0. */

		red {
			label = "red";
			gpios = <&pioA PIN_PA10 GPIO_ACTIVE_HIGH>;
		};

		green {
			label = "green";
			gpios = <&pioA PIN_PB1 GPIO_ACTIVE_HIGH>;
		};

		blue {
			label = "blue";
			gpios = <&pioA PIN_PA31 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};

	vddin_3v3: fixed-regulator-vddin_3v3 {
		compatible = "regulator-fixed";

		regulator-name = "VDDIN_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		regulator-boot-on;
		status = "okay";
	};

	vddana: fixed-regulator-vddana {
		compatible = "regulator-fixed";

		regulator-name = "VDDANA";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vddin_3v3>;
		status = "okay";
	};

	advref: fixed-regulator-advref {
		compatible = "regulator-fixed";

		regulator-name = "advref";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		regulator-boot-on;
		vin-supply = <&vddana>;
		status = "okay";
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sama5d27_wlsom1.dtsi - Device Tree file for SAMA5D27 WLSOM1
 *
 * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries
 *
 * Author: Nicolas Ferre <nicolas.ferre@microcihp.com>
 * Author: Eugen Hristev <eugen.hristev@microcihp.com>
 */
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/mfd/atmel-flexcom.h>
#include <dt-bindings/pinctrl/at91.h>

/ {
	model = "Microchip SAMA5D27 WLSOM1";
	compatible = "microchip,sama5d27-wlsom1", "atmel,sama5d27", "atmel,sama5d2", "atmel,sama5";

	aliases {
		i2c0 = &i2c0;
	};

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <24000000>;
		};
	};

	wifi_pwrseq: wifi_pwrseq {
		compatible = "mmc-pwrseq-wilc1000";
		reset-gpios = <&pioA PIN_PA27 GPIO_ACTIVE_HIGH>;
		powerdown-gpios = <&pioA PIN_PA29 GPIO_ACTIVE_HIGH>;
		pinctrl-0 = <&pinctrl_wilc_pwrseq>;
		pinctrl-names = "default";
	};
};

&flx1 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;

	uart6: serial@200 {
		pinctrl-0 = <&pinctrl_flx1_default>;
		pinctrl-names = "default";
	};
};

&i2c0 {
	pinctrl-0 = <&pinctrl_i2c0_default>;
	pinctrl-1 = <&pinctrl_i2c0_gpio>;
	pinctrl-names = "default", "gpio";
	sda-gpios = <&pioA PIN_PD21 GPIO_ACTIVE_HIGH>;
	scl-gpios = <&pioA PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
	status = "okay";
};

&i2c1 {
	dmas = <0>, <0>;
	pinctrl-names = "default", "gpio";
	pinctrl-0 = <&pinctrl_i2c1_default>;
	pinctrl-1 = <&pinctrl_i2c1_gpio>;
	sda-gpios = <&pioA PIN_PD19 GPIO_ACTIVE_HIGH>;
	scl-gpios = <&pioA PIN_PD20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
	status = "okay";

	mcp16502@5b {
		compatible = "microchip,mcp16502";
		reg = <0x5b>;
		status = "okay";
		lpm-gpios = <&pioBU 0 GPIO_ACTIVE_LOW>;

		regulators {
			vdd_3v3: VDD_IO {
				regulator-name = "VDD_IO";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-initial-mode = <2>;
				regulator-allowed-modes = <2>, <4>;
				regulator-always-on;

				regulator-state-standby {
					regulator-on-in-suspend;
					regulator-mode = <4>;
				};

				regulator-state-mem {
					regulator-off-in-suspend;
					regulator-mode = <4>;
				};
			};

			vddio_ddr: VDD_DDR {
				regulator-name = "VDD_DDR";
				regulator-min-microvolt = <1200000>;
				regulator-max-microvolt = <1200000>;
				regulator-initial-mode = <2>;
				regulator-allowed-modes = <2>, <4>;
				regulator-always-on;

				regulator-state-standby {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1200000>;
					regulator-changeable-in-suspend;
					regulator-mode = <4>;
				};

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1200000>;
					regulator-changeable-in-suspend;
					regulator-mode = <4>;
				};
			};

			vdd_core: VDD_CORE {
				regulator-name = "VDD_CORE";
				regulator-min-microvolt = <1250000>;
				regulator-max-microvolt = <1250000>;
				regulator-initial-mode = <2>;
				regulator-allowed-modes = <2>, <4>;
				regulator-always-on;

				regulator-state-standby {
					regulator-on-in-suspend;
					regulator-mode = <4>;
				};

				regulator-state-mem {
					regulator-off-in-suspend;
					regulator-mode = <4>;
				};
			};

			vdd_ddr: VDD_OTHER {
				regulator-name = "VDD_OTHER";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <1800000>;
				regulator-initial-mode = <2>;
				regulator-allowed-modes = <2>, <4>;
				regulator-always-on;

				regulator-state-standby {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
					regulator-changeable-in-suspend;
					regulator-mode = <4>;
				};

				regulator-state-mem {
					regulator-on-in-suspend;
					regulator-suspend-microvolt = <1800000>;
					regulator-changeable-in-suspend;
					regulator-mode = <4>;
				};
			};

			LDO1 {
				regulator-name = "LDO1";
				regulator-min-microvolt = <3300000>;
				regulator-max-microvolt = <3300000>;
				regulator-always-on;

				regulator-state-standby {
					regulator-on-in-suspend;
				};

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};

			LDO2 {
				regulator-name = "LDO2";
				regulator-min-microvolt = <1800000>;
				regulator-max-microvolt = <3300000>;

				regulator-state-standby {
					regulator-on-in-suspend;
				};

				regulator-state-mem {
					regulator-off-in-suspend;
				};
			};
		};
	};
};

&macb0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_macb0_default>;
	#address-cells = <1>;
	#size-cells = <0>;
	phy-mode = "rmii";

	ethernet-phy@0 {
		reg = <0x0>;
		interrupt-parent = <&pioA>;
		interrupts = <PIN_PB24 IRQ_TYPE_LEVEL_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_macb0_phy_irq>;
	};
};

&pmc {
	atmel,osc-bypass;
};

&qspi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_qspi1_default>;
	status = "disabled";

	qspi1_flash: flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		spi-rx-bus-width = <4>;
		spi-tx-bus-width = <4>;
		m25p,fast-read;
		status = "disabled";

		at91bootstrap@0 {
			label = "at91bootstrap";
			reg = <0x0 0x40000>;
		};

		bootloader@40000 {
			label = "bootloader";
			reg = <0x40000 0xc0000>;
		};

		bootloaderenvred@100000 {
			label = "bootloader env redundant";
			reg = <0x100000 0x40000>;
		};

		bootloaderenv@140000 {
			label = "bootloader env";
			reg = <0x140000 0x40000>;
		};

		dtb@180000 {
			label = "device tree";
			reg = <0x180000 0x80000>;
		};

		kernel@200000 {
			label = "kernel";
			reg = <0x200000 0x600000>;
		};
	};
};

&pioA {
	pinctrl_flx1_default: flx1_usart_default {
		pinmux = <PIN_PA24__FLEXCOM1_IO0>,
			 <PIN_PA23__FLEXCOM1_IO1>,
			 <PIN_PA25__FLEXCOM1_IO3>,
			 <PIN_PA26__FLEXCOM1_IO4>;
		bias-disable;
	};

	pinctrl_i2c0_default: i2c0_default {
		pinmux = <PIN_PD21__TWD0>,
			 <PIN_PD22__TWCK0>;
		bias-disable;
	};

	pinctrl_i2c0_gpio: i2c0_gpio {
		pinmux = <PIN_PD21__GPIO>,
			 <PIN_PD22__GPIO>;
		bias-disable;
	};

	pinctrl_i2c1_default: i2c1_default {
		pinmux = <PIN_PD19__TWD1>,
			 <PIN_PD20__TWCK1>;
		bias-disable;
	};

	pinctrl_i2c1_gpio: i2c1_gpio {
		pinmux = <PIN_PD19__GPIO>,
			 <PIN_PD20__GPIO>;
		bias-disable;
	};

	pinctrl_macb0_default: macb0_default {
		pinmux = <PIN_PB14__GTXCK>,
			 <PIN_PB15__GTXEN>,
			 <PIN_PB16__GRXDV>,
			 <PIN_PB17__GRXER>,
			 <PIN_PB18__GRX0>,
			 <PIN_PB19__GRX1>,
			 <PIN_PB20__GTX0>,
			 <PIN_PB21__GTX1>,
			 <PIN_PB22__GMDC>,
			 <PIN_PB23__GMDIO>;
		bias-disable;
	};

	pinctrl_macb0_phy_irq: macb0_phy_irq {
		pinmux = <PIN_PB24__GPIO>;
		bias-disable;
	};

	pinctrl_qspi1_default: qspi1_default {
		pinmux = <PIN_PB5__QSPI1_SCK>,
			 <PIN_PB6__QSPI1_CS>,
			 <PIN_PB7__QSPI1_IO0>,
			 <PIN_PB8__QSPI1_IO1>,
			 <PIN_PB9__QSPI1_IO2>,
			 <PIN_PB10__QSPI1_IO3>;
		bias-pull-up;
	};

	pinctrl_sdmmc1_default: sdmmc1_default {
		cmd-data {
			pinmux = <PIN_PA28__SDMMC1_CMD>,
				 <PIN_PA18__SDMMC1_DAT0>,
				 <PIN_PA19__SDMMC1_DAT1>,
				 <PIN_PA20__SDMMC1_DAT2>,
				 <PIN_PA21__SDMMC1_DAT3>;
			bias-disable;
		};

		conf-ck {
			pinmux = <PIN_PA22__SDMMC1_CK>;
			bias-disable;
		};
	};

	pinctrl_wilc_default: wilc_default {
		conf-irq {
			pinmux = <PIN_PB25__GPIO>;
			bias-disable;
		};
	};

	pinctrl_wilc_pwrseq: wilc_pwrseq {
		conf-ce-nrst {
			pinmux = <PIN_PA27__GPIO>,
				 <PIN_PA29__GPIO>;
			bias-disable;
		};

		conf-rtcclk {
			pinmux = <PIN_PB13__PCK1>;
			bias-disable;
		};
	};
};

&sdmmc1 {
	#address-cells = <1>;
	#size-cells = <0>;
	bus-width = <4>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sdmmc1_default>;
	mmc-pwrseq = <&wifi_pwrseq>;
	no-1-8-v;
	non-removable;
	bus-width = <4>;
	status = "okay";

	wilc: wifi@0 {
		reg = <0>;
		compatible = "microchip,wilc1000";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_wilc_default>;
		clocks = <&pmc PMC_TYPE_SYSTEM 9>;
		clock-names = "rtc";
		interrupts = <PIN_PB25 IRQ_TYPE_NONE>;
		interrupt-parent = <&pioA>;
		assigned-clocks = <&pmc PMC_TYPE_SYSTEM 9>;
		assigned-clock-rates = <32768>;
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sama5d27_wlsom1_ek.dts - Device Tree file for SAMA5D27 WLSOM1 EK
 *
 * Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries
 *
 * Author: Nicolas Ferre <nicolas.ferre@microcihp.com>
 */
/dts-v1/;
#include "at91-sama5d27_wlsom1.dtsi"
#include <dt-bindings/input/input.h>

/ {
	model = "Microchip SAMA5D27 WLSOM1 EK";
	compatible = "microchip,sama5d27-wlsom1-ek", "microchip,sama5d27-wlsom1", "atmel,sama5d27", "atmel,sama5d2", "atmel,sama5";

	aliases {
		serial0 = &uart0;	/* DBGU */
		serial1 = &uart6;	/* BT */
		serial2 = &uart5;	/* mikro BUS 2 */
		serial3 = &uart3;	/* mikro BUS 1 */
		i2c1 = &i2c1;
	};

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

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio_default>;

		button-1 {
			label = "USER BUTTON";
			gpios = <&pioA PIN_PB2 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_PROG1>;
			wakeup-source;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led_gpio_default>;
		status = "okay";

		red {
			label = "red";
			gpios = <&pioA PIN_PA6 GPIO_ACTIVE_HIGH>;
		};

		green {
			label = "green";
			gpios = <&pioA PIN_PA7 GPIO_ACTIVE_HIGH>;
		};

		blue {
			label = "blue";
			gpios = <&pioA PIN_PA8 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};
};

&adc {
	vddana-supply = <&vdd_3v3>;
	vref-supply = <&vdd_3v3>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_adc_default>;
	status = "okay";
};

&flx0 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
	status = "okay";

	uart5: serial@200 {
		pinctrl-0 = <&pinctrl_flx0_default>;
		pinctrl-names = "default";
		atmel,use-dma-rx;
		atmel,use-dma-tx;
		status = "okay";
	};
};

&flx1 {
	status = "okay";

	uart6: serial@200 {
		atmel,use-dma-rx;
		atmel,use-dma-tx;
		status = "okay";
	};
};

&macb0 {
	status = "okay";
};

&pioA {
	/*
	 * There is no real pinmux for ADC, if the pin
	 * is not requested by another peripheral then
	 * the muxing is done when channel is enabled.
	 * Requesting pins for ADC is GPIO is
	 * encouraged to prevent conflicts and to
	 * disable bias in order to be in the same
	 * state when the pin is not muxed to the adc.
	 */
	pinctrl_adc_default: adc_default {
		pinmux = <PIN_PD25__GPIO>,
			 <PIN_PD26__GPIO>;
		bias-disable;
	};

	pinctrl_flx0_default: flx0_usart_default {
		pinmux = <PIN_PB28__FLEXCOM0_IO0>,
			 <PIN_PB29__FLEXCOM0_IO1>;
		bias-disable;
	};

	pinctrl_key_gpio_default: key_gpio_default {
		pinmux = <PIN_PB2__GPIO>;
		bias-pull-up;
	};

	pinctrl_led_gpio_default: led_gpio_default {
		pinmux = <PIN_PA6__GPIO>,
			 <PIN_PA7__GPIO>,
			 <PIN_PA8__GPIO>;
		bias-pull-down;
	};

	pinctrl_sdmmc0_default: sdmmc0_default {
		cmd_data {
			pinmux = <PIN_PA1__SDMMC0_CMD>,
				 <PIN_PA2__SDMMC0_DAT0>,
				 <PIN_PA3__SDMMC0_DAT1>,
				 <PIN_PA4__SDMMC0_DAT2>,
				 <PIN_PA5__SDMMC0_DAT3>;
			bias-disable;
		};

		ck_cd_vddsel {
			pinmux = <PIN_PA0__SDMMC0_CK>,
				 <PIN_PA11__SDMMC0_VDDSEL>,
				 <PIN_PA12__SDMMC0_WP>,
				 <PIN_PA13__SDMMC0_CD>;
			bias-disable;
		};
	};

	pinctrl_uart0_default: uart0_default {
		pinmux = <PIN_PB26__URXD0>,
			 <PIN_PB27__UTXD0>;
		bias-disable;
	};

	pinctrl_uart3_default: uart3_default {
		pinmux = <PIN_PB11__URXD3>,
			 <PIN_PB12__UTXD3>;
		bias-disable;
	};

	pinctrl_pwm0_default: pwm0_default {
		pinmux = <PIN_PA31__PWML0>,
			 <PIN_PA30__PWMH0>;
		bias-disable;
	};

	pinctrl_usb_default: usb_default {
		pinmux = <PIN_PA10__GPIO>;
		bias-disable;
	};

	pinctrl_usba_vbus: usba_vbus {
		pinmux = <PIN_PA16__GPIO>;
		bias-disable;
	};
};

&pwm0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm0_default>;
	status = "okay";
};

&qspi1 {
	status = "okay";

	qspi1_flash: flash@0 {
		status = "okay";
	};
};

&sdmmc0 {
	bus-width = <4>;
	mmc-ddr-3_3v;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sdmmc0_default>;
	status = "okay";
};

&shutdown_controller {
	debounce-delay-us = <976>;
	atmel,wakeup-rtc-timer;

	input@0 {
		reg = <0>;
	};
};

&tcb0 {
	timer0: timer@0 {
		compatible = "atmel,tcb-timer";
		reg = <0>;
	};

	timer1: timer@1 {
		compatible = "atmel,tcb-timer";
		reg = <1>;
	};
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart0_default>;
	atmel,use-dma-rx;
	atmel,use-dma-tx;
	status = "okay";
};

&uart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_uart3_default>;
	atmel,use-dma-rx;
	atmel,use-dma-tx;
	status = "okay";
};

&usb0 {
	atmel,vbus-gpio = <&pioA PIN_PA16 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usba_vbus>;
	status = "okay";
};

&usb1 {
	num-ports = <3>;
	atmel,vbus-gpio = <0
			   &pioA PIN_PA10 GPIO_ACTIVE_HIGH
			   0
			  >;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usb_default>;
	status = "okay";
};

&usb2 {
	phy_type = "hsic";
	status = "okay";
};

&watchdog {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sama5d2_icp.dts - Device Tree file for SAMA5D2-ICP board
 *
 *  Copyright (C) 2019 Microchip Technology Inc. and its subsidiaries
 *
 *	Author: Radu Pirea & Razvan Stefanescu,
 *		Codrin Ciubotariu <codrin.ciubotariu@microchip.com>,
 *		Cristian Birsan <cristian.birsan@microchip.com>
 */
/dts-v1/;
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/mfd/atmel-flexcom.h>

/ {
	model = "Microchip SAMA5D2-ICP";
	compatible = "microchip,sama5d2-icp", "atmel,sama5d27", "atmel,sama5d2", "atmel,sama5";

	aliases {
		serial0 = &uart0;	/* debug uart0 + mikro BUS 1 */
		serial1 = &uart1;	/* mikro BUS 3 */
		serial3 = &uart3;	/* mikro BUS 2 */
		serial5 = &uart7;	/* flx2 */
		i2c0 = &i2c0;
		i2c1 = &i2c1;
	};

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

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <12000000>;
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio_default>;

		button-1 {
			label = "USER_PB1";
			gpios = <&pioA PIN_PD0 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_PROG1>;
			wakeup-source;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led_gpio_default>;
		status = "okay"; /* conflict with pwm0 */

		red {
			label = "red";
			gpios = <&pioA PIN_PB0 GPIO_ACTIVE_HIGH>;
		};

		green {
			label = "green";
			gpios = <&pioA PIN_PB1 GPIO_ACTIVE_HIGH>;
		};

		blue {
			label = "blue";
			gpios = <&pioA PIN_PA31 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};
};

&adc {
	vddana-supply = <&vdd_io_reg>;
	vref-supply = <&vdd_io_reg>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_adc_default &pinctrl_adtrg_default>;
	status = "okay";
};

&can0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_can0_default>;
	status = "okay";
};

&can1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_can1_default>;
	status = "okay";
};

&flx0 { /* mikrobus2 spi */
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
	status = "okay";

	spi2: spi@400 {
		dmas = <0>, <0>;
		cs-gpios = <&pioA PIN_PC0 GPIO_ACTIVE_LOW>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mikrobus2_spi &pinctrl_ksz_spi_cs>;
		status = "okay";
		#address-cells = <1>;
		#size-cells = <0>;

		switch0: ksz8563@0 {
			compatible = "microchip,ksz8563";
			reg = <0>;
			reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>;

			spi-max-frequency = <500000>;
			spi-cpha;
			spi-cpol;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;
				port@0 {
					reg = <0>;
					label = "lan1";
				};

				port@1 {
					reg = <1>;
					label = "lan2";
				};

				port@2 {
					reg = <2>;
					label = "cpu";
					ethernet = <&macb0>;
					phy-mode = "mii";
					fixed-link {
						speed = <100>;
						full-duplex;
					};
				};
			};
		};
	};
};

&flx2 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
	status = "okay";

	uart7: serial@200 {
		pinctrl-0 = <&pinctrl_flx2_default>;
		pinctrl-names = "default";
		atmel,use-dma-rx;
		atmel,use-dma-tx;
		status = "okay"; /* Conflict w/ qspi1. */
	};
};

&flx3 { /* mikrobus1 spi */
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_SPI>;
	status = "okay";

	spi5: spi@400 {
		dmas = <0>, <0>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_mikrobus1_spi &pinctrl_mikrobus1_spi_cs>;
		status = "okay";
	};
};

&flx4 {
	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
	status = "okay";

	i2c6: i2c@600 {
		dmas = <0>, <0>;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_flx4_default>;
		i2c-digital-filter;
		i2c-digital-filter-width-ns = <35>;
		status = "okay";

		mcp16502@5b {
			compatible = "microchip,mcp16502";
			reg = <0x5b>;
			status = "okay";
			lpm-gpios = <&pioBU 7 GPIO_ACTIVE_LOW>;

			regulators {
				vdd_io_reg: VDD_IO {
					regulator-name = "VDD_IO";
					regulator-min-microvolt = <3300000>;
					regulator-max-microvolt = <3300000>;
					regulator-initial-mode = <2>;
					regulator-allowed-modes = <2>, <4>;
					regulator-always-on;

					regulator-state-standby {
						regulator-on-in-suspend;
						regulator-mode = <4>;
					};

					regulator-state-mem {
						regulator-off-in-suspend;
						regulator-mode = <4>;
					};
				};

				VDD_DDR {
					regulator-name = "VDD_DDR";
					regulator-min-microvolt = <1350000>;
					regulator-max-microvolt = <1350000>;
					regulator-initial-mode = <2>;
					regulator-allowed-modes = <2>, <4>;
					regulator-always-on;

					regulator-state-standby {
						regulator-on-in-suspend;
						regulator-mode = <4>;
					};

					regulator-state-mem {
						regulator-on-in-suspend;
						regulator-mode = <4>;
					};
				};

				VDD_CORE {
					regulator-name = "VDD_CORE";
					regulator-min-microvolt = <1250000>;
					regulator-max-microvolt = <1250000>;
					regulator-initial-mode = <2>;
					regulator-allowed-modes = <2>, <4>;
					regulator-always-on;

					regulator-state-standby {
						regulator-on-in-suspend;
						regulator-mode = <4>;
					};

					regulator-state-mem {
						regulator-off-in-suspend;
						regulator-mode = <4>;
					};
				};

				VDD_OTHER {
					regulator-name = "VDD_OTHER";
					regulator-min-microvolt = <600000>;
					regulator-max-microvolt = <1850000>;
					regulator-initial-mode = <2>;
					regulator-allowed-modes = <2>, <4>;

					regulator-state-standby {
						regulator-on-in-suspend;
						regulator-mode = <4>;
					};

					regulator-state-mem {
						regulator-off-in-suspend;
						regulator-mode = <4>;
					};
				};

				LDO1 {
					regulator-name = "LDO1";
					regulator-min-microvolt = <2500000>;
					regulator-max-microvolt = <2500000>;
					regulator-always-on;

					regulator-state-standby {
						regulator-on-in-suspend;
					};

					regulator-state-mem {
						regulator-off-in-suspend;
					};
				};

				LDO2 {
					regulator-name = "LDO2";
					regulator-min-microvolt = <3300000>;
					regulator-max-microvolt = <3300000>;
					regulator-always-on;

					regulator-state-standby {
						regulator-on-in-suspend;
					};

					regulator-state-mem {
						regulator-off-in-suspend;
					};
				};

			};
		};
	};
};

&i2c0 { /* mikrobus i2c */
	pinctrl-names = "default", "gpio";
	pinctrl-0 = <&pinctrl_mikrobus_i2c>;
	pinctrl-1 = <&pinctrl_i2c0_gpio>;
	sda-gpios = <&pioA PIN_PD21 GPIO_ACTIVE_HIGH>;
	scl-gpios = <&pioA PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
	i2c-digital-filter;
	i2c-digital-filter-width-ns = <35>;
	status = "okay";
};

&i2c1 {
	dmas = <0>, <0>;
	pinctrl-names = "default", "gpio";
	pinctrl-0 = <&pinctrl_i2c1_default>;
	pinctrl-1 = <&pinctrl_i2c1_gpio>;
	sda-gpios = <&pioA PIN_PD19 GPIO_ACTIVE_HIGH>;
	scl-gpios = <&pioA PIN_PD20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
	i2c-digital-filter;
	i2c-digital-filter-width-ns = <35>;
	status = "okay";

	eeprom@50 {
		compatible = "atmel,24c02";
		reg = <0x50>;
		pagesize = <16>;
		status = "okay";
	};

	eeprom@52 {
		compatible = "atmel,24c02";
		reg = <0x52>;
		pagesize = <16>;
		status = "disabled";
	};

	eeprom@53 {
		compatible = "atmel,24c02";
		reg = <0x53>;
		pagesize = <16>;
		status = "disabled";
	};
};

&macb0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq &pinctrl_macb0_rst>;
	phy-mode = "mii";
	status = "okay";

	fixed-link {
		speed = <100>;
		full-duplex;
	};
};

&pioA {
	pinctrl_adc_default: adc_default {
		pinmux = <PIN_PD24__GPIO>,
				<PIN_PD25__GPIO>,
				<PIN_PD26__GPIO>;
		bias-disable;
	};

	/*
	 * The ADTRG pin can work on any edge type.
	 * In here it's being pulled up, so need to
	 * connect it to ground to get an edge e.g.
	 * Trigger can be configured on falling, rise
	 * or any edge, and the pull-up can be changed
	 * to pull-down or left floating according to
	 * needs.
	 */
	pinctrl_adtrg_default: adtrg_default {
		pinmux = <PIN_PD31__ADTRG>;
		bias-pull-up;
	};

	pinctrl_flx4_default: flx4_default {
		pinmux = <PIN_PC28__FLEXCOM4_IO0>,
			 <PIN_PC29__FLEXCOM4_IO1>;
		bias-disable;
	};

	pinctrl_can0_default: can0_default {
		pinmux = <PIN_PC10__CANTX0>,
			 <PIN_PC11__CANRX0>;
		bias-disable;
	};

	pinctrl_can1_default: can1_default {
		pinmux = <PIN_PC26__CANTX1>,
			 <PIN_PC27__CANRX1>;
		bias-disable;
	};

	pinctrl_i2c1_default: i2c1_default {
		pinmux = <PIN_PD19__TWD1>,
			 <PIN_PD20__TWCK1>;
		bias-disable;
	};

	pinctrl_i2c1_gpio: i2c1_gpio {
                pinmux = <PIN_PD19__GPIO>,
                         <PIN_PD20__GPIO>;
                bias-disable;
        };

	pinctrl_key_gpio_default: key_gpio_default {
		pinmux = <PIN_PD0__GPIO>;
		bias-pull-up;
	};

	pinctrl_led_gpio_default: led_gpio_default {
		pinmux = <PIN_PB0__GPIO>,
			 <PIN_PB1__GPIO>,
			 <PIN_PA31__GPIO>;
		bias-pull-up;
	};

	pinctrl_qspi1_default: qspi1_default {
		pinmux = <PIN_PA6__QSPI1_SCK>,
			 <PIN_PA7__QSPI1_IO0>,
			 <PIN_PA8__QSPI1_IO1>,
			 <PIN_PA9__QSPI1_IO2>,
			 <PIN_PA10__QSPI1_IO3>,
			 <PIN_PA11__QSPI1_CS>;
		bias-disable;
	};

	pinctrl_sdmmc0_default: sdmmc0_default {
		cmd_data {
			pinmux = <PIN_PA1__SDMMC0_CMD>,
				 <PIN_PA2__SDMMC0_DAT0>,
				 <PIN_PA3__SDMMC0_DAT1>,
				 <PIN_PA4__SDMMC0_DAT2>,
				 <PIN_PA5__SDMMC0_DAT3>;
			bias-disable;
		};

		ck_cd {
			pinmux = <PIN_PA0__SDMMC0_CK>,
				 <PIN_PA13__SDMMC0_CD>;
			bias-disable;
		};
	};

	pinctrl_sdmmc1_default: sdmmc1_default {
		cmd_data {
			pinmux = <PIN_PA18__SDMMC1_DAT0>,
				 <PIN_PA19__SDMMC1_DAT1>,
				 <PIN_PA20__SDMMC1_DAT2>,
				 <PIN_PA21__SDMMC1_DAT3>;
			bias-disable;
		};

		ck_cd {
			pinmux = <PIN_PA22__SDMMC1_CK>,
				 <PIN_PA28__SDMMC1_CMD>;
			bias-disable;
		};
	};

	pinctrl_mikrobus_i2c: mikrobus_i2c {
		pinmux = <PIN_PD22__TWCK0>,
			 <PIN_PD21__TWD0>;
		bias-disable;
	};

	pinctrl_i2c0_gpio: i2c0_gpio {
		pinmux = <PIN_PD21__GPIO>,
			 <PIN_PD22__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus1_an: mikrobus1_an {
		pinmux = <PIN_PD26__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus1_rst: mikrobus1_rst {
		pinmux = <PIN_PC5__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus1_spi_cs: mikrobus1_spi_cs {
		pinmux = <PIN_PC21__FLEXCOM3_IO3>;
		bias-disable;
	};

	pinctrl_mikrobus1_spi: mikrobus1_spi {
		pinmux = <PIN_PC20__FLEXCOM3_IO0>,
			 <PIN_PC19__FLEXCOM3_IO1>,
			 <PIN_PC18__FLEXCOM3_IO2>;
		bias-disable;
	};

	pinctrl_mikrobus1_pwm: mikrobus1_pwm {
		pinmux = <PIN_PC4__TIOB1>;
		bias-disable;
	};

	pinctrl_mikrobus1_int: mikrobus1_int {
		pinmux = <PIN_PC3__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus1_uart: mikrobus1_uart {
		pinmux = <PIN_PB26__URXD0>,
			 <PIN_PB27__UTXD0>;
		bias-disable;
	};

	pinctrl_mikrobus2_an: mikrobus2_an {
		pinmux = <PIN_PD25__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus2_rst: mikrobus2_rst {
		pinmux = <PIN_PB24__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus2_spi_cs: mikrobus2_spi_cs {
		pinmux = <PIN_PB31__FLEXCOM0_IO3>;
		bias-disable;
	};

	pinctrl_mikrobus2_spi: mikrobus2_spi {
		pinmux = <PIN_PB28__FLEXCOM0_IO0>,
			 <PIN_PB29__FLEXCOM0_IO1>,
			 <PIN_PB30__FLEXCOM0_IO2>;
		bias-disable;
	};

	pinctrl_ksz_spi_cs: ksz_spi_cs {
		pinmux = <PIN_PC0__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus2_pwm: mikrobus2_pwm {
		pinmux = <PIN_PB23__TIOB2>;
		bias-disable;
	};

	pinctrl_mikrobus2_int: mikrobus2_int {
		pinmux = <PIN_PB22__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus2_uart: mikrobus2_uart {
		pinmux = <PIN_PC12__URXD3>,
			 <PIN_PC13__UTXD3>;
		bias-disable;
	};

	pinctrl_mikrobus3_an: mikrobus3_an {
		pinmux = <PIN_PD24__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus3_rst: mikrobus3_rst {
		pinmux = <PIN_PB21__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus3_spi_cs: mikrobus3_spi_cs {
		pinmux = <PIN_PA17__SPI0_NPCS0>;
		bias-disable;
	};

	pinctrl_mikrobus3_spi: mikrobus3_spi {
		pinmux = <PIN_PA14__SPI0_SPCK>,
			 <PIN_PA16__SPI0_MISO>,
			 <PIN_PA15__SPI0_MOSI>;
		bias-disable;
	};

	pinctrl_mikrobus3_pwm: mikrobus3_pwm {
		pinmux = <PIN_PB20__TIOB3>;
		bias-disable;
	};

	pinctrl_mikrobus3_int: mikrobus3_int {
		pinmux = <PIN_PB18__GPIO>;
		bias-disable;
	};

	pinctrl_mikrobus3_uart: mikrobus3_uart {
		pinmux = <PIN_PC7__URXD1>,
			 <PIN_PC8__UTXD1>;
		bias-disable;
	};

	pinctrl_usb_default: usb_default {
		pinmux = <PIN_PC17__GPIO>;
		bias-disable;
	};

	pinctrl_usba_vbus: usba_vbus {
		pinmux = <PIN_PD23__GPIO>;
		bias-disable;
	};

	pinctrl_pwm0_pwm2_default: pwm0_pwm2_default {
		pinmux = <PIN_PB5__PWMH2>,
			 <PIN_PB6__PWML2>;
		bias-pull-up;
	};

	pinctrl_macb0_default: macb0_default {
		pinmux = <PIN_PD1__GRXCK>,
			 <PIN_PD2__GTXER>,
			 <PIN_PD5__GRX2>,
			 <PIN_PD6__GRX3>,
			 <PIN_PD7__GTX2>,
			 <PIN_PD8__GTX3>,
			 <PIN_PD9__GTXCK>,
			 <PIN_PD10__GTXEN>,
			 <PIN_PD11__GRXDV>,
			 <PIN_PD12__GRXER>,
			 <PIN_PD13__GRX0>,
			 <PIN_PD14__GRX1>,
			 <PIN_PD15__GTX0>,
			 <PIN_PD16__GTX1>,
			 <PIN_PD17__GMDC>,
			 <PIN_PD18__GMDIO>;
		bias-disable;
	};

	pinctrl_macb0_phy_irq: macb0_phy_irq {
		pinmux = <PIN_PD3__GPIO>;
		bias-disable;
	};

	pinctrl_macb0_rst: macb0_sw_rst {
		pinmux = <PIN_PD4__GPIO>;
		bias-disable;
	};

	pinctrl_flx2_default: flx2_default {
		pinmux = <PIN_PA6__FLEXCOM2_IO0>,
			 <PIN_PA7__FLEXCOM2_IO1>,
			 <PIN_PA9__FLEXCOM2_IO3>,
			 <PIN_PA10__FLEXCOM2_IO4>;
		bias-disable;
	};
};

&pwm0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_pwm0_pwm2_default>;
	status = "disabled"; /* conflict with leds, HSIC */
};

&qspi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_qspi1_default>;
	status = "disabled"; /* Conflict with wilc_pwrseq, flx2 */

	flash@0 {
		#address-cells = <1>;
		#size-cells = <1>;
		compatible = "jedec,spi-nor";
		reg = <0>;
		spi-max-frequency = <80000000>;
		spi-tx-bus-width = <4>;
		spi-rx-bus-width = <4>;
		m25p,fast-read;

		at91bootstrap@0 {
			label = "qspi: at91bootstrap";
			reg = <0x00000000 0x00040000>;
		};

		bootloader@40000 {
			label = "qspi: bootloader";
			reg = <0x00040000 0x000c0000>;
		};

		bootloaderenvred@100000 {
			label = "qspi: bootloader env redundant";
			reg = <0x00100000 0x00040000>;
		};

		bootloaderenv@140000 {
			label = "qspi: bootloader env";
			reg = <0x00140000 0x00040000>;
		};

		dtb@180000 {
			label = "qspi: device tree";
			reg = <0x00180000 0x00080000>;
		};

		kernel@200000 {
			label = "qspi: kernel";
			reg = <0x00200000 0x00600000>;
		};
	};
};

&sdmmc0 {
	no-1-8-v;
	bus-width = <4>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_sdmmc0_default>;
	status = "okay";
};

&shutdown_controller {
	debounce-delay-us = <976>;
	atmel,wakeup-rtc-timer;

	input@0 {
		reg = <0>;
	};
};

&spi0 {  /* mikrobus3 spi */
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_mikrobus3_spi &pinctrl_mikrobus3_spi_cs>;
	status = "okay";
};

&tcb0 {
	timer0: timer@0 {
		compatible = "atmel,tcb-timer";
		reg = <0>;
	};

	timer1: timer@1 {
		compatible = "atmel,tcb-timer";
		reg = <1>;
	};
};

&uart0 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_mikrobus1_uart>;
	atmel,use-dma-rx;
	atmel,use-dma-tx;
	status = "okay";
};

&uart1 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_mikrobus3_uart>;
	atmel,use-dma-rx;
	atmel,use-dma-tx;
	status = "okay";
};

&uart3 {
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_mikrobus2_uart>;
	atmel,use-dma-rx;
	atmel,use-dma-tx;
	status = "okay";
};

&usb0 {
	atmel,vbus-gpio = <&pioA PIN_PD23 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usba_vbus>;
	status = "okay";
};

&usb1 {
	num-ports = <3>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usb_default>;
	status = "okay";
};

&usb2 {
	phy_type = "hsic";
	status = "okay";
};

&watchdog {
	status = "okay";
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR X11)
/*
 * at91-sama5d2_ptc_ek.dts - Device Tree file for SAMA5D2 PTC EK board
 *
 *  Copyright (C) 2017 Microchip/Atmel,
 *		  2017 Wenyou Yang <wenyou.yang@microchip.com>
 *		  2017 Ludovic Desroches <ludovic.desroches@microchip.com>
 */
/dts-v1/;
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/mfd/atmel-flexcom.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/pinctrl/at91.h>

/ {
	model = "Atmel SAMA5D2 PTC EK";
	compatible = "atmel,sama5d2-ptc_ek", "atmel,sama5d2", "atmel,sama5";

	aliases {
		serial0 = &uart0;	/* DBGU */
		i2c0 = &i2c0;	/* mikroBUS 1 */
		i2c1 = &i2c1;	/* XPRO EXT1 */
		i2c2 = &i2c2;
	};

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

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <24000000>;
		};
	};

	ahb {
		usb0: gadget@300000 {
			atmel,vbus-gpio = <&pioA PIN_PB11 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usba_vbus>;
			status = "okay";
		};

		usb1: ohci@400000 {
			num-ports = <3>;
			atmel,vbus-gpio = <0
					   &pioA PIN_PB12 GPIO_ACTIVE_HIGH
					   0
					  >;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usb_default>;
			status = "okay";
		};

		usb2: ehci@500000 {
			status = "okay";
		};

		ebi: ebi@10000000 {
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_nand_default>;
			status = "okay"; /* conflicts with sdmmc1 and qspi0 */

			nand_controller: nand-controller {
				status = "okay";

				nand@3 {
					reg = <0x3 0x0 0x2>;
					atmel,rb = <0>;
					nand-bus-width = <8>;
					nand-ecc-mode = "hw";
					nand-on-flash-bbt;
					label = "atmel_nand";

					partitions {
						compatible = "fixed-partitions";
						#address-cells = <1>;
						#size-cells = <1>;

						at91bootstrap@0 {
							label = "bootstrap";
							reg = <0x0 0x40000>;
						};

						bootloader@40000 {
							label = "bootloader";
							reg = <0x40000 0xc0000>;
						};

						bootloaderenvred@100000 {
							label = "bootloader env redundant";
							reg = <0x100000 0x40000>;
						};

						bootloaderenv@140000 {
							label = "bootloader env";
							reg = <0x140000 0x40000>;
						};

						dtb@180000 {
							label = "device tree";
							reg = <0x180000 0x80000>;
						};

						kernel@200000 {
							label = "kernel";
							reg = <0x200000 0x600000>;
						};

						rootfs@800000 {
							label = "rootfs";
							reg = <0x800000 0x1f800000>;
						};
					};
				};
			};
		};

		sdmmc0: sdio-host@a0000000 {
			bus-width = <8>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc0_default>;
			status = "okay";
		};

		apb {
			spi0: spi@f8000000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_spi0_default>;
				status = "okay";
			};

			macb0: ethernet@f8008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
				#address-cells = <1>;
				#size-cells = <0>;
				phy-mode = "rmii";
				status = "okay";

				ethernet-phy@1 {
					reg = <0x1>;
					interrupt-parent = <&pioA>;
					interrupts = <56 IRQ_TYPE_LEVEL_LOW>;
				};
			};

			tcb0: timer@f800c000 {
				timer0: timer@0 {
					compatible = "atmel,tcb-timer";
					reg = <0>;
				};

				timer1: timer@1 {
					compatible = "atmel,tcb-timer";
					reg = <1>;
				};
			};

			uart0: serial@f801c000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart0_default>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};

			uart2: serial@f8024000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart2_default>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};

			i2c0: i2c@f8028000 {
				dmas = <0>, <0>;
				pinctrl-names = "default", "gpio";
				pinctrl-0 = <&pinctrl_i2c0_default>;
				pinctrl-1 = <&pinctrl_i2c0_gpio>;
				sda-gpios = <&pioA PIN_PD21 GPIO_ACTIVE_HIGH>;
				scl-gpios = <&pioA PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
				status = "okay";
			};

			flx0: flexcom@f8034000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
				status = "okay";

				i2c2: i2c@600 {
					dmas = <0>, <0>;
					pinctrl-names = "default", "gpio";
					pinctrl-0 = <&pinctrl_flx0_default>;
					pinctrl-1 = <&pinctrl_flx0_gpio>;
					sda-gpios = <&pioA PIN_PB28 GPIO_ACTIVE_HIGH>;
					scl-gpios = <&pioA PIN_PB29 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
					status = "okay";
				};
			};

			shdwc@f8048010 {
				debounce-delay-us = <976>;

				input@0 {
					reg = <0>;
				};
			};

			watchdog@f8048040 {
				status = "okay";
			};

			spi1: spi@fc000000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_spi1_default>;
				status = "okay";
			};

			i2c1: i2c@fc028000 {
				dmas = <0>, <0>;
				pinctrl-names = "default", "gpio";
				pinctrl-0 = <&pinctrl_i2c1_default>;
				pinctrl-1 = <&pinctrl_i2c1_gpio>;
				sda-gpios = <&pioA PIN_PC6 GPIO_ACTIVE_HIGH>;
				scl-gpios = <&pioA PIN_PC7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
				status = "okay";

				at24@50 {
					compatible = "atmel,24c02";
					reg = <0x50>;
					pagesize = <8>;
				};
			};

			pinctrl@fc038000 {
				pinctrl_flx0_default: flx0_default {
					pinmux = <PIN_PB28__FLEXCOM0_IO0>,
						 <PIN_PB29__FLEXCOM0_IO1>;
					bias-disable;
				};

				pinctrl_flx0_gpio: flx0_gpio {
					pinmux = <PIN_PB28__GPIO>,
						 <PIN_PB29__GPIO>;
					bias-disable;
				};

				pinctrl_i2c0_default: i2c0_default {
					pinmux = <PIN_PD21__TWD0>,
						 <PIN_PD22__TWCK0>;
					bias-disable;
				};

				pinctrl_i2c0_gpio: i2c0_gpio {
					pinmux = <PIN_PD21__GPIO>,
						 <PIN_PD22__GPIO>;
					bias-disable;
				};

				pinctrl_i2c1_default: i2c1_default {
					pinmux = <PIN_PC6__TWD1>,
						 <PIN_PC7__TWCK1>;
					bias-disable;
				};

				pinctrl_i2c1_gpio: i2c1_gpio {
					pinmux = <PIN_PC6__GPIO>,
						 <PIN_PC7__GPIO>;
					bias-disable;
				};

				pinctrl_key_gpio_default: key_gpio_default {
					pinmux = <PIN_PA10__GPIO>;
					bias-pull-up;
				};

				pinctrl_led_gpio_default: led_gpio_default {
					pinmux = <PIN_PB6__GPIO>,
						 <PIN_PB8__GPIO>,
						 <PIN_PB10__GPIO>;
					bias-pull-up;
				};

				pinctrl_macb0_default: macb0_default {
					pinmux = <PIN_PB14__GTXCK>,
						 <PIN_PB15__GTXEN>,
						 <PIN_PB16__GRXDV>,
						 <PIN_PB17__GRXER>,
						 <PIN_PB18__GRX0>,
						 <PIN_PB19__GRX1>,
						 <PIN_PB20__GTX0>,
						 <PIN_PB21__GTX1>,
						 <PIN_PB22__GMDC>,
						 <PIN_PB23__GMDIO>;
					bias-disable;
				};

				pinctrl_macb0_phy_irq: macb0_phy_irq {
					pinmux = <PIN_PB24__GPIO>;
					bias-disable;
				};

				pinctrl_nand_default: nand_default {
					re_we_data {
						pinmux = <PIN_PA22__D0>,
							 <PIN_PA23__D1>,
							 <PIN_PA24__D2>,
							 <PIN_PA25__D3>,
							 <PIN_PA26__D4>,
							 <PIN_PA27__D5>,
							 <PIN_PA28__D6>,
							 <PIN_PA29__D7>,
							 <PIN_PA30__NWE_NANDWE>,
							 <PIN_PB2__NRD_NANDOE>;
						bias-pull-up;
						atmel,drive-strength = <ATMEL_PIO_DRVSTR_ME>;
					};

					ale_cle_rdy_cs {
						pinmux = <PIN_PB0__A21_NANDALE>,
							 <PIN_PB1__A22_NANDCLE>,
							 <PIN_PC8__NANDRDY>,
							 <PIN_PA31__NCS3>;
						bias-pull-up;
					};
				};

				pinctrl_sdmmc0_default: sdmmc0_default {
					cmd_data {
						pinmux = <PIN_PA1__SDMMC0_CMD>,
							 <PIN_PA2__SDMMC0_DAT0>,
							 <PIN_PA3__SDMMC0_DAT1>,
							 <PIN_PA4__SDMMC0_DAT2>,
							 <PIN_PA5__SDMMC0_DAT3>,
							 <PIN_PA6__SDMMC0_DAT4>,
							 <PIN_PA7__SDMMC0_DAT5>,
							 <PIN_PA8__SDMMC0_DAT6>,
							 <PIN_PA9__SDMMC0_DAT7>;
						bias-pull-up;
					};

					ck_cd_vddsel {
						pinmux = <PIN_PA0__SDMMC0_CK>,
							 <PIN_PA11__SDMMC0_VDDSEL>,
							 <PIN_PA13__SDMMC0_CD>;
						bias-disable;
					};
				};

				pinctrl_spi0_default: spi0_default {
					pinmux = <PIN_PA14__SPI0_SPCK>,
						 <PIN_PA15__SPI0_MOSI>,
						 <PIN_PA16__SPI0_MISO>,
						 <PIN_PA17__SPI0_NPCS0>;
					bias-disable;
				};

				pinctrl_spi1_default: spi1_default {
					pinmux = <PIN_PC1__SPI1_SPCK>,
						 <PIN_PC2__SPI1_MOSI>,
						 <PIN_PC3__SPI1_MISO>,
						 <PIN_PC4__SPI1_NPCS0>;
					bias-disable;
				};

				pinctrl_uart0_default: uart0_default {
					pinmux = <PIN_PB26__URXD0>,
						 <PIN_PB27__UTXD0>;
					bias-disable;
				};

				pinctrl_uart2_default: uart2_default {
					pinmux = <PIN_PD23__URXD2>,
						 <PIN_PD24__UTXD2>;
					bias-disable;
				};

				pinctrl_usb_default: usb_default {
					pinmux = <PIN_PB12__GPIO>;
					bias-disable;
				};

				pinctrl_usba_vbus: usba_vbus {
					pinmux = <PIN_PB11__GPIO>;
					bias-disable;
				};

			};

		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio_default>;

		button-1 {
			label = "PB_USER";
			gpios = <&pioA PIN_PA10 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_PROG1>;
			wakeup-source;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led_gpio_default>;
		status = "okay";

		red {
			label = "red";
			gpios = <&pioA PIN_PB10 GPIO_ACTIVE_HIGH>;
		};

		green {
			label = "green";
			gpios = <&pioA PIN_PB8 GPIO_ACTIVE_HIGH>;
		};

		blue {
			label = "blue";
			gpios = <&pioA PIN_PB6 GPIO_ACTIVE_HIGH>;
			linux,default-trigger = "heartbeat";
		};
	};
};


code:
// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
/*
 * at91-sama5d2_xplained.dts - Device Tree file for SAMA5D2 Xplained board
 *
 *  Copyright (C) 2015 Atmel,
 *                2015 Nicolas Ferre <nicolas.ferre@atmel.com>
 */
/dts-v1/;
#include "sama5d2.dtsi"
#include "sama5d2-pinfunc.h"
#include <dt-bindings/mfd/atmel-flexcom.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/regulator/active-semi,8945a-regulator.h>

/ {
	model = "Atmel SAMA5D2 Xplained";
	compatible = "atmel,sama5d2-xplained", "atmel,sama5d2", "atmel,sama5";

	aliases {
		serial0 = &uart1;	/* DBGU */
		i2c0 = &i2c0;
		i2c1 = &i2c1;
		i2c2 = &i2c2;		/* XPRO EXT2 */
	};

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

	clocks {
		slow_xtal {
			clock-frequency = <32768>;
		};

		main_xtal {
			clock-frequency = <12000000>;
		};
	};

	ahb {
		usb0: gadget@300000 {
			atmel,vbus-gpio = <&pioA PIN_PA31 GPIO_ACTIVE_HIGH>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usba_vbus>;
			status = "okay";
		};

		usb1: ohci@400000 {
			num-ports = <3>;
			atmel,vbus-gpio = <0 /* &pioA PIN_PB9 GPIO_ACTIVE_HIGH */
					   &pioA PIN_PB10 GPIO_ACTIVE_HIGH
					   0
					  >;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_usb_default>;
			status = "okay";
		};

		usb2: ehci@500000 {
			status = "okay";
		};

		sdmmc0: sdio-host@a0000000 {
			bus-width = <8>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc0_default>;
			non-removable;
			mmc-ddr-3_3v;
			status = "okay";
		};

		sdmmc1: sdio-host@b0000000 {
			bus-width = <4>;
			pinctrl-names = "default";
			pinctrl-0 = <&pinctrl_sdmmc1_default>;
			status = "okay"; /* conflict with qspi0 */
			vqmmc-supply = <&vdd_3v3_reg>;
			vmmc-supply = <&vdd_3v3_reg>;
		};

		apb {
			qspi0: spi@f0020000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_qspi0_default>;
				status = "disabled"; /* conflict with sdmmc1 */

				flash@0 {
					#address-cells = <1>;
					#size-cells = <1>;
					compatible = "jedec,spi-nor";
					reg = <0>;
					spi-max-frequency = <80000000>;
					spi-tx-bus-width = <4>;
					spi-rx-bus-width = <4>;
					m25p,fast-read;

					at91bootstrap@0 {
						label = "at91bootstrap";
						reg = <0x00000000 0x00040000>;
					};

					bootloader@40000 {
						label = "bootloader";
						reg = <0x00040000 0x000c0000>;
					};

					bootloaderenvred@100000 {
						label = "bootloader env redundant";
						reg = <0x00100000 0x00040000>;
					};

					bootloaderenv@140000 {
						label = "bootloader env";
						reg = <0x00140000 0x00040000>;
					};

					dtb@180000 {
						label = "device tree";
						reg = <0x00180000 0x00080000>;
					};

					kernel@200000 {
						label = "kernel";
						reg = <0x00200000 0x00600000>;
					};

					misc@800000 {
						label = "misc";
						reg = <0x00800000 0x00000000>;
					};
				};
			};

			spi0: spi@f8000000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_spi0_default>;
				status = "okay";

				flash@0 {
					compatible = "atmel,at25df321a";
					reg = <0>;
					spi-max-frequency = <50000000>;
				};
			};

			macb0: ethernet@f8008000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
				#address-cells = <1>;
				#size-cells = <0>;
				phy-mode = "rmii";
				status = "okay";

				ethernet-phy@1 {
					reg = <0x1>;
					interrupt-parent = <&pioA>;
					interrupts = <PIN_PC9 IRQ_TYPE_LEVEL_LOW>;
				};
			};

			tcb0: timer@f800c000 {
				timer0: timer@0 {
					compatible = "atmel,tcb-timer";
					reg = <0>;
				};

				timer1: timer@1 {
					compatible = "atmel,tcb-timer";
					reg = <1>;
				};
			};

			uart1: serial@f8020000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart1_default>;
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				status = "okay";
			};

			i2c0: i2c@f8028000 {
				dmas = <0>, <0>;
				pinctrl-names = "default", "gpio";
				pinctrl-0 = <&pinctrl_i2c0_default>;
				pinctrl-1 = <&pinctrl_i2c0_gpio>;
				sda-gpios = <&pioA PIN_PD21 GPIO_ACTIVE_HIGH>;
				scl-gpios = <&pioA PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
				i2c-sda-hold-time-ns = <350>;
				status = "okay";

				pmic@5b {
					compatible = "active-semi,act8945a";
					reg = <0x5b>;
					active-semi,vsel-high;
					status = "okay";

					regulators {
						vdd_1v35_reg: REG_DCDC1 {
							regulator-name = "VDD_1V35";
							regulator-min-microvolt = <1350000>;
							regulator-max-microvolt = <1350000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
							regulator-always-on;

							regulator-state-mem {
								regulator-on-in-suspend;
								regulator-suspend-min-microvolt = <1400000>;
								regulator-suspend-max-microvolt = <1400000>;
								regulator-changeable-in-suspend;
								regulator-mode = <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							};
						};

						vdd_1v2_reg: REG_DCDC2 {
							regulator-name = "VDD_1V2";
							regulator-min-microvolt = <1100000>;
							regulator-max-microvolt = <1300000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
							regulator-always-on;

							regulator-state-mem {
								regulator-off-in-suspend;
							};
						};

						vdd_3v3_reg: REG_DCDC3 {
							regulator-name = "VDD_3V3";
							regulator-min-microvolt = <3300000>;
							regulator-max-microvolt = <3300000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
							regulator-always-on;

							regulator-state-mem {
								regulator-off-in-suspend;
							};
						};

						vdd_fuse_reg: REG_LDO1 {
							regulator-name = "VDD_FUSE";
							regulator-min-microvolt = <2500000>;
							regulator-max-microvolt = <2500000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
							regulator-always-on;

							regulator-state-mem {
								regulator-off-in-suspend;
							};
						};

						vdd_3v3_lp_reg: REG_LDO2 {
							regulator-name = "VDD_3V3_LP";
							regulator-min-microvolt = <3300000>;
							regulator-max-microvolt = <3300000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
							regulator-always-on;

							regulator-state-mem {
								regulator-off-in-suspend;
							};
						};

						vdd_led_reg: REG_LDO3 {
							regulator-name = "VDD_LED";
							regulator-min-microvolt = <3300000>;
							regulator-max-microvolt = <3300000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
							regulator-always-on;

							regulator-state-mem {
								regulator-off-in-suspend;
							};
						};

						vdd_sdhc_1v8_reg: REG_LDO4 {
							regulator-name = "VDD_SDHC_1V8";
							regulator-min-microvolt = <1800000>;
							regulator-max-microvolt = <1800000>;
							regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
										  <ACT8945A_REGULATOR_MODE_LOWPOWER>;
							regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
							regulator-always-on;

							regulator-state-mem {
								regulator-off-in-suspend;
							};
						};
					};

					charger {
						compatible = "active-semi,act8945a-charger";
						pinctrl-names = "default";
						pinctrl-0 = <&pinctrl_charger_chglev &pinctrl_charger_lbo &pinctrl_charger_irq>;
						interrupt-parent = <&pioA>;
						interrupts = <PIN_PB13 IRQ_TYPE_EDGE_RISING>;

						active-semi,chglev-gpios = <&pioA PIN_PA12 GPIO_ACTIVE_HIGH>;
						active-semi,lbo-gpios = <&pioA PIN_PC8 GPIO_ACTIVE_LOW>;
						active-semi,input-voltage-threshold-microvolt = <6600>;
						active-semi,precondition-timeout = <40>;
						active-semi,total-timeout = <3>;
						status = "okay";
					};
				};
			};

			pwm0: pwm@f802c000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_pwm0_pwm2_default>;
				status = "disabled"; /* conflict with leds */
			};

			flx0: flexcom@f8034000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
				status = "disabled"; /* conflict with ISC_D2 & ISC_D3 data pins */

				uart5: serial@200 {
					dmas = <0>, <0>;
					pinctrl-names = "default";
					pinctrl-0 = <&pinctrl_flx0_default>;
					status = "okay";
				};

				i2c2: i2c@600 {
					dmas = <0>, <0>;
					pinctrl-names = "default", "gpio";
					pinctrl-0 = <&pinctrl_flx0_default>;
					pinctrl-1 = <&pinctrl_i2c2_gpio>;
					sda-gpios = <&pioA PIN_PB28 GPIO_ACTIVE_HIGH>;
					scl-gpios = <&pioA PIN_PB29 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
					i2c-sda-hold-time-ns = <350>;
					i2c-analog-filter;
					i2c-digital-filter;
					i2c-digital-filter-width-ns = <35>;
					status = "disabled"; /* conflict with ISC_D2 & ISC_D3 data pins */
				};
			};

			shdwc@f8048010 {
				debounce-delay-us = <976>;
				atmel,wakeup-rtc-timer;

				input@0 {
					reg = <0>;
				};
			};

			watchdog@f8048040 {
				status = "okay";
			};

			i2s0: i2s@f8050000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_i2s0_default>;
				status = "disabled"; /* conflict with can0 */
			};

			can0: can@f8054000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_can0_default>;
				status = "okay";
			};

			uart3: serial@fc008000 {
				atmel,use-dma-rx;
				atmel,use-dma-tx;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_uart3_default>;
				status = "okay";
			};

			flx4: flexcom@fc018000 {
				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
				status = "okay";

				i2c6: i2c@600 {
					dmas = <0>, <0>;
					pinctrl-names = "default", "gpio";
					pinctrl-0 = <&pinctrl_flx4_default>;
					pinctrl-1 = <&pinctrl_flx4_gpio>;
					sda-gpios = <&pioA PIN_PD12 GPIO_ACTIVE_HIGH>;
					scl-gpios = <&pioA PIN_PD13 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
					i2c-analog-filter;
					i2c-digital-filter;
					i2c-digital-filter-width-ns = <35>;
					status = "okay";
				};
			};

			i2c1: i2c@fc028000 {
				dmas = <0>, <0>;
				pinctrl-names = "default", "gpio";
				pinctrl-0 = <&pinctrl_i2c1_default>;
				i2c-analog-filter;
				i2c-digital-filter;
				i2c-digital-filter-width-ns = <35>;
				pinctrl-1 = <&pinctrl_i2c1_gpio>;
				sda-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_HIGH>;
				scl-gpios = <&pioA PIN_PD5 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
				status = "okay";

				at24@54 {
					compatible = "atmel,24c02";
					reg = <0x54>;
					pagesize = <16>;
				};
			};

			adc: adc@fc030000 {
				vddana-supply = <&vdd_3v3_lp_reg>;
				vref-supply = <&vdd_3v3_lp_reg>;
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_adc_default &pinctrl_adtrg_default>;
				status = "okay";
			};

			pinctrl@fc038000 {
				/*
				 * There is no real pinmux for ADC, if the pin
				 * is not requested by another peripheral then
				 * the muxing is done when channel is enabled.
				 * Requesting pins for ADC is GPIO is
				 * encouraged to prevent conflicts and to
				 * disable bias in order to be in the same
				 * state when the pin is not muxed to the adc.
				 */
				pinctrl_adc_default: adc_default {
					pinmux = <PIN_PD23__GPIO>;
					bias-disable;
				};

				pinctrl_can0_default: can0_default {
					pinmux = <PIN_PC10__CANTX0>,
						 <PIN_PC11__CANRX0>;
					bias-disable;
				};

				pinctrl_can1_default: can1_default {
					pinmux = <PIN_PC26__CANTX1>,
						 <PIN_PC27__CANRX1>;
					bias-disable;
				};

				/*
				 * The ADTRG pin can work on any edge type.
				 * In here it's being pulled up, so need to
				 * connect it to ground to get an edge e.g.
				 * Trigger can be configured on falling, rise
				 * or any edge, and the pull-up can be changed
				 * to pull-down or left floating according to
				 * needs.
				 */
				pinctrl_adtrg_default: adtrg_default {
					pinmux = <PIN_PD31__ADTRG>;
					bias-pull-up;
				};

				pinctrl_charger_chglev: charger_chglev {
					pinmux = <PIN_PA12__GPIO>;
					bias-disable;
				};

				pinctrl_charger_irq: charger_irq {
					pinmux = <PIN_PB13__GPIO>;
					bias-disable;
				};

				pinctrl_charger_lbo: charger_lbo {
					pinmux = <PIN_PC8__GPIO>;
					bias-pull-up;
				};

				pinctrl_classd_default_pfets: classd_default_pfets {
					pinmux = <PIN_PB1__CLASSD_R0>,
						 <PIN_PB3__CLASSD_R2>;
					bias-pull-up;
				};

				pinctrl_classd_default_nfets: classd_default_nfets {
					pinmux = <PIN_PB2__CLASSD_R1>,
						 <PIN_PB4__CLASSD_R3>;
					bias-pull-down;
				};

				pinctrl_flx0_default: flx0_default {
					pinmux = <PIN_PB28__FLEXCOM0_IO0>,
						 <PIN_PB29__FLEXCOM0_IO1>;
					bias-disable;
				};

				pinctrl_flx4_default: flx4_default {
					pinmux = <PIN_PD12__FLEXCOM4_IO0>,
						 <PIN_PD13__FLEXCOM4_IO1>;
					bias-disable;
				};

				pinctrl_flx4_gpio: flx4_gpio {
					pinmux = <PIN_PD12__GPIO>,
						 <PIN_PD13__GPIO>;
					bias-disable;
				};

				pinctrl_i2c0_default: i2c0_default {
					pinmux = <PIN_PD21__TWD0>,
						 <PIN_PD22__TWCK0>;
					bias-disable;
				};

				pinctrl_i2c0_gpio: i2c0_gpio {
					pinmux = <PIN_PD21__GPIO>,
						 <PIN_PD22__GPIO>;
					bias-disable;
				};

				pinctrl_i2c1_default: i2c1_default {
					pinmux = <PIN_PD4__TWD1>,
						 <PIN_PD5__TWCK1>;
					bias-disable;
				};

				pinctrl_i2c1_gpio: i2c1_gpio {
					pinmux = <PIN_PD4__GPIO>,
						 <PIN_PD5__GPIO>;
					bias-disable;
				};

				pinctrl_i2c2_gpio: i2c2_gpio {
					pinmux = <PIN_PB28__GPIO>,
						 <PIN_PB29__GPIO>;
					bias-disable;
				};

				pinctrl_i2s0_default: i2s0_default {
					pinmux = <PIN_PC1__I2SC0_CK>,
						 <PIN_PC2__I2SC0_MCK>,
						 <PIN_PC3__I2SC0_WS>,
						 <PIN_PC4__I2SC0_DI0>,
						 <PIN_PC5__I2SC0_DO0>;
					bias-disable;
				};

				pinctrl_i2s1_default: i2s1_default {
					pinmux = <PIN_PA15__I2SC1_CK>,
						 <PIN_PA14__I2SC1_MCK>,
						 <PIN_PA16__I2SC1_WS>,
						 <PIN_PA17__I2SC1_DI0>,
						 <PIN_PA18__I2SC1_DO0>;
					bias-disable;
				};

				pinctrl_key_gpio_default: key_gpio_default {
					pinmux = <PIN_PB9__GPIO>;
					bias-pull-up;
				};

				pinctrl_led_gpio_default: led_gpio_default {
					pinmux = <PIN_PB0__GPIO>,
						 <PIN_PB5__GPIO>,
						 <PIN_PB6__GPIO>;
					bias-pull-up;
				};

				pinctrl_macb0_default: macb0_default {
					pinmux = <PIN_PB14__GTXCK>,
						 <PIN_PB15__GTXEN>,
						 <PIN_PB16__GRXDV>,
						 <PIN_PB17__GRXER>,
						 <PIN_PB18__GRX0>,
						 <PIN_PB19__GRX1>,
						 <PIN_PB20__GTX0>,
						 <PIN_PB21__GTX1>,
						 <PIN_PB22__GMDC>,
						 <PIN_PB23__GMDIO>;
					bias-disable;
				};

				pinctrl_macb0_phy_irq: macb0_phy_irq {
					pinmux = <PIN_PC9__GPIO>;
					bias-disable;
				};

				pinctrl_qspi0_default: qspi0_default {
					sck_cs {
						pinmux = <PIN_PA22__QSPI0_SCK>,
							 <PIN_PA23__QSPI0_CS>;
						bias-disable;
					};

					data {
						pinmux = <PIN_PA24__QSPI0_IO0>,
							 <PIN_PA25__QSPI0_IO1>,
							 <PIN_PA26__QSPI0_IO2>,
							 <PIN_PA27__QSPI0_IO3>;
						bias-pull-up;
					};
				};

				pinctrl_sdmmc0_default: sdmmc0_default {
					cmd_data {
						pinmux = <PIN_PA1__SDMMC0_CMD>,
							 <PIN_PA2__SDMMC0_DAT0>,
							 <PIN_PA3__SDMMC0_DAT1>,
							 <PIN_PA4__SDMMC0_DAT2>,
							 <PIN_PA5__SDMMC0_DAT3>,
							 <PIN_PA6__SDMMC0_DAT4>,
							 <PIN_PA7__SDMMC0_DAT5>,
							 <PIN_PA8__SDMMC0_DAT6>,
							 <PIN_PA9__SDMMC0_DAT7>;
						bias-disable;
					};

					ck_cd_rstn {
						pinmux = <PIN_PA0__SDMMC0_CK>,
							 <PIN_PA10__SDMMC0_RSTN>,
							 <PIN_PA13__SDMMC0_CD>;
						bias-disable;
					};
				};

				pinctrl_sdmmc1_default: sdmmc1_default {
					cmd_data {
						pinmux = <PIN_PA28__SDMMC1_CMD>,
							 <PIN_PA18__SDMMC1_DAT0>,
							 <PIN_PA19__SDMMC1_DAT1>,
							 <PIN_PA20__SDMMC1_DAT2>,
							 <PIN_PA21__SDMMC1_DAT3>;
						bias-disable;
					};

					conf-ck_cd {
						pinmux = <PIN_PA22__SDMMC1_CK>,
							 <PIN_PA30__SDMMC1_CD>;
						bias-disable;
					};
				};

				pinctrl_spi0_default: spi0_default {
					pinmux = <PIN_PA14__SPI0_SPCK>,
						 <PIN_PA15__SPI0_MOSI>,
						 <PIN_PA16__SPI0_MISO>,
						 <PIN_PA17__SPI0_NPCS0>;
					bias-disable;
				};

				pinctrl_uart1_default: uart1_default {
					pinmux = <PIN_PD2__URXD1>,
						 <PIN_PD3__UTXD1>;
					bias-disable;
				};

				pinctrl_uart3_default: uart3_default {
					pinmux = <PIN_PB11__URXD3>,
						 <PIN_PB12__UTXD3>;
					bias-disable;
				};

				pinctrl_usb_default: usb_default {
					pinmux = <PIN_PB10__GPIO>;
					bias-disable;
				};

				pinctrl_usba_vbus: usba_vbus {
					pinmux = <PIN_PA31__GPIO>;
					bias-disable;
				};

				pinctrl_pwm0_pwm2_default: pwm0_pwm2_default {
					pinmux = <PIN_PB5__PWMH2>,
						 <PIN_PB6__PWML2>;
					bias-pull-up;
				};
			};

			classd: classd@fc048000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_classd_default_pfets &pinctrl_classd_default_nfets>;
				atmel,pwm-type = "diff";
				atmel,non-overlap-time = <10>;
				status = "okay";
			};

			i2s1: i2s@fc04c000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_i2s1_default>;
				status = "disabled"; /* conflict with spi0, sdmmc1 */
			};

			can1: can@fc050000 {
				pinctrl-names = "default";
				pinctrl-0 = <&pinctrl_can1_default>;
				status = "okay";
			};
		};
	};

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio_default>;

		button {
			label = "PB_USER";
			gpios = <&pioA PIN_PB9 GPIO_ACTIVE_LOW>;
			linux,code = <KEY_PROG1>;
			wakeup-source;
		};
	};

	leds {
		compatible = "gpio-leds";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_led_gpio_default>;
		status = "okay"; /* conflict with pwm0 */

		red {
			label = "red";
			gpios = <&pioA PIN_PB6 GPIO_ACTIVE_LOW>;
		};

		green {
			label = "green";
			gpios = <&pioA PIN_PB5 GPIO_ACTIVE_LOW>;
		};

		blue {
			label = "blue";
			gpios = <&pioA PIN_PB0 GPIO_ACTIVE_LOW>;
			linux,default-trigger = "heartbeat";
		};
	};
};


code:
// SPDX-License-Identifier: GPL-2.0+ OR MIT
/*
 * at91-sama5d3_eds.dts - Device Tree file for the SAMA5D3 Ethernet
 *    Development System board.
 *
 * Copyright (C) 2022 Microchip Technology Inc. and its subsidiaries
 *
 * Author: Jerry Ray <jerry.ray@microchip.com>
 */
/dts-v1/;
#include "sama5d36.dtsi"

/ {
	model = "SAMA5D3 Ethernet Development System";
	compatible = "microchip,sama5d3-eds", "atmel,sama5d36",
		     "atmel,sama5d3", "atmel,sama5";

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

	gpio-keys {
		compatible = "gpio-keys";

		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_key_gpio>;

		button-3 {
			label = "PB_USER";
			gpios = <&pioE 29 GPIO_ACTIVE_LOW>;
			linux,code = <0x104>;
			wakeup-source;
		};
	};

	memory@20000000 {
		reg = <0x20000000 0x10000000>;
	};

	vcc_3v3_reg: regulator-1 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_3V3";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
	};

	vcc_2v5_reg: regulator-2 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_2V5";
		regulator-min-microvolt = <2500000>;
		regulator-max-microvolt = <2500000>;
		regulator-always-on;
		vin-supply = <&vcc_3v3_reg>;
	};

	vcc_1v8_reg: regulator-3 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_1V8";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
		regulator-always-on;
		vin-supply = <&vcc_3v3_reg>;
	};

	vcc_1v2_reg: regulator-4 {
		compatible = "regulator-fixed";
		regulator-name = "VCC_1V2";
		regulator-min-microvolt = <1200000>;
		regulator-max-microvolt = <1200000>;
		regulator-always-on;
	};

	vcc_mmc0_reg: regulator-5 {
		compatible = "regulator-fixed";
		regulator-name = "mmc0-card-supply";
		regulator-min-microvolt = <3300000>;
		regulator-max-microvolt = <3300000>;
		regulator-always-on;
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_vcc_mmc0_reg_gpio>;
		gpio = <&pioE 2 GPIO_ACTIVE_LOW>;
	};
};

&can0 {
	status = "okay";
};

&dbgu {
	status = "okay";
};

&ebi {
	pinctrl-0 = <&pinctrl_ebi_nand_addr>;
	pinctrl-names = "default";
	status = "okay";

	nand_controller: nand-controller {
		status = "okay";

		nand@3 {
			reg = <0x3 0x0 0x2>;
			atmel,rb = <0>;
			nand-bus-width = <8>;
			nand-ecc-mode = "hw";
			nand-ecc-strength = <4>;
			nand-ecc-step-size = <512>;
			nand-on-flash-bbt;
			label = "atmel_nand";

			partitions {
				compatible = "fixed-partitions";
				#address-cells = <1>;
				#size-cells = <1>;

				at91bootstrap@0 {
					label = "at91bootstrap";
					reg = <0x0 0x40000>;
				};

				bootloader@40000 {
					label = "bootloader";
					reg = <0x40000 0xc0000>;
				};

				bootloaderenvred@100000 {
					label = "bootloader env redundant";
					reg = <0x100000 0x40000>;
				};

				bootloaderenv@140000 {
					label = "bootloader env";
					reg = <0x140000 0x40000>;
				};

				dtb@180000 {
					label = "device tree";
					reg = <0x180000 0x80000>;
				};

				kernel@200000 {
					label = "kernel";
					reg = <0x200000 0x600000>;
				};

				rootfs@800000 {
					label = "rootfs";
					reg = <0x800000 0x0f800000>;
				};
			};
		};
	};
};

&i2c0 {
	pinctrl-0 = <&pinctrl_i2c0_pu>;
	status = "okay";
};

&i2c1 {
	status = "okay";
};

&i2c2 {
	pinctrl-0 = <&pinctrl_i2c2_pu>;
	status = "okay";
};

&main_xtal {
	clock-frequency = <12000000>;
};

&mmc0 {
	pinctrl-0 = <&pinctrl_mmc0_clk_cmd_dat0 &pinctrl_mmc0_dat1_3
		     &pinctrl_mmc0_dat4_7 &pinctrl_mmc0_cd>;
	vmmc-supply = <&vcc_mmc0_reg>;
	vqmmc-supply = <&vcc_3v3_reg>;
	status = "okay";
	slot@0 {
		reg = <0>;
		bus-width = <8>;
		cd-gpios = <&pioE 0 GPIO_ACTIVE_LOW>;
	};
};

&pinctrl {
	board {
		pinctrl_i2c0_pu: i2c0-pu {
			atmel,pins =
				<AT91_PIOA 30 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>,
				<AT91_PIOA 31 AT91_PERIPH_A AT91_PINCTRL_PULL_UP>;
		};

		pinctrl_i2c2_pu: i2c2-pu {
			atmel,pins =
				<AT91_PIOA 18 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>,
				<AT91_PIOA 19 AT91_PERIPH_B AT91_PINCTRL_PULL_UP>;
		};

		pinctrl_key_gpio: key-gpio-0 {
			atmel,pins =
				<AT91_PIOE 29 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
		};

		pinctrl_mmc0_cd: mmc0-cd {
			atmel,pins =
				<AT91_PIOE 0 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
		};

		/* Reserved for reset signal to the RGMII connector. */
		pinctrl_rgmii_rstn: rgmii-rstn {
			atmel,pins =
				<AT91_PIOD 18 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP_DEGLITCH>;
		};

		/* Reserved for an interrupt line from the RMII and RGMII connectors. */
		pinctrl_spi_irqn: spi-irqn {
			atmel,pins =
				<AT91_PIOB 28 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
		};

		pinctrl_spi0_cs: spi0-cs-default {
			atmel,pins =
				<AT91_PIOD 13 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
				 AT91_PIOD 16 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};

		pinctrl_spi1_cs: spi1-cs-default {
			atmel,pins = <AT91_PIOC 25 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
				      AT91_PIOC 28 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};

		pinctrl_usba_vbus: usba-vbus {
			atmel,pins =
				<AT91_PIOE 9 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
		};

		pinctrl_usb_default: usb-default {
			atmel,pins =
				<AT91_PIOE 3 AT91_PERIPH_GPIO AT91_PINCTRL_NONE
				 AT91_PIOE 4 AT91_PERIPH_GPIO AT91_PINCTRL_NONE>;
		};

		/* Reserved for VBUS fault interrupt. */
		pinctrl_vbusfault_irqn: vbusfault-irqn {
			atmel,pins =
				<AT91_PIOE 5 AT91_PERIPH_GPIO AT91_PINCTRL_DEGLITCH>;
		};

		pinctrl_vcc_mmc0_reg_gpio: vcc-mmc0-reg-gpio-default {
			atmel,pins = <AT91_PIOE 2 AT91_PERIPH_GPIO AT91_PINCTRL_PULL_UP>;
		};
	};
};

&slow_xtal {
	clock-frequency = <32768>;
};

&spi0 {
	pinctrl-names = "default", "cs";
	pinctrl-1 = <&pinctrl_spi0_cs>;
	cs-gpios = <&pioD 13 0>, <0>, <0>, <&pioD 16 0>;
	status = "okay";
};

&spi1 {
	pinctrl-names = "default", "cs";
	pinctrl-1 = <&pinctrl_spi1_cs>;
	cs-gpios = <&pioC 25 0>, <0>, <0>, <&pioC 28 0>;
	status = "okay";
};

&tcb0 {
	timer0: timer@0 {
		compatible = "atmel,tcb-timer";
		reg = <0>;
	};

	timer1: timer@1 {
		compatible = "atmel,tcb-timer";
		reg = <1>;
	};
};

&usb0 {	/* USB Device port with VBUS detection. */
	atmel,vbus-gpio = <&pioE 9 GPIO_ACTIVE_HIGH>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usba_vbus>;
	status = "okay";
};

&usb1 {	/* 3-port Host. First port is unused. */
	atmel,vbus-gpio = <0
			   &pioE 3 GPIO_ACTIVE_HIGH
			   &pioE 4 GPIO_ACTIVE_HIGH
			  >;
	num-ports = <3>;
	pinctrl-names = "default";
	pinctrl-0 = <&pinctrl_usb_default>;
	status = "okay";
};

&usb2 {
	status = "okay";
};