Commit 6186d06c authored by Wolfram Sang's avatar Wolfram Sang Committed by Ulf Hansson

mmc: parse new binding for eMMC fixed driver type

Parse the new binding and store it in the host struct after doing some
sanity checks. The code is designed to support fixed SD driver type if
we ever need that.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: default avatarSimon Horman <horms+renesas@verge.net.au>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent f7834cbd
...@@ -179,7 +179,7 @@ static void mmc_retune_timer(unsigned long data) ...@@ -179,7 +179,7 @@ static void mmc_retune_timer(unsigned long data)
int mmc_of_parse(struct mmc_host *host) int mmc_of_parse(struct mmc_host *host)
{ {
struct device *dev = host->parent; struct device *dev = host->parent;
u32 bus_width; u32 bus_width, drv_type;
int ret; int ret;
bool cd_cap_invert, cd_gpio_invert = false; bool cd_cap_invert, cd_gpio_invert = false;
bool ro_cap_invert, ro_gpio_invert = false; bool ro_cap_invert, ro_gpio_invert = false;
...@@ -321,6 +321,15 @@ int mmc_of_parse(struct mmc_host *host) ...@@ -321,6 +321,15 @@ int mmc_of_parse(struct mmc_host *host)
if (device_property_read_bool(dev, "no-mmc")) if (device_property_read_bool(dev, "no-mmc"))
host->caps2 |= MMC_CAP2_NO_MMC; host->caps2 |= MMC_CAP2_NO_MMC;
/* Must be after "non-removable" check */
if (device_property_read_u32(dev, "fixed-emmc-driver-type", &drv_type) == 0) {
if (host->caps & MMC_CAP_NONREMOVABLE)
host->fixed_drv_type = drv_type;
else
dev_err(host->parent,
"can't use fixed driver type, media is removable\n");
}
host->dsr_req = !device_property_read_u32(dev, "dsr", &host->dsr); host->dsr_req = !device_property_read_u32(dev, "dsr", &host->dsr);
if (host->dsr_req && (host->dsr & ~0xffff)) { if (host->dsr_req && (host->dsr & ~0xffff)) {
dev_err(host->parent, dev_err(host->parent,
...@@ -393,6 +402,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev) ...@@ -393,6 +402,8 @@ struct mmc_host *mmc_alloc_host(int extra, struct device *dev)
host->max_blk_size = 512; host->max_blk_size = 512;
host->max_blk_count = PAGE_SIZE / 512; host->max_blk_count = PAGE_SIZE / 512;
host->fixed_drv_type = -EINVAL;
return host; return host;
} }
......
...@@ -1291,13 +1291,18 @@ int mmc_hs400_to_hs200(struct mmc_card *card) ...@@ -1291,13 +1291,18 @@ int mmc_hs400_to_hs200(struct mmc_card *card)
static void mmc_select_driver_type(struct mmc_card *card) static void mmc_select_driver_type(struct mmc_card *card)
{ {
int card_drv_type, drive_strength, drv_type; int card_drv_type, drive_strength, drv_type;
int fixed_drv_type = card->host->fixed_drv_type;
card_drv_type = card->ext_csd.raw_driver_strength | card_drv_type = card->ext_csd.raw_driver_strength |
mmc_driver_type_mask(0); mmc_driver_type_mask(0);
drive_strength = mmc_select_drive_strength(card, if (fixed_drv_type >= 0)
card->ext_csd.hs200_max_dtr, drive_strength = card_drv_type & mmc_driver_type_mask(fixed_drv_type)
card_drv_type, &drv_type); ? fixed_drv_type : 0;
else
drive_strength = mmc_select_drive_strength(card,
card->ext_csd.hs200_max_dtr,
card_drv_type, &drv_type);
card->drive_strength = drive_strength; card->drive_strength = drive_strength;
......
...@@ -354,6 +354,8 @@ struct mmc_host { ...@@ -354,6 +354,8 @@ struct mmc_host {
#define MMC_CAP2_CQE (1 << 23) /* Has eMMC command queue engine */ #define MMC_CAP2_CQE (1 << 23) /* Has eMMC command queue engine */
#define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */ #define MMC_CAP2_CQE_DCMD (1 << 24) /* CQE can issue a direct command */
int fixed_drv_type; /* fixed driver type for non-removable media */
mmc_pm_flag_t pm_caps; /* supported pm features */ mmc_pm_flag_t pm_caps; /* supported pm features */
/* host specific block data */ /* host specific block data */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment