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#include <common.h>
28#include <asm/io.h>
29#include <asm/arch/imx-regs.h>
30#include <asm/arch/imx25-pinmux.h>
31
32static void mdelay(int n)
33{
34 while (n-- > 0)
35 udelay(1000);
36}
37
38DECLARE_GLOBAL_DATA_PTR;
39
40#ifdef CONFIG_FEC_MXC
41void tx25_fec_init(void)
42{
43 struct iomuxc_mux_ctl *muxctl;
44 struct iomuxc_pad_ctl *padctl;
45 u32 val;
46 u32 gpio_mux_mode = MX25_PIN_MUX_MODE(5);
47 struct gpio_regs *gpio4 = (struct gpio_regs *)IMX_GPIO4_BASE;
48 struct gpio_regs *gpio3 = (struct gpio_regs *)IMX_GPIO3_BASE;
49 u32 saved_rdata0_mode, saved_rdata1_mode, saved_rx_dv_mode;
50
51 debug("tx25_fec_init\n");
52
53
54
55 mx25_fec_init_pins();
56
57
58
59
60
61
62
63 muxctl = (struct iomuxc_mux_ctl *)IMX_IOPADMUX_BASE;
64 padctl = (struct iomuxc_pad_ctl *)IMX_IOPADCTL_BASE;
65
66 writel(gpio_mux_mode, &muxctl->pad_d13);
67 writel(gpio_mux_mode, &muxctl->pad_d11);
68
69 writel(0x0, &padctl->pad_d13);
70 writel(0x0, &padctl->pad_d11);
71
72
73 val = readl(&gpio4->dr) & ~((1 << 7) | (1 << 9));
74 writel(val, &gpio4->dr);
75 val = readl(&gpio4->dir) | (1 << 7) | (1 << 9);
76 writel(val, &gpio4->dir);
77
78 mdelay(5);
79
80 debug("resetting phy\n");
81
82
83 val = readl(&gpio4->dr) | 1 << 9;
84 writel(val, &gpio4->dr);
85
86 mdelay(10);
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103 saved_rdata0_mode = readl(&muxctl->pad_fec_rdata0);
104 saved_rdata1_mode = readl(&muxctl->pad_fec_rdata1);
105 saved_rx_dv_mode = readl(&muxctl->pad_fec_rx_dv);
106
107 writel(gpio_mux_mode, &muxctl->pad_fec_rdata0);
108 writel(gpio_mux_mode, &muxctl->pad_fec_rdata1);
109 writel(gpio_mux_mode, &muxctl->pad_fec_rx_dv);
110
111
112
113
114 val = readl(&gpio3->dr) | (1 << 10) | (1 << 11) | (1 << 12);
115 writel(val, &gpio3->dr);
116 val = readl(&gpio3->dir) | (1 << 10) | (1 << 11) | (1 << 12);
117 writel(val, &gpio3->dir);
118
119 mdelay(22);
120
121
122
123
124 val = readl(&gpio4->dr) | 1 << 7;
125 writel(val, &gpio4->dr);
126 writel(val, &gpio4->dr);
127
128 mdelay(5);
129
130
131
132
133 writel(saved_rdata0_mode, &muxctl->pad_fec_rdata0);
134 writel(saved_rdata1_mode, &muxctl->pad_fec_rdata1);
135 writel(saved_rx_dv_mode, &muxctl->pad_fec_rx_dv);
136}
137#else
138#define tx25_fec_init()
139#endif
140
141int board_init()
142{
143#ifdef CONFIG_MXC_UART
144 extern void mx25_uart_init_pins(void);
145
146 mx25_uart_init_pins();
147#endif
148
149 gd->bd->bi_arch_number = MACH_TYPE_TX25;
150 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
151 return 0;
152}
153
154int board_late_init(void)
155{
156 tx25_fec_init();
157 return 0;
158}
159
160int dram_init (void)
161{
162
163 gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
164 gd->bd->bi_dram[0].size = get_ram_size((volatile void *)PHYS_SDRAM_1,
165 PHYS_SDRAM_1_SIZE);
166#if CONFIG_NR_DRAM_BANKS > 1
167 gd->bd->bi_dram[1].start = PHYS_SDRAM_2;
168 gd->bd->bi_dram[1].size = get_ram_size((volatile void *)PHYS_SDRAM_2,
169 PHYS_SDRAM_2_SIZE);
170#endif
171
172 return 0;
173}
174
175int checkboard(void)
176{
177 printf("KARO TX25\n");
178 return 0;
179}
180