io.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. * This program is free software; you can redistribute it and/or modify
  3. * it under the terms of the GNU General Public License as published by
  4. * the Free Software Foundation; either version 2 of the License, or
  5. * (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. *
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. #define GPDIR 0
  18. #define GPCFG 4 /* open drain or not */
  19. #define GPDAT 8
  20. /*
  21. * gpio port and pin definitions
  22. * NOTE: port number starts from 0
  23. */
  24. #define XL_INITN_PORT 1
  25. #define XL_INITN_PIN 14
  26. #define XL_RDWRN_PORT 1
  27. #define XL_RDWRN_PIN 13
  28. #define XL_CCLK_PORT 1
  29. #define XL_CCLK_PIN 10
  30. #define XL_PROGN_PORT 1
  31. #define XL_PROGN_PIN 25
  32. #define XL_CSIN_PORT 1
  33. #define XL_CSIN_PIN 26
  34. #define XL_DONE_PORT 1
  35. #define XL_DONE_PIN 27
  36. /*
  37. * gpio mapping
  38. *
  39. XL_config_D0 – gpio1_31
  40. Xl_config_d1 – gpio1_30
  41. Xl_config_d2 – gpio1_29
  42. Xl_config_d3 – gpio1_28
  43. Xl_config_d4 – gpio1_27
  44. Xl_config_d5 – gpio1_26
  45. Xl_config_d6 – gpio1_25
  46. Xl_config_d7 – gpio1_24
  47. Xl_config_d8 – gpio1_23
  48. Xl_config_d9 – gpio1_22
  49. Xl_config_d10 – gpio1_21
  50. Xl_config_d11 – gpio1_20
  51. Xl_config_d12 – gpio1_19
  52. Xl_config_d13 – gpio1_18
  53. Xl_config_d14 – gpio1_16
  54. Xl_config_d15 – gpio1_14
  55. *
  56. */
  57. /*
  58. * program bus width in bytes
  59. */
  60. enum wbus {
  61. bus_1byte = 1,
  62. bus_2byte = 2,
  63. };
  64. #define MAX_WAIT_DONE 10000
  65. struct gpiobus {
  66. int ngpio;
  67. void __iomem *r[4];
  68. };
  69. int xl_supported_prog_bus_width(enum wbus bus_bytes);
  70. void xl_program_b(int32_t i);
  71. void xl_rdwr_b(int32_t i);
  72. void xl_csi_b(int32_t i);
  73. int xl_get_init_b(void);
  74. int xl_get_done_b(void);
  75. void xl_shift_cclk(int count);
  76. void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata);
  77. int xl_init_io(void);