Training courses

Kernel and Embedded Linux

Bootlin training courses

Embedded Linux, kernel,
Yocto Project, Buildroot, real-time,
graphics, boot time, debugging...

Bootlin logo

Elixir Cross Referencer

  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
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
/*	$Id: at91cf.c,v 1.8 2022/09/27 06:34:44 skrll Exp $	*/
/*	$NetBSD: at91cf.c,v 1.8 2022/09/27 06:34:44 skrll Exp $	*/

/*
 * Copyright (c) 2007 Embedtronics Oy. All rights reserved.
 *
 * Based on arch/evbarm/ep93xx/eppcic.c,
 * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: at91cf.c,v 1.8 2022/09/27 06:34:44 skrll Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/kmem.h>
#include <sys/device.h>
#include <sys/kthread.h>
#include <uvm/uvm_param.h>
#include <sys/bus.h>
#include <dev/pcmcia/pcmciareg.h>
#include <dev/pcmcia/pcmciavar.h>
#include <dev/pcmcia/pcmciachip.h>
#include <arm/at91/at91reg.h>
#include <arm/at91/at91var.h>
#include <arm/at91/at91cfvar.h>

#include "at91pio.h"
#if NAT91PIO == 0
#error "at91cf requires at91pio"
#endif

#ifdef AT91CF_DEBUG
int at91cf_debug = AT91CF_DEBUG;
#define DPRINTFN(n,x)	if (at91cf_debug>(n)) printf x;
#else
#define DPRINTFN(n,x)
#endif

struct at91cf_handle {
	struct at91cf_softc	*ph_sc;
	device_t		ph_card;
	int			(*ph_ih_func)(void *);
	void			*ph_ih_arg;
	lwp_t			*ph_event_thread;
	int			ph_type;	/* current access type */
	int			ph_run;		/* kthread running */
	int			ph_width;	/* 8 or 16 */
	int			ph_vcc;		/* 3 or 5 */
	int			ph_status;	/* combined cd1 and cd2 */
	struct {
		bus_size_t	reg;
		bus_addr_t	base;
		bus_size_t	size;
	} ph_space[3];
#define	IO		0
#define	COMMON		1
#define	ATTRIBUTE	2
};

static int at91cf_intr_carddetect(void *);
static int at91cf_intr_socket(void *);
static int at91cf_print(void *, const char *);
static void at91cf_create_event_thread(void *);
static void at91cf_event_thread(void *);
void at91cf_shutdown(void *);

static int at91cf_mem_alloc(pcmcia_chipset_handle_t, bus_size_t,
			    struct pcmcia_mem_handle *);
static void at91cf_mem_free(pcmcia_chipset_handle_t,
			    struct pcmcia_mem_handle *);
static int at91cf_mem_map(pcmcia_chipset_handle_t, int, bus_addr_t, bus_size_t,
			  struct pcmcia_mem_handle *, bus_size_t *, int *);
static void at91cf_mem_unmap(pcmcia_chipset_handle_t, int);
static int at91cf_io_alloc(pcmcia_chipset_handle_t, bus_addr_t, bus_size_t,
			   bus_size_t, struct pcmcia_io_handle *);
static void at91cf_io_free(pcmcia_chipset_handle_t, struct pcmcia_io_handle *);
static int at91cf_io_map(pcmcia_chipset_handle_t, int, bus_addr_t, bus_size_t,
			 struct pcmcia_io_handle *, int *);
static void at91cf_io_unmap(pcmcia_chipset_handle_t, int);
static void *at91cf_intr_establish(pcmcia_chipset_handle_t,
				   struct pcmcia_function *,
				   int, int (*)(void *), void *);
static void at91cf_intr_disestablish(pcmcia_chipset_handle_t, void *);
static void at91cf_socket_enable(pcmcia_chipset_handle_t);
static void at91cf_socket_disable(pcmcia_chipset_handle_t);
static void at91cf_socket_settype(pcmcia_chipset_handle_t, int);

static void at91cf_attach_socket(struct at91cf_handle *);
static void at91cf_config_socket(struct at91cf_handle *);
//static int at91cf_get_voltage(struct at91cf_handle *);

static struct pcmcia_chip_functions at91cf_functions = {
	at91cf_mem_alloc,	at91cf_mem_free,
	at91cf_mem_map,		at91cf_mem_unmap,
	at91cf_io_alloc,	at91cf_io_free,
	at91cf_io_map,		at91cf_io_unmap,
	at91cf_intr_establish,	at91cf_intr_disestablish,
	at91cf_socket_enable,	at91cf_socket_disable,
	at91cf_socket_settype
};

