diff options
author | Bin Meng <bmeng@tinylab.org> | 2023-09-26 16:43:39 +0800 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-10 16:25:48 -0400 |
commit | cf83ff3452ac76ebe882136a7722bf73ea737d3d (patch) | |
tree | 04127225f3a8f3ca442a81af81cb7f581e9c8d99 | |
parent | 42411e068da2ca16aeb1e80cb89cd5cfde98ada8 (diff) |
blk: blkmap: Support mapping to device of any block size
At present if a device to map has a block size other than 512,
the blkmap map process just fails. There is no reason why we
can't just use the block size of the mapped device.
Signed-off-by: Bin Meng <bmeng@tinylab.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/block/blkmap.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c index f6acfa89276..149a4cac3ea 100644 --- a/drivers/block/blkmap.c +++ b/drivers/block/blkmap.c @@ -171,11 +171,11 @@ int blkmap_map_linear(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, bd = dev_get_uclass_plat(bm->blk); lbd = dev_get_uclass_plat(lblk); - if (lbd->blksz != bd->blksz) - /* We could support block size translation, but we - * don't yet. - */ - return -EINVAL; + if (lbd->blksz != bd->blksz) { + /* update to match the mapped device */ + bd->blksz = lbd->blksz; + bd->log2blksz = LOG2(bd->blksz); + } linear = malloc(sizeof(*linear)); if (!linear) |