Root/xbboot/target-stage1/stage1.c

1//
2// Authors: Wolfgang Spraul <wolfgang@sharism.cc>
3//
4// This program is free software; you can redistribute it and/or
5// modify it under the terms of the GNU General Public License
6// as published by the Free Software Foundation; either version
7// 3 of the License, or (at your option) any later version.
8//
9
10#include "common.h"
11#include "serial.h"
12
13extern void gpio_init_4740();
14extern void pll_init_4740();
15extern void serial_init_4740(int uart);
16extern void sdram_init_4740();
17extern void nand_init_4740();
18
19extern void gpio_init_4760();
20extern void pll_init_4760();
21extern void cpm_start_all_4760();
22extern void serial_init_4760(int uart);
23extern void sdram_init_4760();
24extern void nand_init_4760();
25
26void load_args_4740()
27{
28    ARG_EXTAL = 12 * 1000000;
29    ARG_CPU_SPEED = 21 * ARG_EXTAL;
30    ARG_PHM_DIV = 3;
31    ARG_UART_BAUD = 57600;
32    ARG_BUS_WIDTH_16 = * (int *)0x80002014;
33    ARG_BANK_ADDR_2BIT = 1;
34    ARG_ROW_ADDR = 13;
35    ARG_COL_ADDR = 9;
36}
37
38void c_main(void)
39{
40    ARG_CPU_ID = * (int *)0x80002008;
41
42    switch (ARG_CPU_ID) {
43    case 0x4740:
44        load_args_4740();
45        gpio_init_4740();
46        serial_init_4740(0);
47        pll_init_4740();
48        sdram_init_4740();
49        nand_init_4740();
50        serial_puts("Ben NanoNote\n");
51        break;
52    case 0x4760:
53        gpio_init_4760();
54        cpm_start_all_4760();
55        serial_init_4760(1);
56        pll_init_4760();
57        sdram_init_4760();
58        nand_init_4760();
59        serial_puts("JZ4760 EVB lepus\n");
60        break;
61    default:
62        return;
63    }
64
65    serial_puts("GPIO, clocks, SDRAM, UART setup\n"
66            "now jump back to BOOT ROM...\n");
67
68    if (ARG_CPU_ID == 0x4760) {
69        __asm__ (
70        "li $31, 0xbfc012e0 \n\t"
71        "jr $31 \n\t "
72        );
73    }
74}
75
76

Archive Download this file



interactive