From: Wolfgang Denk Date: Tue, 12 Apr 2011 21:31:23 +0200 Subject: [U-Boot] [U-BOOT] [PATCH] mmc: enable switch partition function In-Reply-To: References: <1296463665-26551-1-git-send-email-leiwen@marvell.com> <20110208142758.1945014B9A0D@gemini.denx.de> <20110208151331.DE1E614B9A0D@gemini.denx.de> Message-ID: <20110412193123.05E1214F02E@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear Lei Wen, In message 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 -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de No journaling file system can recover your data if the disk dies. - Steve Rago in