blob: 8d01f5fcf0d62b7cfbab5b33af87bbf8b9a28a3f [file] [log] [blame]
TsiChung Liewf6afe722007-06-18 13:50:13 -05001/*
2 *
3 * (C) Copyright 2000-2003
4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 *
Alison Wang35d23df2012-03-26 21:49:05 +00006 * (C) Copyright 2004-2008, 2012 Freescale Semiconductor, Inc.
TsiChung Liewf6afe722007-06-18 13:50:13 -05007 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
8 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
TsiChung Liewf6afe722007-06-18 13:50:13 -050010 */
11
12#include <common.h>
13#include <watchdog.h>
TsiChungLiew97401c32007-07-05 23:03:28 -050014#include <asm/immap.h>
Alison Wang35d23df2012-03-26 21:49:05 +000015#include <asm/io.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050016
TsiChung Liew69b17572008-10-21 13:47:54 +000017#if defined(CONFIG_CMD_NET)
18#include <config.h>
19#include <net.h>
20#include <asm/fec.h>
21#endif
22
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000023#ifdef CONFIG_MCF5301x
24void cpu_init_f(void)
25{
Alison Wang35d23df2012-03-26 21:49:05 +000026 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
27 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
28 fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000029
Alison Wang35d23df2012-03-26 21:49:05 +000030 out_be32(&scm1->mpr, 0x77777777);
31 out_be32(&scm1->pacra, 0);
32 out_be32(&scm1->pacrb, 0);
33 out_be32(&scm1->pacrc, 0);
34 out_be32(&scm1->pacrd, 0);
35 out_be32(&scm1->pacre, 0);
36 out_be32(&scm1->pacrf, 0);
37 out_be32(&scm1->pacrg, 0);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000038
39#if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \
40 && defined(CONFIG_SYS_CS0_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000041 setbits_8(&gpio->par_cs, GPIO_PAR_CS0_CS0);
42 out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE);
43 out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL);
44 out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000045#endif
46
47#if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \
48 && defined(CONFIG_SYS_CS1_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000049 setbits_8(&gpio->par_cs, GPIO_PAR_CS1_CS1);
50 out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE);
51 out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL);
52 out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000053#endif
54
55#if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \
56 && defined(CONFIG_SYS_CS2_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000057 out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE);
58 out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL);
59 out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000060#endif
61
62#if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \
63 && defined(CONFIG_SYS_CS3_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000064 out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE);
65 out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL);
66 out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000067#endif
68
69#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
70 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000071 setbits_8(&gpio->par_cs, GPIO_PAR_CS4);
72 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
73 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
74 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000075#endif
76
77#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
78 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000079 setbits_8(&gpio->par_cs, GPIO_PAR_CS5);
80 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
81 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
82 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000083#endif
84
Heiko Schocherf2850742012-10-24 13:48:22 +020085#ifdef CONFIG_SYS_I2C_FSL
Alison Wang35d23df2012-03-26 21:49:05 +000086 out_8(&gpio->par_feci2c,
87 GPIO_PAR_FECI2C_SDA_SDA | GPIO_PAR_FECI2C_SCL_SCL);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000088#endif
89
90 icache_enable();
91}
92
93/* initialize higher level parts of CPU like timers */
94int cpu_init_r(void)
95{
96#ifdef CONFIG_MCFFEC
Alison Wang35d23df2012-03-26 21:49:05 +000097 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000098#endif
99#ifdef CONFIG_MCFRTC
Alison Wang35d23df2012-03-26 21:49:05 +0000100 rtc_t *rtc = (rtc_t *) (CONFIG_SYS_MCFRTC_BASE);
101 rtcex_t *rtcex = (rtcex_t *) &rtc->extended;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000102
Alison Wang35d23df2012-03-26 21:49:05 +0000103 out_be32(&rtcex->gocu, CONFIG_SYS_RTC_CNT);
104 out_be32(&rtcex->gocl, CONFIG_SYS_RTC_SETUP);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000105
106#endif
107#ifdef CONFIG_MCFFEC
108 if (CONFIG_SYS_FEC0_MIIBASE != CONFIG_SYS_FEC1_MIIBASE)
Alison Wang35d23df2012-03-26 21:49:05 +0000109 setbits_be16(&ccm->misccr, CCM_MISCCR_FECM);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000110 else
Alison Wang35d23df2012-03-26 21:49:05 +0000111 clrbits_be16(&ccm->misccr, CCM_MISCCR_FECM);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000112#endif
113
114 return (0);
115}
116
TsiChung Liewf9556a72010-03-09 19:17:52 -0600117void uart_port_conf(int port)
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000118{
Alison Wang35d23df2012-03-26 21:49:05 +0000119 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000120
121 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600122 switch (port) {
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000123 case 0:
Alison Wang35d23df2012-03-26 21:49:05 +0000124 clrbits_8(&gpio->par_uart,
125 GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
126 setbits_8(&gpio->par_uart,
127 GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000128 break;
129 case 1:
130#ifdef CONFIG_SYS_UART1_ALT1_GPIO
Alison Wang35d23df2012-03-26 21:49:05 +0000131 clrbits_8(&gpio->par_simp1h,
132 GPIO_PAR_SIMP1H_DATA1_UNMASK |
133 GPIO_PAR_SIMP1H_VEN1_UNMASK);
134 setbits_8(&gpio->par_simp1h,
135 GPIO_PAR_SIMP1H_DATA1_U1TXD |
136 GPIO_PAR_SIMP1H_VEN1_U1RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000137#elif defined(CONFIG_SYS_UART1_ALT2_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000138 clrbits_8(&gpio->par_ssih,
139 GPIO_PAR_SSIH_RXD_UNMASK |
140 GPIO_PAR_SSIH_TXD_UNMASK);
141 setbits_8(&gpio->par_ssih,
142 GPIO_PAR_SSIH_RXD_U1RXD |
143 GPIO_PAR_SSIH_TXD_U1TXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000144#endif
145 break;
146 case 2:
147#ifdef CONFIG_SYS_UART2_PRI_GPIO
Alison Wang35d23df2012-03-26 21:49:05 +0000148 setbits_8(&gpio->par_uart,
149 GPIO_PAR_UART_U2TXD |
150 GPIO_PAR_UART_U2RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000151#elif defined(CONFIG_SYS_UART2_ALT1_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000152 clrbits_8(&gpio->par_dspih,
153 GPIO_PAR_DSPIH_SIN_UNMASK |
154 GPIO_PAR_DSPIH_SOUT_UNMASK);
155 setbits_8(&gpio->par_dspih,
156 GPIO_PAR_DSPIH_SIN_U2RXD |
157 GPIO_PAR_DSPIH_SOUT_U2TXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000158#elif defined(CONFIG_SYS_UART2_ALT2_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000159 clrbits_8(&gpio->par_feci2c,
160 GPIO_PAR_FECI2C_SDA_UNMASK |
161 GPIO_PAR_FECI2C_SCL_UNMASK);
162 setbits_8(&gpio->par_feci2c,
163 GPIO_PAR_FECI2C_SDA_U2TXD |
164 GPIO_PAR_FECI2C_SCL_U2RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000165#endif
166 break;
167 }
168}
169
170#if defined(CONFIG_CMD_NET)
171int fecpin_setclear(struct eth_device *dev, int setclear)
172{
Alison Wang35d23df2012-03-26 21:49:05 +0000173 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000174 struct fec_info_s *info = (struct fec_info_s *)dev->priv;
175
176 if (setclear) {
177 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang35d23df2012-03-26 21:49:05 +0000178 setbits_8(&gpio->par_fec,
179 GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC);
180 setbits_8(&gpio->par_feci2c,
181 GPIO_PAR_FECI2C_MDC0 | GPIO_PAR_FECI2C_MDIO0);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000182 } else {
Alison Wang35d23df2012-03-26 21:49:05 +0000183 setbits_8(&gpio->par_fec,
184 GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC);
185 setbits_8(&gpio->par_feci2c,
186 GPIO_PAR_FECI2C_MDC1 | GPIO_PAR_FECI2C_MDIO1);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000187 }
188 } else {
189 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang35d23df2012-03-26 21:49:05 +0000190 clrbits_8(&gpio->par_fec,
191 GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC);
192 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII0_UNMASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000193 } else {
Alison Wang35d23df2012-03-26 21:49:05 +0000194 clrbits_8(&gpio->par_fec,
195 GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC);
196 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII1_UNMASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000197 }
198 }
199 return 0;
200}
201#endif /* CONFIG_CMD_NET */
202#endif /* CONFIG_MCF5301x */
203
204#ifdef CONFIG_MCF532x
TsiChung Liewf6afe722007-06-18 13:50:13 -0500205void cpu_init_f(void)
206{
Alison Wang35d23df2012-03-26 21:49:05 +0000207 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
208 scm2_t *scm2 = (scm2_t *) MMAP_SCM2;
209 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
210 fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
Simon Glass660031e2014-06-07 22:07:58 -0600211#ifndef CONFIG_WATCHDOG
Alison Wang35d23df2012-03-26 21:49:05 +0000212 wdog_t *wdog = (wdog_t *) MMAP_WDOG;
TsiChung Liewf6afe722007-06-18 13:50:13 -0500213
214 /* watchdog is enabled by default - disable the watchdog */
Alison Wang35d23df2012-03-26 21:49:05 +0000215 out_be16(&wdog->cr, 0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500216#endif
217
Alison Wang35d23df2012-03-26 21:49:05 +0000218 out_be32(&scm1->mpr0, 0x77777777);
219 out_be32(&scm2->pacra, 0);
220 out_be32(&scm2->pacrb, 0);
221 out_be32(&scm2->pacrc, 0);
222 out_be32(&scm2->pacrd, 0);
223 out_be32(&scm2->pacre, 0);
224 out_be32(&scm2->pacrf, 0);
225 out_be32(&scm2->pacrg, 0);
226 out_be32(&scm1->pacrh, 0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500227
TsiChung Liewf6afe722007-06-18 13:50:13 -0500228 /* Port configuration */
Alison Wang35d23df2012-03-26 21:49:05 +0000229 out_8(&gpio->par_cs, 0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500230
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000231#if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \
232 && defined(CONFIG_SYS_CS0_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000233 out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE);
234 out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL);
235 out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500236#endif
237
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000238#if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \
239 && defined(CONFIG_SYS_CS1_CTRL))
TsiChung Liewf6afe722007-06-18 13:50:13 -0500240 /* Latch chipselect */
Alison Wang35d23df2012-03-26 21:49:05 +0000241 setbits_8(&gpio->par_cs, GPIO_PAR_CS1);
242 out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE);
243 out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL);
244 out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500245#endif
246
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000247#if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \
248 && defined(CONFIG_SYS_CS2_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000249 setbits_8(&gpio->par_cs, GPIO_PAR_CS2);
250 out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE);
251 out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL);
252 out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500253#endif
254
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000255#if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \
256 && defined(CONFIG_SYS_CS3_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000257 setbits_8(&gpio->par_cs, GPIO_PAR_CS3);
258 out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE);
259 out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL);
260 out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500261#endif
262
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000263#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
264 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000265 setbits_8(&gpio->par_cs, GPIO_PAR_CS4);
266 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
267 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
268 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500269#endif
270
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000271#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
272 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000273 setbits_8(&gpio->par_cs, GPIO_PAR_CS5);
274 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
275 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
276 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500277#endif
TsiChung6373c0c2007-07-10 15:45:43 -0500278
Heiko Schocherf2850742012-10-24 13:48:22 +0200279#ifdef CONFIG_SYS_I2C_FSL
Alison Wang35d23df2012-03-26 21:49:05 +0000280 out_8(&gpio->par_feci2c,
281 GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA);
TsiChungLiew2325c9f2007-08-05 05:15:18 -0500282#endif
283
TsiChung6373c0c2007-07-10 15:45:43 -0500284 icache_enable();
TsiChung Liewf6afe722007-06-18 13:50:13 -0500285}
286
287/*
288 * initialize higher level parts of CPU like timers
289 */
290int cpu_init_r(void)
291{
TsiChung Liewf6afe722007-06-18 13:50:13 -0500292 return (0);
293}
TsiChungLiew74634c82007-08-05 03:55:21 -0500294
TsiChung Liewf9556a72010-03-09 19:17:52 -0600295void uart_port_conf(int port)
TsiChungLiew74634c82007-08-05 03:55:21 -0500296{
Alison Wang35d23df2012-03-26 21:49:05 +0000297 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChungLiew74634c82007-08-05 03:55:21 -0500298
299 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600300 switch (port) {
TsiChungLiew74634c82007-08-05 03:55:21 -0500301 case 0:
Alison Wang35d23df2012-03-26 21:49:05 +0000302 clrbits_be16(&gpio->par_uart,
303 GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
304 setbits_be16(&gpio->par_uart,
305 GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
TsiChungLiew74634c82007-08-05 03:55:21 -0500306 break;
307 case 1:
Alison Wang35d23df2012-03-26 21:49:05 +0000308 clrbits_be16(&gpio->par_uart,
309 GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
310 setbits_be16(&gpio->par_uart,
311 GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
TsiChungLiew74634c82007-08-05 03:55:21 -0500312 break;
313 case 2:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600314#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang35d23df2012-03-26 21:49:05 +0000315 clrbits_8(&gpio->par_timer, 0xf0);
316 setbits_8(&gpio->par_timer,
317 GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2);
TsiChung Liewf9556a72010-03-09 19:17:52 -0600318#elif defined(CONFIG_SYS_UART2_ALT2_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000319 clrbits_8(&gpio->par_feci2c, 0x00ff);
320 setbits_8(&gpio->par_feci2c,
321 GPIO_PAR_FECI2C_SCL_UTXD2 | GPIO_PAR_FECI2C_SDA_URXD2);
TsiChung Liewf9556a72010-03-09 19:17:52 -0600322#elif defined(CONFIG_SYS_UART2_ALT3_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000323 clrbits_be16(&gpio->par_ssi, 0x0f00);
324 setbits_be16(&gpio->par_ssi,
325 GPIO_PAR_SSI_RXD(2) | GPIO_PAR_SSI_TXD(2));
TsiChung Liewf9556a72010-03-09 19:17:52 -0600326#endif
TsiChungLiew74634c82007-08-05 03:55:21 -0500327 break;
328 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000329}
330
331#if defined(CONFIG_CMD_NET)
332int fecpin_setclear(struct eth_device *dev, int setclear)
333{
Alison Wang35d23df2012-03-26 21:49:05 +0000334 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000335
336 if (setclear) {
Alison Wang35d23df2012-03-26 21:49:05 +0000337 setbits_8(&gpio->par_fec,
338 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
339 setbits_8(&gpio->par_feci2c,
340 GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);
TsiChung Liew69b17572008-10-21 13:47:54 +0000341 } else {
Alison Wang35d23df2012-03-26 21:49:05 +0000342 clrbits_8(&gpio->par_fec,
343 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
344 clrbits_8(&gpio->par_feci2c,
345 GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);
TsiChung Liew69b17572008-10-21 13:47:54 +0000346 }
347 return 0;
TsiChungLiew74634c82007-08-05 03:55:21 -0500348}
TsiChung Liew69b17572008-10-21 13:47:54 +0000349#endif
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000350#endif /* CONFIG_MCF532x */