diff options
author | Tom Rini <trini@konsulko.com> | 2021-08-02 08:53:58 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2021-08-02 08:53:58 -0400 |
commit | 99bb5f248ade371ee4713e0ef51401708ecbb13c (patch) | |
tree | 2e87b5480c87447a3df51db6aaab5e3e5ea9f401 /drivers/mmc/rpmb.c | |
parent | 72ffb41a873722993d89c02bae4743a8ad6f16f9 (diff) | |
parent | d890f23406c00e3af5c63d76a9991e2e79d84096 (diff) |
Merge tag 'mmc-2021-7-30' of https://source.denx.de/u-boot/custodians/u-boot-mmc
pl180_mmci update and cleanup
fix rpmb routing memory alignment
Diffstat (limited to 'drivers/mmc/rpmb.c')
-rw-r--r-- | drivers/mmc/rpmb.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/mmc/rpmb.c b/drivers/mmc/rpmb.c index ea7e506666..b68d98573c 100644 --- a/drivers/mmc/rpmb.c +++ b/drivers/mmc/rpmb.c @@ -480,10 +480,24 @@ int mmc_rpmb_route_frames(struct mmc *mmc, void *req, unsigned long reqlen, * and possibly just delay an eventual error which will be harder * to track down. */ + void *rpmb_data = NULL; + int ret; if (reqlen % sizeof(struct s_rpmb) || rsplen % sizeof(struct s_rpmb)) return -EINVAL; - return rpmb_route_frames(mmc, req, reqlen / sizeof(struct s_rpmb), - rsp, rsplen / sizeof(struct s_rpmb)); + if (!IS_ALIGNED((uintptr_t)req, ARCH_DMA_MINALIGN)) { + /* Memory alignment is required by MMC driver */ + rpmb_data = malloc(reqlen); + if (!rpmb_data) + return -ENOMEM; + + memcpy(rpmb_data, req, reqlen); + req = rpmb_data; + } + + ret = rpmb_route_frames(mmc, req, reqlen / sizeof(struct s_rpmb), + rsp, rsplen / sizeof(struct s_rpmb)); + free(rpmb_data); + return ret; } |