1
2
3
4
5
6
7
8
9#include <common.h>
10#include <s6e63d6.h>
11#include <netdev.h>
12#include <asm/arch/clock.h>
13#include <asm/arch/imx-regs.h>
14#include <asm/arch/sys_proto.h>
15
16DECLARE_GLOBAL_DATA_PTR;
17
18int dram_init(void)
19{
20
21 gd->ram_size = get_ram_size((void *)PHYS_SDRAM_1,
22 PHYS_SDRAM_1_SIZE);
23 return 0;
24}
25
26int board_init(void)
27{
28
29 gd->bd->bi_arch_number = MACH_TYPE_PCM037;
30 gd->bd->bi_boot_params = (0x80000100);
31
32 return 0;
33}
34
35int board_early_init_f(void)
36{
37
38 static const struct mxc_weimcs cs0 = {
39
40 CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 15, 0, 0, 3),
41
42 CSCR_L(1, 0, 0, 0, 0, 1, 5, 0, 0, 0, 1, 1),
43
44 CSCR_A(0, 0, 7, 2, 0, 0, 2, 1, 0, 0, 0, 0, 0, 0)
45 };
46
47
48 static const struct mxc_weimcs cs1 = {
49
50 CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 31, 0, 0, 6),
51
52 CSCR_L(4, 4, 4, 10, 4, 0, 5, 4, 0, 0, 0, 1),
53
54 CSCR_A(4, 4, 4, 4, 0, 1, 4, 3, 0, 0, 0, 0, 1, 0)
55 };
56
57
58 static const struct mxc_weimcs cs4 = {
59
60 CSCR_U(0, 0, 0, 0, 0, 0, 0, 0, 3, 24, 0, 4, 3),
61
62 CSCR_L(2, 2, 2, 5, 2, 0, 5, 2, 0, 0, 0, 1),
63
64 CSCR_A(2, 2, 2, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0)
65 };
66
67 mxc_setup_weimcs(0, &cs0);
68 mxc_setup_weimcs(1, &cs1);
69 mxc_setup_weimcs(4, &cs4);
70
71
72 mx31_gpio_mux(MUX_RXD1__UART1_RXD_MUX);
73 mx31_gpio_mux(MUX_TXD1__UART1_TXD_MUX);
74 mx31_gpio_mux(MUX_RTS1__UART1_RTS_B);
75 mx31_gpio_mux(MUX_CTS1__UART1_CTS_B);
76
77
78 mx31_gpio_mux(MUX_CSPI2_MOSI__I2C2_SCL);
79 mx31_gpio_mux(MUX_CSPI2_MISO__I2C2_SDA);
80
81 return 0;
82}
83
84#ifdef CONFIG_BOARD_LATE_INIT
85int board_late_init(void)
86{
87#ifdef CONFIG_S6E63D6
88 struct s6e63d6 data = {
89
90
91
92
93
94 .cs = 2 | (57 << 8),
95 .bus = 0,
96 .id = 0,
97 };
98 int ret;
99
100
101 mx31_gpio_mux(MUX_CSPI1_SCLK__CSPI1_CLK);
102 mx31_gpio_mux(MUX_CSPI1_SPI_RDY__CSPI1_DATAREADY_B);
103 mx31_gpio_mux(MUX_CSPI1_MOSI__CSPI1_MOSI);
104 mx31_gpio_mux(MUX_CSPI1_MISO__CSPI1_MISO);
105 mx31_gpio_mux(MUX_CSPI1_SS0__CSPI1_SS0_B);
106 mx31_gpio_mux(MUX_CSPI1_SS1__CSPI1_SS1_B);
107 mx31_gpio_mux(MUX_CSPI1_SS2__CSPI1_SS2_B);
108
109
110 __REG(CCM_CGR2) = __REG(CCM_CGR2) | (3 << 2);
111
112
113
114 mx31_gpio_mux(IOMUX_MODE(0x63, MUX_CTL_GPIO));
115
116
117 ret = s6e63d6_init(&data);
118 if (ret)
119 return ret;
120
121
122
123
124
125
126 s6e63d6_index(&data, 2);
127 s6e63d6_param(&data, 0x0182);
128 s6e63d6_index(&data, 3);
129 s6e63d6_param(&data, 0x8130);
130 s6e63d6_index(&data, 0x10);
131 s6e63d6_param(&data, 0x0000);
132 s6e63d6_index(&data, 5);
133 s6e63d6_param(&data, 0x0001);
134 s6e63d6_index(&data, 0x22);
135#endif
136 return 0;
137}
138#endif
139
140int checkboard (void)
141{
142 printf("Board: Phytec phyCore i.MX31\n");
143 return 0;
144}
145
146int board_eth_init(bd_t *bis)
147{
148 int rc = 0;
149#ifdef CONFIG_SMC911X
150 rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
151#endif
152 return rc;
153}
154