16 #include <linux/module.h>
35 #define SDHCI_TEGRA_VENDOR_MISC_CTRL 0x120
36 #define SDHCI_MISC_CTRL_ENABLE_SDHCI_SPEC_300 0x20
38 #define NVQUIRK_FORCE_SDHCI_SPEC_200 BIT(0)
39 #define NVQUIRK_ENABLE_BLOCK_GAP_DET BIT(1)
40 #define NVQUIRK_ENABLE_SDHCI_SPEC_300 BIT(2)
107 static unsigned int tegra_sdhci_get_ro(
struct sdhci_host *host)
113 if (!gpio_is_valid(plat->
wp_gpio))
168 static struct sdhci_ops tegra_sdhci_ops = {
169 .get_ro = tegra_sdhci_get_ro,
170 .read_l = tegra_sdhci_readl,
171 .read_w = tegra_sdhci_readw,
172 .write_l = tegra_sdhci_writel,
173 .platform_8bit_width = tegra_sdhci_8bit,
174 .platform_reset_exit = tegra_sdhci_reset_exit,
177 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
183 .ops = &tegra_sdhci_ops,
187 .
pdata = &sdhci_tegra20_pdata,
193 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
200 .ops = &tegra_sdhci_ops,
204 .
pdata = &sdhci_tegra30_pdata,
210 #ifdef CONFIG_ARCH_TEGRA_3x_SOC
211 { .compatible =
"nvidia,tegra30-sdhci", .data = &soc_data_tegra30 },
213 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
214 { .compatible =
"nvidia,tegra20-sdhci", .data = &soc_data_tegra20 },
232 dev_err(&pdev->
dev,
"Can't allocate platform data\n");
236 plat->
cd_gpio = of_get_named_gpio(np,
"cd-gpios", 0);
237 plat->
wp_gpio = of_get_named_gpio(np,
"wp-gpios", 0);
238 plat->
power_gpio = of_get_named_gpio(np,
"power-gpios", 0);
240 if (of_property_read_u32(np,
"bus-width", &bus_width) == 0 &&
261 soc_data = match->
data;
265 return PTR_ERR(host);
267 pltfm_host = sdhci_priv(host);
269 plat = pdev->
dev.platform_data;
272 plat = sdhci_tegra_dt_parse_pdata(pdev);
287 tegra_host->
plat = plat;
290 pltfm_host->
priv = tegra_host;
296 "failed to allocate power gpio\n");
302 if (gpio_is_valid(plat->
cd_gpio)) {
306 "failed to allocate cd gpio\n");
322 if (gpio_is_valid(plat->
wp_gpio)) {
326 "failed to allocate wp gpio\n");
338 clk_prepare_enable(clk);
339 pltfm_host->
clk = clk;
353 clk_disable_unprepare(pltfm_host->
clk);
356 if (gpio_is_valid(plat->
wp_gpio))
359 if (gpio_is_valid(plat->
cd_gpio))
362 if (gpio_is_valid(plat->
cd_gpio))
375 struct sdhci_host *host = platform_get_drvdata(pdev);
383 if (gpio_is_valid(plat->
wp_gpio))
386 if (gpio_is_valid(plat->
cd_gpio)) {
394 clk_disable_unprepare(pltfm_host->
clk);
404 .name =
"sdhci-tegra",
406 .of_match_table = sdhci_tegra_dt_match,
409 .probe = sdhci_tegra_probe,