-
Notifications
You must be signed in to change notification settings - Fork 30
/
board.c
96 lines (86 loc) · 2.81 KB
/
board.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <types.h>
#include <log.h>
#include <common.h>
#include <reg-ncat.h>
#include <sys-clk.h>
#include <mmu.h>
#include <sys-gpio.h>
#include <sys-sdcard.h>
#include <sys-dram.h>
#include <sys-spi.h>
#include <sys-uart.h>
sunxi_serial_t uart_dbg = {
.base = SUNXI_UART0_BASE,
.id = 0,
.gpio_tx = {GPIO_PIN(GPIO_PORTB, 8), GPIO_PERIPH_MUX6},
.gpio_rx = {GPIO_PIN(GPIO_PORTB, 9), GPIO_PERIPH_MUX6},
};
sunxi_spi_t sunxi_spi0 = {
.base = SUNXI_SPI0_BASE,
.id = 0,
.clk_rate = 75 * 1000 * 1000,
.gpio_cs = {GPIO_PIN(GPIO_PORTC, 1), GPIO_PERIPH_MUX4},
.gpio_sck = {GPIO_PIN(GPIO_PORTC, 0), GPIO_PERIPH_MUX4},
.gpio_mosi = {GPIO_PIN(GPIO_PORTC, 2), GPIO_PERIPH_MUX4},
.gpio_miso = {GPIO_PIN(GPIO_PORTC, 3), GPIO_PERIPH_MUX4},
.gpio_wp = {GPIO_PIN(GPIO_PORTC, 4), GPIO_PERIPH_MUX4},
.gpio_hold = {GPIO_PIN(GPIO_PORTC, 5), GPIO_PERIPH_MUX4},
};
sdhci_t sdhci0 = {
.name = "sdhci0",
.id = 0,
.reg = (sdhci_reg_t *) 0x04020000,
.voltage = MMC_VDD_27_36,
.width = MMC_BUS_WIDTH_4,
.clock = MMC_CLK_50M,
.removable = 0,
.isspi = FALSE,
.skew_auto_mode = TRUE,
.sdhci_pll = CCU_MMC_CTRL_PLL_PERIPH1X,
.gpio_clk = {GPIO_PIN(GPIO_PORTF, 2), GPIO_PERIPH_MUX2},
.gpio_cmd = {GPIO_PIN(GPIO_PORTF, 3), GPIO_PERIPH_MUX2},
.gpio_d0 = {GPIO_PIN(GPIO_PORTF, 1), GPIO_PERIPH_MUX2},
.gpio_d1 = {GPIO_PIN(GPIO_PORTF, 0), GPIO_PERIPH_MUX2},
.gpio_d2 = {GPIO_PIN(GPIO_PORTF, 5), GPIO_PERIPH_MUX2},
.gpio_d3 = {GPIO_PIN(GPIO_PORTF, 4), GPIO_PERIPH_MUX2},
};
dram_para_t dram_para = {
.dram_clk = 792,
.dram_type = 3,
.dram_zq = 0x7b7bfb,
.dram_odt_en = 0x01,
.dram_para1 = 0x000010d2,
.dram_para2 = 0,
.dram_mr0 = 0x1c70,
.dram_mr1 = 0x42,
.dram_mr2 = 0x18,
.dram_mr3 = 0,
.dram_tpr0 = 0x004a2195,
.dram_tpr1 = 0x02423190,
.dram_tpr2 = 0x0008b061,
.dram_tpr3 = 0xb4787896,// unused
.dram_tpr4 = 0,
.dram_tpr5 = 0x48484848,
.dram_tpr6 = 0x00000048,
.dram_tpr7 = 0x1620121e,// unused
.dram_tpr8 = 0,
.dram_tpr9 = 0,// clock?
.dram_tpr10 = 0,
.dram_tpr11 = 0x00770000,
.dram_tpr12 = 0x00000002,
.dram_tpr13 = 0x34050100,
};
void clean_syterkit_data(void) {
/* Disable MMU, data cache, instruction cache, interrupts */
arm32_mmu_disable();
printk_info("disable mmu ok...\n");
arm32_dcache_disable();
printk_info("disable dcache ok...\n");
arm32_icache_disable();
printk_info("disable icache ok...\n");
arm32_interrupt_disable();
printk_info("free interrupt ok...\n");
}