Re: [PATCH V6 06/24] mmc: core: Support UHS-II card control and access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13/12/22 11:00, Victor Shih wrote:
> Embed UHS-II access/control functionality into the MMC request
> processing flow.
> 
> Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> Signed-off-by: Jason Lai <jason.lai@xxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Victor Shih <victor.shih@xxxxxxxxxxxxxxxxxxx>
> ---
>  drivers/mmc/core/block.c   |    6 +-
>  drivers/mmc/core/core.c    |   20 +
>  drivers/mmc/core/mmc_ops.c |   25 +-
>  drivers/mmc/core/mmc_ops.h |    1 +
>  drivers/mmc/core/sd.c      |   11 +-
>  drivers/mmc/core/sd.h      |    3 +
>  drivers/mmc/core/sd_ops.c  |   13 +
>  drivers/mmc/core/sd_ops.h  |    3 +
>  drivers/mmc/core/sd_uhs2.c | 1171 +++++++++++++++++++++++++++++++++++-
>  9 files changed, 1206 insertions(+), 47 deletions(-)
> 

<SNIP>

> diff --git a/drivers/mmc/core/sd_uhs2.c b/drivers/mmc/core/sd_uhs2.c
> index 800957f74632..a79eb08ec540 100644
> --- a/drivers/mmc/core/sd_uhs2.c
> +++ b/drivers/mmc/core/sd_uhs2.c

<SNIP>

> +/*
> + * Mask off any voltages we don't support and select
> + * the lowest voltage
> + */
> +u32 sd_uhs2_select_voltage(struct mmc_host *host, u32 ocr)
> +{
> +	int bit;
> +	int err;
> +
> +	/*
> +	 * Sanity check the voltages that the card claims to
> +	 * support.
> +	 */
> +	if (ocr & 0x7F) {
> +		dev_warn(mmc_dev(host), "card claims to support voltages below defined range\n");
> +		ocr &= ~0x7F;
> +	}
> +
> +	ocr &= host->ocr_avail;
> +	if (!ocr) {
> +		dev_warn(mmc_dev(host), "no support for card's volts\n");
> +		return 0;
> +	}
> +
> +	if (host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) {
> +		bit = ffs(ocr) - 1;
> +		ocr &= 3 << bit;
> +		/* Power cycle */
> +		err = sd_uhs2_power_off(host);
> +		if (err)
> +			return 0;
> +		err = sd_uhs2_reinit(host);

This looks circular:

sd_uhs2_select_voltage
-> sd_uhs2_reinit
   -> sd_uhs2_init_card
      -> sd_uhs2_legacy_init
         -> sd_uhs2_select_voltage

> +		if (err)
> +			return 0;
> +	} else {
> +		bit = fls(ocr) - 1;
> +		ocr &= 3 << bit;
> +		if (bit != host->ios.vdd)
> +			dev_warn(mmc_dev(host), "exceeding card's volts\n");
> +	}
> +
> +	return ocr;
> +}
> +

<SNIP>




[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux