/*
 *  Copyright (C) 2012 Altera Corporation <www.altera.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * dtc -O dtb -o socfpga.dtb socfpga.dts
 */

/dts-v1/;
/include/ "socfpga.dtsi"

/ {
	model = "Altera SOCFPGA Cyclone V";
	compatible = "altr,socfpga-cyclone5", "altr,socfpga";

	chosen {
		bootargs = "console=ttyS0,57600";
	};

	memory {
		name = "memory";
		device_type = "memory";
		reg = <0x0 0x40000000>; /* 1 GB */
	};

	aliases {
		/* this allow the ethaddr uboot environmnet variable contents
		 * to be added to the gmac1 device tree blob.
		 */
		ethernet0 = &gmac1;
	};

	soc {
		clkmgr@ffd04000 {
			clocks {
				osc1 {
					clock-frequency = <25000000>;
				};
			};
		};

		dcan0: d_can@ffc00000 {
			status = "disabled";
		};

		dcan1: d_can@ffc10000 {
			status = "disabled";
		};

		dwmmc0@ff704000 {
			num-slots = <1>;
			supports-highspeed;
			broken-cd;
			altr,dw-mshc-ciu-div = <4>;
			altr,dw-mshc-sdr-timing = <0 3>;

			slot@0 {
				reg = <0>;
				bus-width = <4>;
			};
		};

		ethernet@ff700000 {
			status = "disabled";
		};

		ethernet@ff702000 {
			phy-mode = "rgmii";
			phy-addr = <0xffffffff>; /* probe for phy addr */
		};

		i2c1: i2c@ffc05000 {
			status = "disabled";
		};

		i2c2: i2c@ffc06000 {
			status = "disabled";
		};

		i2c3: i2c@ffc07000 {
			status = "disabled";
		};

		qspi: spi@ff705000 {
				compatible = "cadence,qspi";
				#address-cells = <1>;
				#size-cells = <0>;
				reg = <0xff705000 0x1000>,
					<0xffa00000 0x1000>;
				interrupts = <0 151 4>;
				master-ref-clk = <400000000>;
				ext-decoder = <0>;  /* external decoder */
				num-chipselect = <4>;
				fifo-depth = <128>;
				bus-num = <2>;

				flash0: n25q00@0 {
					#address-cells = <1>;
					#size-cells = <1>;
					compatible = "n25q00";
					reg = <0>;	/* chip select */
					spi-max-frequency = <100000000>;
					page-size = <256>;
					block-size = <16>; /* 2^16, 64KB */
					quad = <1>;	   /* 1-support quad */
					tshsl-ns = <200>;
					tsd2d-ns = <255>;
					tchsh-ns = <20>;
					tslch-ns = <20>;

					partition@0 {
						/* 8MB for raw data. */
						label = "Flash 0 Raw Data";
						reg = <0x0 0x800000>;
					};
					partition@800000 {
						/* 8MB for jffs2 data. */
						label = "Flash 0 jffs2 Filesystem";
						reg = <0x800000 0x800000>;
					};
				};

			};

		sysmgr@ffd08000 {
			cpu1-start-addr = <0xffd080c4>;
		};

		timer0@ffc08000 {
			clock-frequency = <100000000>;
		};

		timer1@ffc09000 {
			clock-frequency = <100000000>;
		};

		timer2@ffd00000 {
			clock-frequency = <25000000>;
		};

		timer3@ffd01000 {
			clock-frequency = <25000000>;
		};

		serial0@ffc02000 {
			clock-frequency = <100000000>;
		};

		serial1@ffc03000 {
			clock-frequency = <100000000>;
		};

		usb0: usb@ffb00000 {
			status = "disabled";
		};

		usb1: usb@ffb40000 {
			ulpi-ddr = <0>;
		};

		i2c0: i2c@ffc04000 {
			speed-mode = <0>;
		};

		leds {
			compatible = "gpio-leds";
			hps0 {
				label = "hps_led0";
				gpios = <&gpio1 15 1>;
			};

			hps1 {
				label = "hps_led1";
				gpios = <&gpio1 14 1>;
			};

			hps2 {
				label = "hps_led2";
				gpios = <&gpio1 13 1>;
			};

			hps3 {
				label = "hps_led3";
				gpios = <&gpio1 12 1>;
			};
		};

		lightweight_bridge: bridge@0xff200000 {
			#address-cells = <1>;
			#size-cells = <1>;
			ranges = < 0x0 0xff200000 0x200000 >;

			compatible = "simple-bus";

			vga_ball: vga_ball@0 {
				 compatible = "altr,vga_ball";
				 reg = <0x0 0x8>;
			};				 
		};
	};
};

&i2c0 {
	lcd: lcd@28 {
		compatible = "newhaven,nhd-0216k3z-nsw-bbw";
		reg = <0x28>;
		height = <2>;
		width = <16>;
		brightness = <8>;
	};

	eeprom@51 {
		compatible = "atmel,24c32";
		reg = <0x51>;
		pagesize = <32>;
	};

	rtc@68 {
		compatible = "dallas,ds1339";
		reg = <0x68>;
	};
};
