blob: c23ad509f9cfdefde6d67fa6063d488b90784067 [file] [log] [blame]
Kévin Redon9a12d682018-07-08 13:21:16 +02001/* sysmocom quad-modem sysmoQMOD board definition
2 *
3 * (C) 2016-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 Weltea02b6412016-08-21 18:32:12 +020019#pragma once
20#include "board_common.h"
Kévin Redona1012b12018-07-01 18:11:01 +020021#include "simtrace_usb.h"
Harald Weltea02b6412016-08-21 18:32:12 +020022
Harald Weltec47fc5f2017-05-11 16:51:57 +020023#define LED_USIM1 LED_GREEN
24#define LED_USIM2 LED_RED
25
Harald Weltea02b6412016-08-21 18:32:12 +020026/** Name of the board */
27#define BOARD_NAME "QMOD"
28/** Board definition */
29#define qmod
30
31#define BOARD_MAINOSC 12000000
32
33/* 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 Weltea02b6412016-08-21 18:32:12 +020053#define PIN_USIM1_nRST {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
54#define PIN_USIM1_VCC {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
55
Harald Weltea02b6412016-08-21 18:32:12 +020056#define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT}
57#define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT}
58
Harald Welte6d1128e2017-05-05 20:23:10 +020059#define PINS_USIM1 PINS_TC_USIM1, PINS_ISO7816_USIM1, PIN_USIM1_nRST
60#define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST
Harald Weltea02b6412016-08-21 18:32:12 +020061
Harald Welte6d1128e2017-05-05 20:23:10 +020062/* from v3 and onwards only (!) */
63#define PIN_DET_USIM1_PRES {PIO_PA12, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE}
64#define PIN_DET_USIM2_PRES {PIO_PA8, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE}
Harald Weltea02b6412016-08-21 18:32:12 +020065
Harald Welte6d1128e2017-05-05 20:23:10 +020066/* only in v2 and lower (!) */
Harald Weltee974fbb2016-10-19 19:36:07 +020067#define PIN_PRTPWR_OVERRIDE {PIO_PA8, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT}
Harald Welte15e026e2016-10-11 17:46:09 +020068
Harald Welte2819e9c2017-02-03 07:46:01 +010069/* inputs reading the WWAN LED level */
70#define PIN_WWAN1 {PIO_PA15, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE}
71#define PIN_WWAN2 {PIO_PA16, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE}
72#define PINS_WWAN_IN { PIN_WWAN1, PIN_WWAN2 }
73
Harald Welte31f817c2017-02-03 22:21:32 +010074/* outputs controlling RESET input of modems */
Harald Welte1d910582017-02-10 19:50:24 +010075#define PIN_PERST1 {PIO_PA25, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_PULLUP}
76#define PIN_PERST2 {PIO_PA26, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_PULLUP}
Harald Welte31f817c2017-02-03 22:21:32 +010077#define PINS_PERST { PIN_PERST1, PIN_PERST2 }
78
Harald Welte67322482017-02-04 14:43:41 +010079#define PIN_VERSION_DET {PIO_PA19, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT}
80
Harald Welte5c583d32017-05-09 06:46:47 +020081/* GPIO towards SPDT switches between real SIM and SAM3 */
82#define PIN_SIM_SWITCH1 {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
83#define PIN_SIM_SWITCH2 {PIO_PA28, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT}
84
Harald Welte3ecbf672017-03-03 02:10:34 +010085#define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP
86
Harald Weltec6e482d2017-03-05 16:24:29 +010087#define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO
88#define BOARD_USB_PRODUCT_ID USB_PRODUCT_QMOD_SAM3
89#define BOARD_DFU_USB_PRODUCT_ID USB_PRODUCT_QMOD_SAM3_DFU
90#define BOARD_USB_RELEASE 0x010
Harald Weltea02b6412016-08-21 18:32:12 +020091
92#define CARDEMU_SECOND_UART
93#define DETECT_VCC_BY_ADC
94
95#define HAVE_CARDEM