1 /* $NetBSD: armadillo9_com.c,v 1.2 2006/02/13 12:24:21 hamajima Exp $ */
4 * Ichiro FUKUHARA <ichiro@ichiro.org>.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY ICHIRO FUKUHARA ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: armadillo9_com.c,v 1.2 2006/02/13 12:24:21 hamajima Exp $");
32 /* Front-end of epcom */
34 #include <sys/types.h>
35 #include <sys/device.h>
36 #include <sys/systm.h>
37 #include <sys/param.h>
38 #include <sys/malloc.h>
40 #include <sys/termios.h>
42 #include <machine/intr.h>
43 #include <machine/bus.h>
45 #include <arm/ep93xx/epcomreg.h>
46 #include <arm/ep93xx/epcomvar.h>
47 #include <arm/ep93xx/ep93xxreg.h>
48 #include <arm/ep93xx/ep93xxvar.h>
49 #include <arm/ep93xx/epsocvar.h>
52 #include <arm/ep93xx/epledvar.h>
54 #include <evbarm/armadillo/armadillo9var.h>
56 static int armadillo9com_match(struct device
*, struct cfdata
*, void *);
57 static void armadillo9com_attach(struct device
*, struct device
*, void *);
58 static int armadillo9com_intr(void *);
60 CFATTACH_DECL(armadillo9com
, sizeof(struct epcom_softc
),
61 armadillo9com_match
, armadillo9com_attach
, NULL
, NULL
);
64 armadillo9com_match(struct device
*parent
, struct cfdata
*match
, void *aux
)
66 if (strcmp(match
->cf_name
, "epcom") == 0)
72 armadillo9com_attach(struct device
*parent
, struct device
*self
, void *aux
)
74 struct epcom_softc
*sc
= (struct epcom_softc
*)self
;
75 struct epsoc_attach_args
*sa
= aux
;
77 bus_space_handle_t ioh
;
79 sc
->sc_iot
= sa
->sa_iot
;
80 sc
->sc_hwbase
= sa
->sa_addr
;
84 bus_space_map(sa
->sa_iot
, sa
->sa_addr
, sa
->sa_size
, 0, &sc
->sc_ioh
);
86 bus_space_map(sa
->sa_iot
, EP93XX_APB_HWBASE
+ EP93XX_APB_SYSCON
,
87 EP93XX_APB_SYSCON_SIZE
, 0, &ioh
);
88 pwrcnt
= bus_space_read_4(sa
->sa_iot
, ioh
, EP93XX_SYSCON_PwrCnt
);
89 pwrcnt
&= ~(PwrCnt_UARTBAUD
);
90 bus_space_write_4(sa
->sa_iot
, ioh
, EP93XX_SYSCON_PwrCnt
, pwrcnt
);
91 bus_space_unmap(sa
->sa_iot
, ioh
, EP93XX_APB_SYSCON_SIZE
);
93 epcom_attach_subr(sc
);
94 ep93xx_intr_establish(sa
->sa_intr
, IPL_SERIAL
, armadillo9com_intr
, sc
);
96 if (armadillo_model
->devcfg
== DEVCFG_ARMADILLO210
)
102 armadillo9com_intr(void *arg
)
107 if (armadillo_model
->devcfg
== DEVCFG_ARMADILLO210
)
112 if (armadillo_model
->devcfg
== DEVCFG_ARMADILLO210
)