1235348Smarius/*-
2235348Smarius * Copyright (c) 2012 Marius Strobl <marius@FreeBSD.org>
3235348Smarius * All rights reserved.
4235348Smarius *
5235348Smarius * Redistribution and use in source and binary forms, with or without
6235348Smarius * modification, are permitted provided that the following conditions
7235348Smarius * are met:
8235348Smarius * 1. Redistributions of source code must retain the above copyright
9235348Smarius *    notice, this list of conditions and the following disclaimer.
10235348Smarius * 2. Redistributions in binary form must reproduce the above copyright
11235348Smarius *    notice, this list of conditions and the following disclaimer in the
12235348Smarius *    documentation and/or other materials provided with the distribution.
13235348Smarius *
14235348Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15235348Smarius * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16235348Smarius * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17235348Smarius * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18235348Smarius * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19235348Smarius * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20235348Smarius * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21235348Smarius * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22235348Smarius * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23235348Smarius * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24235348Smarius * SUCH DAMAGE.
25235348Smarius */
26235348Smarius
27235348Smarius/*
28235348Smarius * Ethernut 5 board support
29235348Smarius */
30235348Smarius
31235348Smarius#include <sys/cdefs.h>
32235348Smarius__FBSDID("$FreeBSD: releng/11.0/sys/arm/at91/board_ethernut5.c 238442 2012-07-14 06:00:37Z imp $");
33235348Smarius
34235348Smarius#include <sys/param.h>
35235348Smarius#include <sys/systm.h>
36238189Simp#include <machine/board.h>
37235348Smarius#include <arm/at91/at91_pioreg.h>
38235348Smarius#include <arm/at91/at91_piovar.h>
39235348Smarius#include <arm/at91/at91board.h>
40235348Smarius#include <arm/at91/at91sam9260reg.h>
41235348Smarius
42238189SimpBOARD_INIT long
43235348Smariusboard_init(void)
44235348Smarius{
45235348Smarius
46235348Smarius	/*
47235348Smarius	 * DBGU
48235348Smarius	 */
49235348Smarius	/* DRXD */
50235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB14, 0);
51235348Smarius	/* DTXD */
52235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB15, 1);
53235348Smarius
54235348Smarius	/*
55235348Smarius	 * EMAC
56235348Smarius	 */
57235348Smarius	/* ETX0 */
58235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA12, 0);
59235348Smarius	/* ETX1 */
60235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA13, 0);
61235348Smarius	/* ERX0 */
62235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA14, 0);
63235348Smarius	/* ERX1 */
64235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA15, 0);
65235348Smarius	/* ETXEN */
66235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA16, 0);
67235348Smarius	/* ERXDV */
68235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA17, 0);
69235348Smarius	/* ERXER */
70235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA18, 0);
71235348Smarius	/* ETXCK */
72235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA19, 0);
73235348Smarius	/* EMDC */
74235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA20, 0);
75235348Smarius	/* EMDIO */
76235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA21, 0);
77235348Smarius
78235348Smarius	/*
79235348Smarius	 * MMC
80235348Smarius	 */
81235348Smarius	/* MCDA0 */
82235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA6, 1);
83235348Smarius	/* MCCDA */
84235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA7, 1);
85235348Smarius	/* MCCK */
86235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA8, 1);
87235348Smarius	/* MCDA1 */
88235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA9, 1);
89235348Smarius	/* MCDA2 */
90235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA10, 1);
91235348Smarius	/* MCDA3 */
92235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA11, 1);
93235348Smarius
94235348Smarius	/*
95235348Smarius	 * SPI0
96235348Smarius	 */
97235348Smarius	/* MISO */
98235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA0, 0);
99235348Smarius	/* MOSI */
100235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA1, 0);
101235348Smarius	/* SPCK */
102235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA2, 0);
103235348Smarius	/* NPCS0 */
104235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA3, 0);
105235348Smarius
106235348Smarius	/*
107235348Smarius	 * TWI
108235348Smarius	 */
109235348Smarius	/* TWD */
110235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA23, 1);
111235348Smarius	/* TWCK */
112235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA24, 1);
113235348Smarius
114235348Smarius	/*
115235348Smarius	 * USART0
116235348Smarius	 */
117235348Smarius	/* TXD0 */
118235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB4, 1);
119235348Smarius	/* RXD0 */
120235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB5, 0);
121235348Smarius	/* DSR0 */
122235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB22, 0);
123235348Smarius	/* DCD0 */
124235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB23, 0);
125235348Smarius	/* DTR0 */
126235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB24, 1);
127235348Smarius	/* RI0 */
128235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB25, 0);
129235348Smarius	/* RTS0 */
130235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB26, 1);
131235348Smarius	/* CTS0 */
132235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB27, 0);
133235348Smarius
134235348Smarius	/*
135235348Smarius	 * USART2
136235348Smarius	 */
137235348Smarius	/* RTS2 */
138235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA4, 1);
139235348Smarius	/* CTS2 */
140235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOA_BASE, AT91C_PIO_PA5, 0);
141235348Smarius	/* TXD2 */
142235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB8, 1);
143235348Smarius	/* RXD2 */
144235348Smarius	at91_pio_use_periph_a(AT91SAM9260_PIOB_BASE, AT91C_PIO_PB9, 0);
145235348Smarius
146235348Smarius	return (at91_ramsize());
147235348Smarius}
148238189Simp
149238442SimpARM_BOARD(ETHERNUT5, "Ethernut 5")
150