26
26
#define ETRAX_FS_r_pe_din 84
27
27
#define ETRAX_FS_rw_pe_oe 88
28
28
29
+ #define ARTPEC3_r_pa_din 0
30
+ #define ARTPEC3_rw_pa_dout 4
31
+ #define ARTPEC3_rw_pa_oe 8
32
+ #define ARTPEC3_r_pb_din 44
33
+ #define ARTPEC3_rw_pb_dout 48
34
+ #define ARTPEC3_rw_pb_oe 52
35
+ #define ARTPEC3_r_pc_din 88
36
+ #define ARTPEC3_rw_pc_dout 92
37
+ #define ARTPEC3_rw_pc_oe 96
38
+ #define ARTPEC3_r_pd_din 116
39
+
29
40
struct etraxfs_gpio_port {
30
41
const char * label ;
31
42
unsigned int oe ;
@@ -82,6 +93,40 @@ static const struct etraxfs_gpio_info etraxfs_gpio_etraxfs = {
82
93
.ports = etraxfs_gpio_etraxfs_ports ,
83
94
};
84
95
96
+ static const struct etraxfs_gpio_port etraxfs_gpio_artpec3_ports [] = {
97
+ {
98
+ .label = "A" ,
99
+ .ngpio = 32 ,
100
+ .oe = ARTPEC3_rw_pa_oe ,
101
+ .dout = ARTPEC3_rw_pa_dout ,
102
+ .din = ARTPEC3_r_pa_din ,
103
+ },
104
+ {
105
+ .label = "B" ,
106
+ .ngpio = 32 ,
107
+ .oe = ARTPEC3_rw_pb_oe ,
108
+ .dout = ARTPEC3_rw_pb_dout ,
109
+ .din = ARTPEC3_r_pb_din ,
110
+ },
111
+ {
112
+ .label = "C" ,
113
+ .ngpio = 16 ,
114
+ .oe = ARTPEC3_rw_pc_oe ,
115
+ .dout = ARTPEC3_rw_pc_dout ,
116
+ .din = ARTPEC3_r_pc_din ,
117
+ },
118
+ {
119
+ .label = "D" ,
120
+ .ngpio = 32 ,
121
+ .din = ARTPEC3_r_pd_din ,
122
+ },
123
+ };
124
+
125
+ static const struct etraxfs_gpio_info etraxfs_gpio_artpec3 = {
126
+ .num_ports = ARRAY_SIZE (etraxfs_gpio_artpec3_ports ),
127
+ .ports = etraxfs_gpio_artpec3_ports ,
128
+ };
129
+
85
130
static int etraxfs_gpio_of_xlate (struct gpio_chip * gc ,
86
131
const struct of_phandle_args * gpiospec ,
87
132
u32 * flags )
@@ -101,6 +146,10 @@ static const struct of_device_id etraxfs_gpio_of_table[] = {
101
146
.compatible = "axis,etraxfs-gio" ,
102
147
.data = & etraxfs_gpio_etraxfs ,
103
148
},
149
+ {
150
+ .compatible = "axis,artpec3-gio" ,
151
+ .data = & etraxfs_gpio_artpec3 ,
152
+ },
104
153
{},
105
154
};
106
155
@@ -133,14 +182,19 @@ static int etraxfs_gpio_probe(struct platform_device *pdev)
133
182
for (i = 0 ; i < info -> num_ports ; i ++ ) {
134
183
struct bgpio_chip * bgc = & chips [i ];
135
184
const struct etraxfs_gpio_port * port = & info -> ports [i ];
185
+ unsigned long flags = BGPIOF_READ_OUTPUT_REG_SET ;
186
+ void __iomem * dat = regs + port -> din ;
187
+ void __iomem * set = regs + port -> dout ;
188
+ void __iomem * dirout = regs + port -> oe ;
189
+
190
+ if (dirout == set ) {
191
+ dirout = set = NULL ;
192
+ flags = BGPIOF_NO_OUTPUT ;
193
+ }
136
194
137
195
ret = bgpio_init (bgc , dev , 4 ,
138
- regs + port -> din , /* dat */
139
- regs + port -> dout , /* set */
140
- NULL , /* clr */
141
- regs + port -> oe , /* dirout */
142
- NULL , /* dirin */
143
- BGPIOF_READ_OUTPUT_REG_SET );
196
+ dat , set , NULL , dirout , NULL ,
197
+ flags );
144
198
if (ret )
145
199
return ret ;
146
200
0 commit comments