From edabc799edcc893fcdef707ee861de9807dc78e7 Mon Sep 17 00:00:00 2001 From: Mychaela Falconia Date: Tue, 12 Feb 2019 16:21:14 +0700 Subject: firmware/board: introduce new FCDEV3B (FreeCalypso) target FCDEV3B (stands for "FreeCalypso development board, triband") is a GSM mobile station development board by FreeCalypso project. The board features the same legendary TI Calypso GSM MS chipset that was used in commercial GSM/GPRS modems such as Openmoko's, and functions as a standalone (or "bare") GSM modem. For more information, please see the project's web side: https://www.freecalypso.org/fcdev3b.html. Change-Id: I09bd35a18d3ea094000050169a62fd82ba6eccfe Related: OS#3581 --- src/target/firmware/Makefile | 8 +- src/target/firmware/board/fcdev3b/init.c | 141 +++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 src/target/firmware/board/fcdev3b/init.c diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile index 22fa7461..1196d10f 100644 --- a/src/target/firmware/Makefile +++ b/src/target/firmware/Makefile @@ -24,7 +24,7 @@ ENV_e88flash_OBJS=board/compal/start.rom.o board/compal/header.o board/compal/ex # # List of all supported boards (meant to be overridden on command line) -BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x pirelli_dpl10 +BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x fcdev3b pirelli_dpl10 # Framebuffer support, board specific drivers FB_OBJS=fb/framebuffer.o fb/font.o fb/helvR08.o fb/helvB14.o fb/c64.o \ @@ -46,6 +46,12 @@ BOARD_gta0x_OBJS=$(calypso_COMMON_OBJS) board/gta0x/init.o \ battery/dummy.o $(FB_dummy_OBJS) BOARD_gta0x_ENVIRONMENTS=highram +# FreeCalypso FCDEV3B +BOARD_fcdev3b_OBJS=$(calypso_COMMON_OBJS) board/fcdev3b/init.o \ + board/gta0x/rffe_gta0x_triband.o board/gta0x/rf_power.o \ + battery/dummy.o $(FB_dummy_OBJS) +BOARD_fcdev3b_ENVIRONMENTS=highram + # Pirelli DP-L10 BOARD_pirelli_dpl10_OBJS=$(calypso_COMMON_OBJS) board/pirelli_dpl10/init.o \ board/pirelli_dpl10/rffe_dpl10_triband.o board/pirelli_dpl10/rf_power.o \ diff --git a/src/target/firmware/board/fcdev3b/init.c b/src/target/firmware/board/fcdev3b/init.c new file mode 100644 index 00000000..92be6674 --- /dev/null +++ b/src/target/firmware/board/fcdev3b/init.c @@ -0,0 +1,141 @@ +/* Initialization for the FreeCalypso FCDEV3B modem */ + +/* Based on board/gta0x/init.c with the following obnoxious legalese: + * + * (C) 2010 by Harald Welte + * + * All Rights Reserved + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#define ARMIO_LATCH_OUT 0xfffe4802 +#define IO_CNTL_REG 0xfffe4804 +#define ARM_CONF_REG 0xfffef006 +#define ASIC_CONF_REG 0xfffef008 +#define IO_CONF_REG 0xfffef00a + +static void board_io_init(void) +{ + uint16_t reg; + + reg = readw(ASIC_CONF_REG); + /* TWL3025: Set SPI+RIF RX clock to rising edge */ + reg |= (1 << 13) | (1 << 14); + writew(reg, ASIC_CONF_REG); + + /* + * Most Calypso peripheral interface signals are unconnected + * on this modem. We configure them to be GPIOs in IO_CONF_REG, + * then configure them to be outputs in IO_CNTL_REG, then set + * the outputs to 0 in ARMIO_LATCH_OUT. + * + * Differences from Openmoko GTA0x: + * + * GPIO1 output needs to be 1 to enable the loudspeaker amplifier + * GPIO3 needs to be configured as an input + * I/O 9-12 are MCSI rather than GPIOs + */ + writew(0x0215, IO_CONF_REG); + writew(0xDC08, IO_CNTL_REG); + writew(0x0002, ARMIO_LATCH_OUT); + + /* configure ADD(22), needed for second half of flash */ + reg = readw(ARM_CONF_REG); + reg |= (1 << 3); + writew(reg, ARM_CONF_REG); +} + +void board_init(int with_irq) +{ + /* Configure the memory interface */ + /* Using the same settings as the official FreeCalypso fw */ + calypso_mem_cfg(CALYPSO_nCS0, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS1, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS2, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS3, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_CS4, 4, CALYPSO_MEM_16bit, 1); + calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1); + calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0); + + /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */ + calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2); + + /* Configure the RHEA bridge with some sane default values */ + calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0); + + /* Initialize board-specific GPIO */ + board_io_init(); + + /* Enable bootrom mapping to route exception vectors to RAM */ + calypso_bootrom(with_irq); + calypso_exceptions_install(); + + /* Initialize interrupt controller */ + if (with_irq) + irq_init(); + + sercomm_bind_uart(UART_MODEM); + cons_bind_uart(UART_IRDA); + + /* initialize MODEM UART to be used for sercomm */ + uart_init(UART_MODEM, with_irq); + uart_baudrate(UART_MODEM, UART_115200); + + /* Initialize IRDA UART to be used for old-school console code. + * note: IRDA uart only accessible on C115 and C117 PCB */ + uart_init(UART_IRDA, with_irq); + uart_baudrate(UART_IRDA, UART_115200); + + /* Initialize hardware timers */ + hwtimer_init(); + + /* Initialize DMA controller */ + dma_init(); + + /* Initialize real time clock */ + rtc_init(); + + /* Initialize system timers (uses hwtimer 2) */ + timer_init(); + + /* Initialize ABB driver (uses SPI) */ + twl3025_init(); +} -- cgit v1.2.3