emmc: fixed bug 'failed to check sd card partition'

BUG: if CONFIG_EMMC_RK is defined but storage memory is FLASH,
     it will fail to check sd card partition

     emmc failed to load ==>
     sdcard's disk->first_minor = 0 ==>
     sdcard's msdos_partition return 0

WARN: if disk's flags: 2(include/linux/genhd.h) is defined in new kernel version,
      it maybe a problem!
This commit is contained in:
kfx
2013-11-02 14:45:25 +08:00
parent 4dcec1ce90
commit d0a66796aa
3 changed files with 7 additions and 3 deletions

View File

@@ -1756,6 +1756,10 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,
md->disk->driverfs_dev = parent;
set_disk_ro(md->disk, md->read_only || default_ro);
md->disk->flags = GENHD_FL_EXT_DEVT;
#ifdef CONFIG_EMMC_RK
if(HOST_IS_EMMC(card->host))
md->disk->flags |= 2; /* 2 is unused flags in 'include/linux/genhd.h' */
#endif
/*
* As discussed on lkml, GENHD_FL_REMOVABLE should:

View File

@@ -441,8 +441,8 @@ int msdos_partition(struct parsed_partitions *state)
struct fat_boot_sector *fb;
int slot;
#ifdef CONFIG_EMMC_RK
//if card is emmc, msdos_partition return false
if(state->bdev->bd_disk->major == MMC_BLOCK_MAJOR &&state->bdev->bd_disk->first_minor == 0)
//if card is emmc(flag:2 is set in 'drivers/mmc/card/block.c'), return false
if(state->bdev->bd_disk->flags & 2)
return 0;
#endif

View File

@@ -337,7 +337,7 @@ int mtdpart_partition(struct parsed_partitions *state)
if(n < SECTOR_1G)
return 0;
if (state->bdev->bd_disk->major != MMC_BLOCK_MAJOR || state->bdev->bd_disk->first_minor != 0)
if (!(state->bdev->bd_disk->flags & 2))
return 0;
cmdline = strstr(saved_command_line, "mtdparts=") + 9;