io.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. #define GPDIR 0
  3. #define GPCFG 4 /* open drain or not */
  4. #define GPDAT 8
  5. /*
  6. * gpio port and pin definitions
  7. * NOTE: port number starts from 0
  8. */
  9. #define XL_INITN_PORT 1
  10. #define XL_INITN_PIN 14
  11. #define XL_RDWRN_PORT 1
  12. #define XL_RDWRN_PIN 13
  13. #define XL_CCLK_PORT 1
  14. #define XL_CCLK_PIN 10
  15. #define XL_PROGN_PORT 1
  16. #define XL_PROGN_PIN 25
  17. #define XL_CSIN_PORT 1
  18. #define XL_CSIN_PIN 26
  19. #define XL_DONE_PORT 1
  20. #define XL_DONE_PIN 27
  21. /*
  22. * gpio mapping
  23. *
  24. XL_config_D0 – gpio1_31
  25. Xl_config_d1 – gpio1_30
  26. Xl_config_d2 – gpio1_29
  27. Xl_config_d3 – gpio1_28
  28. Xl_config_d4 – gpio1_27
  29. Xl_config_d5 – gpio1_26
  30. Xl_config_d6 – gpio1_25
  31. Xl_config_d7 – gpio1_24
  32. Xl_config_d8 – gpio1_23
  33. Xl_config_d9 – gpio1_22
  34. Xl_config_d10 – gpio1_21
  35. Xl_config_d11 – gpio1_20
  36. Xl_config_d12 – gpio1_19
  37. Xl_config_d13 – gpio1_18
  38. Xl_config_d14 – gpio1_16
  39. Xl_config_d15 – gpio1_14
  40. *
  41. */
  42. /*
  43. * program bus width in bytes
  44. */
  45. enum wbus {
  46. bus_1byte = 1,
  47. bus_2byte = 2,
  48. };
  49. #define MAX_WAIT_DONE 10000
  50. struct gpiobus {
  51. int ngpio;
  52. void __iomem *r[4];
  53. };
  54. int xl_supported_prog_bus_width(enum wbus bus_bytes);
  55. void xl_program_b(int32_t i);
  56. void xl_rdwr_b(int32_t i);
  57. void xl_csi_b(int32_t i);
  58. int xl_get_init_b(void);
  59. int xl_get_done_b(void);
  60. void xl_shift_cclk(int count);
  61. void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata);
  62. int xl_init_io(void);