summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Markgraf <steve@steve-m.de>2013-01-03 22:50:21 +0100
committerSylvain Munaut <tnt@246tNt.com>2013-01-05 18:37:49 +0100
commite340681c5bbcb9f904b0058d7f69f80ab2d32cc5 (patch)
tree444a59eb702b21985ca5ddce17f82f5217c2662f
parent9fc637700346a269f4fbd40284c440ed53e6355b (diff)
fw: introduce with_irq parameter for board_init()
So far the loader-app used to do the init on its own, which brought a lot of problems for board- specific initialization. Signed-off-by: Steve Markgraf <steve@steve-m.de>
-rw-r--r--src/target/firmware/apps/compal_dsp_dump/main.c2
-rw-r--r--src/target/firmware/apps/hello_world/main.c2
-rw-r--r--src/target/firmware/apps/layer1/main.c2
-rw-r--r--src/target/firmware/apps/loader/main.c21
-rw-r--r--src/target/firmware/apps/loader_mtk/main.c2
-rw-r--r--src/target/firmware/apps/rssi/main.c2
-rwxr-xr-xsrc/target/firmware/apps/simtest/main.c2
-rw-r--r--src/target/firmware/board/compal_e86/init.c13
-rwxr-xr-xsrc/target/firmware/board/compal_e88/init.c13
-rw-r--r--src/target/firmware/board/compal_e99/init.c13
-rw-r--r--src/target/firmware/board/gta0x/init.c13
-rw-r--r--src/target/firmware/board/mt62xx/init.c4
-rw-r--r--src/target/firmware/board/pirelli_dpl10/init.c13
-rw-r--r--src/target/firmware/board/se_j100/init.c13
-rw-r--r--src/target/firmware/include/board.h2
15 files changed, 53 insertions, 64 deletions
diff --git a/src/target/firmware/apps/compal_dsp_dump/main.c b/src/target/firmware/apps/compal_dsp_dump/main.c
index ba48790..5e1ab68 100644
--- a/src/target/firmware/apps/compal_dsp_dump/main.c
+++ b/src/target/firmware/apps/compal_dsp_dump/main.c
@@ -44,7 +44,7 @@ const char *hr = "==============================================================
int main(void)
{
- board_init();
+ board_init(1);
puts("\n\nOsmocomBB Compal DSP Dumper (revision " GIT_REVISION ")\n");
puts(hr);
diff --git a/src/target/firmware/apps/hello_world/main.c b/src/target/firmware/apps/hello_world/main.c
index 02cab05..481cf17 100644
--- a/src/target/firmware/apps/hello_world/main.c
+++ b/src/target/firmware/apps/hello_world/main.c
@@ -100,7 +100,7 @@ static struct osmo_timer_list write_battery_info_timer = {
int main(void)
{
- board_init();
+ board_init(1);
puts("\n\nOsmocomBB Hello World (revision " GIT_REVISION ")\n");
puts(hr);
diff --git a/src/target/firmware/apps/layer1/main.c b/src/target/firmware/apps/layer1/main.c
index 6a78bef..59ffe97 100644
--- a/src/target/firmware/apps/layer1/main.c
+++ b/src/target/firmware/apps/layer1/main.c
@@ -62,7 +62,7 @@ int main(void)
uint8_t atr[20];
uint8_t atrLength = 0;
- board_init();
+ board_init(1);
puts("\n\nOsmocomBB Layer 1 (revision " GIT_REVISION ")\n");
puts(hr);
diff --git a/src/target/firmware/apps/loader/main.c b/src/target/firmware/apps/loader/main.c
index 50a39dd..3cb1333 100644
--- a/src/target/firmware/apps/loader/main.c
+++ b/src/target/firmware/apps/loader/main.c
@@ -131,25 +131,8 @@ int main(void)
putchar_asm(phone_ack[i]);
}
- /* Always disable wdt (some platforms enable it on boot) */
- wdog_enable(0);
-
- /* Disable the bootrom mapping */
- calypso_bootrom(0);
-
- /* Initialize TWL3025 for power control */
- twl3025_init();
-
- /* Backlight */
- bl_mode_pwl(1);
- bl_level(50);
-
- /* Initialize UART without interrupts */
- uart_init(SERCOMM_UART_NR, 0);
- uart_baudrate(SERCOMM_UART_NR, UART_115200);
-
- /* Initialize HDLC subsystem */
- sercomm_init();
+ /* initialize board without interrupts */
+ board_init(0);
/* Say hi */
puts("\n\nOsmocomBB Loader (revision " GIT_REVISION ")\n");
diff --git a/src/target/firmware/apps/loader_mtk/main.c b/src/target/firmware/apps/loader_mtk/main.c
index 7748dc4..d3c974e 100644
--- a/src/target/firmware/apps/loader_mtk/main.c
+++ b/src/target/firmware/apps/loader_mtk/main.c
@@ -111,7 +111,7 @@ static const uint8_t phone_ack[] = { 0x1b, 0xf6, 0x02, 0x00, 0x41, 0x03, 0x42 };
int main(void)
{
- board_init ();
+ board_init(0);
/* Initialize HDLC subsystem */
sercomm_init();
diff --git a/src/target/firmware/apps/rssi/main.c b/src/target/firmware/apps/rssi/main.c
index b2cafae..5020486 100644
--- a/src/target/firmware/apps/rssi/main.c
+++ b/src/target/firmware/apps/rssi/main.c
@@ -1506,7 +1506,7 @@ static void key_handler(enum key_codes code, enum key_states state)
int main(void)
{
- board_init();
+ board_init(1);
puts("\n\nOsmocomBB Monitor Tool (revision " GIT_REVISION ")\n");
puts(hr);
diff --git a/src/target/firmware/apps/simtest/main.c b/src/target/firmware/apps/simtest/main.c
index 8e089d3..e20c52a 100755
--- a/src/target/firmware/apps/simtest/main.c
+++ b/src/target/firmware/apps/simtest/main.c
@@ -310,7 +310,7 @@ static void *console_rx_cb(uint8_t dlci, struct msgb *msg)
int main(void)
{
- board_init();
+ board_init(1);
puts("\n\nOsmocomBB SIM Test (revision " GIT_REVISION ")\n");
puts(hr);
diff --git a/src/target/firmware/board/compal_e86/init.c b/src/target/firmware/board/compal_e86/init.c
index 2d463cb..1280ddd 100644
--- a/src/target/firmware/board/compal_e86/init.c
+++ b/src/target/firmware/board/compal_e86/init.c
@@ -77,7 +77,7 @@ static void board_io_init(void)
writew(reg, ARMIO_LATCH_OUT);
}
-void board_init(void)
+void board_init(int with_irq)
{
/* Disable watchdog (compal loader leaves it enabled) */
wdog_enable(0);
@@ -101,19 +101,20 @@ void board_init(void)
board_io_init();
/* Enable bootrom mapping to route exception vectors to RAM */
- calypso_bootrom(1);
+ calypso_bootrom(with_irq);
calypso_exceptions_install();
/* Initialize interrupt controller */
- irq_init();
+ if (with_irq)
+ irq_init();
/* initialize MODEM UART to be used for sercomm*/
- uart_init(SERCOMM_UART_NR, 1);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, 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(CONS_UART_NR, 1);
+ uart_init(CONS_UART_NR, with_irq);
uart_baudrate(CONS_UART_NR, UART_115200);
/* Initialize hardware timers */
@@ -134,7 +135,7 @@ void board_init(void)
bl_level(0);
/* Initialize keypad driver */
- keypad_init(1);
+ keypad_init(with_irq);
/* Initialize ABB driver (uses SPI) */
twl3025_init();
diff --git a/src/target/firmware/board/compal_e88/init.c b/src/target/firmware/board/compal_e88/init.c
index 2e95731..12ead87 100755
--- a/src/target/firmware/board/compal_e88/init.c
+++ b/src/target/firmware/board/compal_e88/init.c
@@ -75,7 +75,7 @@ static void board_io_init(void)
writew(reg, ARMIO_LATCH_OUT);
}
-void board_init(void)
+void board_init(int with_irq)
{
/* Configure the memory interface */
calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
@@ -96,19 +96,20 @@ void board_init(void)
board_io_init();
/* Enable bootrom mapping to route exception vectors to RAM */
- calypso_bootrom(1);
+ calypso_bootrom(with_irq);
calypso_exceptions_install();
/* Initialize interrupt controller */
- irq_init();
+ if (with_irq)
+ irq_init();
/* initialize MODEM UART to be used for sercomm*/
- uart_init(SERCOMM_UART_NR, 1);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, 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(CONS_UART_NR, 1);
+ uart_init(CONS_UART_NR, with_irq);
uart_baudrate(CONS_UART_NR, UART_115200);
/* Initialize hardware timers */
@@ -130,7 +131,7 @@ void board_init(void)
bl_level(50);
/* Initialize keypad driver */
- keypad_init(1);
+ keypad_init(with_irq);
/* Initialize ABB driver (uses SPI) */
twl3025_init();
diff --git a/src/target/firmware/board/compal_e99/init.c b/src/target/firmware/board/compal_e99/init.c
index 31eb978..8dab47c 100644
--- a/src/target/firmware/board/compal_e99/init.c
+++ b/src/target/firmware/board/compal_e99/init.c
@@ -77,7 +77,7 @@ static void board_io_init(void)
writew(reg, ARMIO_LATCH_OUT);
}
-void board_init(void)
+void board_init(int with_irq)
{
/* Disable watchdog (compal loader leaves it enabled) */
wdog_enable(0);
@@ -101,19 +101,20 @@ void board_init(void)
board_io_init();
/* Enable bootrom mapping to route exception vectors to RAM */
- calypso_bootrom(1);
+ calypso_bootrom(with_irq);
calypso_exceptions_install();
/* Initialize interrupt controller */
- irq_init();
+ if (with_irq)
+ irq_init();
/* initialize MODEM UART to be used for sercomm*/
- uart_init(SERCOMM_UART_NR, 1);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, 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(CONS_UART_NR, 1);
+ uart_init(CONS_UART_NR, with_irq);
uart_baudrate(CONS_UART_NR, UART_115200);
/* Initialize hardware timers */
@@ -135,7 +136,7 @@ void board_init(void)
fb_init();
/* Initialize keypad driver */
- keypad_init(1);
+ keypad_init(with_irq);
/* Initialize ABB driver (uses SPI) */
twl3025_init();
diff --git a/src/target/firmware/board/gta0x/init.c b/src/target/firmware/board/gta0x/init.c
index d125e15..ef75e7d 100644
--- a/src/target/firmware/board/gta0x/init.c
+++ b/src/target/firmware/board/gta0x/init.c
@@ -73,7 +73,7 @@ static void board_io_init(void)
writew(reg, ARMIO_LATCH_OUT);
}
-void board_init(void)
+void board_init(int with_irq)
{
/* Configure the memory interface */
calypso_mem_cfg(CALYPSO_nCS0, 3, CALYPSO_MEM_16bit, 1);
@@ -94,19 +94,20 @@ void board_init(void)
board_io_init();
/* Enable bootrom mapping to route exception vectors to RAM */
- calypso_bootrom(1);
+ calypso_bootrom(with_irq);
calypso_exceptions_install();
/* Initialize interrupt controller */
- irq_init();
+ if (with_irq)
+ irq_init();
/* initialize MODEM UART to be used for sercomm*/
- uart_init(SERCOMM_UART_NR, 1);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, 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(CONS_UART_NR, 1);
+ uart_init(CONS_UART_NR, with_irq);
uart_baudrate(CONS_UART_NR, UART_115200);
/* Initialize hardware timers */
@@ -126,7 +127,7 @@ void board_init(void)
bl_level(50);
/* Initialize keypad driver */
- keypad_init(1);
+ keypad_init(with_irq);
/* Initialize ABB driver (uses SPI) */
twl3025_init();
diff --git a/src/target/firmware/board/mt62xx/init.c b/src/target/firmware/board/mt62xx/init.c
index 3f68375..e3daa37 100644
--- a/src/target/firmware/board/mt62xx/init.c
+++ b/src/target/firmware/board/mt62xx/init.c
@@ -117,7 +117,7 @@ void memory_init(void)
#endif
}
-void board_init(void)
+void board_init(int with_irq)
{
/* powerup the baseband */
writew(POWERKEY1_MAGIC, MTK_RTC_POWERKEY1);
@@ -134,6 +134,6 @@ void board_init(void)
memory_init();
/* Initialize UART without interrupts */
- uart_init(SERCOMM_UART_NR, 0);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, UART_115200);
}
diff --git a/src/target/firmware/board/pirelli_dpl10/init.c b/src/target/firmware/board/pirelli_dpl10/init.c
index ef18403..629e227 100644
--- a/src/target/firmware/board/pirelli_dpl10/init.c
+++ b/src/target/firmware/board/pirelli_dpl10/init.c
@@ -84,7 +84,7 @@ static void board_io_init(void)
writew(reg, ARMIO_LATCH_OUT);
}
-void board_init(void)
+void board_init(int with_irq)
{
/* Configure the memory interface */
calypso_mem_cfg(CALYPSO_nCS0, 4, CALYPSO_MEM_16bit, 1);
@@ -105,19 +105,20 @@ void board_init(void)
board_io_init();
/* Enable bootrom mapping to route exception vectors to RAM */
- calypso_bootrom(1);
+ calypso_bootrom(with_irq);
calypso_exceptions_install();
/* Initialize interrupt controller */
- irq_init();
+ if (with_irq)
+ irq_init();
/* initialize MODEM UART to be used for sercomm*/
- uart_init(SERCOMM_UART_NR, 1);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, 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(CONS_UART_NR, 1);
+ uart_init(CONS_UART_NR, with_irq);
uart_baudrate(CONS_UART_NR, UART_115200);
/* Initialize hardware timers */
@@ -139,7 +140,7 @@ void board_init(void)
fb_init();
/* Initialize keypad driver */
- keypad_init(1);
+ keypad_init(with_irq);
/* Initialize ABB driver (uses SPI) */
twl3025_init();
diff --git a/src/target/firmware/board/se_j100/init.c b/src/target/firmware/board/se_j100/init.c
index 2a3de0e..284ff72 100644
--- a/src/target/firmware/board/se_j100/init.c
+++ b/src/target/firmware/board/se_j100/init.c
@@ -77,7 +77,7 @@ static void board_io_init(void)
writew(reg, ARMIO_LATCH_OUT);
}
-void board_init(void)
+void board_init(int with_irq)
{
/* Disable watchdog (compal loader leaves it enabled) */
wdog_enable(0);
@@ -101,19 +101,20 @@ void board_init(void)
board_io_init();
/* Enable bootrom mapping to route exception vectors to RAM */
- calypso_bootrom(1);
+ calypso_bootrom(with_irq);
calypso_exceptions_install();
/* Initialize interrupt controller */
- irq_init();
+ if (with_irq)
+ irq_init();
/* initialize MODEM UART to be used for sercomm*/
- uart_init(SERCOMM_UART_NR, 1);
+ uart_init(SERCOMM_UART_NR, with_irq);
uart_baudrate(SERCOMM_UART_NR, 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(CONS_UART_NR, 1);
+ uart_init(CONS_UART_NR, with_irq);
uart_baudrate(CONS_UART_NR, UART_115200);
/* Initialize hardware timers */
@@ -134,7 +135,7 @@ void board_init(void)
bl_level(50);
/* Initialize keypad driver */
- keypad_init(1);
+ keypad_init(with_irq);
/* Initialize ABB driver (uses SPI) */
twl3025_init();
diff --git a/src/target/firmware/include/board.h b/src/target/firmware/include/board.h
index 9783ef3..4a9657f 100644
--- a/src/target/firmware/include/board.h
+++ b/src/target/firmware/include/board.h
@@ -3,6 +3,6 @@
extern const char *target_board;
-void board_init(void);
+void board_init(int with_irq);
#endif /* _BOARD_H */