#define	MEMORY_BASE	0
#define	MEMORY_SIZE	0x1000
#define	COMMON_BASE	0x400000
#define	COMMON_SIZE	0x1000
#define	IO_BASE		0x800000
#define	IO_SIZE		0x1000
#define	MIN_SIZE	(IO_BASE + IO_SIZE)

void
at91cf_attach_common(device_t parent, device_t self, void *aux,
		      at91cf_chipset_tag_t cscf)
{
	struct at91cf_softc *sc = device_private(self);
	struct at91bus_attach_args *sa = aux;
	struct at91cf_handle *ph;

	if (sa->sa_size < MIN_SIZE) {
		printf("%s: it's not possible to map registers\n",
		    device_xname(self));
		return;
	}

	sc->sc_dev = self;
	sc->sc_iot = sa->sa_iot;
	sc->sc_cscf = cscf;
	sc->sc_enable = 0;

	if (bus_space_map(sa->sa_iot, sa->sa_addr + MEMORY_BASE,
			  MEMORY_SIZE, 0, &sc->sc_memory_ioh)){
		printf("%s: Cannot map memory space\n", device_xname(self));
		return;
	}

	if (bus_space_map(sa->sa_iot, sa->sa_addr + COMMON_BASE,
			  COMMON_SIZE, 0, &sc->sc_common_ioh)){
		printf("%s: Cannot map common memory space\n",
		    device_xname(self));
		bus_space_unmap(sa->sa_iot, sc->sc_memory_ioh, MEMORY_SIZE);
		return;
	}

	if (bus_space_map(sa->sa_iot, sa->sa_addr + IO_BASE,
			  IO_SIZE, 0, &sc->sc_io_ioh)){
		printf("%s: Cannot map I/O space\n", device_xname(self));
		bus_space_unmap(sa->sa_iot, sc->sc_memory_ioh, MEMORY_SIZE);
		bus_space_unmap(sa->sa_iot, sc->sc_common_ioh, COMMON_SIZE);
		return;
	}

	printf("\n");

	/* socket 0 */
	ph = kmem_zalloc(sizeof(*ph), KM_SLEEP);
	sc->sc_ph = ph;
	ph->ph_sc = sc;
	ph->ph_space[IO].base = sa->sa_addr + IO_BASE;
	ph->ph_space[IO].size = IO_SIZE;
	ph->ph_space[COMMON].base = sa->sa_addr + COMMON_BASE;
	ph->ph_space[COMMON].size = COMMON_SIZE;
	ph->ph_space[ATTRIBUTE].base = sa->sa_addr + MEMORY_BASE;
	ph->ph_space[ATTRIBUTE].size = MEMORY_SIZE;
	at91cf_attach_socket(ph);

	// @@@ reset CF now? @@@@

	at91cf_config_socket(sc->sc_ph);
}

static void
at91cf_attach_socket(struct at91cf_handle *ph)
{
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	int wait;

	ph->ph_width = 16;
	ph->ph_vcc = 3;
	ph->ph_event_thread = NULL;
	ph->ph_run = 0;
	ph->ph_ih_func = NULL;
	ph->ph_ih_arg = NULL;

	ph->ph_status = (*cscf->card_detect)(sc);

	wait = (cscf->power_ctl)(sc, POWER_OFF);
	delay(wait);
	wait = (cscf->power_ctl)(sc, POWER_ON);
	delay(wait);
}

static void
at91cf_config_socket(struct at91cf_handle *ph)
{
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	struct pcmciabus_attach_args paa;
	int wait;

	paa.paa_busname = "pcmcia";
	paa.pct = (pcmcia_chipset_tag_t)&at91cf_functions;
	paa.pch = (pcmcia_chipset_handle_t)ph;
	ph->ph_card = config_found(sc->sc_dev, &paa, at91cf_print, CFARGS_NONE);

	(*cscf->intr_establish)(sc, CD_IRQ, IPL_BIO, at91cf_intr_carddetect, ph);
	wait = (*cscf->power_ctl)(sc, POWER_OFF);
	delay(wait);

	kthread_create(PRI_NONE, 0, NULL, at91cf_create_event_thread, ph,
	    &ph->ph_event_thread, "%s", device_xname(sc->sc_dev));
}

static int     
at91cf_print(void *arg, const char *pnp)
{                       
	return (UNCONF);
}       

static void
at91cf_create_event_thread(void *arg)
{
	struct at91cf_handle *ph = arg;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;

	ph->ph_status = (*cscf->card_detect)(sc);

	DPRINTFN(1, ("at91cf_create_event_thread: status=%d\n", ph->ph_status));

	if (ph->ph_status)
		pcmcia_card_attach(ph->ph_card);

	ph->ph_run = 1;
	kthread_create(PRI_NONE, 0, NULL, at91cf_event_thread, ph,
	    &ph->ph_event_thread, "%s", device_xname(sc->sc_dev));
}

