board_bwct.c revision 238189
1155324Simp/*-
2185305Simp * Copyright (c) 2005-2008 Olivier Houchard.  All rights reserved.
3185305Simp * Copyright (c) 2005-2008 Warner Losh.  All rights reserved.
4155324Simp *
5155324Simp * Redistribution and use in source and binary forms, with or without
6155324Simp * modification, are permitted provided that the following conditions
7155324Simp * are met:
8155324Simp * 1. Redistributions of source code must retain the above copyright
9155324Simp *    notice, this list of conditions and the following disclaimer.
10155324Simp * 2. Redistributions in binary form must reproduce the above copyright
11155324Simp *    notice, this list of conditions and the following disclaimer in the
12155324Simp *    documentation and/or other materials provided with the distribution.
13155324Simp *
14185305Simp * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15185305Simp * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16185305Simp * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17185305Simp * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
18185305Simp * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19185305Simp * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20185305Simp * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21155324Simp * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22155324Simp * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23155324Simp * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24155324Simp * SUCH DAMAGE.
25155324Simp */
26155324Simp
27155324Simp#include <sys/cdefs.h>
28155324Simp__FBSDID("$FreeBSD: head/sys/arm/at91/board_bwct.c 238189 2012-07-07 05:02:39Z imp $");
29155324Simp#include <sys/param.h>
30155324Simp#include <sys/systm.h>
31155324Simp
32238189Simp#include <machine/board.h>
33185305Simp#include <arm/at91/at91board.h>
34155324Simp#include <arm/at91/at91rm92reg.h>
35160363Simp#include <arm/at91/at91_piovar.h>
36160363Simp#include <arm/at91/at91_pio_rm9200.h>
37155324Simp
38238189SimpBOARD_INIT long
39160363Simpboard_init(void)
40160363Simp{
41160363Simp	/*
42174880Sstas	 * Since the USART supports RS-485 multidrop mode, it allows the
43160363Simp	 * TX pins to float.  However, for RS-232 operations, we don't want
44160363Simp	 * these pins to float.  Instead, they should be pulled up to avoid
45160363Simp	 * mismatches.  Linux does something similar when it configures the
46160363Simp	 * TX lines.  This implies that we also allow the RX lines to float
47160363Simp	 * rather than be in the state they are left in by the boot loader.
48160363Simp	 * Since they are input pins, I think that this is the right thing
49160363Simp	 * to do.
50160363Simp	 */
51160363Simp
52160363Simp	/* PIOA's A periph: Turn USART 0 and 2's TX/RX pins */
53160363Simp	at91_pio_use_periph_a(AT91RM92_PIOA_BASE,
54160363Simp	    AT91C_PA18_RXD0 | AT91C_PA22_RXD2, 0);
55160363Simp	at91_pio_use_periph_a(AT91RM92_PIOA_BASE,
56160363Simp	    AT91C_PA17_TXD0 | AT91C_PA23_TXD2, 1);
57160363Simp	/* PIOA's B periph: Turn USART 3's TX/RX pins */
58160363Simp	at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA6_RXD3, 0);
59160363Simp	at91_pio_use_periph_b(AT91RM92_PIOA_BASE, AT91C_PA5_TXD3, 1);
60160363Simp	/* PIOB's A periph: Turn USART 1's TX/RX pins */
61160363Simp	at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB21_RXD1, 0);
62160363Simp	at91_pio_use_periph_a(AT91RM92_PIOB_BASE, AT91C_PB20_TXD1, 1);
63160363Simp
64160363Simp	/* Pin assignment */
65160363Simp
66185305Simp	return (at91_ramsize());
67160363Simp}
68238189Simp
69238189SimpARM_BOARD(NONE, "BWCT special");
70