60
61
static unsigned int esdhc_of_get_max_clock(struct sdhci_host *host)
62
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
63
struct sdhci_of_host *of_host = sdhci_priv(host);
64
return pltfm_host->clock;
65
return of_host->clock;
67
68
static unsigned int esdhc_of_get_min_clock(struct sdhci_host *host)
69
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
71
return pltfm_host->clock / 256 / 16;
74
static unsigned int esdhc_of_get_max_blk_size(struct sdhci_host *host)
76
/* Force 2048 bytes, which is the maximum supported size in SDHCI. */
80
static struct sdhci_ops sdhci_esdhc_ops = {
81
.read_l = sdhci_be32bs_readl,
82
.read_w = esdhc_readw,
83
.read_b = sdhci_be32bs_readb,
84
.write_l = sdhci_be32bs_writel,
85
.write_w = esdhc_writew,
86
.write_b = esdhc_writeb,
87
.set_clock = esdhc_set_clock,
88
.enable_dma = esdhc_of_enable_dma,
89
.get_max_clock = esdhc_of_get_max_clock,
90
.get_min_clock = esdhc_of_get_min_clock,
91
.get_max_blk_size = esdhc_of_get_max_blk_size,
94
static struct sdhci_pltfm_data sdhci_esdhc_pdata = {
70
struct sdhci_of_host *of_host = sdhci_priv(host);
72
return of_host->clock / 256 / 16;
75
struct sdhci_of_data sdhci_esdhc = {
95
76
/* card detection could be handled via GPIO */
96
77
.quirks = ESDHC_DEFAULT_QUIRKS | SDHCI_QUIRK_BROKEN_CARD_DETECTION
97
78
| SDHCI_QUIRK_NO_CARD_NO_RESET,
98
.ops = &sdhci_esdhc_ops,
101
static int __devinit sdhci_esdhc_probe(struct platform_device *pdev)
103
return sdhci_pltfm_register(pdev, &sdhci_esdhc_pdata);
106
static int __devexit sdhci_esdhc_remove(struct platform_device *pdev)
108
return sdhci_pltfm_unregister(pdev);
111
static const struct of_device_id sdhci_esdhc_of_match[] = {
112
{ .compatible = "fsl,mpc8379-esdhc" },
113
{ .compatible = "fsl,mpc8536-esdhc" },
114
{ .compatible = "fsl,esdhc" },
117
MODULE_DEVICE_TABLE(of, sdhci_esdhc_of_match);
119
static struct platform_driver sdhci_esdhc_driver = {
121
.name = "sdhci-esdhc",
122
.owner = THIS_MODULE,
123
.of_match_table = sdhci_esdhc_of_match,
80
.read_l = sdhci_be32bs_readl,
81
.read_w = esdhc_readw,
82
.read_b = sdhci_be32bs_readb,
83
.write_l = sdhci_be32bs_writel,
84
.write_w = esdhc_writew,
85
.write_b = esdhc_writeb,
86
.set_clock = esdhc_set_clock,
87
.enable_dma = esdhc_of_enable_dma,
88
.get_max_clock = esdhc_of_get_max_clock,
89
.get_min_clock = esdhc_of_get_min_clock,
125
.probe = sdhci_esdhc_probe,
126
.remove = __devexit_p(sdhci_esdhc_remove),
128
.suspend = sdhci_pltfm_suspend,
129
.resume = sdhci_pltfm_resume,
133
static int __init sdhci_esdhc_init(void)
135
return platform_driver_register(&sdhci_esdhc_driver);
137
module_init(sdhci_esdhc_init);
139
static void __exit sdhci_esdhc_exit(void)
141
platform_driver_unregister(&sdhci_esdhc_driver);
143
module_exit(sdhci_esdhc_exit);
145
MODULE_DESCRIPTION("SDHCI OF driver for Freescale MPC eSDHC");
146
MODULE_AUTHOR("Xiaobo Xie <X.Xie@freescale.com>, "
147
"Anton Vorontsov <avorontsov@ru.mvista.com>");
148
MODULE_LICENSE("GPL v2");