21 #include <linux/kernel.h>
23 #include <linux/slab.h>
25 #include <linux/module.h>
43 static int sh_mobile_sdhi_clk_enable(
struct platform_device *pdev,
unsigned int *
f)
78 static int sh_mobile_sdhi_wait_idle(
struct tmio_mmc_host *host)
82 while (--timeout && !(sd_ctrl_read16(host,
CTL_STATUS2) & (1 << 13)))
86 dev_warn(host->
pdata->dev,
"timeout waiting for SD bus idle\n");
105 return sh_mobile_sdhi_wait_idle(host);
111 static void sh_mobile_sdhi_cd_wakeup(
const struct platform_device *pdev)
117 .cd_wakeup = sh_mobile_sdhi_cd_wakeup,
128 bool multiplexed_isr =
true;
141 ret = p->
init(pdev, &sdhi_ops);
147 snprintf(clk_name,
sizeof(clk_name),
"sdhi%d", pdev->
id);
149 if (IS_ERR(priv->
clk)) {
150 dev_err(&pdev->
dev,
"cannot get clock \"%s\"\n", clk_name);
151 ret = PTR_ERR(priv->
clk);
155 mmc_data->
clk_enable = sh_mobile_sdhi_clk_enable;
156 mmc_data->
clk_disable = sh_mobile_sdhi_clk_disable;
167 mmc_data->
set_pwr = sh_mobile_sdhi_set_pwr;
169 mmc_data->
get_cd = sh_mobile_sdhi_get_cd;
203 multiplexed_isr =
false;
205 dev_name(&pdev->
dev), host);
207 goto eirq_card_detect;
212 multiplexed_isr =
false;
214 dev_name(&pdev->
dev), host);
221 multiplexed_isr =
false;
223 dev_name(&pdev->
dev), host);
226 }
else if (!multiplexed_isr) {
228 "Principal SD-card IRQ is missing among named interrupts\n");
233 if (multiplexed_isr) {
240 dev_name(&pdev->
dev), host);
242 goto eirq_multiplexed;
247 goto eirq_multiplexed;
250 dev_info(&pdev->
dev,
"%s base at 0x%08lx clock rate %u MHz\n",
253 mmc_data->
hclk / 1000000);
284 struct mmc_host *mmc = platform_get_drvdata(pdev);
312 static const struct dev_pm_ops tmio_mmc_dev_pm_ops = {
319 static const struct of_device_id sh_mobile_sdhi_of_match[] = {
320 { .compatible =
"renesas,shmobile-sdhi" },
327 .name =
"sh_mobile_sdhi",
329 .pm = &tmio_mmc_dev_pm_ops,
330 .of_match_table = sh_mobile_sdhi_of_match,
332 .probe = sh_mobile_sdhi_probe,