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