io.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * the ``general-purpose'' memory controller.
  3. * only works with flash memory.
  4. */
  5. enum {
  6. /* syscfg bits */
  7. Idlemask = MASK(2) << 3,
  8. Noidle = 1 << 3,
  9. /* config bits */
  10. Postnandwrites = 1<<0, /* force nand reg. writes to be posted */
  11. /* indices of cscfg[].cfg[] */
  12. Csctl = 1 - 1, /* chip-select signal ctl */
  13. Csmap = 7 - 1, /* chip-select addr map cfg */
  14. /* Csctl bits */
  15. Muxadddata = 1 << 9,
  16. Devtypemask = MASK(2) << 10,
  17. Devtypenor = 0 << 10,
  18. Devtypenand = 2 << 10,
  19. Devsizemask = 1 << 12,
  20. Devsize8 = 0 << 12,
  21. Devsize16 = 1 << 12,
  22. Writesync = 1 << 27,
  23. Readsync = 1 << 29,
  24. /* Csmap bits */
  25. Csvalid = 1 << 6,
  26. MB16 = 017 << 8, /* 16MB size */
  27. MB128 = 010 << 8, /* 128MB size */
  28. };
  29. typedef struct Gpmc Gpmc;
  30. typedef struct Gpmccs Gpmccs;
  31. /*
  32. * configuration for non-dram (e.g., flash) memory
  33. */
  34. struct Gpmc { /* hw registers */
  35. uchar _pad0[0x10];
  36. ulong syscfg;
  37. ulong syssts;
  38. ulong irqsts;
  39. ulong irqenable;
  40. uchar _pad1[0x40 - 0x20];
  41. ulong tmout_ctl;
  42. ulong erraddr;
  43. ulong errtype;
  44. ulong _pad7;
  45. ulong config;
  46. ulong sts;
  47. uchar _pad2[0x60 - 0x58];
  48. /* chip-select config */
  49. struct Gpmccs {
  50. ulong cfg[7];
  51. ulong nandcmd;
  52. ulong nandaddr;
  53. ulong nanddata;
  54. ulong _pad6[2];
  55. } cscfg[8];
  56. /* prefetch */
  57. ulong prefcfg[2];
  58. ulong _pad8;
  59. ulong prefctl;
  60. ulong prefsts;
  61. /* ecc */
  62. ulong ecccfg;
  63. ulong eccctl;
  64. ulong eccsize;
  65. ulong eccres[9];
  66. uchar _pad3[0x240 - 0x224];
  67. /* bch */
  68. ulong bchres[8][4];
  69. uchar _pad4[0x2d0 - 0x2c0];
  70. ulong bchswdata;
  71. };