tegra2_mmc.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * (C) Copyright 2009 SAMSUNG Electronics
  3. * Minkyu Kang <mk7.kang@samsung.com>
  4. * Portions Copyright (C) 2011 NVIDIA Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. *
  20. */
  21. #ifndef __TEGRA2_MMC_H_
  22. #define __TEGRA2_MMC_H_
  23. #define TEGRA2_SDMMC1_BASE 0xC8000000
  24. #define TEGRA2_SDMMC2_BASE 0xC8000200
  25. #define TEGRA2_SDMMC3_BASE 0xC8000400
  26. #define TEGRA2_SDMMC4_BASE 0xC8000600
  27. #ifndef __ASSEMBLY__
  28. struct tegra2_mmc {
  29. unsigned int sysad; /* _SYSTEM_ADDRESS_0 */
  30. unsigned short blksize; /* _BLOCK_SIZE_BLOCK_COUNT_0 15:00 */
  31. unsigned short blkcnt; /* _BLOCK_SIZE_BLOCK_COUNT_0 31:16 */
  32. unsigned int argument; /* _ARGUMENT_0 */
  33. unsigned short trnmod; /* _CMD_XFER_MODE_0 15:00 xfer mode */
  34. unsigned short cmdreg; /* _CMD_XFER_MODE_0 31:16 cmd reg */
  35. unsigned int rspreg0; /* _RESPONSE_R0_R1_0 CMD RESP 31:00 */
  36. unsigned int rspreg1; /* _RESPONSE_R2_R3_0 CMD RESP 63:32 */
  37. unsigned int rspreg2; /* _RESPONSE_R4_R5_0 CMD RESP 95:64 */
  38. unsigned int rspreg3; /* _RESPONSE_R6_R7_0 CMD RESP 127:96 */
  39. unsigned int bdata; /* _BUFFER_DATA_PORT_0 */
  40. unsigned int prnsts; /* _PRESENT_STATE_0 */
  41. unsigned char hostctl; /* _POWER_CONTROL_HOST_0 7:00 */
  42. unsigned char pwrcon; /* _POWER_CONTROL_HOST_0 15:8 */
  43. unsigned char blkgap; /* _POWER_CONTROL_HOST_9 23:16 */
  44. unsigned char wakcon; /* _POWER_CONTROL_HOST_0 31:24 */
  45. unsigned short clkcon; /* _CLOCK_CONTROL_0 15:00 */
  46. unsigned char timeoutcon; /* _TIMEOUT_CTRL 23:16 */
  47. unsigned char swrst; /* _SW_RESET_ 31:24 */
  48. unsigned int norintsts; /* _INTERRUPT_STATUS_0 */
  49. unsigned int norintstsen; /* _INTERRUPT_STATUS_ENABLE_0 */
  50. unsigned int norintsigen; /* _INTERRUPT_SIGNAL_ENABLE_0 */
  51. unsigned short acmd12errsts; /* _AUTO_CMD12_ERR_STATUS_0 15:00 */
  52. unsigned char res1[2]; /* _RESERVED 31:16 */
  53. unsigned int capareg; /* _CAPABILITIES_0 */
  54. unsigned char res2[4]; /* RESERVED, offset 44h-47h */
  55. unsigned int maxcurr; /* _MAXIMUM_CURRENT_0 */
  56. unsigned char res3[4]; /* RESERVED, offset 4Ch-4Fh */
  57. unsigned short setacmd12err; /* offset 50h */
  58. unsigned short setinterr; /* offset 52h */
  59. unsigned char admaerr; /* offset 54h */
  60. unsigned char res4[3]; /* RESERVED, offset 55h-57h */
  61. unsigned long admaaddr; /* offset 58h-5Fh */
  62. unsigned char res5[0x9c]; /* RESERVED, offset 60h-FBh */
  63. unsigned short slotintstatus; /* offset FCh */
  64. unsigned short hcver; /* HOST Version */
  65. unsigned char res6[0x100]; /* RESERVED, offset 100h-1FFh */
  66. };
  67. struct mmc_host {
  68. struct tegra2_mmc *reg;
  69. unsigned int version; /* SDHCI spec. version */
  70. unsigned int clock; /* Current clock (MHz) */
  71. unsigned int base; /* Base address, SDMMC1/2/3/4 */
  72. };
  73. int tegra2_mmc_init(int dev_index, int bus_width);
  74. #endif /* __ASSEMBLY__ */
  75. #endif /* __TEGRA2_MMC_H_ */