blob: 9c853688179640ec7cbee25872fa8a0f7f7e3280 [file] [log] [blame]
Mike Rapoport985b1aa2010-11-07 16:57:12 -05001/*
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>
Alf Høgemark8c2fc8e2012-04-04 12:27:09 -040023#include <linux/module.h>
Mike Rapoport985b1aa2010-11-07 16:57:12 -050024#include <linux/mmc/host.h>
25
Mike Rapoport985b1aa2010-11-07 16:57:12 -050026#include "sdhci-pltfm.h"
27
28static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
29{
30 u16 ret;
31
32 switch (reg) {
33 case SDHCI_HOST_VERSION:
34 case SDHCI_SLOT_INT_STATUS:
35 /* those registers don't exist */
36 return 0;
37 default:
38 ret = readw(host->ioaddr + reg);
39 }
40 return ret;
41}
42
43static u32 sdhci_dove_readl(struct sdhci_host *host, int reg)
44{
45 u32 ret;
46
47 switch (reg) {
48 case SDHCI_CAPABILITIES:
49 ret = readl(host->ioaddr + reg);
50 /* Mask the support for 3.0V */
51 ret &= ~SDHCI_CAN_VDD_300;
52 break;
53 default:
54 ret = readl(host->ioaddr + reg);
55 }
56 return ret;
57}
58
59static struct sdhci_ops sdhci_dove_ops = {
60 .read_w = sdhci_dove_readw,
61 .read_l = sdhci_dove_readl,
62};
63
Shawn Guo85d65092011-05-27 23:48:12 +080064static struct sdhci_pltfm_data sdhci_dove_pdata = {
Mike Rapoport985b1aa2010-11-07 16:57:12 -050065 .ops = &sdhci_dove_ops,
66 .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
67 SDHCI_QUIRK_NO_BUSY_IRQ |
68 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
Sebastian Hesselbartha9ca1d52012-07-21 19:26:19 -040069 SDHCI_QUIRK_FORCE_DMA |
70 SDHCI_QUIRK_NO_HISPD_BIT,
Mike Rapoport985b1aa2010-11-07 16:57:12 -050071};
Shawn Guo85d65092011-05-27 23:48:12 +080072
73static int __devinit sdhci_dove_probe(struct platform_device *pdev)
74{
75 return sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
76}
77
78static int __devexit sdhci_dove_remove(struct platform_device *pdev)
79{
80 return sdhci_pltfm_unregister(pdev);
81}
82
83static struct platform_driver sdhci_dove_driver = {
84 .driver = {
85 .name = "sdhci-dove",
86 .owner = THIS_MODULE,
Manuel Lauss29495aa2011-11-03 11:09:45 +010087 .pm = SDHCI_PLTFM_PMOPS,
Shawn Guo85d65092011-05-27 23:48:12 +080088 },
89 .probe = sdhci_dove_probe,
90 .remove = __devexit_p(sdhci_dove_remove),
Shawn Guo85d65092011-05-27 23:48:12 +080091};
92
Axel Lind1f81a62011-11-26 12:55:43 +080093module_platform_driver(sdhci_dove_driver);
Shawn Guo85d65092011-05-27 23:48:12 +080094
95MODULE_DESCRIPTION("SDHCI driver for Dove");
96MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>, "
97 "Mike Rapoport <mike@compulab.co.il>");
98MODULE_LICENSE("GPL v2");