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

Commit e72bc718 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "mmc: core: Simplify by adding mmc_execute_tuning()"

parents 75e58124 4654d9ee
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -2232,6 +2232,30 @@ void mmc_set_ungated(struct mmc_host *host)
}
#endif

int mmc_execute_tuning(struct mmc_card *card)
{
	struct mmc_host *host = card->host;
	u32 opcode;
	int err;

	if (!host->ops->execute_tuning)
		return 0;

	if (mmc_card_mmc(card))
		opcode = MMC_SEND_TUNING_BLOCK_HS200;
	else
		opcode = MMC_SEND_TUNING_BLOCK;

	mmc_host_clk_hold(host);
	err = host->ops->execute_tuning(host, opcode);
	mmc_host_clk_release(host);

	if (err)
		pr_err("%s: tuning execution failed\n", mmc_hostname(host));

	return err;
}

/*
 * Change the bus mode (open drain/push-pull) of a host.
 */
+2 −0
Original line number Diff line number Diff line
@@ -75,6 +75,8 @@ void mmc_remove_card_debugfs(struct mmc_card *card);

void mmc_init_context_info(struct mmc_host *host);

int mmc_execute_tuning(struct mmc_card *card);

extern bool mmc_can_scale_clk(struct mmc_host *host);
extern int mmc_init_clk_scaling(struct mmc_host *host);
extern int mmc_suspend_clk_scaling(struct mmc_host *host);
+1 −13
Original line number Diff line number Diff line
@@ -1395,7 +1395,6 @@ EXPORT_SYMBOL(tuning_blk_pattern_8bit);
static int mmc_hs200_tuning(struct mmc_card *card)
{
	struct mmc_host *host = card->host;
	int err = 0;

	/*
	 * Timing should be adjusted to the HS400 target
@@ -1405,18 +1404,7 @@ static int mmc_hs200_tuning(struct mmc_card *card)
	    host->ios.bus_width == MMC_BUS_WIDTH_8)
		mmc_set_timing(host, MMC_TIMING_MMC_HS400);

	if (host->ops->execute_tuning) {
		mmc_host_clk_hold(host);
		err = host->ops->execute_tuning(host,
				MMC_SEND_TUNING_BLOCK_HS200);
		mmc_host_clk_release(host);

		if (err)
			pr_warn("%s: tuning execution failed\n",
				mmc_hostname(host));
	}

	return err;
	return mmc_execute_tuning(card);
}

static int mmc_select_cmdq(struct mmc_card *card)
+4 −9
Original line number Diff line number Diff line
@@ -730,15 +730,10 @@ static int mmc_sd_init_uhs_card(struct mmc_card *card)
	 * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
	 * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
	 */
	if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning &&
	if (!mmc_host_is_spi(card->host) &&
	    (card->sd_bus_speed == UHS_SDR50_BUS_SPEED ||
			 card->sd_bus_speed == UHS_SDR104_BUS_SPEED)) {
		mmc_host_clk_hold(card->host);
		err = card->host->ops->execute_tuning(card->host,
						      MMC_SEND_TUNING_BLOCK);
		mmc_host_clk_release(card->host);
	}

	     card->sd_bus_speed == UHS_SDR104_BUS_SPEED))
		err = mmc_execute_tuning(card);
out:
	kfree(status);

+4 −10
Original line number Diff line number Diff line
@@ -643,17 +643,11 @@ static int mmc_sdio_init_uhs_card(struct mmc_card *card)
	 * SPI mode doesn't define CMD19 and tuning is only valid for SDR50 and
	 * SDR104 mode SD-cards. Note that tuning is mandatory for SDR104.
	 */
	if (!mmc_host_is_spi(card->host) && card->host->ops->execute_tuning &&
	if (!mmc_host_is_spi(card->host) &&
	    ((card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR50) ||
			 (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104))) {
		mmc_host_clk_hold(card->host);
		err = card->host->ops->execute_tuning(card->host,
						      MMC_SEND_TUNING_BLOCK);
		mmc_host_clk_release(card->host);
	}

	     (card->sw_caps.sd3_bus_mode & SD_MODE_UHS_SDR104)))
		err = mmc_execute_tuning(card);
out:

	return err;
}