2009-08-21 09:04:09 +03:00
|
|
|
//
|
2010-04-28 13:29:53 +03:00
|
|
|
// Authors: Wolfgang Spraul <wolfgang@sharism.cc>
|
2009-08-21 09:04:09 +03:00
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
|
2010-06-07 14:29:49 +03:00
|
|
|
#include "common.h"
|
2010-06-04 17:31:19 +03:00
|
|
|
#include "serial.h"
|
2009-08-21 09:04:09 +03:00
|
|
|
|
2010-06-07 14:29:49 +03:00
|
|
|
extern void gpio_init_4740();
|
|
|
|
extern void pll_init_4740();
|
2010-06-07 15:46:04 +03:00
|
|
|
extern void serial_init_4740(int uart);
|
2010-06-07 14:29:49 +03:00
|
|
|
extern void sdram_init_4740();
|
|
|
|
extern void nand_init_4740();
|
2009-08-21 09:04:09 +03:00
|
|
|
|
2010-06-09 10:20:02 +03:00
|
|
|
extern void gpio_init_4760();
|
|
|
|
extern void pll_init_4760();
|
2010-06-09 12:28:00 +03:00
|
|
|
extern void cpm_start_all_4760();
|
2010-06-09 10:20:02 +03:00
|
|
|
extern void serial_init_4760(int uart);
|
|
|
|
extern void sdram_init_4760();
|
2010-06-10 18:11:29 +03:00
|
|
|
extern void nand_init_4760();
|
2010-06-09 10:20:02 +03:00
|
|
|
|
|
|
|
void load_args_4740()
|
2009-08-21 09:04:09 +03:00
|
|
|
{
|
2010-04-14 10:35:21 +03:00
|
|
|
ARG_EXTAL = 12 * 1000000;
|
|
|
|
ARG_CPU_SPEED = 21 * ARG_EXTAL;
|
|
|
|
ARG_PHM_DIV = 3;
|
|
|
|
ARG_UART_BAUD = 57600;
|
|
|
|
ARG_BUS_WIDTH_16 = * (int *)0x80002014;
|
|
|
|
ARG_BANK_ADDR_2BIT = 1;
|
|
|
|
ARG_ROW_ADDR = 13;
|
|
|
|
ARG_COL_ADDR = 9;
|
2009-08-21 09:04:09 +03:00
|
|
|
}
|
|
|
|
|
2010-06-09 10:20:02 +03:00
|
|
|
void load_args_4760()
|
|
|
|
{
|
|
|
|
ARG_EXTAL = 12 * 1000000;
|
2010-06-09 12:28:00 +03:00
|
|
|
ARG_CPU_SPEED = 12 * ARG_EXTAL;
|
2010-06-09 10:20:02 +03:00
|
|
|
ARG_PHM_DIV = 3;
|
|
|
|
ARG_UART_BAUD = 57600;
|
|
|
|
ARG_BUS_WIDTH_16 = * (int *)0x80002014;
|
2010-06-09 10:48:35 +03:00
|
|
|
ARG_BANK_ADDR_2BIT = 4;
|
2010-06-13 18:06:03 +03:00
|
|
|
ARG_ROW_ADDR = 13;
|
|
|
|
ARG_COL_ADDR = 10;
|
2010-06-09 10:20:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-04 17:31:19 +03:00
|
|
|
void c_main(void)
|
2009-08-21 09:04:09 +03:00
|
|
|
{
|
2010-06-10 18:11:29 +03:00
|
|
|
ARG_CPU_ID = * (int *)0x80002008;
|
2009-08-21 09:04:09 +03:00
|
|
|
|
2010-06-04 17:31:19 +03:00
|
|
|
switch (ARG_CPU_ID) {
|
|
|
|
case 0x4740:
|
2010-06-10 18:11:29 +03:00
|
|
|
load_args_4740();
|
2010-06-07 13:12:20 +03:00
|
|
|
gpio_init_4740();
|
2010-06-07 15:46:04 +03:00
|
|
|
serial_init_4740(0);
|
2010-06-07 13:12:20 +03:00
|
|
|
pll_init_4740();
|
|
|
|
sdram_init_4740();
|
|
|
|
nand_init_4740();
|
2010-06-10 18:11:29 +03:00
|
|
|
serial_puts("Ben NanoNote\n");
|
2010-06-04 17:31:19 +03:00
|
|
|
break;
|
|
|
|
case 0x4760:
|
2010-06-10 18:11:29 +03:00
|
|
|
load_args_4760();
|
2010-06-09 10:48:35 +03:00
|
|
|
gpio_init_4760();
|
2010-06-09 12:28:00 +03:00
|
|
|
cpm_start_all_4760();
|
2010-06-09 10:48:35 +03:00
|
|
|
serial_init_4760(1);
|
|
|
|
pll_init_4760();
|
|
|
|
sdram_init_4760();
|
2010-06-10 18:11:29 +03:00
|
|
|
nand_init_4760();
|
|
|
|
serial_puts("JZ4760 EVB lepus\n");
|
2010-06-04 17:31:19 +03:00
|
|
|
break;
|
|
|
|
default:
|
2010-04-14 10:35:21 +03:00
|
|
|
return;
|
2010-06-04 17:31:19 +03:00
|
|
|
}
|
2009-08-21 09:04:09 +03:00
|
|
|
|
2010-06-10 18:11:29 +03:00
|
|
|
serial_puts("GPIO, clocks, SDRAM, UART setup\n"
|
2010-06-04 17:31:19 +03:00
|
|
|
"now jump back to BOOT ROM...\n");
|
2009-08-21 09:04:09 +03:00
|
|
|
|
2010-06-10 09:59:42 +03:00
|
|
|
if (ARG_CPU_ID == 0x4760) {
|
2010-06-10 09:13:09 +03:00
|
|
|
__asm__ (
|
|
|
|
"li $31, 0xbfc012e0 \n\t"
|
|
|
|
"jr $31 \n\t "
|
|
|
|
);
|
|
|
|
}
|
2009-08-21 09:04:09 +03:00
|
|
|
}
|
2009-12-05 19:22:31 +02:00
|
|
|
|