[U-Boot] [U-BOOT] [PATCH] mmc: enable switch partition function
Lei Wen
adrian.wenl at gmail.com
Wed Apr 13 05:57:21 CEST 2011
Hi Wolfgang,
On Wed, Apr 13, 2011 at 3:31 AM, Wolfgang Denk <wd at denx.de> wrote:
> Dear Lei Wen,
>
> In message <AANLkTikH_5rXgFsWbNRnBQtB6WFjT=2K8pd8CBXaKcCQ at 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.
dev subcommand to act as "sw_part" in my first patch?
>
> 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.
>
How about this solution?
Like if want to access the dev 0 and hardware partition 1, we could use the
command as "mmc read 0:1 ***".
If not pass the :[part] parameter to the dev number, like "mmc read 0 ***",
that would means the partition is 0 by default. For this case, if that device
has no capabilty of multi hardware partition, it would act like normal, or
switch to the default 0 before any further action.
Best regads,
Lei
More information about the U-Boot
mailing list