[U-Boot] [PATCH v2 00/24] dm: mmc: Add driver-model block-device support to MMC

Simon Glass sjg at chromium.org
Sun May 1 21:52:21 CEST 2016


This series adds support for using CONFIG_BLK with MMC, such that it uses
the block interface correctly. The old interface in part.c is removed.

With driver model, when CONFIG_BLK is enabled, MMC devices must have a child
block device. A new mmc_bind() function takes care of this. It should be
called when new MMC devices are bound.

MMC support is added to sandbox along with a simple driver-model test.

Code size does unfortunately increase slightly in SPL. For example firefly
(Thumb 2) adds 128 bytes of code overall due to the new block driver table
support. There may be some potential after this series to rationalise the
common/spl/ implementations and reduce code size a little, but that remains
to be seen.

This series follows on from the previous series which refactored block
devices. It is available at u-boot-dm/blkb-working

Changes in v2:
- Rebase to master

Simon Glass (24):
  dm: blk: Fix allocation of block-device numbering
  dm: core: Allow device names to be freed automatically
  dm: blk: Free the block device name when unbound
  dm: mmc: Move mmc_switch_part() above its callers
  dm: mmc: Implement the select_hwpart() method
  dm: mmc: Add a function to obtain the block device
  dm: mmc: spl: Use the legacy block interface in SPL
  dm: mmc: Use the new select_hwpart() API
  dm: blk: Add functions to select a hardware partition
  dm: part: Use the legacy block driver for hardware partition support
  dm: part: Drop the block_drvr table
  dm: blk: Add a comment as to why the bdev member is needed
  dm: mmc: Set up the device pointer when using the MMC uclass
  dm: mmc: Move the device list into a separate file
  dm: blk: Use the correct error code for blk_get_device_by_str()
  dm: mmc: Adjust mmc_switch_part() to use a struct mmc
  dm: sandbox: Only enable the sandbox MMC driver when valid
  dm: mmc: Implement the MMC functions for block devices
  dm: mmc: Add a way to bind MMC devices with driver model
  dm: mmc: Add support for driver-model block devices
  dm: mmc: sandbox: Add an SD-card emulation
  dm: sandbox: mmc: Enable building MMC code for sandbox
  dm: mmc: test: Add tests for MMC
  Revert "Revert "dm: sandbox: Drop the pre-DM host implementation""

 cmd/mmc.c                     |  16 ++-
 common/env_mmc.c              |   4 +-
 common/spl/spl_mmc.c          |   2 +-
 configs/sandbox_defconfig     |   2 +
 disk/part.c                   |  81 +++---------
 drivers/Makefile              |   1 +
 drivers/block/blk-uclass.c    |  59 +++++++--
 drivers/block/sandbox.c       |  97 --------------
 drivers/core/device-remove.c  |   2 +
 drivers/core/device.c         |   6 +
 drivers/dfu/dfu_mmc.c         |  13 +-
 drivers/mmc/Kconfig           |  11 +-
 drivers/mmc/Makefile          |  12 +-
 drivers/mmc/mmc-uclass.c      | 106 ++++++++++++++++
 drivers/mmc/mmc.c             | 289 ++++++++++++++++++++++--------------------
 drivers/mmc/mmc_legacy.c      | 108 ++++++++++++++++
 drivers/mmc/mmc_private.h     |  33 ++++-
 drivers/mmc/mmc_write.c       |  18 ++-
 drivers/mmc/omap_hsmmc.c      |   1 +
 drivers/mmc/pic32_sdhci.c     |   7 +-
 drivers/mmc/rockchip_dw_mmc.c |   1 +
 drivers/mmc/sandbox_mmc.c     | 134 +++++++++++++++++++-
 drivers/mmc/socfpga_dw_mmc.c  |   1 +
 drivers/mmc/uniphier-sd.c     |   1 +
 drivers/mmc/zynq_sdhci.c      |   1 +
 include/blk.h                 |  35 +++++
 include/configs/sandbox.h     |   2 +
 include/dm/device.h           |  16 +++
 include/mmc.h                 |  38 +++++-
 include/part.h                |  18 ---
 lib/efi_loader/efi_disk.c     |  27 ++--
 test/dm/blk.c                 |   4 +-
 test/dm/mmc.c                 |  19 +++
 33 files changed, 799 insertions(+), 366 deletions(-)
 create mode 100644 drivers/mmc/mmc_legacy.c

-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list