From: zhangguijiang zhangguijiang@huawei.com
ascend inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/I4GVSG CVE: NA
-------------------
Struct mmc_host using variable private[0] to point the end of struct mmc_host, at deaf01a6 we modified struct mmc_host but ignored the role of private[0] and not put it to the end of struct mmc_host.
It will make mmc card probe failed, so we fix this problem, and now ascend hisi mmc card is able to probe success.
Signed-off-by: zhangguijiang zhangguijiang@huawei.com Reviewed-by: Ding Tianhong dingtianhong@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/mmc/core/sd.c | 38 +++----------------------------- drivers/mmc/host/dw_mmc_extern.h | 2 +- include/linux/mmc/host.h | 2 +- 3 files changed, 5 insertions(+), 37 deletions(-)
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 20ca371b9f874..8760b749292b8 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -1163,9 +1163,9 @@ static int _mmc_sd_suspend(struct mmc_host *host) err = mmc_deselect_cards(host);
if (!err) { - if (!(mmc_is_ascend_customized(host->parent))) + if (!mmc_is_ascend_customized(host->parent)) mmc_power_off(host); - else if (mmc_card_keep_power(host)) + else if (!mmc_card_keep_power(host)) mmc_power_off(host); mmc_card_set_suspended(host->card); } @@ -1269,42 +1269,10 @@ static int mmc_sd_runtime_resume(struct mmc_host *host) return 0; }
-#ifdef CONFIG_ASCEND_HISI_MMC -/*********************sd ops begin**********************/ -static int mmc_do_sd_reset(struct mmc_host *host) -{ - struct mmc_card *card = host->card; - - if (!host->bus_ops->power_restore) - return -EOPNOTSUPP; - - if (!card) - return -EINVAL; - - /* hw_reset for ip reset */ - if (host->ops->hw_reset) - host->ops->hw_reset(host); - - /* Only for K930/920 SD slow down clk*/ - if (host->ops->slowdown_clk) - host->ops->slowdown_clk(host, host->ios.timing); - - mmc_power_off(host); - mmc_set_clock(host, host->f_init); - /* Wait at least 200 ms */ - mmc_delay(200); - mmc_power_up(host, host->card->ocr); - (void)mmc_select_voltage(host, host->card->ocr); - - return host->bus_ops->power_restore(host); -} -#endif static int mmc_sd_hw_reset(struct mmc_host *host) { -#ifdef CONFIG_ASCEND_HISI_MMC if (mmc_is_ascend_customized(host->parent)) - return mmc_do_sd_reset(host); -#endif + return mmc_sd_reset(host); mmc_power_cycle(host, host->card->ocr); return mmc_sd_init_card(host, host->card->ocr, host->card); } diff --git a/drivers/mmc/host/dw_mmc_extern.h b/drivers/mmc/host/dw_mmc_extern.h index 04d8c23f39e9a..ab077b4955940 100644 --- a/drivers/mmc/host/dw_mmc_extern.h +++ b/drivers/mmc/host/dw_mmc_extern.h @@ -8,7 +8,7 @@
#include "dw_mmc.h"
-#ifdef CONFIG_MMC_DW_HI3XXX_MODULE +#if defined(CONFIG_MMC_DW_HI3XXX) || defined(CONFIG_MMC_DW_HI3XXX_MODULE) extern void dw_mci_reg_dump(struct dw_mci *host); extern void dw_mci_set_timeout(struct dw_mci *host); extern bool dw_mci_stop_abort_cmd(struct mmc_command *cmd); diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 78b4d0a813b71..fabc23d156242 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -542,13 +542,13 @@ struct mmc_host { bool cqe_enabled; bool cqe_on;
- unsigned long private[0] ____cacheline_aligned; #ifdef CONFIG_ASCEND_HISI_MMC const struct mmc_cmdq_host_ops *cmdq_ops; int sdio_present; unsigned int cmdq_slots; struct mmc_cmdq_context_info cmdq_ctx; #endif + unsigned long private[0] ____cacheline_aligned; };
struct device_node;