@@ -337,6 +337,22 @@ int mmc_bdev_to_part_type(struct block_device *bdev)
return md->part_type;
}
+int mmc_bdev_to_area_type(struct block_device *bdev)
+{
+ struct mmc_blk_data *md;
+ struct mmc_card *card;
+
+ card = mmc_bdev_to_card(bdev);
+ if (!card)
+ return -EINVAL;
+
+ md = mmc_blk_get(bdev->bd_disk);
+ if (!md)
+ return -EINVAL;
+
+ return md->area_type;
+}
+
static int mmc_blk_open(struct block_device *bdev, fmode_t mode)
{
struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk);
@@ -10,5 +10,6 @@ struct mmc_card;
struct mmc_card *mmc_bdev_to_card(struct block_device *bdev);
int mmc_bdev_to_part_type(struct block_device *bdev);
+int mmc_bdev_to_area_type(struct block_device *bdev);
#endif /* LINUX_MMC_BLOCK_DEVICE_H */
NVIDIA Tegra Partition Table parser needs to know eMMC partition type in order to validate and parse partition table properly. This patch adds new mmc_bdev_to_area_type() helper which takes block device for the input and returns a corresponding MMC card partition type. This allows tegra-partition parser to distinguish boot eMMC partition from the main eMMC partition. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> --- drivers/mmc/core/block.c | 16 ++++++++++++++++ include/linux/mmc/blkdev.h | 1 + 2 files changed, 17 insertions(+)