smc.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Static Memory Controller for AT32 chips
  3. *
  4. * Copyright (C) 2006 Atmel Corporation
  5. *
  6. * Inspired by the OMAP2 General-Purpose Memory Controller interface
  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. #ifndef __ARCH_AT32AP_SMC_H
  13. #define __ARCH_AT32AP_SMC_H
  14. /*
  15. * All timing parameters are in nanoseconds.
  16. */
  17. struct smc_timing {
  18. /* Delay from address valid to assertion of given strobe */
  19. int ncs_read_setup;
  20. int nrd_setup;
  21. int ncs_write_setup;
  22. int nwe_setup;
  23. /* Pulse length of given strobe */
  24. int ncs_read_pulse;
  25. int nrd_pulse;
  26. int ncs_write_pulse;
  27. int nwe_pulse;
  28. /* Total cycle length of given operation */
  29. int read_cycle;
  30. int write_cycle;
  31. /* Minimal recovery times, will extend cycle if needed */
  32. int ncs_read_recover;
  33. int nrd_recover;
  34. int ncs_write_recover;
  35. int nwe_recover;
  36. };
  37. /*
  38. * All timing parameters are in clock cycles.
  39. */
  40. struct smc_config {
  41. /* Delay from address valid to assertion of given strobe */
  42. u8 ncs_read_setup;
  43. u8 nrd_setup;
  44. u8 ncs_write_setup;
  45. u8 nwe_setup;
  46. /* Pulse length of given strobe */
  47. u8 ncs_read_pulse;
  48. u8 nrd_pulse;
  49. u8 ncs_write_pulse;
  50. u8 nwe_pulse;
  51. /* Total cycle length of given operation */
  52. u8 read_cycle;
  53. u8 write_cycle;
  54. /* Bus width in bytes */
  55. u8 bus_width;
  56. /*
  57. * 0: Data is sampled on rising edge of NCS
  58. * 1: Data is sampled on rising edge of NRD
  59. */
  60. unsigned int nrd_controlled:1;
  61. /*
  62. * 0: Data is driven on falling edge of NCS
  63. * 1: Data is driven on falling edge of NWR
  64. */
  65. unsigned int nwe_controlled:1;
  66. /*
  67. * 0: NWAIT is disabled
  68. * 1: Reserved
  69. * 2: NWAIT is frozen mode
  70. * 3: NWAIT in ready mode
  71. */
  72. unsigned int nwait_mode:2;
  73. /*
  74. * 0: Byte select access type
  75. * 1: Byte write access type
  76. */
  77. unsigned int byte_write:1;
  78. /*
  79. * Number of clock cycles before data is released after
  80. * the rising edge of the read controlling signal
  81. *
  82. * Total cycles from SMC is tdf_cycles + 1
  83. */
  84. unsigned int tdf_cycles:4;
  85. /*
  86. * 0: TDF optimization disabled
  87. * 1: TDF optimization enabled
  88. */
  89. unsigned int tdf_mode:1;
  90. };
  91. extern void smc_set_timing(struct smc_config *config,
  92. const struct smc_timing *timing);
  93. extern int smc_set_configuration(int cs, const struct smc_config *config);
  94. extern struct smc_config *smc_get_configuration(int cs);
  95. #endif /* __ARCH_AT32AP_SMC_H */