sdhci-dove.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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. #include <linux/io.h>
  22. #include <linux/mmc/host.h>
  23. #include "sdhci-pltfm.h"
  24. static u16 sdhci_dove_readw(struct sdhci_host *host, int reg)
  25. {
  26. u16 ret;
  27. switch (reg) {
  28. case SDHCI_HOST_VERSION:
  29. case SDHCI_SLOT_INT_STATUS:
  30. /* those registers don't exist */
  31. return 0;
  32. default:
  33. ret = readw(host->ioaddr + reg);
  34. }
  35. return ret;
  36. }
  37. static u32 sdhci_dove_readl(struct sdhci_host *host, int reg)
  38. {
  39. u32 ret;
  40. switch (reg) {
  41. case SDHCI_CAPABILITIES:
  42. ret = readl(host->ioaddr + reg);
  43. /* Mask the support for 3.0V */
  44. ret &= ~SDHCI_CAN_VDD_300;
  45. break;
  46. default:
  47. ret = readl(host->ioaddr + reg);
  48. }
  49. return ret;
  50. }
  51. static struct sdhci_ops sdhci_dove_ops = {
  52. .read_w = sdhci_dove_readw,
  53. .read_l = sdhci_dove_readl,
  54. };
  55. static struct sdhci_pltfm_data sdhci_dove_pdata = {
  56. .ops = &sdhci_dove_ops,
  57. .quirks = SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |
  58. SDHCI_QUIRK_NO_BUSY_IRQ |
  59. SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
  60. SDHCI_QUIRK_FORCE_DMA,
  61. };
  62. static int __devinit sdhci_dove_probe(struct platform_device *pdev)
  63. {
  64. return sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
  65. }
  66. static int __devexit sdhci_dove_remove(struct platform_device *pdev)
  67. {
  68. return sdhci_pltfm_unregister(pdev);
  69. }
  70. static struct platform_driver sdhci_dove_driver = {
  71. .driver = {
  72. .name = "sdhci-dove",
  73. .owner = THIS_MODULE,
  74. },
  75. .probe = sdhci_dove_probe,
  76. .remove = __devexit_p(sdhci_dove_remove),
  77. #ifdef CONFIG_PM
  78. .suspend = sdhci_pltfm_suspend,
  79. .resume = sdhci_pltfm_resume,
  80. #endif
  81. };
  82. static int __init sdhci_dove_init(void)
  83. {
  84. return platform_driver_register(&sdhci_dove_driver);
  85. }
  86. module_init(sdhci_dove_init);
  87. static void __exit sdhci_dove_exit(void)
  88. {
  89. platform_driver_unregister(&sdhci_dove_driver);
  90. }
  91. module_exit(sdhci_dove_exit);
  92. MODULE_DESCRIPTION("SDHCI driver for Dove");
  93. MODULE_AUTHOR("Saeed Bishara <saeed@marvell.com>, "
  94. "Mike Rapoport <mike@compulab.co.il>");
  95. MODULE_LICENSE("GPL v2");