2009-09-27 11:23:33 +03:00
|
|
|
#pypp 0
|
|
|
|
// Iris: micro-kernel for a capability-based operating system.
|
|
|
|
// mips/nanonote/board.ccp: nanonote-specific definitions.
|
|
|
|
// Copyright 2009 Bas Wijnen <wijnen@debian.org>
|
|
|
|
//
|
|
|
|
// 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#define ARCH
|
|
|
|
#define INIT
|
|
|
|
#include "kernel.hh"
|
|
|
|
|
|
|
|
void board_init ():
|
2009-09-27 22:14:38 +03:00
|
|
|
pll_init ()
|
2009-09-27 11:23:33 +03:00
|
|
|
cpm_start_all ()
|
|
|
|
gpio_as_uart0 ()
|
|
|
|
gpio_as_sdram_16bit ()
|
|
|
|
gpio_as_nand ()
|
|
|
|
gpio_as_aic ()
|
|
|
|
gpio_as_lcd_16bit ()
|
|
|
|
gpio_as_msc ()
|
2009-10-04 20:47:20 +03:00
|
|
|
setup_sdram ()
|
2009-09-27 11:23:33 +03:00
|
|
|
// Set up keyboard: this breaks uart receive.
|
|
|
|
gpio_as_gpio (3, 0x05fc0000)
|
|
|
|
tcu_stop_counter (0)
|
|
|
|
tcu_select_extalclk (0)
|
2009-09-30 00:48:33 +03:00
|
|
|
tcu_select_clk_div4 (0)
|
2009-09-27 11:23:33 +03:00
|
|
|
tcu_disable_pwm_output (0)
|
2009-09-30 00:48:33 +03:00
|
|
|
tcu_set_full_data (0, JZ_EXTAL / HZ / 4)
|
2009-09-27 11:23:33 +03:00
|
|
|
tcu_mask_half_match_irq (0)
|
|
|
|
tcu_clear_full_match_flag (0)
|
|
|
|
tcu_unmask_full_match_irq (0)
|
|
|
|
tcu_start_counter (0)
|
|
|
|
// Set up uart.
|
|
|
|
UART0_IER = 0
|
2009-09-27 22:14:38 +03:00
|
|
|
UART0_FCR = 0
|
2009-09-27 11:23:33 +03:00
|
|
|
UART0_MCR = 0
|
|
|
|
UART0_SIRCR = 0
|
|
|
|
UART0_UMR = 0
|
|
|
|
UART0_UACR = 0
|
2009-09-27 22:14:38 +03:00
|
|
|
UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1 | UARTLCR_DLAB
|
|
|
|
unsigned uart_div = 3000000 / 16 / 9600
|
|
|
|
UART0_DLHR = uart_div >> 8
|
|
|
|
UART0_DLLR = uart_div
|
|
|
|
UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1
|
|
|
|
UART0_FCR = UARTFCR_UUE | UARTFCR_FE | UARTFCR_RFLS | UARTFCR_TFLS
|
2009-10-10 02:31:10 +03:00
|
|
|
dbg_code.l = 1
|
2009-09-27 22:14:38 +03:00
|
|
|
dbg_log ("Serial port initialized\n")
|