• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
18 #define GPDIR	0
19 #define GPCFG	4	/* open drain or not */
20 #define GPDAT	8
21 
22 /*
23  * gpio port and pin definitions
24  * NOTE: port number starts from 0
25  */
26 #define	XL_INITN_PORT	1
27 #define	XL_INITN_PIN	14
28 #define	XL_RDWRN_PORT	1
29 #define	XL_RDWRN_PIN	13
30 #define	XL_CCLK_PORT	1
31 #define	XL_CCLK_PIN	10
32 #define	XL_PROGN_PORT	1
33 #define	XL_PROGN_PIN	25
34 #define	XL_CSIN_PORT	1
35 #define	XL_CSIN_PIN	26
36 #define	XL_DONE_PORT	1
37 #define	XL_DONE_PIN	27
38 
39 /*
40  * gpio mapping
41  *
42 	XL_config_D0 – gpio1_31
43 	Xl_config_d1 – gpio1_30
44 	Xl_config_d2 – gpio1_29
45 	Xl_config_d3 – gpio1_28
46 	Xl_config_d4 – gpio1_27
47 	Xl_config_d5 – gpio1_26
48 	Xl_config_d6 – gpio1_25
49 	Xl_config_d7 – gpio1_24
50 	Xl_config_d8 – gpio1_23
51 	Xl_config_d9 – gpio1_22
52 	Xl_config_d10 – gpio1_21
53 	Xl_config_d11 – gpio1_20
54 	Xl_config_d12 – gpio1_19
55 	Xl_config_d13 – gpio1_18
56 	Xl_config_d14 – gpio1_16
57 	Xl_config_d15 – gpio1_14
58 *
59 */
60 
61 /*
62  * program bus width in bytes
63  */
64 enum wbus {
65 	bus_1byte	= 1,
66 	bus_2byte	= 2,
67 };
68 
69 
70 #define MAX_WAIT_DONE	10000
71 
72 
73 struct gpiobus {
74 	int	ngpio;
75 	void __iomem *r[4];
76 };
77 
78 int xl_supported_prog_bus_width(enum wbus bus_bytes);
79 
80 void xl_program_b(int32_t i);
81 void xl_rdwr_b(int32_t i);
82 void xl_csi_b(int32_t i);
83 
84 int xl_get_init_b(void);
85 int xl_get_done_b(void);
86 
87 void xl_shift_cclk(int count);
88 void xl_shift_bytes_out(enum wbus bus_byte, unsigned char *pdata);
89 
90 int xl_init_io(void);
91