summaryrefslogtreecommitdiff
path: root/io-module/mtr2d2.c
blob: b2fc03f34586536e4a7a49e67ac47865f541d758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349

static struct gpio_pin gpio_pins_mtr2d2_0_0[] = {
	{
		.name = "RADIO_RESET",
		.pin = {
			.gpio = AT91_PIN_PC5,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "radio-reset",
		},
	},
	{
		.name = "RADIO_RESET",
		.pin = {
			.gpio = AT91_PIN_PC5,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "radio-power",
		},
	},
	{
		.name = "DEVICE_RESET",
		.pin = {
			.gpio = AT91_PIN_PC4,
			.flags = GPIOF_IN,
			.label = "reset",
		},
		.active_low = 1,
	},
	{
		.name = "LS_LED",
		.pin = {
			.gpio = AT91_PIN_PA14,
#if LED_LS_CONTROLLABLE
			.flags = GPIOF_OUT_INIT_HIGH,
#else
			.flags = GPIOF_IN,
#endif
			.label = "led-ls",
		},
		.active_low = 1,
	},
	{
		.name = "STATUS_LED",
		.pin = {
			.gpio = AT91_PIN_PA24,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "led-status",
		},
		.active_low = 1,
	},
	{
		.name = "STATUS_LED",
		.pin = {
			.gpio = AT91_PIN_PA24,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "led-a",
		},
		.active_low = 1,
	},
	{
		.name = "LED7",
		.pin = {
			.gpio = AT91_PIN_PA25,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-cd",
		},
		.active_low = 1,
	},
	{
		.name = "LED7",
		.pin = {
			.gpio = AT91_PIN_PA25,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-c",
		},
		.active_low = 1,
	},
	{
		.name = "LED10",
		.pin = {
			.gpio = AT91_PIN_PA26,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-sig1",
		},
		.active_low = 1,
	},
	{
		.name = "LED10",
		.pin = {
			.gpio = AT91_PIN_PA26,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-d",
		},
		.active_low = 1,
	},
	{
		.name = "LED11",
		.pin = {
			.gpio = AT91_PIN_PA27,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-sig2",
		},
		.active_low = 1,
	},
	{
		.name = "LED11",
		.pin = {
			.gpio = AT91_PIN_PA27,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-e",
		},
		.active_low = 1,
	},
	{
		.name = "LED12",
		.pin = {
			.gpio = AT91_PIN_PA28,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-sig3",
		},
		.active_low = 1,
	},
	{
		.name = "LED12",
		.pin = {
			.gpio = AT91_PIN_PA28,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-f",
		},
		.active_low = 1,
	},
	{
		.name = "LED13",
		.pin = {
			.gpio = AT91_PIN_PA29,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-wifi",
		},
		.active_low = 1,
	},
	{
		.name = "LED13",
		.pin = {
			.gpio = AT91_PIN_PA29,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "led-b",
		},
		.active_low = 1,
	},

	// gpio pins for Accessory Card 1
	{
		.name = "AP1_RESET",
		.pin = {
			.gpio = AT91_PIN_PB12,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "ap1-reset",
		}
	},
	{
		.name = "AP1_GPIO1",
		.pin = {
			.gpio = AT91_PIN_PC6,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap1-gpio1",
		},
		.active_low = 1,
	},
	{
		.name = "AP1_GPIO2",
		.pin = {
			.gpio = AT91_PIN_PC7,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap1-gpio2",
		}
	},
	{
		.name = "AP1_GPIO3",
		.pin = {
			.gpio = AT91_PIN_PC8,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap1-gpio3",
		}
	},
	{
		.name = "AP1_GPIO4",
		.pin = {
			.gpio = AT91_PIN_PC9,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap1-gpio4",
		}
	},
	{
		.name = "AP1_INTERRUPT1",
		.pin = {
			.gpio = AT91_PIN_PB14,
			.flags = GPIOF_IN,
			.label = "ap1-interrupt1",
		}
	},
	{
		.name = "AP1_INTERRUPT2",
		.pin = {
			.gpio = AT91_PIN_PB15,
			.flags = GPIOF_IN,
			.label = "ap1-interrupt2",
		}
	},

