Now, index of mmcblk is allocated in accordance with probing time.
If want to use the mmcblk1 for some device, it can use alias.
aliases {
mmc0 = &mmc0; /* mmcblk0 for eMMC */
mmc1 = &mmc2; /* mmcblk1 for SD */
mmc2 = &mmc1; /* mmcblk2 for SDIO*/
};
If there are no corresponding values, it might be allocated with
existing scheme.
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
[sw0312.kim: port to v4.14
- apply to host index instead of name_idx because host index is used in this version
]
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Change-Id: I44673d62e546ea0aeedd9cac314dbfd31fdcce66
- wakeup-source: Enables wake up of host system on SDIO IRQ assertion
(Legacy property supported: "enable-sdio-wakeup")
+Aliases (Optional):
+- If you want to use the fixed index for block device like mmcblkX, should be
+represented in the aliases node using following format "mmc(X)".
+(X is an unique number for the alias.)
+
MMC power
---------
interrupt-names = "host-wake";
};
};
+
+Example with aliases nodes:
+
+aliases {
+ mmc0 = &mmc0; /* Fixed to mmcblk0 for &mmc0 */
+ mmc1 = &mmc2; /* Fixed to mmcblk1 for &mmc2 */
+};
struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
{
int err;
+ int idx = 0;
struct mmc_host *host;
host = kzalloc(sizeof(struct mmc_host) + extra, GFP_KERNEL);
/* scanning will be enabled when we're ready */
host->rescan_disable = 1;
- err = ida_simple_get(&mmc_host_ida, 0, 0, GFP_KERNEL);
+ if (dev->of_node)
+ idx = of_alias_get_id(dev->of_node, "mmc");
+
+ err = ida_simple_get(&mmc_host_ida, (idx < 0) ? 0 : idx, 0, GFP_KERNEL);
if (err < 0) {
kfree(host);
return NULL;