sdram.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (c) 2015 Google, Inc
  4. *
  5. * Copyright 2014 Rockchip Inc.
  6. */
  7. #ifndef _ASM_ARCH_RK3288_SDRAM_H__
  8. #define _ASM_ARCH_RK3288_SDRAM_H__
  9. enum {
  10. DDR3 = 3,
  11. LPDDR3 = 6,
  12. UNUSED = 0xFF,
  13. };
  14. struct rk3288_sdram_channel {
  15. /*
  16. * bit width in address, eg:
  17. * 8 banks using 3 bit to address,
  18. * 2 cs using 1 bit to address.
  19. */
  20. u8 rank;
  21. u8 col;
  22. u8 bk;
  23. u8 bw;
  24. u8 dbw;
  25. u8 row_3_4;
  26. u8 cs0_row;
  27. u8 cs1_row;
  28. #if CONFIG_IS_ENABLED(OF_PLATDATA)
  29. /*
  30. * For of-platdata, which would otherwise convert this into two
  31. * byte-swapped integers. With a size of 9 bytes, this struct will
  32. * appear in of-platdata as a byte array.
  33. *
  34. * If OF_PLATDATA enabled, need to add a dummy byte in dts.(i.e 0xff)
  35. */
  36. u8 dummy;
  37. #endif
  38. };
  39. struct rk3288_sdram_pctl_timing {
  40. u32 togcnt1u;
  41. u32 tinit;
  42. u32 trsth;
  43. u32 togcnt100n;
  44. u32 trefi;
  45. u32 tmrd;
  46. u32 trfc;
  47. u32 trp;
  48. u32 trtw;
  49. u32 tal;
  50. u32 tcl;
  51. u32 tcwl;
  52. u32 tras;
  53. u32 trc;
  54. u32 trcd;
  55. u32 trrd;
  56. u32 trtp;
  57. u32 twr;
  58. u32 twtr;
  59. u32 texsr;
  60. u32 txp;
  61. u32 txpdll;
  62. u32 tzqcs;
  63. u32 tzqcsi;
  64. u32 tdqs;
  65. u32 tcksre;
  66. u32 tcksrx;
  67. u32 tcke;
  68. u32 tmod;
  69. u32 trstl;
  70. u32 tzqcl;
  71. u32 tmrr;
  72. u32 tckesr;
  73. u32 tdpd;
  74. };
  75. check_member(rk3288_sdram_pctl_timing, tdpd, 0x144 - 0xc0);
  76. struct rk3288_sdram_phy_timing {
  77. u32 dtpr0;
  78. u32 dtpr1;
  79. u32 dtpr2;
  80. u32 mr[4];
  81. };
  82. struct rk3288_base_params {
  83. u32 noc_timing;
  84. u32 noc_activate;
  85. u32 ddrconfig;
  86. u32 ddr_freq;
  87. u32 dramtype;
  88. /*
  89. * DDR Stride is address mapping for DRAM space
  90. * Stride Ch 0 range Ch1 range Total
  91. * 0x00 0-256MB 256MB-512MB 512MB
  92. * 0x05 0-1GB 0-1GB 1GB
  93. * 0x09 0-2GB 0-2GB 2GB
  94. * 0x0d 0-4GB 0-4GB 4GB
  95. * 0x17 N/A 0-4GB 4GB
  96. * 0x1a 0-4GB 4GB-8GB 8GB
  97. */
  98. u32 stride;
  99. u32 odt;
  100. };
  101. #endif