	// gpio pins for Accessory Card 2
	{
		.name = "AP2_RESET",
		.pin = {
			.gpio = AT91_PIN_PB13,
			.flags = GPIOF_OUT_INIT_HIGH,
			.label = "ap2-reset",
		}
	},
	{
		.name = "AP2_GPIO1",
		.pin = {
			.gpio = AT91_PIN_PC20,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap2-gpio1",
		},
		.active_low = 1,
	},
	{
		.name = "AP2_GPIO2",
		.pin = {
			.gpio = AT91_PIN_PC21,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap2-gpio2",
		}
	},
	{
		.name = "AP2_GPIO3",
		.pin = {
			.gpio = AT91_PIN_PC22,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap2-gpio3",
		}
	},
	{
		.name = "AP2_GPIO4",
		.pin = {
			.gpio = AT91_PIN_PC23,
			.flags = GPIOF_OUT_INIT_LOW,
			.label = "ap2-gpio4",
		}
	},
	{
		.name = "AP2_INTERRUPT1",
		.pin = {
			.gpio = AT91_PIN_PB17,
			.flags = GPIOF_IN,
			.label = "ap2-interrupt1",
		}
	},
	{
		.name = "AP2_INTERRUPT2",
		.pin = {
			.gpio = AT91_PIN_PB18,
			.flags = GPIOF_IN,
			.label = "ap2-interrupt2",
		}
	},

	{ },
};

static int mtr2d2_platform_attributes_size = 64;		// not including NULL at end

static struct attribute *mtr2d2_platform_attributes[] = {
	&dev_attr_vendor_id.attr,
	&dev_attr_product_id.attr,
	&dev_attr_device_id.attr,
	&dev_attr_hw_version.attr,
	&dev_attr_imei.attr,
	&dev_attr_eth_mac.attr,
	&dev_attr_reset.attr,
	&dev_attr_reset_monitor.attr,
	&dev_attr_radio_power.attr,
	&dev_attr_radio_reset.attr,

	&dev_attr_led_status.attr,
	&dev_attr_led_wifi_gpio.attr,
	&dev_attr_led_cd_gpio.attr,
	&dev_attr_led_sig1_gpio.attr,
	&dev_attr_led_sig2_gpio.attr,
	&dev_attr_led_sig3_gpio.attr,

	&dev_attr_led_a_gpio.attr,
	&dev_attr_led_b_gpio.attr,
	&dev_attr_led_c_gpio.attr,
	&dev_attr_led_d_gpio.attr,
	&dev_attr_led_e_gpio.attr,
	&dev_attr_led_f_gpio.attr,

	&dev_attr_board_temperature.attr,

	/* extra space for the accessory card attributes */
	NULL,	    // index 23
	NULL,	    // index 24
	NULL,	    // index 25
	NULL,	    // index 26
	NULL,	    // index 27
	NULL,	    // index 28
	NULL,	    // index 29
	NULL,	    // index 30
	NULL,	    // index 31
	NULL,	    // index 32
	NULL,	    // index 33
	NULL,	    // index 34
	NULL,	    // index 35
	NULL,	    // index 36
	NULL,	    // index 37
	NULL,	    // index 38
	NULL,	    // index 39
	NULL,	    // index 40
	NULL,	    // index 41
	NULL,	    // index 42
	NULL,	    // index 43
	NULL,	    // index 44
	NULL,	    // index 45
	NULL,	    // index 46
	NULL,	    // index 47
	NULL,	    // index 48
	NULL,	    // index 49
	NULL,	    // index 50
	NULL,	    // index 51
	NULL,	    // index 52
	NULL,	    // index 53
	NULL,	    // index 54
	NULL,	    // index 55
	NULL,	    // index 56
	NULL,	    // index 57
	NULL,	    // index 58
	NULL,	    // index 59
	NULL,	    // index 60
	NULL,	    // index 61
	NULL,	    // index 62
	NULL,	    // index 63
	NULL,	    // index 64
	NULL,
};

static struct attribute_group mtr2d2_platform_attribute_group = {
	.attrs = mtr2d2_platform_attributes
};