Kévin Redon | 9a12d68 | 2018-07-08 13:21:16 +0200 | [diff] [blame] | 1 | /* 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 Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 19 | #pragma once |
| 20 | #include "board_common.h" |
Kévin Redon | a1012b1 | 2018-07-01 18:11:01 +0200 | [diff] [blame] | 21 | #include "simtrace_usb.h" |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 22 | |
| 23 | /** Name of the board */ |
| 24 | #define BOARD_NAME "QMOD" |
| 25 | /** Board definition */ |
| 26 | #define qmod |
| 27 | |
Kévin Redon | e2b0f97 | 2018-08-28 19:13:06 +0200 | [diff] [blame] | 28 | /** oscillator used as main clock source (in Hz) */ |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 29 | #define BOARD_MAINOSC 12000000 |
Kévin Redon | e2b0f97 | 2018-08-28 19:13:06 +0200 | [diff] [blame] | 30 | /** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */ |
| 31 | #define BOARD_MCK 58000000 // 18.432 * 29 / 6 |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 32 | |
Kévin Redon | 9acff5e | 2019-10-01 19:44:44 +0200 | [diff] [blame] | 33 | /** MCU pin connected to red LED */ |
| 34 | #define PIO_LED_RED PIO_PA17 |
| 35 | /** MCU pin connected to green LED */ |
| 36 | #define PIO_LED_GREEN PIO_PA18 |
| 37 | /** red LED pin definition */ |
| 38 | #define PIN_LED_RED {PIO_LED_RED, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} |
| 39 | /** green LED pin definition */ |
| 40 | #define PIN_LED_GREEN {PIO_LED_GREEN, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} |
| 41 | /** LEDs pin definition */ |
| 42 | #define PINS_LEDS PIN_LED_RED, PIN_LED_GREEN |
| 43 | /** index for red LED in LEDs pin definition array */ |
| 44 | #define LED_NUM_RED 0 |
| 45 | /** index for green LED in LEDs pin definition array */ |
| 46 | #define LED_NUM_GREEN 1 |
| 47 | /** the green LED is actually red and used as indication for USIM1 */ |
| 48 | #define LED_USIM1 LED_GREEN |
| 49 | /** the green LED is actually red and used as indication for USIM2 */ |
| 50 | #define LED_USIM2 LED_RED |
| 51 | |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 52 | /* USIM 2 interface (USART) */ |
| 53 | #define PIN_USIM2_CLK {PIO_PA2, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 54 | #define PIN_USIM2_IO {PIO_PA6, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} |
| 55 | #define PINS_ISO7816_USIM2 PIN_USIM2_CLK, PIN_USIM2_IO |
| 56 | |
| 57 | /* USIM 2 interface (TC) */ |
| 58 | #define PIN_USIM2_IO_TC {PIO_PA1, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 59 | #define PIN_USIM2_CLK_TC {PIO_PA4, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 60 | #define PINS_TC_USIM2 PIN_USIM2_IO_TC, PIN_USIM2_CLK_TC |
| 61 | |
| 62 | /* USIM 1 interface (USART) */ |
| 63 | #define PIN_USIM1_IO {PIO_PA22, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} |
| 64 | #define PIN_USIM1_CLK {PIO_PA23, PIOA, ID_PIOA, PIO_PERIPH_A, PIO_DEFAULT} |
| 65 | #define PINS_ISO7816_USIM1 PIN_USIM1_CLK, PIN_USIM1_IO |
| 66 | |
| 67 | /* USIM 1 interface (TC) */ |
| 68 | #define PIN_USIM1_IO_TC {PIO_PA27, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 69 | #define PIN_USIM1_CLK_TC {PIO_PA29, PIOA, ID_PIOA, PIO_PERIPH_B, PIO_DEFAULT} |
| 70 | #define PINS_TC_USIM1 PIN_USIM1_IO_TC, PIN_USIM1_CLK_TC |
| 71 | |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 72 | #define PIN_USIM1_nRST {PIO_PA24, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} |
| 73 | #define PIN_USIM1_VCC {PIO_PB3, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} |
| 74 | |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 75 | #define PIN_USIM2_nRST {PIO_PA7, PIOA, ID_PIOA, PIO_INPUT, PIO_DEFAULT} |
| 76 | #define PIN_USIM2_VCC {PIO_PB2, PIOB, ID_PIOB, PIO_INPUT, PIO_DEFAULT} |
| 77 | |
Harald Welte | 6d1128e | 2017-05-05 20:23:10 +0200 | [diff] [blame] | 78 | #define PINS_USIM1 PINS_TC_USIM1, PINS_ISO7816_USIM1, PIN_USIM1_nRST |
| 79 | #define PINS_USIM2 PINS_TC_USIM2, PINS_ISO7816_USIM2, PIN_USIM2_nRST |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 80 | |
Harald Welte | 6d1128e | 2017-05-05 20:23:10 +0200 | [diff] [blame] | 81 | /* from v3 and onwards only (!) */ |
| 82 | #define PIN_DET_USIM1_PRES {PIO_PA12, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE} |
| 83 | #define PIN_DET_USIM2_PRES {PIO_PA8, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE} |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 84 | |
Harald Welte | 6d1128e | 2017-05-05 20:23:10 +0200 | [diff] [blame] | 85 | /* only in v2 and lower (!) */ |
Harald Welte | e974fbb | 2016-10-19 19:36:07 +0200 | [diff] [blame] | 86 | #define PIN_PRTPWR_OVERRIDE {PIO_PA8, PIOA, ID_PIOA, PIO_OUTPUT_1, PIO_DEFAULT} |
Harald Welte | 15e026e | 2016-10-11 17:46:09 +0200 | [diff] [blame] | 87 | |
Harald Welte | 2819e9c | 2017-02-03 07:46:01 +0100 | [diff] [blame] | 88 | /* inputs reading the WWAN LED level */ |
| 89 | #define PIN_WWAN1 {PIO_PA15, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE} |
| 90 | #define PIN_WWAN2 {PIO_PA16, PIOA, ID_PIOA, PIO_INPUT, PIO_PULLUP | PIO_DEGLITCH | PIO_IT_EDGE} |
| 91 | #define PINS_WWAN_IN { PIN_WWAN1, PIN_WWAN2 } |
| 92 | |
Harald Welte | 31f817c | 2017-02-03 22:21:32 +0100 | [diff] [blame] | 93 | /* outputs controlling RESET input of modems */ |
Harald Welte | 1d91058 | 2017-02-10 19:50:24 +0100 | [diff] [blame] | 94 | #define PIN_PERST1 {PIO_PA25, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_PULLUP} |
| 95 | #define PIN_PERST2 {PIO_PA26, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_PULLUP} |
Harald Welte | 31f817c | 2017-02-03 22:21:32 +0100 | [diff] [blame] | 96 | #define PINS_PERST { PIN_PERST1, PIN_PERST2 } |
| 97 | |
Harald Welte | 6732248 | 2017-02-04 14:43:41 +0100 | [diff] [blame] | 98 | #define PIN_VERSION_DET {PIO_PA19, PIOA, ID_PIOA, PIO_PERIPH_D, PIO_DEFAULT} |
| 99 | |
Harald Welte | 5c583d3 | 2017-05-09 06:46:47 +0200 | [diff] [blame] | 100 | /* GPIO towards SPDT switches between real SIM and SAM3 */ |
| 101 | #define PIN_SIM_SWITCH1 {PIO_PA20, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} |
| 102 | #define PIN_SIM_SWITCH2 {PIO_PA28, PIOA, ID_PIOA, PIO_OUTPUT_0, PIO_DEFAULT} |
| 103 | |
Harald Welte | 3ecbf67 | 2017-03-03 02:10:34 +0100 | [diff] [blame] | 104 | #define BOARD_USB_BMATTRIBUTES USBConfigurationDescriptor_SELFPOWERED_NORWAKEUP |
| 105 | |
Harald Welte | c6e482d | 2017-03-05 16:24:29 +0100 | [diff] [blame] | 106 | #define BOARD_USB_VENDOR_ID USB_VENDOR_OPENMOKO |
| 107 | #define BOARD_USB_PRODUCT_ID USB_PRODUCT_QMOD_SAM3 |
| 108 | #define BOARD_DFU_USB_PRODUCT_ID USB_PRODUCT_QMOD_SAM3_DFU |
| 109 | #define BOARD_USB_RELEASE 0x010 |
Harald Welte | a02b641 | 2016-08-21 18:32:12 +0200 | [diff] [blame] | 110 | |
| 111 | #define CARDEMU_SECOND_UART |
| 112 | #define DETECT_VCC_BY_ADC |
| 113 | |
| 114 | #define HAVE_CARDEM |