header->image_length = 0x0;
if (!raw_header || !header) {
- pr_debug("%s:no header data\n", __func__);
+ log_debug("%s:no header data\n", __func__);
return -1;
}
if (raw_header->magic_number !=
(('S' << 0) | ('T' << 8) | ('M' << 16) | (0x32 << 24))) {
- pr_debug("%s:invalid magic number : 0x%x\n",
- __func__, raw_header->magic_number);
+ log_debug("%s:invalid magic number : 0x%x\n",
+ __func__, raw_header->magic_number);
return -2;
}
/* only header v1.0 supported */
if (raw_header->header_version != 0x00010000) {
- pr_debug("%s:invalid header version : 0x%x\n",
- __func__, raw_header->header_version);
+ log_debug("%s:invalid header version : 0x%x\n",
+ __func__, raw_header->header_version);
return -3;
}
if (raw_header->reserved1 != 0x0 || raw_header->reserved2) {
- pr_debug("%s:invalid reserved field\n", __func__);
+ log_debug("%s:invalid reserved field\n", __func__);
return -4;
}
for (i = 0; i < (sizeof(raw_header->padding) / 4); i++) {
if (raw_header->padding[i] != 0) {
- pr_debug("%s:invalid padding field\n", __func__);
+ log_debug("%s:invalid padding field\n", __func__);
return -5;
}
}
last = start + size;
*last = 0x0; /* force null terminated string */
- pr_debug("flash layout =\n%s\n", start);
+ log_debug("flash layout =\n%s\n", start);
/* calculate expected number of partitions */
part_list_size = 1;
last_addr = (u64)(block_dev->lba - GPT_HEADER_SZ - 1) *
block_dev->blksz;
}
- pr_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id,
- block_dev->lba, block_dev->blksz);
- pr_debug(" available address = 0x%llx..0x%llx\n",
- first_addr, last_addr);
- pr_debug(" full_update = %d\n", dev->full_update);
+ log_debug("MMC %d: lba=%ld blksz=%ld\n", dev->dev_id,
+ block_dev->lba, block_dev->blksz);
+ log_debug(" available address = 0x%llx..0x%llx\n",
+ first_addr, last_addr);
+ log_debug(" full_update = %d\n", dev->full_update);
break;
case STM32PROG_NOR:
case STM32PROG_NAND:
return -ENODEV;
}
get_mtd_by_target(mtd_id, dev->target, dev->dev_id);
- pr_debug("%s\n", mtd_id);
+ log_debug("%s\n", mtd_id);
mtdparts_init();
mtd = get_mtd_device_nm(mtd_id);
first_addr = 0;
last_addr = mtd->size;
dev->erase_size = mtd->erasesize;
- pr_debug("MTD device %s: size=%lld erasesize=%d\n",
- mtd_id, mtd->size, mtd->erasesize);
- pr_debug(" available address = 0x%llx..0x%llx\n",
- first_addr, last_addr);
+ log_debug("MTD device %s: size=%lld erasesize=%d\n",
+ mtd_id, mtd->size, mtd->erasesize);
+ log_debug(" available address = 0x%llx..0x%llx\n",
+ first_addr, last_addr);
dev->mtd = mtd;
break;
case STM32PROG_RAM:
stm32prog_err("unknown device type = %d", dev->target);
return -ENODEV;
}
- pr_debug(" erase size = 0x%x\n", dev->erase_size);
- pr_debug(" full_update = %d\n", dev->full_update);
+ log_debug(" erase size = 0x%x\n", dev->erase_size);
+ log_debug(" full_update = %d\n", dev->full_update);
/* order partition list in offset order */
list_sort(NULL, &dev->part_list, &part_cmp);
part_id = 1;
- pr_debug("id : Opt Phase Name target.n dev.n addr size part_off part_size\n");
+ log_debug("id : Opt Phase Name target.n dev.n addr size part_off part_size\n");
list_for_each_entry(part, &dev->part_list, list) {
if (part->bin_nb > 1) {
if ((dev->target != STM32PROG_NAND &&
part->size = block_dev->lba * block_dev->blksz;
else
part->size = last_addr;
- pr_debug("-- : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx\n",
- part->option, part->id, part->name,
- part->part_type, part->bin_nb, part->target,
- part->dev_id, part->addr, part->size);
+ log_debug("-- : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx\n",
+ part->option, part->id, part->name,
+ part->part_type, part->bin_nb, part->target,
+ part->dev_id, part->addr, part->size);
continue;
}
if (part->part_id < 0) { /* boot hw partition for eMMC */
part->dev->erase_size);
return -EINVAL;
}
- pr_debug("%02d : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx",
- part->part_id, part->option, part->id, part->name,
- part->part_type, part->bin_nb, part->target,
- part->dev_id, part->addr, part->size);
+ log_debug("%02d : %1d %02x %14s %02d.%d %02d.%02d %08llx %08llx",
+ part->part_id, part->option, part->id, part->name,
+ part->part_type, part->bin_nb, part->target,
+ part->dev_id, part->addr, part->size);
part_addr = 0;
part_size = 0;
* created for full update
*/
if (dev->full_update || part->part_id < 0) {
- pr_debug("\n");
+ log_debug("\n");
continue;
}
struct disk_partition partinfo;
/* no partition for this device */
if (!part_found) {
- pr_debug("\n");
+ log_debug("\n");
continue;
}
- pr_debug(" %08llx %08llx\n", part_addr, part_size);
+ log_debug(" %08llx %08llx\n", part_addr, part_size);
if (part->addr != part_addr) {
stm32prog_err("%s (0x%x): Bad address for partition %d (%s) = 0x%llx <> 0x%llx expected",
continue;
if (offset + 100 > buflen) {
- pr_debug("\n%s: buffer too small, %s skippped",
- __func__, part->name);
+ log_debug("\n%s: buffer too small, %s skippped",
+ __func__, part->name);
continue;
}
if (offset) {
offset += snprintf(buf + offset, buflen - offset, "\"");
- pr_debug("\ncmd: %s\n", buf);
+ log_debug("\ncmd: %s\n", buf);
if (run_command(buf, 0)) {
stm32prog_err("GPT partitionning fail: %s",
buf);
#ifdef DEBUG
sprintf(buf, "gpt verify mmc %d", data->dev[i].dev_id);
- pr_debug("\ncmd: %s", buf);
+ log_debug("\ncmd: %s", buf);
if (run_command(buf, 0))
printf("fail !\n");
else
stm32prog_err("invalid target: %d", part->target);
return ret;
}
- pr_debug("dfu_alt_add(%s,%s,%s)\n", dfustr, devstr, buf);
+ log_debug("dfu_alt_add(%s,%s,%s)\n", dfustr, devstr, buf);
ret = dfu_alt_add(dfu, dfustr, devstr, buf);
- pr_debug("dfu_alt_add(%s,%s,%s) result %d\n",
- dfustr, devstr, buf, ret);
+ log_debug("dfu_alt_add(%s,%s,%s) result %d\n",
+ dfustr, devstr, buf, ret);
return ret;
}
sprintf(devstr, "%d", phase);
sprintf(buf, "@%s/0x%02x/1*%dBe", name, phase, size);
ret = dfu_alt_add(dfu, "virt", devstr, buf);
- pr_debug("dfu_alt_add(virt,%s,%s) result %d\n", devstr, buf, ret);
+ log_debug("dfu_alt_add(virt,%s,%s) result %d\n", devstr, buf, ret);
return ret;
}
sprintf(buf, "@FlashLayout/0x%02x/1*256Ke ram %x 40000",
PHASE_FLASHLAYOUT, STM32_DDR_BASE);
ret = dfu_alt_add(dfu, "ram", NULL, buf);
- pr_debug("dfu_alt_add(ram, NULL,%s) result %d\n", buf, ret);
+ log_debug("dfu_alt_add(ram, NULL,%s) result %d\n", buf, ret);
}
if (!ret)
int stm32prog_otp_write(struct stm32prog_data *data, u32 offset, u8 *buffer,
long *size)
{
- pr_debug("%s: %x %lx\n", __func__, offset, *size);
+ log_debug("%s: %x %lx\n", __func__, offset, *size);
if (!data->otp_part) {
data->otp_part = memalign(CONFIG_SYS_CACHELINE_SIZE, OTP_SIZE);
return -1;
}
- pr_debug("%s: %x %lx\n", __func__, offset, *size);
+ log_debug("%s: %x %lx\n", __func__, offset, *size);
/* alway read for first packet */
if (!offset) {
if (!data->otp_part)
memcpy(buffer, (void *)((u32)data->otp_part + offset), *size);
end_otp_read:
- pr_debug("%s: result %i\n", __func__, result);
+ log_debug("%s: result %i\n", __func__, result);
return result;
}
result = 0;
break;
default:
- pr_err("%s: OTP incorrect value (err = %ld)\n",
- __func__, res.a1);
+ log_err("%s: OTP incorrect value (err = %ld)\n",
+ __func__, res.a1);
result = -EINVAL;
break;
}
} else {
- pr_err("%s: Failed to exec svc=%x op=%x in secure mode (err = %ld)\n",
- __func__, STM32_SMC_BSEC, STM32_SMC_WRITE_ALL, res.a0);
+ log_err("%s: Failed to exec svc=%x op=%x in secure mode (err = %ld)\n",
+ __func__, STM32_SMC_BSEC, STM32_SMC_WRITE_ALL, res.a0);
result = -EINVAL;
}
free(data->otp_part);
data->otp_part = NULL;
- pr_debug("%s: result %i\n", __func__, result);
+ log_debug("%s: result %i\n", __func__, result);
return result;
}
int stm32prog_pmic_write(struct stm32prog_data *data, u32 offset, u8 *buffer,
long *size)
{
- pr_debug("%s: %x %lx\n", __func__, offset, *size);
+ log_debug("%s: %x %lx\n", __func__, offset, *size);
if (!offset)
memset(data->pmic_part, 0, PMIC_SIZE);
return -EOPNOTSUPP;
}
- pr_debug("%s: %x %lx\n", __func__, offset, *size);
+ log_debug("%s: %x %lx\n", __func__, offset, *size);
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_DRIVER_GET(stpmic1_nvm),
&dev);
memcpy(buffer, &data->pmic_part[offset], *size);
end_pmic_read:
- pr_debug("%s: result %i\n", __func__, result);
+ log_debug("%s: result %i\n", __func__, result);
return result;
}
if (!fsbl)
return -ENOMEM;
ret = dfu->read_medium(dfu, 0, fsbl, &size);
- pr_debug("%s read size=%lx ret=%d\n", __func__, size, ret);
+ log_debug("%s read size=%lx ret=%d\n", __func__, size, ret);
if (ret)
goto error;
offset += size;
/* write to the next erase block */
ret = dfu->write_medium(dfu, offset, fsbl, &size);
- pr_debug("%s copy at ofset=%lx size=%lx ret=%d",
- __func__, offset, size, ret);
+ log_debug("%s copy at ofset=%lx size=%lx ret=%d",
+ __func__, offset, size, ret);
if (ret)
goto error;
}
if (dfu->alt == stm32prog_data->cur_part->alt_id) {
dfu->offset = stm32prog_data->offset;
stm32prog_data->dfu_seq = 0;
- pr_debug("dfu offset = 0x%llx\n", dfu->offset);
+ log_debug("dfu offset = 0x%llx\n", dfu->offset);
}
}