4 * Copyright (c) 2005 HAMAJIMA Katsuomi. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include <sys/cdefs.h>
29 __KERNEL_RCSID(0, "$NetBSD$");
31 #include <sys/param.h>
32 #include <sys/systm.h>
33 #include <sys/kernel.h>
34 #include <sys/device.h>
35 #include <arm/ep93xx/epsocvar.h>
36 #include <arm/ep93xx/epgpiovar.h>
37 #include <arm/ep93xx/eppcicvar.h>
40 int armadillo9pcic_debug
= A9PCIC_DEBUG
;
41 #define DPRINTFN(n,x) if (armadillo9pcic_debug>(n)) printf x;
46 struct armadillo9pcic_softc
{
47 struct eppcic_softc sc_dev
;
50 static int armadillo9pcic_match(struct device
*, struct cfdata
*, void *);
51 static void armadillo9pcic_attach(struct device
*, struct device
*, void *);
53 CFATTACH_DECL(armadillo9pcic
, sizeof(struct armadillo9pcic_softc
),
54 armadillo9pcic_match
, armadillo9pcic_attach
, NULL
, NULL
);
56 static int armadillo9pcic_card_mode(void *, int);
57 static int armadillo9pcic_power_capability(void *, int);
58 static int armadillo9pcic_power_ctl(void *, int, int);
60 struct eppcic_chipset_tag armadillo9pcic_tag
= {
61 armadillo9pcic_card_mode
,
62 armadillo9pcic_power_capability
,
63 armadillo9pcic_power_ctl
67 armadillo9pcic_match(struct device
*parent
, struct cfdata
*match
, void *aux
)
73 armadillo9pcic_attach(struct device
*parent
, struct device
*self
, void *aux
)
75 struct epsoc_attach_args
*sa
= aux
;
77 epgpio_out(sa
->sa_gpio
, PORT_A
, 3);
78 eppcic_attach_common(parent
, self
, aux
, &armadillo9pcic_tag
);
82 armadillo9pcic_card_mode(void *self
, int socket
)
91 armadillo9pcic_power_capability(void *self
, int socket
)
101 armadillo9pcic_power_ctl(void *self
, int socket
, int onoff
)
103 struct eppcic_softc
*sc
= (struct eppcic_softc
*)self
;
105 DPRINTFN(1, ("armadillo9pcic_power_ctl: %s\n",onoff
?"on":"off"));
108 epgpio_clear(sc
->sc_gpio
, PORT_A
, 3);
110 epgpio_set(sc
->sc_gpio
, PORT_A
, 3);