
Dear Lei Wen,
In message AANLkTikH_5rXgFsWbNRnBQtB6WFjT=2K8pd8CBXaKcCQ@mail.gmail.com you wrote:
Further refine this idea, don't need to call mmc_register multi-times. For the purpose is to switch partition when needed, we really do want to one real device. So I propose a new solution as:
Assume there is two sd/mmc controller on the board, named as mmc0&mmc1. The mmc0 attach with a sd card, and mmc1 attach with a emmc that has partition supported. Then we would have mmc(2, 3, 4, 5, 6, 7, 8) faked device map to mmc0 , mmc(9, 10, 11, 12, 13, 14, 15) map to mmc1.
Give the command as "mmc read 9 0x1000000 0 0x10", uboot would get the real device num by 9/7, while hardware part num is (9-1-7*real_dev_num) that is 1. So we need to make mmc1 send the switch part 1 command to the emmc, then perform the read operation.
If we want to run "mmc read 5 0x10000 0x10 0x5", the sd attach on mmc0 has no hardware partition suppport, it would simply refuse to execute that command. Or if we want to be more gracefully handled, we could let the read 5 perform like the read 0 command.
This is ugly and error prone.
Why don't you follow the existing examples from other storage devices, where we have a "dev" subcommand that allows to select one of the existing devices as "active" device? Similarly, you could here select an active device/partition pair.
This makes the access commands easier, and the user has much less problems to figure out which number he has to use to specify the - wrong - partition.
Best regards,
Wolfgang Denk