<p>Vadim Yanitskiy has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/12888">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">firmware/board: introduce the new FCDEV3B target<br><br>FCDEV3B (stands for "FreeCalypso development board, triband") is a<br>GSM mobile station development board by FreeCalypso project. The<br>board features the same legendary TI Calypso GSM MS chipset that<br>was used in commercial GSM/GPRS modems such as Openmoko's, and<br>functions as a standalone (or "bare") GSM modem.<br><br>For more information, please see the project's web side:<br><br>  https://www.freecalypso.org/fcdev3b.html.<br><br>Change-Id: I09bd35a18d3ea094000050169a62fd82ba6eccfe<br>Related: OS#3581<br>---<br>M src/target/firmware/Makefile<br>A src/target/firmware/board/fcdev3b/init.c<br>2 files changed, 161 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/88/12888/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile</span><br><span>index 46a8fb1..cc1ca24 100644</span><br><span>--- a/src/target/firmware/Makefile</span><br><span>+++ b/src/target/firmware/Makefile</span><br><span>@@ -24,7 +24,7 @@</span><br><span> #</span><br><span> </span><br><span> # List of all supported boards (meant to be overridden on command line)</span><br><span style="color: hsl(0, 100%, 40%);">-BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x pirelli_dpl10</span><br><span style="color: hsl(120, 100%, 40%);">+BOARDS?=compal_e88 compal_e86 compal_e99 se_j100 gta0x fcdev3b pirelli_dpl10</span><br><span> </span><br><span> # Framebuffer support, board specific drivers</span><br><span> FB_OBJS=fb/framebuffer.o fb/font.o fb/helvR08.o fb/helvB14.o fb/c64.o \</span><br><span>@@ -47,6 +47,12 @@</span><br><span>        board/common/readcal_tiffs.o battery/dummy.o $(FB_dummy_OBJS)</span><br><span> BOARD_gta0x_ENVIRONMENTS=highram</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+# FreeCalypso FCDEV3B</span><br><span style="color: hsl(120, 100%, 40%);">+BOARD_fcdev3b_OBJS=$(calypso_COMMON_OBJS) board/fcdev3b/init.o \</span><br><span style="color: hsl(120, 100%, 40%);">+        board/gta0x/rffe_gta0x_triband.o board/gta0x/rf_tables.o \</span><br><span style="color: hsl(120, 100%, 40%);">+    board/common/readcal_tiffs.o battery/dummy.o $(FB_dummy_OBJS)</span><br><span style="color: hsl(120, 100%, 40%);">+BOARD_fcdev3b_ENVIRONMENTS=highram</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> # Pirelli DP-L10</span><br><span> BOARD_pirelli_dpl10_OBJS=$(calypso_COMMON_OBJS) board/pirelli_dpl10/init.o \</span><br><span>      board/pirelli_dpl10/rffe_dpl10_triband.o \</span><br><span>diff --git a/src/target/firmware/board/fcdev3b/init.c b/src/target/firmware/board/fcdev3b/init.c</span><br><span>new file mode 100644</span><br><span>index 0000000..3601cbf</span><br><span>--- /dev/null</span><br><span>+++ b/src/target/firmware/board/fcdev3b/init.c</span><br><span>@@ -0,0 +1,154 @@</span><br><span style="color: hsl(120, 100%, 40%);">+/* Initialization for the FreeCalypso FCDEV3B modem */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+/* Based on board/gta0x/init.c with the following obnoxious legalese:</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * (C) 2010 by Harald Welte <laforge@gnumonks.org></span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * All Rights Reserved</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is free software; you can redistribute it and/or modify</span><br><span style="color: hsl(120, 100%, 40%);">+ * it under the terms of the GNU General Public License as published by</span><br><span style="color: hsl(120, 100%, 40%);">+ * the Free Software Foundation; either version 2 of the License, or</span><br><span style="color: hsl(120, 100%, 40%);">+ * (at your option) any later version.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * This program is distributed in the hope that it will be useful,</span><br><span style="color: hsl(120, 100%, 40%);">+ * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><br><span style="color: hsl(120, 100%, 40%);">+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><br><span style="color: hsl(120, 100%, 40%);">+ * GNU General Public License for more details.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ * You should have received a copy of the GNU General Public License along</span><br><span style="color: hsl(120, 100%, 40%);">+ * with this program; if not, write to the Free Software Foundation, Inc.,</span><br><span style="color: hsl(120, 100%, 40%);">+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.</span><br><span style="color: hsl(120, 100%, 40%);">+ *</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <stdint.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <stdio.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <debug.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <ctors.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <memory.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <board.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <keypad.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <console.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <flash/cfi_flash.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <tiffs.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <calypso/irq.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <calypso/clock.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <calypso/dma.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <calypso/rtc.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <calypso/timer.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <uart.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <calypso/backlight.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <comm/sercomm.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <comm/timer.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#include <abb/twl3025.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include <rf/trf6151.h></span><br><span style="color: hsl(120, 100%, 40%);">+#include "../compal/keymap.h"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+#define ARMIO_LATCH_OUT 0xfffe4802</span><br><span style="color: hsl(120, 100%, 40%);">+#define IO_CNTL_REG 0xfffe4804</span><br><span style="color: hsl(120, 100%, 40%);">+#define ARM_CONF_REG        0xfffef006</span><br><span style="color: hsl(120, 100%, 40%);">+#define ASIC_CONF_REG       0xfffef008</span><br><span style="color: hsl(120, 100%, 40%);">+#define IO_CONF_REG 0xfffef00a</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+static void board_io_init(void)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      uint16_t reg;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       reg = readw(ASIC_CONF_REG);</span><br><span style="color: hsl(120, 100%, 40%);">+   /* TWL3025: Set SPI+RIF RX clock to rising edge */</span><br><span style="color: hsl(120, 100%, 40%);">+    reg |= (1 << 13) | (1 << 14);</span><br><span style="color: hsl(120, 100%, 40%);">+     writew(reg, ASIC_CONF_REG);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /*</span><br><span style="color: hsl(120, 100%, 40%);">+     * Most Calypso peripheral interface signals are unconnected</span><br><span style="color: hsl(120, 100%, 40%);">+   * on this modem.  We configure them to be GPIOs in IO_CONF_REG,</span><br><span style="color: hsl(120, 100%, 40%);">+       * then configure them to be outputs in IO_CNTL_REG, then set</span><br><span style="color: hsl(120, 100%, 40%);">+  * the outputs to 0 in ARMIO_LATCH_OUT.</span><br><span style="color: hsl(120, 100%, 40%);">+        *</span><br><span style="color: hsl(120, 100%, 40%);">+     * Differences from Openmoko GTA0x:</span><br><span style="color: hsl(120, 100%, 40%);">+    *</span><br><span style="color: hsl(120, 100%, 40%);">+     * GPIO1 output needs to be 1 to enable the loudspeaker amplifier</span><br><span style="color: hsl(120, 100%, 40%);">+      * GPIO3 needs to be configured as an input</span><br><span style="color: hsl(120, 100%, 40%);">+    * I/O 9-12 are MCSI rather than GPIOs</span><br><span style="color: hsl(120, 100%, 40%);">+         */</span><br><span style="color: hsl(120, 100%, 40%);">+   writew(0x0215, IO_CONF_REG);</span><br><span style="color: hsl(120, 100%, 40%);">+  writew(0xDC08, IO_CNTL_REG);</span><br><span style="color: hsl(120, 100%, 40%);">+  writew(0x0002, ARMIO_LATCH_OUT);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* configure ADD(22), needed for second half of flash */</span><br><span style="color: hsl(120, 100%, 40%);">+      reg = readw(ARM_CONF_REG);</span><br><span style="color: hsl(120, 100%, 40%);">+    reg |= (1 << 3);</span><br><span style="color: hsl(120, 100%, 40%);">+        writew(reg, ARM_CONF_REG);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+void board_init(int with_irq)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Configure the memory interface */</span><br><span style="color: hsl(120, 100%, 40%);">+  /* Using the same settings as the official FreeCalypso fw */</span><br><span style="color: hsl(120, 100%, 40%);">+  calypso_mem_cfg(CALYPSO_nCS0, 4, CALYPSO_MEM_16bit, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+       calypso_mem_cfg(CALYPSO_nCS1, 4, CALYPSO_MEM_16bit, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+       calypso_mem_cfg(CALYPSO_nCS2, 4, CALYPSO_MEM_16bit, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+       calypso_mem_cfg(CALYPSO_nCS3, 4, CALYPSO_MEM_16bit, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+       calypso_mem_cfg(CALYPSO_CS4, 4, CALYPSO_MEM_16bit, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+        calypso_mem_cfg(CALYPSO_nCS6, 0, CALYPSO_MEM_32bit, 1);</span><br><span style="color: hsl(120, 100%, 40%);">+       calypso_mem_cfg(CALYPSO_nCS7, 0, CALYPSO_MEM_32bit, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Set VTCXO_DIV2 = 1, configure PLL for 104 MHz and give ARM half of that */</span><br><span style="color: hsl(120, 100%, 40%);">+ calypso_clock_set(2, CALYPSO_PLL13_104_MHZ, ARM_MCLK_DIV_2);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Configure the RHEA bridge with some sane default values */</span><br><span style="color: hsl(120, 100%, 40%);">+ calypso_rhea_cfg(0, 0, 0xff, 0, 1, 0, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   /* Initialize board-specific GPIO */</span><br><span style="color: hsl(120, 100%, 40%);">+  board_io_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    /* Enable bootrom mapping to route exception vectors to RAM */</span><br><span style="color: hsl(120, 100%, 40%);">+        calypso_bootrom(with_irq);</span><br><span style="color: hsl(120, 100%, 40%);">+    calypso_exceptions_install();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Initialize interrupt controller */</span><br><span style="color: hsl(120, 100%, 40%);">+ if (with_irq)</span><br><span style="color: hsl(120, 100%, 40%);">+         irq_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ sercomm_bind_uart(UART_MODEM);</span><br><span style="color: hsl(120, 100%, 40%);">+        cons_bind_uart(UART_IRDA);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* initialize MODEM UART to be used for sercomm */</span><br><span style="color: hsl(120, 100%, 40%);">+    uart_init(UART_MODEM, with_irq);</span><br><span style="color: hsl(120, 100%, 40%);">+      uart_baudrate(UART_MODEM, UART_115200);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Initialize IRDA UART to be used for old-school console code.</span><br><span style="color: hsl(120, 100%, 40%);">+        * note: IRDA uart only accessible on C115 and C117 PCB */</span><br><span style="color: hsl(120, 100%, 40%);">+    uart_init(UART_IRDA, with_irq);</span><br><span style="color: hsl(120, 100%, 40%);">+       uart_baudrate(UART_IRDA, UART_115200);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Initialize hardware timers */</span><br><span style="color: hsl(120, 100%, 40%);">+      hwtimer_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Initialize DMA controller */</span><br><span style="color: hsl(120, 100%, 40%);">+       dma_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Initialize real time clock */</span><br><span style="color: hsl(120, 100%, 40%);">+      rtc_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ /* Initialize system timers (uses hwtimer 2) */</span><br><span style="color: hsl(120, 100%, 40%);">+       timer_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Initialize LCD driver (uses I2C) and backlight */</span><br><span style="color: hsl(120, 100%, 40%);">+  bl_mode_pwl(1);</span><br><span style="color: hsl(120, 100%, 40%);">+       bl_level(50);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+       /* Initialize keypad driver */</span><br><span style="color: hsl(120, 100%, 40%);">+        keypad_init(keymap, with_irq);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      /* Initialize ABB driver (uses SPI) */</span><br><span style="color: hsl(120, 100%, 40%);">+        twl3025_init();</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+     /* Initialize TIFFS reader */</span><br><span style="color: hsl(120, 100%, 40%);">+ tiffs_init(0x01800000, 0x40000, 8);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/12888">change 12888</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/12888"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmocom-bb </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I09bd35a18d3ea094000050169a62fd82ba6eccfe </div>
<div style="display:none"> Gerrit-Change-Number: 12888 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Vadim Yanitskiy <axilirator@gmail.com> </div>