samsung: tizen_rpi: make 'dfu_alt_info' static
authorMarek Szyprowski <m.szyprowski@samsung.com>
Tue, 17 Nov 2020 10:16:28 +0000 (11:16 +0100)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Mon, 15 Nov 2021 10:37:12 +0000 (11:37 +0100)
The data layout on the storage device is the same all the time for RPi3/4
boards and fully known during the compile time. Use this simple approach,
which is a bit more error proof for future changes. It also obsoletes the
custom code added to RPi boards.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8f7211cdde50701418464419b774aeecc795efa1

board/raspberrypi/rpi/rpi.c
include/configs/rpi.h
include/samsung/tizen_rpi.h

index 3ffc6b6..24c9eba 100644 (file)
@@ -558,68 +558,3 @@ int checkboard(void)
 {
        return 0;
 }
-
-#ifdef CONFIG_SET_DFU_ALT_INFO
-static char *get_dfu_alt_system(char *interface, char *devstr)
-{
-       return env_get("dfu_alt_system");
-}
-
-static 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;
-
-       alt_boot = CONFIG_DFU_ALT_SYSTEM;
-
-       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) {
-               env_set("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";
-       }
-
-       env_set("dfu_alt_info", alt_info);
-       puts(status);
-}
-#endif
index 924964a..3953b0d 100644 (file)
 #ifdef CONFIG_DFU
 #define CONFIG_SYS_DFU_DATA_BUF_SIZE   SZ_1M
 #define CONFIG_SYS_DFU_MAX_FILE_SIZE   SZ_2M
-
-#ifdef CONFIG_ARM64
-#define KERNEL_FILENAME                "Image"
-#else
-#define KERNEL_FILENAME                "zImage"
-#endif
-
-#define ENV_DFU_SETTINGS \
-       "dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \
-                     "config.txt fat 0 1;" \
-                     KERNEL_FILENAME " fat 0 1\0"
-#else
-#define ENV_DFU_SETTINGS ""
 #endif
 
 /* Console configuration */
        TIZEN_ENV_SETTING \
        "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
        ENV_DEVICE_SETTINGS \
-       ENV_DFU_SETTINGS \
        ENV_MEM_LAYOUT_SETTINGS \
        BOOTENV
 
index 96aaf85..6770f4a 100644 (file)
@@ -20,7 +20,7 @@
 #endif
 
 /* DFU */
-#define CONFIG_DFU_ALT_SYSTEM                  \
+#define DFU_ALT_SYSTEM                         \
        "Image fat 0 1;"                        \
        "bcm2710-rpi-3-b.dtb fat 0 1;"          \
        "bcm2837-rpi-3-b.dtb fat 0 1;"          \
        "module part 0 6;"                      \
        "ramdisk.img part 0 7;"                 \
        "ramdisk-recovery part 0 8;"            \
-       "hal.img part 0 10\0"
+       "hal.img part 0 10"
 
-#define CONFIG_DFU_ALT_BOOT_EMMC       ""
-#define CONFIG_SET_DFU_ALT_INFO
 #define CONFIG_SET_DFU_ALT_BUF_LEN     (SZ_1K)
 
 #define PARTS_DEFAULT \
@@ -83,6 +81,7 @@
 */
 #define TIZEN_ENV_SETTING \
        "kernel=" KERNEL_NAME "\0"              \
+       "dfu_alt_info=" DFU_ALT_SYSTEM "\0"     \
        "mmcbootdev=0\0"                        \
        "mmcbootpart=1\0"                       \
        "mmcrootdev=0\0"                        \