blob: 401fb73a01e10d3e647348cc66be77a274f9e182 [file] [log] [blame]
Kévin Redon9a12d682018-07-08 13:21:16 +02001/* OWHW board definition
2 *
3 * (C) 2015-2017 by Harald Welte <hwelte@hmw-consulting.de>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
18 */
Harald Welte849269f2015-11-30 12:16:53 +010019#pragma once
20#include "board_common.h"
Kévin Redona1012b12018-07-01 18:11:01 +020021#include "simtrace_usb.h"
Harald Welte849269f2015-11-30 12:16:53 +010022
23/** Name of the board */
24#define BOARD_NAME "OWHW"
25/** Board definition */
26#define owhw
27
Kévin Redone2b0f972018-08-28 19:13:06 +020028/** oscillator used as main clock source (in Hz) */
Harald Weltea02b6412016-08-21 18:32:12 +020029#define BOARD_MAINOSC 18432000
Kévin Redone2b0f972018-08-28 19:13:06 +020030/** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */
31#define BOARD_MCK 58982400 // 18.432 * 16 / 5
Harald Weltea02b6412016-08-21 18:32:12 +020032
Harald Welte849269f2015-11-30 12:16:53 +010033/* USIM 2 interface (USART) */
34#define PIN_USIM2_CLK {PIO_PA2, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
35#define PIN_USIM2_IO {PIO_PA6, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
36#define PINS_ISO7816_USIM2 PIN_USIM2_CLK, PIN_USIM2_IO
37
38/* USIM 2 interface (TC) */
39#define PIN_USIM2_IO_TC {PIO_PA1, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
40#define PIN_USIM2_CLK_TC {PIO_PA4, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
41#define PINS_TC_USIM2 PIN_USIM2_IO_TC, PIN_USIM2_CLK_TC
42
43/* USIM 1 interface (USART) */
44#define PIN_USIM1_IO {PIO_PA22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
45#define PIN_USIM1_CLK {PIO_PA23, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT}
46#define PINS_ISO7816_USIM1 PIN_USIM1_CLK, PIN_USIM1_IO
47
48/* USIM 1 interface (TC) */
49#define PIN_USIM1_IO_TC {PIO_PA27, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
50#define PIN_USIM1_CLK_TC {PIO_PA29, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT}
51#define PINS_TC_USIM1 PIN_USIM1_IO_TC, PIN_USIM1_CLK_TC
52
Harald Welte0eaa9922016-03-04 03:03:49 +010053#define PIN_SET_USIM1_PRES {PIO_PA12, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
Harald Welteb086ab02016-02-29 10:05:53 +010054#define PIN_USIM1_nRST {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
Harald Welte2fb59962016-02-28 12:34:26 +010055#define PIN_USIM1_VCC {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
Harald Welte849269f2015-11-30 12:16:53 +010056
Harald Welte2fb59962016-02-28 12:34:26 +010057#define PIN_SET_USIM2_PRES {PIO_PA14, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
Harald Welte849269f2015-11-30 12:16:53 +010058#define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
Harald Welte2fb59962016-02-28 12:34:26 +010059#define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
Harald Welte849269f2015-11-30 12:16:53 +010060
61#define PINS_USIM1 PINS_TC_USIM1, PINS_ISO7816_USIM1, PIN_USIM1_nRST, PIN_SET_USIM1_PRES
62#define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST, PIN_SET_USIM2_PRES
63
Harald Welte390760a2016-02-27 16:23:46 +010064#define PINS_CARDSIM { PIN_SET_USIM1_PRES, PIN_SET_USIM2_PRES }
65
Harald Welte3ecbf672017-03-03 02:10:34 +010066#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP
67
Harald Weltec6e482d2017-03-05 16:24:29 +010068#define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO
69#define BOARD_USB_PRODUCT_ID USB_PRODUCT_OWHW_SAM3
70#define BOARD_DFU_USB_PRODUCT_ID USB_PRODUCT_OWHW_SAM3_DFU
71#define BOARD_USB_RELEASE 0x010
Harald Welte2fb59962016-02-28 12:34:26 +010072
Harald Welte6dcacf32016-03-19 14:01:31 +010073#define CARDEMU_SECOND_UART
Harald Welte07872b62016-03-20 11:45:36 +010074/* Disable VCC/ADC detection, as OWHWv2 has no ADCVREF */
75//#define DETECT_VCC_BY_ADC
Harald Welte6dcacf32016-03-19 14:01:31 +010076
Harald Welte2fb59962016-02-28 12:34:26 +010077#define HAVE_CARDEM