From 450d595fb8b350d8ab0da536caaf8b42a3fff2ef Mon Sep 17 00:00:00 2001 From: Przemyslaw Marczak Date: Wed, 5 Nov 2014 21:18:39 +0100 Subject: [PATCH] tizen: config: enable platform command and platform setup This patch enables "platform" command and adds multiple platform setups to tizen environment. At this stage - there are available three setups: - trats2 pit v8 - trats2 pit v13 - chosen - odroidu3 Tizen v2.x - chosen - odroidu3 Tizen v3.0 - chosen The chosen setup - is the default for each platform, and is set as an active after first boot. This should be changed manually if another setup is required. Change-Id: I86ec63f4422e210f20d8d2240ca3bade581b5466 Signed-off-by: Przemyslaw Marczak --- include/configs/tizen.h | 15 ++++- include/samsung/gpt_v08.h | 40 ++----------- include/samsung/gpt_v13.h | 17 +++--- include/samsung/mbr_v2x.h | 42 +++++++++++++ include/samsung/mbr_v30.h | 46 +++++++++++++++ include/samsung/platform_setup.h | 124 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 236 insertions(+), 48 deletions(-) create mode 100644 include/samsung/mbr_v2x.h create mode 100644 include/samsung/mbr_v30.h create mode 100644 include/samsung/platform_setup.h diff --git a/include/configs/tizen.h b/include/configs/tizen.h index 512d3b3..b7c7276 100644 --- a/include/configs/tizen.h +++ b/include/configs/tizen.h @@ -10,8 +10,7 @@ #define __CONFIG_TIZEN_H #include -#include -#include +#include #define CONFIG_SYS_PROMPT "Exynos4412 # " /* Monitor Command Prompt */ @@ -141,7 +140,8 @@ "consoleoff=set console console=ram; save; reset\0" \ "initrdname=uInitrd\0" \ "initrdaddr=42000000\0" \ - "fdtaddr=40800000\0" + "fdtaddr=40800000\0" \ + PLATFORM_SETUP_INFO /* I2C */ #include @@ -179,6 +179,15 @@ int get_soft_i2c_sda_pin(void); #define CONFIG_POWER_BATTERY_TRATS2 #define CONFIG_CMD_POWEROFF +/** + * Platform setup command (GPT and DFU) + * Define setup and part num for some static data + * should be changed to linked list in the future. + */ +#define CONFIG_PLATFORM_SETUP +#define CONFIG_PLATFORM_MAX_PART_NUM 32 +#define CONFIG_PLATFORM_MAX_SETUP_NUM 6 + /* GPT */ #define CONFIG_RANDOM_UUID diff --git a/include/samsung/gpt_v08.h b/include/samsung/gpt_v08.h index 84be5b9..a02271b 100644 --- a/include/samsung/gpt_v08.h +++ b/include/samsung/gpt_v08.h @@ -2,6 +2,10 @@ #define _TIZEN_GPT_V08_H_ /* + * Platform: trats + * Boards: trats/trats2 + * version: Pit v8 + * * Bootable media layout: * dev: SD eMMC(part boot) * BL1 1 0 @@ -49,40 +53,6 @@ ""PARTS_V8_CSC" part 0 4;" \ ""PARTS_V8_ROOT" part 0 5;" \ ""PARTS_V8_DATA" part 0 6;" \ - ""PARTS_V8_UMS" part 0 7;" \ - "params.bin raw 2560 8\0" - -#define DFU_ALT_SYSTEM_ODROID \ - "uImage fat 0 1;" \ - "zImage fat 0 1;" \ - "Image.itb fat 0 1;" \ - "exynos4412-odroidu3.dtb fat 0 1;" \ - "exynos4412-odroidx2.dtb fat 0 1;" \ - ""PARTS_V8_BOOT" part 0 1;" \ - ""PARTS_V8_ROOT" part 0 2;" \ - ""PARTS_V8_DATA" part 0 3;" \ - ""PARTS_V8_UMS" part 0 4;" \ - "params.bin raw 2560 8\0" - -#define DFU_ALT_BOOT_SD_TRATS2_GPT_V08 \ - "This boot mode is not used\0" - -#define DFU_ALT_BOOT_EMMC_TRATS2_GPT_V08 \ - "u-boot raw 0x80 0x800\0" - -#define PARTS_ODROID \ - "This board uses MSDOS partition table." - -#define DFU_ALT_BOOT_EMMC_ODROID \ - "u-boot raw 0x3e 0x800 mmcpart 1;" \ - "bl1 raw 0x0 0x1e mmcpart 1;" \ - "bl2 raw 0x1e 0x1d mmcpart 1;" \ - "tzsw raw 0x83e 0x138 mmcpart 1\0" - -#define DFU_ALT_BOOT_SD_ODROID \ - "u-boot raw 0x3f 0x800;" \ - "bl1 raw 0x1 0x1e;" \ - "bl2 raw 0x1f 0x1d;" \ - "tzsw raw 0x83f 0x138\0" + ""PARTS_V8_UMS" part 0 7\0" #endif /* _TIZEN_GPT_V08_H_ */ diff --git a/include/samsung/gpt_v13.h b/include/samsung/gpt_v13.h index 1f4b59e..4d9ee68 100644 --- a/include/samsung/gpt_v13.h +++ b/include/samsung/gpt_v13.h @@ -1,6 +1,12 @@ #ifndef _TIZEN_GPT_V13_H_ #define _TIZEN_GPT_V13_H_ +/** + * Platform: trats + * Boards: trats/trats2 + * version: Pit v13 +*/ + /* Tizen - partitions definitions */ #define PARTS_V13_CSA "csa" #define PARTS_V13_BOOT "boot" @@ -39,8 +45,6 @@ "name="PARTS_V13_USER",size=-,uuid=${uuid_gpt_"PARTS_V13_USER"}\0" \ #define DFU_ALT_SYSTEM_TRATS2_GPT_V13 \ - "s-boot-mmc.bin raw 0x0 0x400 mmcpart 1;" \ - "u-boot-mmc.bin raw 0x80 0x800;" \ "/uImage ext4 0 2;" \ "/zImage ext4 0 2;" \ "/Image.itb ext4 0 2;" \ @@ -60,13 +64,6 @@ ""PARTS_V13_ROOTFS" part 0 11;" \ ""PARTS_V13_SYSDATA" part 0 12;" \ ""PARTS_V13_CSC" part 0 13;" \ - ""PARTS_V13_USER" part 0 14;" \ - "params.bin raw 0x1880 0x200\0" - -#define DFU_ALT_BOOT_SD_TRATS2_GPT_V13 \ - "This boot mode is not used\0" - -#define DFU_ALT_BOOT_EMMC_TRATS2_GPT_V13 \ - "u-boot raw 0x80 0x800\0" + ""PARTS_V13_USER" part 0 14\0" #endif /* _TIZEN_GPT_V13_H_ */ diff --git a/include/samsung/mbr_v2x.h b/include/samsung/mbr_v2x.h new file mode 100644 index 0000000..8a77545 --- /dev/null +++ b/include/samsung/mbr_v2x.h @@ -0,0 +1,42 @@ +#ifndef _TIZEN_MBR_V2X_H_ +#define _TIZEN_MBR_V2X_H_ + +/** + * Platform: odroid + * Boards: odroidu3/odroidx2 + * version: Tizen v2.x + * + * Bootable media layout: + * dev: SD eMMC(part boot) + * BL1 1 0 + * BL2 31 30 + * UBOOT 63 62 + * TZSW 2111 2110 + * ENV 2560 2560(part user) + * + * MBR Primary partiions: + * Num Name Size Offset + * 1. BOOT: 100MiB 2MiB + * 2. ROOT: 3GiB + * 3. DATA: 3GiB + * 4. UMS: - +*/ + +/* Tizen 2.0 - MBR partition definitions for Odroid */ +#define PARTS_V2X_BOOT "boot" +#define PARTS_V2X_ROOT "platform" +#define PARTS_V2X_DATA "data" +#define PARTS_V2X_UMS "ums" + +#define DFU_ALT_SYSTEM_ODROID_MBR_V2X \ + "uImage fat 0 1;" \ + "zImage fat 0 1;" \ + "Image.itb fat 0 1;" \ + "exynos4412-odroidu3.dtb fat 0 1;" \ + "exynos4412-odroidx2.dtb fat 0 1;" \ + ""PARTS_V2X_BOOT" part 0 1;" \ + ""PARTS_V2X_ROOT" part 0 2;" \ + ""PARTS_V2X_DATA" part 0 3;" \ + ""PARTS_V2X_UMS" part 0 4\0" + +#endif /* _TIZEN_MBR_V2X_H_ */ diff --git a/include/samsung/mbr_v30.h b/include/samsung/mbr_v30.h new file mode 100644 index 0000000..a254f37 --- /dev/null +++ b/include/samsung/mbr_v30.h @@ -0,0 +1,46 @@ +#ifndef _TIZEN_MBR_V30_H_ +#define _TIZEN_MBR_V30_H_ + +/** + * Platform: odroid + * Boards: odroidu3/odroidx2 + * version: Tizen v3.0 + * + * Bootable media layout: + * dev: SD eMMC(part boot) + * BL1 1 0 + * BL2 31 30 + * UBOOT 63 62 + * TZSW 2111 2110 + * ENV 2560 2560(part user) + * + * MBR Primary partiions: + * Num Name Size Offset + * 1. BOOT: 32MiB 4MiB + * 2. ROOT: 3GiB + * 3. DATA: 512MiB + * 4. Extd: + * 5. USER: - + * 6. MODULE: 20MiB +*/ + +/* Tizen 3.0 - MBR partition definitions for Odroid */ +#define PARTS_V30_BOOT "boot" +#define PARTS_V30_ROOT "rootfs" +#define PARTS_V30_DATA "system-data" +#define PARTS_V30_USER "user" +#define PARTS_V30_MODULES "modules" + +#define DFU_ALT_SYSTEM_ODROID_MBR_V30 \ + "uImage fat 0 1;" \ + "zImage fat 0 1;" \ + "Image.itb fat 0 1;" \ + "exynos4412-odroidu3.dtb fat 0 1;" \ + "exynos4412-odroidx2.dtb fat 0 1;" \ + ""PARTS_V30_BOOT" part 0 1;" \ + ""PARTS_V30_ROOT" part 0 2;" \ + ""PARTS_V30_DATA" part 0 3;" \ + ""PARTS_V30_USER" part 0 5;" \ + ""PARTS_V30_MODULES" part 0 6\0" + +#endif /* _TIZEN_MBR_V30_H_ */ diff --git a/include/samsung/platform_setup.h b/include/samsung/platform_setup.h new file mode 100644 index 0000000..4123a16 --- /dev/null +++ b/include/samsung/platform_setup.h @@ -0,0 +1,124 @@ +#ifndef _PLATFORM_SETUP_H_ +#define _PLATFORM_SETUP_H_ + +#include +#include +#include +#include + +/** + * Each device has predefined bootloader area which should stay unchanged + * to prevent bootloader failure. + */ +#define DFU_ALT_BOOT_EMMC_TRATS2 \ + "s-boot-mmc.bin raw 0x0 0x400 mmcpart 1;" \ + "u-boot-mmc.bin raw 0x80 0x800;" \ + "params.bin raw 0x1880 0x20\0" + +#define DFU_ALT_BOOT_SD_TRATS2 \ + "This boot mode is not used\0" + +#define DFU_ALT_BOOT_EMMC_ODROID \ + "u-boot raw 0x3e 0x800 mmcpart 1;" \ + "bl1 raw 0x0 0x1e mmcpart 1;" \ + "bl2 raw 0x1e 0x1d mmcpart 1;" \ + "tzsw raw 0x83e 0x138 mmcpart 1;" \ + "params.bin raw 0x1880 0x20\0" + +#define DFU_ALT_BOOT_SD_ODROID \ + "u-boot raw 0x3f 0x800;" \ + "bl1 raw 0x1 0x1e;" \ + "bl2 raw 0x1f 0x1d;" \ + "tzsw raw 0x83f 0x138;" \ + "params.bin raw 0x1880 0x20\0" + +/** + * Each platform (${platname}) can provide N configs. + * Each config can provide a number of partitions. + * + * How to add new setup: + * - ${platname}_setup_N_name + * - ${platname}_setup_N_partitions + * - ${platname}_setup_N_alt_system + * - ${platname}_setup_N_bootpart + * - ${platname}_setup_N_rootpart + * + * Update PLATFORM_SETUP_INFO with: + * - ${platname}_setup_N_name/partitions/alt_system - new setup data + * - ${platname}_setup_cnt - number of configs for board + * - ${platname}_setup_chosen - number of chosen board config + * - ${platname}_setup_active - number of active board config (autoset) + */ + +/** + * TRATS_SETUP_1 - data defined in include/samsung/gpt_v08.h + * TRATS_SETUP_2 - data defined in include/samsung/gpt_v13.h + */ +#define TRATS_SETUP_1 \ + "trats_setup_1_name=PIT v08\0" \ + "trats_setup_1_partitions="PARTS_TRATS2_GPT_V08 \ + "trats_setup_1_alt_system="DFU_ALT_SYSTEM_TRATS2_GPT_V08 \ + "trats_setup_1_bootpart=2\0" \ + "trats_setup_1_rootpart=5\0" + +#define TRATS_SETUP_2 \ + "trats_setup_2_name=PIT v13\0" \ + "trats_setup_2_partitions="PARTS_TRATS2_GPT_V13 \ + "trats_setup_2_alt_system="DFU_ALT_SYSTEM_TRATS2_GPT_V13 \ + "trats_setup_2_bootpart=2\0" \ + "trats_setup_2_rootpart=11\0" + +/** + * ${platname}: trats + * Supported by: trats/trats2 + * setup 1: Pit v08 + * setup 2: Pit v13 (chosen) + */ +#define PLATFORM_SETUP_TRATS \ + "trats_setup_cnt=2\0" \ + "trats_setup_chosen=2\0" \ + "trats_setup_active=\0" \ + TRATS_SETUP_1 \ + TRATS_SETUP_2 + + +/* $partitions - not defined(MSDOS) */ +#define ODROID_SETUP_1 \ + "odroid_setup_1_name=Tizen v2.x\0" \ + "odroid_setup_1_partitions=\0" \ + "odroid_setup_1_alt_system="DFU_ALT_SYSTEM_ODROID_MBR_V2X \ + "odroid_setup_1_bootpart=1\0" \ + "odroid_setup_1_rootpart=2\0" + +/* $partitions - not defined(MSDOS) */ +#define ODROID_SETUP_2 \ + "odroid_setup_2_name=Tizen v3.0\0" \ + "odroid_setup_2_partitions=\0" \ + "odroid_setup_2_alt_system="DFU_ALT_SYSTEM_ODROID_MBR_V30 \ + "odroid_setup_2_bootpart=1\0" \ + "odroid_setup_2_rootpart=2\0" + +/** + * ${platname}: odroid + * Supported by: odroidu3/odroidx2 + * setup 1: Tizen v2.x + * setup 2: Tizen v3.0 (chosen) + */ +#define PLATFORM_SETUP_ODROID \ + "odroid_setup_cnt=2\0" \ + "odroid_setup_chosen=2\0" \ + "odroid_setup_active=\0" \ + ODROID_SETUP_1 \ + ODROID_SETUP_2 + +/** + * PLATFORM_SETUP_INFO - this should be a part of CONFIG_EXTRA_ENV_SETTINGS + * It provides environment variables for each board multiple platform setup. + * !!!Update this when adding new config!!! + * This is default setup - can be overwritten by params.bin + */ +#define PLATFORM_SETUP_INFO \ + PLATFORM_SETUP_TRATS \ + PLATFORM_SETUP_ODROID + +#endif /* _PLATFORM_SETUP_H_ */ -- 2.7.4