1
2
3
4
5
6
7
8
9
10
11
12#include <common.h>
13#include <netdev.h>
14#include <asm/io.h>
15#include <asm/arch/s3c24x0_cpu.h>
16
17DECLARE_GLOBAL_DATA_PTR;
18
19#define FCLK_SPEED 1
20
21#if (FCLK_SPEED == 0)
22#define M_MDIV 0xC3
23#define M_PDIV 0x4
24#define M_SDIV 0x1
25#elif (FCLK_SPEED == 1)
26#define M_MDIV 0xA1
27#define M_PDIV 0x3
28#define M_SDIV 0x1
29#endif
30
31#define USB_CLOCK 1
32
33#if (USB_CLOCK == 0)
34#define U_M_MDIV 0xA1
35#define U_M_PDIV 0x3
36#define U_M_SDIV 0x1
37#elif (USB_CLOCK == 1)
38#define U_M_MDIV 0x48
39#define U_M_PDIV 0x3
40#define U_M_SDIV 0x2
41#endif
42
43static inline void pll_delay(unsigned long loops)
44{
45 __asm__ volatile ("1:\n"
46 "subs %0, %1, #1\n"
47 "bne 1b" : "=r" (loops) : "0" (loops));
48}
49
50
51
52
53
54int board_early_init_f(void)
55{
56 struct s3c24x0_clock_power * const clk_power =
57 s3c24x0_get_base_clock_power();
58 struct s3c24x0_gpio * const gpio = s3c24x0_get_base_gpio();
59
60
61 writel(0xFFFFFF, &clk_power->locktime);
62
63
64 writel((M_MDIV << 12) + (M_PDIV << 4) + M_SDIV,
65 &clk_power->mpllcon);
66
67
68 pll_delay(4000);
69
70
71 writel((U_M_MDIV << 12) + (U_M_PDIV << 4) + U_M_SDIV,
72 &clk_power->upllcon);
73
74
75 pll_delay(8000);
76
77
78 writel(0x007FFFFF, &gpio->gpacon);
79 writel(0x00044555, &gpio->gpbcon);
80 writel(0x000007FF, &gpio->gpbup);
81 writel(0xAAAAAAAA, &gpio->gpccon);
82 writel(0x0000FFFF, &gpio->gpcup);
83 writel(0xAAAAAAAA, &gpio->gpdcon);
84 writel(0x0000FFFF, &gpio->gpdup);
85 writel(0xAAAAAAAA, &gpio->gpecon);
86 writel(0x0000FFFF, &gpio->gpeup);
87 writel(0x000055AA, &gpio->gpfcon);
88 writel(0x000000FF, &gpio->gpfup);
89 writel(0xFF95FFBA, &gpio->gpgcon);
90 writel(0x0000FFFF, &gpio->gpgup);
91 writel(0x002AFAAA, &gpio->gphcon);
92 writel(0x000007FF, &gpio->gphup);
93
94 return 0;
95}
96
97int board_init(void)
98{
99
100 gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
101
102
103 gd->bd->bi_boot_params = 0x30000100;
104
105 icache_enable();
106 dcache_enable();
107
108 return 0;
109}
110
111int dram_init(void)
112{
113
114 gd->ram_size = PHYS_SDRAM_1_SIZE;
115 return 0;
116}
117
118#ifdef CONFIG_CMD_NET
119int board_eth_init(bd_t *bis)
120{
121 int rc = 0;
122#ifdef CONFIG_CS8900
123 rc = cs8900_initialize(0, CONFIG_CS8900_BASE);
124#endif
125 return rc;
126}
127#endif
128
129
130
131
132
133ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info)
134{
135 info->portwidth = FLASH_CFI_16BIT;
136 info->chipwidth = FLASH_CFI_BY16;
137 info->interface = FLASH_CFI_X16;
138 return 1;
139}
140