Recent additions of the MMC and DISK uclasses have indicated that it is time to look at adding a uclass for block devices. This series does this and includes a few clean-ups to the partition code also.
A block device is typically a child device of its storage parent. For example an MMC device will have a block-device child. A USB storage device may have multiple block-device children, one for each LUN. With this series only USB storage and 'host' are converted over to use the new support. Several more remain, including SCSI, IDE and MMC. Each of these should get its own uclass. The uclass implements only a few basic features. A few tests are added to check that things work as expected. The code size impact of switching to driver model for block devices is small. One benefit is that it becomes possible to enumerate all block devices, regardless of their type. Changes in v2: - Fix use of pci_mem instead of pci_prefetch - Remove 0x prefix for addresses - Add a missing word 'is' to the commit message - Rename the enum to 'if_type' instead of 'if_type_t' - Rename to blk_get_device_by_str() - Rename to blk_get_device_by_str() - Fix 'by' which should be 'but' in the commit message - Sort the CONFIG_..._PARTITION options in the header file - Reorder the linker list so that EFI comes before DOS, and add a comment - Bring the 'case 0' from a later patch into this one - Fix rebase error in cmd/cbfs.c - Use snprintf() to avoid overflow - Rename to blk_get_device_by_str() - Add new patch to rename test_part_xx() and print_part_xx() Simon Glass (32): dm: Drop the block_dev_desc_t typedef dm: pci: Break out the common region display code dm: part: Correct a sandbox build warning dm: fdtdec: Correct a sandbox build warning dm: part: Drop the common.h header dm: Add a new header for block devices dm: blk: Convert interface type to an enum dm: blk: Add comments to a few functions dm: blk: Rename get_dev() to blk_get_dev() dm: blk: Rename get_device() to blk_get_device_by_str() dm: blk: Rename get_device_and_partition() dm: part: Add a cast to avoid a compiler warning dm: sandbox: Enable all partition types dm: part: Convert partition API use to linker lists dm: part: Rename some partition functions dm: cbfs: Fix handling of invalid type dm: sandbox: Enable cbfs and cramfs dm: block: Rename device number member dev to devnum dm: block: Adjust device calls to go through helpers function dm: usb: Avoid exceeding available array size for storage devices dm: usb: Tidy up storage code ready for driver model conversion dm: blk: Add a block-device uclass dm: sandbox: Prepare block driver for driver-model conversion dm: sandbox: Add driver-model block-device support for sandbox dm: usb: Convert USB storage to use driver-model for block devs dm: usb: Unbind old block devices when shutting down USB dm: sandbox: Switch over to use DM for block devices dm: sandbox: Drop the pre-DM host implementation dm: usb: Clean up USB after each test dm: blk: Add tests for block devices part: Rename test_part_xx() and print_part_xx() Drop CONFIG_CRAMFS_CMDLINE api/api.c | 2 +- api/api_storage.c | 26 +-- board/cm5200/fwupdate.c | 4 +- board/mpl/pip405/README | 4 +- board/sunxi/board.c | 4 +- cmd/cbfs.c | 5 +- cmd/cramfs.c | 5 - cmd/disk.c | 12 +- cmd/fat.c | 12 +- cmd/gpt.c | 10 +- cmd/host.c | 13 +- cmd/ide.c | 44 +++--- cmd/mmc.c | 4 +- cmd/mmc_spi.c | 4 +- cmd/part.c | 24 +-- cmd/read.c | 10 +- cmd/reiser.c | 12 +- cmd/sata.c | 22 +-- cmd/scsi.c | 24 +-- cmd/unzip.c | 4 +- cmd/usb.c | 12 +- cmd/usb_mass_storage.c | 10 +- cmd/zfs.c | 10 +- common/env_fat.c | 12 +- common/fb_mmc.c | 33 ++-- common/spl/spl_ext.c | 12 +- common/spl/spl_fat.c | 8 +- common/spl/spl_mmc.c | 2 +- common/spl/spl_sata.c | 2 +- common/spl/spl_usb.c | 2 +- common/usb_storage.c | 276 +++++++++++++++++++++++--------- configs/sandbox_defconfig | 1 + disk/part.c | 230 +++++++++------------------ disk/part_amiga.c | 47 +++--- disk/part_dos.c | 66 ++++---- disk/part_efi.c | 101 ++++++------ disk/part_iso.c | 72 +++++---- disk/part_mac.c | 58 ++++--- drivers/block/Kconfig | 11 ++ drivers/block/Makefile | 2 + drivers/block/blk-uclass.c | 175 ++++++++++++++++++++ drivers/block/dwc_ahsata.c | 4 +- drivers/block/pata_bfin.c | 2 +- drivers/block/sandbox.c | 170 +++++++++++--------- drivers/block/systemace.c | 12 +- drivers/dfu/dfu_mmc.c | 4 +- drivers/mmc/arm_pl180_mmci.c | 2 +- drivers/mmc/mmc.c | 14 +- drivers/mmc/mmc_private.h | 8 +- drivers/mmc/mmc_write.c | 8 +- drivers/mmc/mxsmmc.c | 24 +-- drivers/mmc/omap_hsmmc.c | 4 +- drivers/mmc/sdhci.c | 2 +- drivers/pci/pci_auto_common.c | 51 ++---- drivers/usb/host/usb-uclass.c | 6 +- fs/ext4/dev.c | 54 +++---- fs/ext4/ext4_common.c | 27 ++-- fs/ext4/ext4fs.c | 2 +- fs/fat/fat.c | 18 +-- fs/fat/fat_write.c | 5 +- fs/fs.c | 8 +- fs/reiserfs/dev.c | 33 ++-- fs/sandbox/sandboxfs.c | 4 +- fs/ubifs/ubifs.c | 4 +- fs/zfs/dev.c | 35 ++-- fs/zfs/zfs.c | 2 +- include/blk.h | 248 +++++++++++++++++++++++++++++ include/common.h | 2 +- include/configs/UCP1020.h | 1 - include/configs/km/keymile-common.h | 1 - include/configs/sandbox.h | 7 +- include/dm/uclass-id.h | 1 + include/ext4fs.h | 6 +- include/fat.h | 4 +- include/ide.h | 18 +-- include/mmc.h | 2 +- include/part.h | 308 ++++++++++++++++++++++-------------- include/reiserfs.h | 2 +- include/sandboxblockdev.h | 4 +- include/sandboxfs.h | 2 +- include/sata.h | 2 +- include/spl.h | 10 +- include/systemace.h | 2 +- include/ubifs_uboot.h | 2 +- include/usb.h | 2 +- include/usb_mass_storage.h | 2 +- include/zfs_common.h | 4 +- lib/fdtdec.c | 5 +- lib/gunzip.c | 2 +- test/dm/Makefile | 1 + test/dm/blk.c | 96 +++++++++++ test/dm/usb.c | 8 +- 92 files changed, 1667 insertions(+), 965 deletions(-) create mode 100644 drivers/block/blk-uclass.c create mode 100644 include/blk.h create mode 100644 test/dm/blk.c -- 2.7.0.rc3.207.g0ac5344 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot