Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3417de3d authored by Sarthak Garg's avatar Sarthak Garg
Browse files

mmc: core: Update mmc_scale_high logic properly for HS400 mode



Current mmc_scale_high logic don't work well for HS400 mode.
Infact we are ending up selecting HS200 mode instead of HS400 mode.

Update mmc_scale_high logic properly for HS400 mode.

Change-Id: Ic4960268866c35dd94b5ea9b41a813fc36ba8a94
Signed-off-by: default avatarSarthak Garg <sartgarg@codeaurora.org>
parent 73db1046
Loading
Loading
Loading
Loading
+12 −29
Original line number Diff line number Diff line
@@ -1610,45 +1610,28 @@ static int mmc_scale_high(struct mmc_host *host)
		mmc_set_clock(host, MMC_HIGH_26_MAX_DTR);
	}

	if (!host->card->ext_csd.strobe_support) {
		if (!(host->card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS200)) {
			pr_err("%s: %s: card does not support HS200\n",
				mmc_hostname(host), __func__);
			WARN_ON(1);
			return -EPERM;
		}

		err = mmc_select_hs200(host->card);
	mmc_set_initial_state(host);
	err = mmc_select_timing(host->card);
	if (err) {
			pr_err("%s: %s: selecting HS200 failed (%d)\n",
		pr_err("%s: %s: select hs400 failed (%d)\n",
			mmc_hostname(host), __func__, err);
		return err;
	}

		mmc_set_bus_speed(host->card);

	if (mmc_card_hs200(host->card)) {
		err = mmc_hs200_tuning(host->card);
		if (err) {
			pr_err("%s: %s: hs200 tuning failed (%d)\n",
				mmc_hostname(host), __func__, err);
			return err;
		}

		if (!(host->card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400)) {
			pr_debug("%s: card does not support HS400\n",
				mmc_hostname(host));
			return 0;
		}
	}

	mmc_set_initial_state(host);
	err = mmc_select_timing(host->card);
		err = mmc_select_hs400(host->card);
		if (err) {
		pr_err("%s: %s: select hs400 failed (%d)\n",
			pr_err("%s: %s: Select hs400 failed (%d)\n",
				mmc_hostname(host), __func__, err);
			return err;
		}

	}
	return 0;
}