summaryrefslogtreecommitdiffstats
path: root/include/mci.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-05-22 09:21:45 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-05-30 12:18:27 +0200
commit4a4f2f20b8873224983ab9b78173f9bc0564fa33 (patch)
treee068357e683ffe4abc956016b9a45d33e099ddeb /include/mci.h
parent93b15783232cb3a866ec9253cb4284a812cc5fe8 (diff)
downloadbarebox-4a4f2f20b8873224983ab9b78173f9bc0564fa33.tar.gz
barebox-4a4f2f20b8873224983ab9b78173f9bc0564fa33.tar.xz
mci: Add support for MMC boot partitions
Some MMC cards support boot partitions. These are special regions on the MMC card intended to put a bootloader on. This patch adds support for these partitions, they are accessible as /dev/diskx.boot[0|1]. Additionally the partitions can be configured bootable using a device parameter. This can be used to mark the user area or one of the boot partitions as bootable. Since this feature is mostly seen on eMMC cards it is made optional to lower the size impact for boards which do not have eMMC. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/mci.h')
-rw-r--r--include/mci.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/include/mci.h b/include/mci.h
index eca48a52f4..173598655f 100644
--- a/include/mci.h
+++ b/include/mci.h
@@ -185,6 +185,8 @@
/*
* EXT_CSD field definitions
*/
+#define EXT_CSD_PART_CONFIG_ACC_MASK (0x7)
+#define EXT_CSD_PART_CONFIG_ACC_BOOT0 (0x1)
#define EXT_CSD_CMD_SET_NORMAL (1<<0)
#define EXT_CSD_CMD_SET_SECURE (1<<1)
@@ -306,10 +308,28 @@ struct mci_host {
int (*card_write_protected)(struct mci_host *);
};
+struct mci;
+
+#define MMC_NUM_BOOT_PARTITION 2
+#define MMC_NUM_GP_PARTITION 4
+#define MMC_NUM_PHY_PARTITION 6
+
+struct mci_part {
+ struct block_device blk; /**< the blockdevice for the card */
+ struct mci *mci;
+ uint64_t size; /* partition size (in bytes) */
+ unsigned int part_cfg; /* partition type */
+ char *name;
+ unsigned int area_type;
+#define MMC_BLK_DATA_AREA_MAIN (1<<0)
+#define MMC_BLK_DATA_AREA_BOOT (1<<1)
+#define MMC_BLK_DATA_AREA_GP (1<<2)
+#define MMC_BLK_DATA_AREA_RPMB (1<<3)
+};
+
/** MMC/SD and interface instance information */
struct mci {
struct mci_host *host; /**< the host for this card */
- struct block_device blk; /**< the blockdevice for the card */
struct device_d *mci_dev; /**< the device for our disk (mcix) */
unsigned version;
/** != 0 when a high capacity card is connected (OCR -> OCR_HCS) */
@@ -330,6 +350,15 @@ struct mci {
char *ext_csd;
int probe;
struct param_d *param_probe;
+ struct param_d *param_boot;
+ int bootpart;
+
+ struct mci_part part[MMC_NUM_PHY_PARTITION];
+ int nr_parts;
+ char *cdevname;
+
+ struct mci_part *part_curr;
+ u8 ext_csd_part_config;
};
int mci_register(struct mci_host*);