u-boot/drivers/block
Simon Glass e48eeb9ea3 dm: blk: Improve block device claiming
The intention with block devices is that the device number (devnum field
in its descriptor) matches the alias of its parent device. For example,
with:

	aliases {
		mmc0 = "/sdhci@700b0600";
		mmc1 = "/sdhci@700b0400";
	}

we expect that the block devices for mmc0 and mmc1 would have device
numbers of 0 and 1 respectively.

Unfortunately this does not currently always happen. If there is another
MMC device earlier in the driver model data structures its block device
will be created first. It will therefore get device number 0 and mmc0
will therefore miss out. In this case the MMC device will have sequence
number 0 but its block device will not.

To avoid this, allow a device to request a device number and bump any
existing device number that is using it. This all happens during the
binding phase so it is safe to change these numbers around. This allows
device numbers to match the aliases in all circumstances.

Add a test to verify the behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
2017-06-01 07:03:05 -06:00
..
ahci-uclass.c dm: Rename disk uclass to ahci 2016-05-17 09:54:43 -06:00
ahci.c dm: Add support for scsi/sata based devices 2016-12-20 09:15:27 +01:00
blk_legacy.c dm: blk: Add a legacy block interface 2016-05-17 09:54:43 -06:00
blk-uclass.c dm: blk: Improve block device claiming 2017-06-01 07:03:05 -06:00
blkcache.c drivers: block: add block device cache 2016-04-01 17:18:27 -04:00
dwc_ahci.c dm: core: Replace of_offset with accessor (part 2) 2017-06-01 07:03:04 -06:00
dwc_ahsata.c treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
dwc_ahsata.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
fsl_sata.c fsl/sata: correctly identify failed malloc 2017-04-18 10:29:24 -04:00
fsl_sata.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
ftide020.c Merge branch 'master' of git://git.denx.de/u-boot-nds32 2013-07-25 08:51:51 -04:00
ftide020.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
ide.c Kconfig: Add a CONFIG_IDE option 2017-05-22 12:45:27 -04:00
Kconfig Kconfig: Add a CONFIG_IDE option 2017-05-22 12:45:27 -04:00
libata.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
Makefile Kconfig: Add a CONFIG_IDE option 2017-05-22 12:45:27 -04:00
mvsata_ide.c Use correct spelling of "U-Boot" 2016-02-06 12:00:59 +01:00
mxc_ata.c Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
sandbox_scsi.c sandbox: Add dummy SCSI functions 2016-05-17 09:54:43 -06:00
sandbox.c dm: core: Add flags parameter to device_remove() 2017-04-04 20:15:10 -06:00
sata_ceva.c dm: Rename dev_addr..() functions 2017-06-01 07:03:01 -06:00
sata_dwc.c treewide: replace #include <asm/errno.h> with <linux/errno.h> 2016-09-23 17:55:42 -04:00
sata_dwc.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
sata_mv.c sata: sata_mv: Fix misaligned cache warnings 2016-12-05 13:53:42 +01:00
sata_sandbox.c sandbox: Add dummy SATA functions 2016-05-17 09:54:43 -06:00
sata_sil3114.c sata: implement reset_sata for dwc_ahsata 2014-11-24 11:59:59 +01:00
sata_sil3114.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
sata_sil.c Merge branch 'master' of git://www.denx.de/git/u-boot-imx 2014-11-24 12:02:12 -05:00
sata_sil.h Add GPL-2.0+ SPDX-License-Identifier to source files 2013-07-24 09:44:38 -04:00
scsi-uclass.c dm: Add support for scsi/sata based devices 2016-12-20 09:15:27 +01:00
sil680.c Kconfig: Add a CONFIG_IDE option 2017-05-22 12:45:27 -04:00
sym53c8xx.c drivers: squash lines for immediate return 2016-09-23 17:53:54 -04:00
systemace.c dm: systemace: Add driver-mode block-device support 2016-05-17 09:54:43 -06:00