1 // SPDX-License-Identifier: GPL-2.0-only
3 * sdhci-dove.c Support for SDHCI on Marvell's Dove SoC
5 * Author: Saeed Bishara <saeed@marvell.com>
6 * Mike Rapoport <mike@compulab.co.il>
7 * Based on sdhci-cns3xxx.c
10 #include <linux/clk.h>
11 #include <linux/err.h>
13 #include <linux/mmc/host.h>
14 #include <linux/module.h>
17 #include "sdhci-pltfm.h"
19 static u16
sdhci_dove_readw(struct sdhci_host
*host
, int reg
)
24 case SDHCI_HOST_VERSION
:
25 case SDHCI_SLOT_INT_STATUS
:
26 /* those registers don't exist */
29 ret
= readw(host
->ioaddr
+ reg
);
34 static u32
sdhci_dove_readl(struct sdhci_host
*host
, int reg
)
38 ret
= readl(host
->ioaddr
+ reg
);
41 case SDHCI_CAPABILITIES
:
42 /* Mask the support for 3.0V */
43 ret
&= ~SDHCI_CAN_VDD_300
;
49 static const struct sdhci_ops sdhci_dove_ops
= {
50 .read_w
= sdhci_dove_readw
,
51 .read_l
= sdhci_dove_readl
,
52 .set_clock
= sdhci_set_clock
,
53 .set_bus_width
= sdhci_set_bus_width
,
55 .set_uhs_signaling
= sdhci_set_uhs_signaling
,
58 static const struct sdhci_pltfm_data sdhci_dove_pdata
= {
59 .ops
= &sdhci_dove_ops
,
60 .quirks
= SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER
|
61 SDHCI_QUIRK_NO_BUSY_IRQ
|
62 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL
|
63 SDHCI_QUIRK_FORCE_DMA
|
64 SDHCI_QUIRK_NO_HISPD_BIT
,
67 static int sdhci_dove_probe(struct platform_device
*pdev
)
69 struct sdhci_host
*host
;
70 struct sdhci_pltfm_host
*pltfm_host
;
73 host
= sdhci_pltfm_init(pdev
, &sdhci_dove_pdata
, 0);
77 pltfm_host
= sdhci_priv(host
);
78 pltfm_host
->clk
= devm_clk_get(&pdev
->dev
, NULL
);
80 if (!IS_ERR(pltfm_host
->clk
))
81 clk_prepare_enable(pltfm_host
->clk
);
83 ret
= mmc_of_parse(host
->mmc
);
87 ret
= sdhci_add_host(host
);
94 clk_disable_unprepare(pltfm_host
->clk
);
95 sdhci_pltfm_free(pdev
);
99 static const struct of_device_id sdhci_dove_of_match_table
[] = {
100 { .compatible
= "marvell,dove-sdhci", },
103 MODULE_DEVICE_TABLE(of
, sdhci_dove_of_match_table
);
105 static struct platform_driver sdhci_dove_driver
= {
107 .name
= "sdhci-dove",
108 .probe_type
= PROBE_PREFER_ASYNCHRONOUS
,
109 .pm
= &sdhci_pltfm_pmops
,
110 .of_match_table
= sdhci_dove_of_match_table
,
112 .probe
= sdhci_dove_probe
,
113 .remove
= sdhci_pltfm_unregister
,
116 module_platform_driver(sdhci_dove_driver
);
118 MODULE_DESCRIPTION("SDHCI driver for Dove");
119 MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>, "
120 "Mike Rapoport <mike@compulab.co.il>");
121 MODULE_LICENSE("GPL v2");