Révision | 233662411d12109cdc8957de6e85fb30fe2d42b8 (tree) |
---|---|
l'heure | 2022-07-27 15:19:09 |
Auteur | Ying-Chun Liu (PaulLiu) <paul.liu@lina...> |
Commiter | Jaehoon Chung |
cmd: mmc: allow to write protect single boot partition
add arguments for mmc wp to assign which boot partition to protect.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
@@ -1048,6 +1048,7 @@ static int do_mmc_boot_wp(struct cmd_tbl *cmdtp, int flag, | ||
1048 | 1048 | { |
1049 | 1049 | int err; |
1050 | 1050 | struct mmc *mmc; |
1051 | + int part; | |
1051 | 1052 | |
1052 | 1053 | mmc = init_mmc_device(curr_device, false); |
1053 | 1054 | if (!mmc) |
@@ -1056,7 +1057,14 @@ static int do_mmc_boot_wp(struct cmd_tbl *cmdtp, int flag, | ||
1056 | 1057 | printf("It is not an eMMC device\n"); |
1057 | 1058 | return CMD_RET_FAILURE; |
1058 | 1059 | } |
1059 | - err = mmc_boot_wp(mmc); | |
1060 | + | |
1061 | + if (argc == 2) { | |
1062 | + part = dectoul(argv[1], NULL); | |
1063 | + err = mmc_boot_wp_single_partition(mmc, part); | |
1064 | + } else { | |
1065 | + err = mmc_boot_wp(mmc); | |
1066 | + } | |
1067 | + | |
1060 | 1068 | if (err) |
1061 | 1069 | return CMD_RET_FAILURE; |
1062 | 1070 | printf("boot areas protected\n"); |
@@ -1066,7 +1074,7 @@ static int do_mmc_boot_wp(struct cmd_tbl *cmdtp, int flag, | ||
1066 | 1074 | static struct cmd_tbl cmd_mmc[] = { |
1067 | 1075 | U_BOOT_CMD_MKENT(info, 1, 0, do_mmcinfo, "", ""), |
1068 | 1076 | U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""), |
1069 | - U_BOOT_CMD_MKENT(wp, 1, 0, do_mmc_boot_wp, "", ""), | |
1077 | + U_BOOT_CMD_MKENT(wp, 2, 0, do_mmc_boot_wp, "", ""), | |
1070 | 1078 | #if CONFIG_IS_ENABLED(MMC_WRITE) |
1071 | 1079 | U_BOOT_CMD_MKENT(write, 4, 0, do_mmc_write, "", ""), |
1072 | 1080 | U_BOOT_CMD_MKENT(erase, 3, 0, do_mmc_erase, "", ""), |
@@ -1140,7 +1148,11 @@ U_BOOT_CMD( | ||
1140 | 1148 | " [MMC_LEGACY, MMC_HS, SD_HS, MMC_HS_52, MMC_DDR_52, UHS_SDR12, UHS_SDR25,\n" |
1141 | 1149 | " UHS_SDR50, UHS_DDR50, UHS_SDR104, MMC_HS_200, MMC_HS_400, MMC_HS_400_ES]\n" |
1142 | 1150 | "mmc list - lists available devices\n" |
1143 | - "mmc wp - power on write protect boot partitions\n" | |
1151 | + "mmc wp [PART] - power on write protect boot partitions\n" | |
1152 | + " arguments:\n" | |
1153 | + " PART - [0|1]\n" | |
1154 | + " : 0 - first boot partition, 1 - second boot partition\n" | |
1155 | + " if not assigned, write protect all boot partitions\n" | |
1144 | 1156 | #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING) |
1145 | 1157 | "mmc hwpartition <USER> <GP> <MODE> - does hardware partitioning\n" |
1146 | 1158 | " arguments (sizes in 512-byte blocks):\n" |