Merge tag 'writeback' of git://git.kernel.org/pub/scm/linux/kernel/git/wfg/linux
[pandora-kernel.git] / drivers / mmc / host / sdhci-dove.c
1 /*
2  * sdhci-dove.c Support for SDHCI on Marvell's Dove SoC
3  *
4  * Author: Saeed Bishara <saeed@marvell.com>
5  *         Mike Rapoport <mike@compulab.co.il>
6  * Based on sdhci-cns3xxx.c
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as
10  * published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  */
21
22 #include <linux/io.h>
23 #include <linux/mmc/host.h>
24
25 #include "sdhci-pltfm.h"
26
27 static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
28 {
29         u16 ret;
30
31         switch (reg) {
32         case SDHCI_HOST_VERSION:
33         case SDHCI_SLOT_INT_STATUS:
34                 /* those registers don't exist */
35                 return 0;
36         default:
37                 ret = readw(host->ioaddr + reg);
38         }
39         return ret;
40 }
41
42 static u32 sdhci_dove_readl(struct sdhci_host *host, int reg)
43 {
44         u32 ret;
45
46         switch (reg) {
47         case SDHCI_CAPABILITIES:
48                 ret = readl(host->ioaddr + reg);
49                 /* Mask the support for 3.0V */
50                 ret &= ~SDHCI_CAN_VDD_300;
51                 break;
52         default:
53                 ret = readl(host->ioaddr + reg);
54         }
55         return ret;
56 }
57
58 static struct sdhci_ops sdhci_dove_ops = {
59         .read_w = sdhci_dove_readw,
60         .read_l = sdhci_dove_readl,
61 };
62
63 static struct sdhci_pltfm_data sdhci_dove_pdata = {
64         .ops    = &sdhci_dove_ops,
65         .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
66                   SDHCI_QUIRK_NO_BUSY_IRQ |
67                   SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
68                   SDHCI_QUIRK_FORCE_DMA,
69 };
70
71 static int __devinit sdhci_dove_probe(struct platform_device *pdev)
72 {
73         return sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
74 }
75
76 static int __devexit sdhci_dove_remove(struct platform_device *pdev)
77 {
78         return sdhci_pltfm_unregister(pdev);
79 }
80
81 static struct platform_driver sdhci_dove_driver = {
82         .driver         = {
83                 .name   = "sdhci-dove",
84                 .owner  = THIS_MODULE,
85                 .pm     = SDHCI_PLTFM_PMOPS,
86         },
87         .probe          = sdhci_dove_probe,
88         .remove         = __devexit_p(sdhci_dove_remove),
89 };
90
91 static int __init sdhci_dove_init(void)
92 {
93         return platform_driver_register(&sdhci_dove_driver);
94 }
95 module_init(sdhci_dove_init);
96
97 static void __exit sdhci_dove_exit(void)
98 {
99         platform_driver_unregister(&sdhci_dove_driver);
100 }
101 module_exit(sdhci_dove_exit);
102
103 MODULE_DESCRIPTION("SDHCI driver for Dove");
104 MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>, "
105               "Mike Rapoport <mike@compulab.co.il>");
106 MODULE_LICENSE("GPL v2");