On 12/22/10 10:01, Olof Johansson wrote:
> SDHCI driver for Tegra. Pretty straight forward, a few pieces of
> functionality left to fill in but nothing that stops it from going
> upstream. Board enablement submitted separately.
> 
> This driver plugs in as a new variant of sdhci-pltfm, using the platform
> data structure passed in to specify the GPIOs to use for card detect,
> write protect and card power enablement.
> 
> Original driver (of which only the header file is left):
> Signed-off-by: Yvonne Yip <[email protected]>
> 
> The rest, which has been rewritten by now:
> Signed-off-by: Olof Johansson <[email protected]>
> Cc: Wolfram Sang <[email protected]>
> Cc: Mike Rapoport <[email protected]>

Only one comment below, otherwise feel free to add
Acked-by: Mike Rapoport <[email protected]>

> ---
> 
>  arch/arm/mach-tegra/include/mach/sdhci.h |   28 ++++
>  drivers/mmc/host/Kconfig                 |   10 ++
>  drivers/mmc/host/Makefile                |    1 +
>  drivers/mmc/host/sdhci-pltfm.c           |    3 +
>  drivers/mmc/host/sdhci-pltfm.h           |    1 +
>  drivers/mmc/host/sdhci-tegra.c           |  219 
> ++++++++++++++++++++++++++++++
>  6 files changed, 262 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-tegra/include/mach/sdhci.h
>  create mode 100644 drivers/mmc/host/sdhci-tegra.c
> 

[ snip ]

> +     if (gpio_is_valid(plat->wp_gpio)) {
> +             rc = gpio_request(plat->wp_gpio, "sdhci_wp");
> +             if (rc) {
> +                     dev_err(mmc_dev(host->mmc), 
> +                             "failed to allocate wp gpio\n");
> +                     goto out_cd;
> +             }
> +             tegra_gpio_enable(plat->wp_gpio);

gpio_direction_input?

> +     }
> +
> +     clk = clk_get(mmc_dev(host->mmc), NULL);
> +     if (IS_ERR(clk)) {
> +             dev_err(mmc_dev(host->mmc), "clk err\n");
> +             rc = PTR_ERR(clk);
> +             goto out_wp;
> +     }
> +     clk_enable(clk);
> +     pltfm_host->clk = clk;
> +
> +     return 0;
> +
> +out_wp:
> +     if (gpio_is_valid(plat->wp_gpio)) {
> +             tegra_gpio_disable(plat->wp_gpio);
> +             gpio_free(plat->wp_gpio);
> +     }
> +
> +out_cd:
> +     if (gpio_is_valid(plat->cd_gpio)) {
> +             tegra_gpio_disable(plat->cd_gpio);
> +             gpio_free(plat->cd_gpio);
> +     }
> +
> +out_power:
> +     if (gpio_is_valid(plat->power_gpio)) {
> +             tegra_gpio_disable(plat->power_gpio);
> +             gpio_free(plat->power_gpio);
> +     }
> +
> +out:
> +     return rc;
> +}
> +
> +static void tegra_sdhci_pltfm_exit(struct sdhci_host *host)
> +{
> +     struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
> +     struct platform_device *pdev = to_platform_device(mmc_dev(host->mmc));
> +     struct tegra_sdhci_platform_data *plat;
> +
> +     plat = pdev->dev.platform_data;
> +
> +     if (gpio_is_valid(plat->wp_gpio)) {
> +             tegra_gpio_disable(plat->wp_gpio);
> +             gpio_free(plat->wp_gpio);
> +     }
> +
> +     if (gpio_is_valid(plat->cd_gpio)) {
> +             tegra_gpio_disable(plat->cd_gpio);
> +             gpio_free(plat->cd_gpio);
> +     }
> +
> +     if (gpio_is_valid(plat->power_gpio)) {
> +             tegra_gpio_disable(plat->power_gpio);
> +             gpio_free(plat->power_gpio);
> +     }
> +
> +     clk_disable(pltfm_host->clk);
> +     clk_put(pltfm_host->clk);
> +}
> +
> +static struct sdhci_ops tegra_sdhci_ops = {
> +     .get_ro     = tegra_sdhci_get_ro,
> +     .read_l     = tegra_sdhci_readl,
> +     .read_w     = tegra_sdhci_readw,
> +     .write_l    = tegra_sdhci_writel,
> +};
> +
> +struct sdhci_pltfm_data sdhci_tegra_pdata = {
> +     .quirks = SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
> +               SDHCI_QUIRK_SINGLE_POWER_WRITE |
> +               SDHCI_QUIRK_NO_HISPD_BIT |
> +               SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC,
> +     .ops  = &tegra_sdhci_ops,
> +     .init = tegra_sdhci_pltfm_init,
> +     .exit = tegra_sdhci_pltfm_exit,
> +};


-- 
Sincerely yours,
Mike.
--
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