Hi, Chris,
Could you have any comment about this patch?
Can it go into 3.3 or 3.4?

Thanks
Jerry Huang

> -----Original Message-----
> From: Huang Changming-R66093
> Sent: Friday, December 09, 2011 10:54 AM
> To: [email protected]
> Cc: Huang Changming-R66093; Chris Ball
> Subject: [PATCH 4/4 v3] ESDHC: add callback esdhc_of_get_cd to detect
> card
> 
> From: Jerry Huang <[email protected]>
> 
> In order to check if the card is present, we will read the PRESENT STATE
> register and check the bit13(Card detect pin level) and bit15(CINS).
> 
> Signed-off-by: Jerry Huang <[email protected]>
> CC: Chris Ball <[email protected]>
> ---
> changes for v2:
>       - add new callback for esdhc to detect the card state
>       - add the CC
> changes for v3:
>       - enable the controller clock when detect the card state, not core
> 
>  drivers/mmc/host/sdhci-of-esdhc.c |   25 ++++++++++++++++++++++++-
>  1 files changed, 24 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-
> of-esdhc.c
> index 59e9d00..40da8f4 100644
> --- a/drivers/mmc/host/sdhci-of-esdhc.c
> +++ b/drivers/mmc/host/sdhci-of-esdhc.c
> @@ -1,7 +1,7 @@
>  /*
>   * Freescale eSDHC controller driver.
>   *
> - * Copyright (c) 2007, 2010 Freescale Semiconductor, Inc.
> + * Copyright (c) 2007, 2010-2011 Freescale Semiconductor, Inc.
>   * Copyright (c) 2009 MontaVista Software, Inc.
>   *
>   * Authors: Xiaobo Xie <[email protected]>
> @@ -82,6 +82,28 @@ static unsigned int esdhc_of_get_min_clock(struct
> sdhci_host *host)
>       return pltfm_host->clock / 256 / 16;
>  }
> 
> +/* Return: none zero - the card is presetn; 0 - card is absent */
> +static int esdhc_of_get_cd(struct sdhci_host *host)
> +{
> +     int present;
> +
> +     if (host->flags & SDHCI_DEVICE_DEAD)
> +             present = 0;
> +     else {
> +             int sysctl = sdhci_be32bs_readl(host, SDHCI_CLOCK_CONTROL);
> +             /* Enable the controller clock to update the present state */
> +             sdhci_be32bs_writel(host, sysctl | SDHCI_CLOCK_INT_EN,
> +                             SDHCI_CLOCK_CONTROL);
> +             /* Detect the card present or absent */
> +             present = sdhci_be32bs_readl(host, SDHCI_PRESENT_STATE);
> +             present &= (SDHCI_CARD_PRESENT | SDHCI_CARD_CDPL);
> +             /* Resve the previous to System control register */
> +             sdhci_be32bs_writel(host, sysctl, SDHCI_CLOCK_CONTROL);
> +     }
> +
> +     return present;
> +}
> +
>  static struct sdhci_ops sdhci_esdhc_ops = {
>       .read_l = sdhci_be32bs_readl,
>       .read_w = esdhc_readw,
> @@ -93,6 +115,7 @@ static struct sdhci_ops sdhci_esdhc_ops = {
>       .enable_dma = esdhc_of_enable_dma,
>       .get_max_clock = esdhc_of_get_max_clock,
>       .get_min_clock = esdhc_of_get_min_clock,
> +     .get_cd = esdhc_of_get_cd,
>  };
> 
>  static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
> --
> 1.7.5.4


--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to