static void
at91cf_event_thread(void *arg)
{
	struct at91cf_handle *ph = arg;
	int status;

	for (;;) {
		status = ph->ph_status;
		tsleep(ph, PWAIT, "CSC wait", 0);
		if (!ph->ph_run)
			break;

		DPRINTFN(1, ("at91cf_event_thread: old status=%d, new status=%d\n", status, ph->ph_status));

		if (!status && ph->ph_status)
			pcmcia_card_attach(ph->ph_card);
		else if (status && !ph->ph_status)
			pcmcia_card_detach(ph->ph_card, DETACH_FORCE);
	}

	DPRINTFN(1, ("at91cf_event_thread: run=%d\n",ph->ph_run));
	ph->ph_event_thread = NULL;
	kthread_exit(0);
}

void
at91cf_shutdown(void *arg)
{
	struct at91cf_handle *ph = arg;

	DPRINTFN(1, ("at91cf_shutdown\n"));
	ph->ph_run = 0;
	wakeup(ph);
}

static int
at91cf_intr_carddetect(void *arg)
{
	struct at91cf_handle *ph = arg;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	int nstatus;

	nstatus = (*cscf->card_detect)(sc);

	DPRINTFN(1, ("at91cf_intr: nstatus=%#x, ostatus=%#x\n", nstatus, ph->ph_status));

	if (nstatus != ph->ph_status) {
		ph->ph_status = nstatus;
		wakeup(ph);
	}

	return 0;
}

static int
at91cf_mem_alloc(pcmcia_chipset_handle_t pch, bus_size_t size,
		 struct pcmcia_mem_handle *pmh)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;

	DPRINTFN(1, ("at91cf_mem_alloc: size=%#x\n",(unsigned)size));

	pmh->memt = sc->sc_iot;
	return 0;
}

static void
at91cf_mem_free(pcmcia_chipset_handle_t pch, struct pcmcia_mem_handle *pmh)
{
	DPRINTFN(1, ("at91cf_mem_free\n"));
}

static int
at91cf_mem_map(pcmcia_chipset_handle_t pch, int kind, bus_addr_t addr,
	       bus_size_t size, struct pcmcia_mem_handle *pmh,
	       bus_size_t *offsetp, int *windowp)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;
	bus_addr_t pa;
	int err;

	DPRINTFN(1, ("at91cf_mem_map: kind=%d, addr=%#x, size=%#x\n",kind,(unsigned)addr,(unsigned)size));

	pa = addr;
	*offsetp = 0;
	size = round_page(size);
	pmh->realsize = size;
	if (kind & PCMCIA_WIDTH_MEM8)
		ph->ph_width = 8;
	else
		ph->ph_width = 16;
	switch (kind & ~PCMCIA_WIDTH_MEM_MASK) {
	case PCMCIA_MEM_ATTR:
		pa += ph->ph_space[ATTRIBUTE].base;
		break;
	case PCMCIA_MEM_COMMON:
		pa += ph->ph_space[COMMON].base;
		break;
	default:
		return -1;
	}

	DPRINTFN(1, ("at91cf_mem_map: pa=%#x, *offsetp=%#x, size=%#x\n",(unsigned)pa,(unsigned)addr,(unsigned)size));

	if (!(err = bus_space_map(sc->sc_iot, pa, size, 0, &pmh->memh)))
		*windowp = (int)pmh->memh;
	return err;
}

static void
at91cf_mem_unmap(pcmcia_chipset_handle_t pch, int window)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;

	DPRINTFN(1, ("at91cf_mem_unmap: window=%#x\n",window));

	bus_space_unmap(sc->sc_iot, (bus_addr_t)window, 0x1000);
}

static int
at91cf_io_alloc(pcmcia_chipset_handle_t pch, bus_addr_t start, bus_size_t size,
		bus_size_t align, struct pcmcia_io_handle *pih)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;
	bus_addr_t pa;

	DPRINTFN(1, ("at91cf_io_alloc: start=%#x, size=%#x, align=%#x\n",(unsigned)start,(unsigned)size,(unsigned)align));

	pih->iot = sc->sc_iot;
	pih->addr = start;
	pih->size = size;
	pa = pih->addr + ph->ph_space[IO].base;
	return bus_space_map(sc->sc_iot, pa, size, 0, &pih->ioh);
}

static void
at91cf_io_free(pcmcia_chipset_handle_t pch, struct pcmcia_io_handle *pih)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;

	DPRINTFN(1, ("at91cf_io_free\n"));

	bus_space_unmap(sc->sc_iot, pih->ioh, pih->size);
}

