This patch adds DFU functions and DFU informations for the ARTIK devices.
set_dfu_alt_info
- setting dfu information for the ARTIK devices.
get_dfu_alt_system
- getting system partition information.
get_dfu_alt_boot
- getting predefined boot partition information.
Change-Id: I4361f75ba6889b86d6c6bb4501c38545c742442a
Signed-off-by: jino.cho <jino.cho@samsung.com>
#include <asm/arch/pinmux.h>
#include <asm/arch/sromc.h>
#include <asm/arch/sysreg.h>
+#include <mmc.h>
#include "pmic.h"
#define DEBOUNCE_DELAY 10000
#endif
return 0;
}
+
+#ifdef CONFIG_SET_DFU_ALT_INFO
+char *get_dfu_alt_system(char *interface, char *devstr)
+{
+ return getenv("dfu_alt_system");
+}
+
+char *get_dfu_alt_boot(char *interface, char *devstr)
+{
+ struct mmc *mmc;
+ char *alt_boot;
+ int dev_num;
+
+ dev_num = simple_strtoul(devstr, NULL, 10);
+
+ mmc = find_mmc_device(dev_num);
+ if (!mmc)
+ return NULL;
+
+ if (mmc_init(mmc))
+ return NULL;
+
+ if (IS_SD(mmc))
+ alt_boot = CONFIG_DFU_ALT_BOOT_SD;
+ else
+ alt_boot = CONFIG_DFU_ALT_BOOT_EMMC;
+
+ return alt_boot;
+}
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+ size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN;
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size);
+ char *alt_info = "Settings not found!";
+ char *status = "error!\n";
+ char *alt_setting;
+ char *alt_sep;
+ int offset = 0;
+
+ puts("DFU alt info setting: ");
+
+ alt_setting = get_dfu_alt_boot(interface, devstr);
+ if (alt_setting) {
+ setenv("dfu_alt_boot", alt_setting);
+ offset = snprintf(buf, buf_size, "%s", alt_setting);
+ }
+
+ alt_setting = get_dfu_alt_system(interface, devstr);
+ if (alt_setting) {
+ if (offset)
+ alt_sep = ";";
+ else
+ alt_sep = "";
+
+ offset += snprintf(buf + offset, buf_size - offset,
+ "%s%s", alt_sep, alt_setting);
+ }
+
+ if (offset) {
+ alt_info = buf;
+ status = "done\n";
+ }
+
+ setenv("dfu_alt_info", alt_info);
+ puts(status);
+}
+#endif
#include <asm/arch/pinmux.h>
#include <asm/arch/sromc.h>
#include <asm/arch/sysreg.h>
+#include <mmc.h>
#include "pmic.h"
#ifdef CONFIG_CPU_EXYNOS5422_EVT0
#ifdef CONFIG_MACH_UNIVERSAL5422
return alt_boot;
}
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+ size_t buf_size = CONFIG_SET_DFU_ALT_BUF_LEN;
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, buf_size);
+ char *alt_info = "Settings not found!";
+ char *status = "error!\n";
+ char *alt_setting;
+ char *alt_sep;
+ int offset = 0;
+
+ puts("DFU alt info setting: ");
+
+ alt_setting = get_dfu_alt_boot(interface, devstr);
+ if (alt_setting) {
+ setenv("dfu_alt_boot", alt_setting);
+ offset = snprintf(buf, buf_size, "%s", alt_setting);
+ }
+
+ alt_setting = get_dfu_alt_system(interface, devstr);
+ if (alt_setting) {
+ if (offset)
+ alt_sep = ";";
+ else
+ alt_sep = "";
+
+ offset += snprintf(buf + offset, buf_size - offset,
+ "%s%s", alt_sep, alt_setting);
+ }
+
+ if (offset) {
+ alt_info = buf;
+ status = "done\n";
+ }
+
+ setenv("dfu_alt_info", alt_info);
+ puts(status);
+}
#endif
#define CONFIG_MODULE_PART 2
#define CONFIG_ROOT_PART 3
+#define CONFIG_SET_DFU_ALT_INFO
+#define CONFIG_SET_DFU_ALT_BUF_LEN (1 << 10) /* 1 KB */
+
#define CONFIG_DFU_ALT_SYSTEM \
"uImage fat 0 1;" \
"zImage fat 0 1;" \
"system-data part 0 4;" \
"user part 0 5\0"
+#ifdef CONFIG_MACH_ARTIK5
+#define CONFIG_DFU_ALT_BOOT_EMMC \
+ "u-boot raw 0x3e 0x290 mmcpart 1;" \
+ "bl1 raw 0x0 0x1e mmcpart 1;" \
+ "bl2 raw 0x1e 0x20 mmcpart 1;" \
+ "tzsw raw 0x2ce 0x138 mmcpart 1;" \
+ "params raw 0x406 0x20 \0"
+
+#define CONFIG_DFU_ALT_BOOT_SD \
+ "u-boot raw 0x3e 0x290;" \
+ "bl1 raw 0x0 0x1e;" \
+ "bl2 raw 0x1e 0x20;" \
+ "tzsw raw 0x2ce 0x138;" \
+ "params raw 0x406 0x20\0"
+#endif
+
+#ifdef CONFIG_MACH_ARTIK10
+#define CONFIG_DFU_ALT_BOOT_EMMC \
+ "u-boot raw 0x3e 0x290 mmcpart 1;" \
+ "bl1 raw 0x0 0x1e mmcpart 1;" \
+ "bl2 raw 0x1e 0x20 mmcpart 1;" \
+ "tzsw raw 0x2ce 0x200 mmcpart 1;" \
+ "params raw 0x4ce 0x20 \0"
+
+#define CONFIG_DFU_ALT_BOOT_SD \
+ "u-boot raw 0x3e 0x290;" \
+ "bl1 raw 0x0 0x1e;" \
+ "bl2 raw 0x1e 0x20;" \
+ "tzsw raw 0x2ce 0x200;" \
+ "params raw 0x4ce 0x20\0"
+#endif
+
#define PARTS_DEFAULT \
"uuid_disk=${uuid_gpt_disk};" \
"name=boot,start=1MiB,size=" __stringify(CONFIG_BOOT_PART_SIZE) \
"fdtaddr=40800000\0" \
"initrd_file=uInitrd\0" \
"initrd_addr=43000000\0" \
- "dfu_alt_info=" CONFIG_DFU_ALT_SYSTEM \
+ "dfu_alt_system=" CONFIG_DFU_ALT_SYSTEM \
+ "dfu_usb_con=0\0" \
+ "dfu_interface=mmc\0" \
+ "dfu_device=${emmc_dev}\0" \
"sdrecovery=sdfuse format; sdfuse flashall 3\0" \
"factory_load=factory_info load mmc ${emmc_dev} 0x80 0x8\0" \
"factory_save=factory_info save mmc ${emmc_dev} 0x80 0x8\0" \