lkml.org 
[lkml]   [2023]   [Oct]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH V12 20/23] mmc: sdhci-uhs2: add add_host() and others to set up the driver
On Fri, 15 Sept 2023 at 11:44, Victor Shih <victorshihgli@gmail.com> wrote:
>
> From: Victor Shih <victor.shih@genesyslogic.com.tw>
>
> This is a UHS-II version of sdhci's add_host/remove_host operation.
> Any sdhci drivers which are capable of handling UHS-II cards must
> call those functions instead of the corresponding sdhci's.
>
> Signed-off-by: Ben Chuang <ben.chuang@genesyslogic.com.tw>
> Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
> Signed-off-by: Victor Shih <victor.shih@genesyslogic.com.tw>
> Acked-by: Adrian Hunter <adrian.hunter@intel.com>

[...]

Just a few nitpicks, see below.

> +static void __sdhci_uhs2_add_host_v4(struct sdhci_host *host, u32 caps1)
> +{
> + struct mmc_host *mmc;
> + u32 max_current_caps2;
> +
> + mmc = host->mmc;
> +
> + /* Support UHS2 */
> + if (caps1 & SDHCI_SUPPORT_UHS2)
> + mmc->caps2 |= MMC_CAP2_SD_UHS2;
> +
> + max_current_caps2 = sdhci_readl(host, SDHCI_MAX_CURRENT_1);
> +
> + if ((caps1 & SDHCI_CAN_VDD2_180) &&
> + !max_current_caps2 &&
> + !IS_ERR(mmc->supply.vmmc2)) {
> + /* UHS2 - VDD2 */
> + int curr = regulator_get_current_limit(mmc->supply.vmmc2);

As I also stated in another reply, please use vqmmc2 instead, which we
added in patch4.

> +
> + if (curr > 0) {
> + /* convert to SDHCI_MAX_CURRENT format */
> + curr = curr / 1000; /* convert to mA */
> + curr = curr / SDHCI_MAX_CURRENT_MULTIPLIER;
> + curr = min_t(u32, curr, SDHCI_MAX_CURRENT_LIMIT);
> + max_current_caps2 = curr;
> + }
> + }
> +
> + if (!(caps1 & SDHCI_CAN_VDD2_180))
> + mmc->caps2 &= ~MMC_CAP2_SD_UHS2;
> +}
> +
> +static int sdhci_uhs2_host_ops_init(struct sdhci_host *host);

Please try to re-order the code so this declaration isn't needed.

> +
> +static void __sdhci_uhs2_remove_host(struct sdhci_host *host, int dead)
> +{
> + if (!sdhci_uhs2_mode(host))
> + return;
> +
> + if (!dead)
> + sdhci_uhs2_reset(host, SDHCI_UHS2_SW_RESET_FULL);
> +}
> +

[...]

Kind regards
Uffe

\
 
 \ /
  Last update: 2023-10-05 16:09    [W:0.318 / U:0.504 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site