static int
at91cf_io_map(pcmcia_chipset_handle_t pch, int width, bus_addr_t offset,
	      bus_size_t size, struct pcmcia_io_handle *pih, int *windowp)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;

	DPRINTFN(1, ("at91cf_io_map: offset=%#x, size=%#x, width=%d",(unsigned)offset,(unsigned)size,width));

	switch (width) {
	case PCMCIA_WIDTH_IO8:
		DPRINTFN(1, ("(8bit)\n"));
		ph->ph_width = 8;
		break;
	case PCMCIA_WIDTH_IO16:
	case PCMCIA_WIDTH_AUTO:	/* I don't understand how I check it */
		DPRINTFN(1, ("(16bit)\n"));
		ph->ph_width = 16;
		break;
	default:
		DPRINTFN(1, ("(unknown)\n"));
		return -1;
	}
	*windowp = 0; /* unused */
	return 0;
}

static void
at91cf_io_unmap(pcmcia_chipset_handle_t pch, int window)
{
	DPRINTFN(1, ("at91cf_io_unmap: window=%#x\n",window));
}

static void *
at91cf_intr_establish(pcmcia_chipset_handle_t pch, struct pcmcia_function *pf,
		      int ipl, int (*ih_func)(void *), void *ih_arg)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;

	DPRINTFN(1, ("at91cf_intr_establish\n"));

	if (ph->ph_ih_func)
		return 0;

	ph->ph_ih_func = ih_func;
	ph->ph_ih_arg = ih_arg;

	return (*cscf->intr_establish)(sc, CF_IRQ, ipl, at91cf_intr_socket, ph);
//	return (*cscf->intr_establish)(sc, CF_IRQ, ipl, ih_func, ih_arg);
}

static void
at91cf_intr_disestablish(pcmcia_chipset_handle_t pch, void *ih)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;

	DPRINTFN(1, ("at91cf_intr_disestablish\n"));

	ph->ph_ih_func = NULL;
	ph->ph_ih_arg = NULL;

	(*cscf->intr_disestablish)(sc, CF_IRQ, ih);
}

static int
at91cf_intr_socket(void *arg)
{
	struct at91cf_handle *ph = arg;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	int err = 0, irq;

	if (ph->ph_ih_func) {
		irq = (*cscf->irq_line)(sc);
		if (ph->ph_type == PCMCIA_IFTYPE_IO)
			irq = !irq;
		if (irq)
			err = (*ph->ph_ih_func)(ph->ph_ih_arg);
		else
			DPRINTFN(2,("%s: other edge ignored\n", __FUNCTION__));
	}

	return err;
}

static void
at91cf_socket_enable(pcmcia_chipset_handle_t pch)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	int wait;

	DPRINTFN(1, ("at91cf_socket_enable\n"));

	wait = (cscf->power_ctl)(sc, POWER_ON);
	delay(wait);
}

static void
at91cf_socket_disable(pcmcia_chipset_handle_t pch)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	int wait;

	DPRINTFN(1, ("at91cf_socket_disable\n"));

	wait = (cscf->power_ctl)(sc, POWER_OFF);
	delay(wait);
}

static void
at91cf_socket_settype(pcmcia_chipset_handle_t pch, int type)
{
	struct at91cf_handle *ph = (struct at91cf_handle *)pch;

	DPRINTFN(1, ("at91cf_socket_settype: type=%d",type));

	ph->ph_type = type;

	switch (type) {
	case PCMCIA_IFTYPE_MEMORY:
		DPRINTFN(1, ("(Memory)\n"));
		break;
	case PCMCIA_IFTYPE_IO:
		DPRINTFN(1, ("(I/O)\n"));
		break;
	default:
		DPRINTFN(1, ("(unknown)\n"));
		return;
	}
}

#if 0
static int
at91cf_get_voltage(struct at91cf_handle *ph)
{
	struct at91cf_softc *sc = ph->ph_sc;
	at91cf_chipset_tag_t cscf = sc->sc_cscf;
	int cap, vcc = 0;

	cap = (cscf->power_capability)(sc);
	if (eppio_read(sc->sc_pio, ph->ph_port, ph->ph_vs[0])) {
		if (cap | VCC_5V)
			vcc = 5;
		else
			printf("%s: unsupported Vcc 5 Volts",
			       device_xname(sc->sc_dev));
	} else {
		if (cap | VCC_3V)
			vcc = 3;
		else
			printf("%s: unsupported Vcc 3.3 Volts",
			       device_xname(sc->sc_dev));
	}
	DPRINTFN(1, ("at91cf_get_voltage: vs1=%d, vs2=%d (%dV)\n",eppio_read_bit(sc->sc_pio, ph->ph_port, ph->ph_vs[0]),eppio_read_bit(sc->sc_pio, ph->ph_port, ph->ph_vs[1]),vcc));
	return vcc;
}

#endif