summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-03-18 09:25:03 +0100
committerPatrick Delaunay <patrick.delaunay@st.com>2020-05-14 09:02:12 +0200
commit306a5cf24f30b9eea1c7ca04bba4af11c097b2d9 (patch)
tree057177a4fba172443e5cfcdacbf069297709ee5e /arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
parentd0686c69ff6cb8d8e63052bde8ca00e6468dd88d (diff)
downloadu-boot-306a5cf24f30b9eea1c7ca04bba4af11c097b2d9.tar.gz
u-boot-306a5cf24f30b9eea1c7ca04bba4af11c097b2d9.tar.xz
u-boot-306a5cf24f30b9eea1c7ca04bba4af11c097b2d9.zip
stm32mp: stm32prog: add support of RAM target
Add support of RAM target in flashlayout to load kernel image ("system") and device tree ("filesystem") in DDR with DFU and start these images. The flashlayout.tsv is: - 0x01 fsbl Binary none 0x00000000 tf-a.stm32 - 0x03 ssbl Binary none 0x00000000 u-boot.stm32 P 0x10 kernel System ram0 0xC2000000 uImage.bin P 0x11 dtb FileSystem ram0 0xC4000000 dtb.bin Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c')
-rw-r--r--arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index 0967bbc11a..cc303214cf 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -272,6 +272,9 @@ static int parse_ip(struct stm32prog_data *data,
} else if (!strncmp(p, "spi-nand", 8)) {
part->target = STM32PROG_SPI_NAND;
len = 8;
+ } else if (!strncmp(p, "ram", 3)) {
+ part->target = STM32PROG_RAM;
+ len = 0;
} else {
result = -EINVAL;
}
@@ -610,6 +613,11 @@ static int init_device(struct stm32prog_data *data,
dev->mtd = mtd;
break;
#endif
+ case STM32PROG_RAM:
+ first_addr = gd->bd->bi_dram[0].start;
+ last_addr = first_addr + gd->bd->bi_dram[0].size;
+ dev->erase_size = 1;
+ break;
default:
stm32prog_err("unknown device type = %d", dev->target);
return -ENODEV;
@@ -1022,7 +1030,11 @@ static int stm32prog_alt_add(struct stm32prog_data *data,
part->name, part->id,
size, multiplier, type);
- if (part->part_type == RAW_IMAGE) {
+ if (part->target == STM32PROG_RAM) {
+ offset += snprintf(buf + offset, ALT_BUF_LEN - offset,
+ "ram 0x%llx 0x%llx",
+ part->addr, part->size);
+ } else if (part->part_type == RAW_IMAGE) {
u64 dfu_size;
if (part->dev->target == STM32PROG_MMC)
@@ -1073,6 +1085,10 @@ static int stm32prog_alt_add(struct stm32prog_data *data,
get_mtd_by_target(devstr, part->target, part->dev_id);
break;
#endif
+ case STM32PROG_RAM:
+ sprintf(dfustr, "ram");
+ sprintf(devstr, "0");
+ break;
default:
stm32prog_err("invalid target: %d", part->target);
return -ENODEV;
@@ -1440,6 +1456,13 @@ static void stm32prog_end_phase(struct stm32prog_data *data)
if (!data->cur_part)
return;
+ if (data->cur_part->target == STM32PROG_RAM) {
+ if (data->cur_part->part_type == PART_SYSTEM)
+ data->uimage = data->cur_part->addr;
+ if (data->cur_part->part_type == PART_FILESYSTEM)
+ data->dtb = data->cur_part->addr;
+ }
+
if (CONFIG_IS_ENABLED(MMC) &&
data->cur_part->part_id < 0) {
char cmdbuf[60];
@@ -1569,6 +1592,10 @@ static int part_delete(struct stm32prog_data *data,
}
break;
#endif
+ case STM32PROG_RAM:
+ printf("on ram: ");
+ memset((void *)(uintptr_t)part->addr, 0, (size_t)part->size);
+ break;
default:
ret = -1;
stm32prog_err("%s (0x%x): erase invalid", part->name, part->id);