cosmos: add defconfig and fmap.dts

this adds defconfig and fmap.dts for cosmos. fmap.dts is adjusted
to the size of the spi flash on the board (2MB). the first half is for RO sections
and the second half is for RW sections. read fmap.dts for more details.

BUG=chrome-os-partner:32772
BRANCH=none
TEST=Built chromeos-bootimage
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

Change-Id: If70aea03d38c8d01cefd1b257a67df1e8f6c0477
Reviewed-on: https://chromium-review.googlesource.com/222649
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
diff --git a/board/cosmos/defconfig b/board/cosmos/defconfig
new file mode 100644
index 0000000..2560022
--- /dev/null
+++ b/board/cosmos/defconfig
@@ -0,0 +1,29 @@
+# Arch
+CONFIG_ARCH_ARM=y
+
+# Board
+CONFIG_BOARD="cosmos"
+
+# Image
+CONFIG_BASE_ADDRESS=0x43000000
+CONFIG_FMAP_OFFSET=0x00080000
+CONFIG_HEAP_SIZE=0x01000000
+CONFIG_KERNEL_START=0x2000000
+
+# Vboot
+CONFIG_RO_NORMAL_SUPPORT=y
+CONFIG_VIRTUAL_DEV_SWITCH=y
+
+CONFIG_CROSSYSTEM_FDT=y
+
+# Kernel format
+CONFIG_KERNEL_FIT=y
+CONFIG_KERNEL_FIT_FDT_ADDR=0x6400000
+
+# Drivers
+CONFIG_DRIVER_FLASH_SPI=y
+CONFIG_DRIVER_INPUT_USB=y
+CONFIG_DRIVER_TPM_SLB9635_I2C=y
+
+CONFIG_HEADLESS=y
+CONFIG_NV_STORAGE_FLASH=y
diff --git a/board/cosmos/fmap.dts b/board/cosmos/fmap.dts
new file mode 100644
index 0000000..6db42fe
--- /dev/null
+++ b/board/cosmos/fmap.dts
@@ -0,0 +1,202 @@
+/dts-v1/;
+
+/ {
+	model = "Google Cosmos";
+	config {
+		hwid = "Cosmos TEST 1";
+	};
+	chromeos-config {
+		/* Enable factory-friendly features. */
+		gbb-flag-dev-screen-short-delay;
+		gbb-flag-force-dev-switch-on;
+		gbb-flag-force-dev-boot-usb;
+		gbb-flag-disable-fw-rollback-check;
+	};
+	flash@0 {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "chromeos,flashmap";
+		reg = <0x00000000 0x00200000>;
+
+		/* ---- Section: Read-only ---- */
+		wp-ro {
+			label = "wp-ro";
+			reg = <0x00000000 0x00100000>;
+			read-only;
+		};
+
+		ro-section {
+			label = "ro-section";
+			reg = <0x00000000 0x000f0000>;
+			read-only;
+		};
+		ro-boot {
+			label = "coreboot";
+			size = <0x00080000>;
+			read-only;
+			type = "blob coreboot";
+			required;
+		};
+
+		ro-fmap {
+			label = "fmap";
+
+			/* We encourage to align FMAP partition in as large
+			 * block as possible so that flashrom can find it soon.
+			 * For example, aligning to 512KB is better than to
+			 * 256KB. */
+
+			reg = <0x00080000 0x00001000>;
+			read-only;
+			type = "fmap";
+			ver-major = <1>;
+			ver-minor = <0>;
+		};
+
+		ro-gbb {
+			label = "gbb";
+
+			/* GBB offset must be aligned to 4K bytes */
+			reg = <0x00081000 0x0006ef00>;
+			read-only;
+			type = "blob gbb";
+		};
+
+		ro-firmware-id {
+			label = "ro-frid";
+			reg = <0x000eff00 0x00000100>;
+			read-only;
+			type = "blobstring fwid";
+		};
+
+		/* ---- Section: Vital-product data (VPD) ---- */
+		ro-vpd {
+			label = "ro-vpd";
+
+			/* VPD offset must be aligned to 4K bytes */
+			reg = <0x000f0000 0x00010000>;
+			read-only;
+			type = "wiped";
+			wipe-value = [ff];
+		};
+
+		/* ---- Section: Rewritable slot A ---- */
+		rw-a {
+			label = "rw-section-a";
+			/* Alignment: 4k (for updating) */
+			reg = <0x00100000 0x00068000>;
+		};
+		rw-a-vblock {
+			label = "vblock-a";
+			/*
+			 * Alignment: 4k (for updating) and must be in start of
+			 * each RW_SECTION.
+			 */
+			reg = <0x00100000 0x00002000>;
+			type = "keyblock boot,romstage,ramstage";
+			with_index;
+			keyblock = "firmware.keyblock";
+			signprivate = "firmware_data_key.vbprivk";
+			version = <1>;
+			kernelkey = "kernel_subkey.vbpubk";
+			preamble-flags = <1>;
+		};
+		rw-a-boot {
+			/* Alignment: no requirement (yet). */
+			label = "fw-main-a";
+			reg = <0x00102000 0x00065f00>;
+			type = "blob boot,romstage,ramstage";
+			with_index;
+		};
+		rw-a-firmware-id {
+			/* Alignment: no requirement. */
+			label = "rw-fwid-a";
+			reg = <0x00167f00 0x00000100>;
+			read-only;
+			type = "blobstring fwid";
+		};
+
+		/* ---- Section: Rewritable shared 16 KB---- */
+		shared-section {
+			/*
+			 * Alignment: 4k (for updating).
+			 * Anything in this range may be updated in recovery.
+			 */
+			label = "rw-shared";
+			reg = <0x00168000 0x00004000>;
+		};
+		shared-data {
+			label = "shared-data";
+			/*
+			 * Alignment: 4k (for random read/write).
+			 * RW firmware can put calibration data here.
+			 */
+			reg = <0x00168000 0x00004000>;
+			type = "wiped";
+			wipe-value = [00];
+		};
+
+		/* ---- Section: Rewritable Event Log 16KB ---- */
+		rw-elog {
+			label = "rw-elog";
+			/* Alignment: 4K (for updating) */
+			reg = <0x0016c000 0x00004000>;
+			type = "wiped";
+			wipe-value = [ff];
+		};
+
+		/* ---- Section: Rewritable slot B ---- */
+		rw-b {
+			label = "rw-section-b";
+			/* Alignment: 4k (for updating) */
+			reg = <0x00180000 0x000068000>;
+		};
+		rw-b-vblock {
+			label = "vblock-b";
+			/*
+			 * Alignment: 4k (for updating) and must be in start of
+			 * each RW_SECTION.
+			 */
+			reg = <0x00180000 0x00002000>;
+			type = "keyblock boot,romstage,ramstage";
+			with_index;
+			keyblock = "firmware.keyblock";
+			signprivate = "firmware_data_key.vbprivk";
+			version = <1>;
+			kernelkey = "kernel_subkey.vbpubk";
+			preamble-flags = <1>;
+		};
+		rw-b-boot {
+			label = "fw-main-b";
+			/* Alignment: no requirement (yet). */
+			reg = <0x00182000 0x00065f00>;
+			type = "blob boot,romstage,ramstage";
+			with_index;
+		};
+		rw-b-firmware-id {
+			label = "rw-fwid-b";
+			/* Alignment: no requirement. */
+			reg = <0x001e7f00 0x00000100>;
+			read-only;
+			type = "blobstring fwid";
+		};
+
+		/* ---- Section: Rewritable VPD 32 KB ---- */
+		rw-vpd {
+			label = "rw-vpd";
+			/* Alignment: 4k (for updating) */
+			reg = <0x001e8000 0x00008000>;
+			type = "wiped";
+			wipe-value = [ff];
+		};
+
+		/* ---- Section: nvram 64KB ---- */
+		rw-nvram {
+			label = "rw-nvram";
+			/* Alignment: 64K (for block erases) */
+			reg = <0x001f0000 0x00010000>;
+			type = "wiped";
+			wipe-value = [ff];
+		};
+	};
+};