dm: blk: Add udevice functions
authorSimon Glass <sjg@chromium.org>
Fri, 21 Oct 2022 00:22:54 +0000 (18:22 -0600)
committerTom Rini <trini@konsulko.com>
Mon, 31 Oct 2022 15:02:44 +0000 (11:02 -0400)
commit606b926f9d76eaab11be2d95cfd7734644e1627c
tree513867ec3914aeeee981ac980eec71edb51c47d8
parentb55afa0c0e6dcb185ee527a6c37941bfde04ffd1
dm: blk: Add udevice functions

At present we have functions called blk_dread(), etc., which take a
struct blk_desc * to refer to the block device. Add some functions which
use udevice instead, since this is more in keeping with how driver model
is supposed to work.

Update one of the tests to use this.

Note that it would be nice to update the functions in disk-uclass.c to use
these new functions. However they are not quite the same. For example,
disk_blk_read() adds the partition offset to 'start' when calling the
cache read/fill functions, but does not with part_blk_read(), which does
the addition itself. So as designed the code is duplicated.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/block/blk-uclass.c
include/blk.h
test/dm/usb.c