From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 14 Feb 2016 19:16:29 -0700 Subject: [U-Boot] [PATCH 00/30] dm: Add driver-model support for block drivers Message-ID: <1455502619-16093-1-git-send-email-sjg@chromium.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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. Simon Glass (30): 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_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 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/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 | 33 +++-- disk/part_dos.c | 66 +++++---- disk/part_efi.c | 96 ++++++------- 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/sandbox.h | 8 +- 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 | 306 +++++++++++++++++++++++++----------------- 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 +- 89 files changed, 1655 insertions(+), 950 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