blob: cbf840f76e81364d85aa032b01bb24bbcb5d7bdd [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
TsiChung Liewf6afe722007-06-18 13:50:13 -05002/*
3 *
4 * (C) Copyright 2000-2003
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
6 *
Alison Wang35d23df2012-03-26 21:49:05 +00007 * (C) Copyright 2004-2008, 2012 Freescale Semiconductor, Inc.
TsiChung Liewf6afe722007-06-18 13:50:13 -05008 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
TsiChung Liewf6afe722007-06-18 13:50:13 -05009 */
10
11#include <common.h>
12#include <watchdog.h>
TsiChungLiew97401c32007-07-05 23:03:28 -050013#include <asm/immap.h>
Alison Wang35d23df2012-03-26 21:49:05 +000014#include <asm/io.h>
TsiChung Liewf6afe722007-06-18 13:50:13 -050015
TsiChung Liew69b17572008-10-21 13:47:54 +000016#if defined(CONFIG_CMD_NET)
17#include <config.h>
18#include <net.h>
19#include <asm/fec.h>
20#endif
21
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000022#ifdef CONFIG_MCF5301x
23void cpu_init_f(void)
24{
Alison Wang35d23df2012-03-26 21:49:05 +000025 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
26 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
27 fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000028
Alison Wang35d23df2012-03-26 21:49:05 +000029 out_be32(&scm1->mpr, 0x77777777);
30 out_be32(&scm1->pacra, 0);
31 out_be32(&scm1->pacrb, 0);
32 out_be32(&scm1->pacrc, 0);
33 out_be32(&scm1->pacrd, 0);
34 out_be32(&scm1->pacre, 0);
35 out_be32(&scm1->pacrf, 0);
36 out_be32(&scm1->pacrg, 0);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000037
38#if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \
39 && defined(CONFIG_SYS_CS0_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000040 setbits_8(&gpio->par_cs, GPIO_PAR_CS0_CS0);
41 out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE);
42 out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL);
43 out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000044#endif
45
46#if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \
47 && defined(CONFIG_SYS_CS1_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000048 setbits_8(&gpio->par_cs, GPIO_PAR_CS1_CS1);
49 out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE);
50 out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL);
51 out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000052#endif
53
54#if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \
55 && defined(CONFIG_SYS_CS2_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000056 out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE);
57 out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL);
58 out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000059#endif
60
61#if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \
62 && defined(CONFIG_SYS_CS3_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000063 out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE);
64 out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL);
65 out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000066#endif
67
68#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
69 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000070 setbits_8(&gpio->par_cs, GPIO_PAR_CS4);
71 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
72 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
73 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000074#endif
75
76#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
77 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +000078 setbits_8(&gpio->par_cs, GPIO_PAR_CS5);
79 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
80 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
81 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000082#endif
83
Heiko Schocherf2850742012-10-24 13:48:22 +020084#ifdef CONFIG_SYS_I2C_FSL
Alison Wang35d23df2012-03-26 21:49:05 +000085 out_8(&gpio->par_feci2c,
86 GPIO_PAR_FECI2C_SDA_SDA | GPIO_PAR_FECI2C_SCL_SCL);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000087#endif
88
89 icache_enable();
90}
91
92/* initialize higher level parts of CPU like timers */
93int cpu_init_r(void)
94{
95#ifdef CONFIG_MCFFEC
Alison Wang35d23df2012-03-26 21:49:05 +000096 ccm_t *ccm = (ccm_t *) MMAP_CCM;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +000097#endif
98#ifdef CONFIG_MCFRTC
Alison Wang35d23df2012-03-26 21:49:05 +000099 rtc_t *rtc = (rtc_t *) (CONFIG_SYS_MCFRTC_BASE);
100 rtcex_t *rtcex = (rtcex_t *) &rtc->extended;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000101
Alison Wang35d23df2012-03-26 21:49:05 +0000102 out_be32(&rtcex->gocu, CONFIG_SYS_RTC_CNT);
103 out_be32(&rtcex->gocl, CONFIG_SYS_RTC_SETUP);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000104
105#endif
106#ifdef CONFIG_MCFFEC
107 if (CONFIG_SYS_FEC0_MIIBASE != CONFIG_SYS_FEC1_MIIBASE)
Alison Wang35d23df2012-03-26 21:49:05 +0000108 setbits_be16(&ccm->misccr, CCM_MISCCR_FECM);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000109 else
Alison Wang35d23df2012-03-26 21:49:05 +0000110 clrbits_be16(&ccm->misccr, CCM_MISCCR_FECM);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000111#endif
112
113 return (0);
114}
115
TsiChung Liewf9556a72010-03-09 19:17:52 -0600116void uart_port_conf(int port)
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000117{
Alison Wang35d23df2012-03-26 21:49:05 +0000118 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000119
120 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600121 switch (port) {
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000122 case 0:
Alison Wang35d23df2012-03-26 21:49:05 +0000123 clrbits_8(&gpio->par_uart,
124 GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
125 setbits_8(&gpio->par_uart,
126 GPIO_PAR_UART_U0TXD | GPIO_PAR_UART_U0RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000127 break;
128 case 1:
129#ifdef CONFIG_SYS_UART1_ALT1_GPIO
Alison Wang35d23df2012-03-26 21:49:05 +0000130 clrbits_8(&gpio->par_simp1h,
131 GPIO_PAR_SIMP1H_DATA1_UNMASK |
132 GPIO_PAR_SIMP1H_VEN1_UNMASK);
133 setbits_8(&gpio->par_simp1h,
134 GPIO_PAR_SIMP1H_DATA1_U1TXD |
135 GPIO_PAR_SIMP1H_VEN1_U1RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000136#elif defined(CONFIG_SYS_UART1_ALT2_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000137 clrbits_8(&gpio->par_ssih,
138 GPIO_PAR_SSIH_RXD_UNMASK |
139 GPIO_PAR_SSIH_TXD_UNMASK);
140 setbits_8(&gpio->par_ssih,
141 GPIO_PAR_SSIH_RXD_U1RXD |
142 GPIO_PAR_SSIH_TXD_U1TXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000143#endif
144 break;
145 case 2:
146#ifdef CONFIG_SYS_UART2_PRI_GPIO
Alison Wang35d23df2012-03-26 21:49:05 +0000147 setbits_8(&gpio->par_uart,
148 GPIO_PAR_UART_U2TXD |
149 GPIO_PAR_UART_U2RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000150#elif defined(CONFIG_SYS_UART2_ALT1_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000151 clrbits_8(&gpio->par_dspih,
152 GPIO_PAR_DSPIH_SIN_UNMASK |
153 GPIO_PAR_DSPIH_SOUT_UNMASK);
154 setbits_8(&gpio->par_dspih,
155 GPIO_PAR_DSPIH_SIN_U2RXD |
156 GPIO_PAR_DSPIH_SOUT_U2TXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000157#elif defined(CONFIG_SYS_UART2_ALT2_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000158 clrbits_8(&gpio->par_feci2c,
159 GPIO_PAR_FECI2C_SDA_UNMASK |
160 GPIO_PAR_FECI2C_SCL_UNMASK);
161 setbits_8(&gpio->par_feci2c,
162 GPIO_PAR_FECI2C_SDA_U2TXD |
163 GPIO_PAR_FECI2C_SCL_U2RXD);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000164#endif
165 break;
166 }
167}
168
169#if defined(CONFIG_CMD_NET)
170int fecpin_setclear(struct eth_device *dev, int setclear)
171{
Alison Wang35d23df2012-03-26 21:49:05 +0000172 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000173 struct fec_info_s *info = (struct fec_info_s *)dev->priv;
174
175 if (setclear) {
176 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang35d23df2012-03-26 21:49:05 +0000177 setbits_8(&gpio->par_fec,
178 GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC);
179 setbits_8(&gpio->par_feci2c,
180 GPIO_PAR_FECI2C_MDC0 | GPIO_PAR_FECI2C_MDIO0);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000181 } else {
Alison Wang35d23df2012-03-26 21:49:05 +0000182 setbits_8(&gpio->par_fec,
183 GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC);
184 setbits_8(&gpio->par_feci2c,
185 GPIO_PAR_FECI2C_MDC1 | GPIO_PAR_FECI2C_MDIO1);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000186 }
187 } else {
188 if (info->iobase == CONFIG_SYS_FEC0_IOBASE) {
Alison Wang35d23df2012-03-26 21:49:05 +0000189 clrbits_8(&gpio->par_fec,
190 GPIO_PAR_FEC0_7W_FEC | GPIO_PAR_FEC0_RMII_FEC);
191 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII0_UNMASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000192 } else {
Alison Wang35d23df2012-03-26 21:49:05 +0000193 clrbits_8(&gpio->par_fec,
194 GPIO_PAR_FEC1_7W_FEC | GPIO_PAR_FEC1_RMII_FEC);
195 clrbits_8(&gpio->par_feci2c, ~GPIO_PAR_FECI2C_RMII1_UNMASK);
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000196 }
197 }
198 return 0;
199}
200#endif /* CONFIG_CMD_NET */
201#endif /* CONFIG_MCF5301x */
202
203#ifdef CONFIG_MCF532x
TsiChung Liewf6afe722007-06-18 13:50:13 -0500204void cpu_init_f(void)
205{
Alison Wang35d23df2012-03-26 21:49:05 +0000206 scm1_t *scm1 = (scm1_t *) MMAP_SCM1;
207 scm2_t *scm2 = (scm2_t *) MMAP_SCM2;
208 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
209 fbcs_t *fbcs = (fbcs_t *) MMAP_FBCS;
Simon Glass660031e2014-06-07 22:07:58 -0600210#ifndef CONFIG_WATCHDOG
Alison Wang35d23df2012-03-26 21:49:05 +0000211 wdog_t *wdog = (wdog_t *) MMAP_WDOG;
TsiChung Liewf6afe722007-06-18 13:50:13 -0500212
213 /* watchdog is enabled by default - disable the watchdog */
Alison Wang35d23df2012-03-26 21:49:05 +0000214 out_be16(&wdog->cr, 0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500215#endif
216
Alison Wang35d23df2012-03-26 21:49:05 +0000217 out_be32(&scm1->mpr0, 0x77777777);
218 out_be32(&scm2->pacra, 0);
219 out_be32(&scm2->pacrb, 0);
220 out_be32(&scm2->pacrc, 0);
221 out_be32(&scm2->pacrd, 0);
222 out_be32(&scm2->pacre, 0);
223 out_be32(&scm2->pacrf, 0);
224 out_be32(&scm2->pacrg, 0);
225 out_be32(&scm1->pacrh, 0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500226
TsiChung Liewf6afe722007-06-18 13:50:13 -0500227 /* Port configuration */
Alison Wang35d23df2012-03-26 21:49:05 +0000228 out_8(&gpio->par_cs, 0);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500229
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000230#if (defined(CONFIG_SYS_CS0_BASE) && defined(CONFIG_SYS_CS0_MASK) \
231 && defined(CONFIG_SYS_CS0_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000232 out_be32(&fbcs->csar0, CONFIG_SYS_CS0_BASE);
233 out_be32(&fbcs->cscr0, CONFIG_SYS_CS0_CTRL);
234 out_be32(&fbcs->csmr0, CONFIG_SYS_CS0_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500235#endif
236
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000237#if (defined(CONFIG_SYS_CS1_BASE) && defined(CONFIG_SYS_CS1_MASK) \
238 && defined(CONFIG_SYS_CS1_CTRL))
TsiChung Liewf6afe722007-06-18 13:50:13 -0500239 /* Latch chipselect */
Alison Wang35d23df2012-03-26 21:49:05 +0000240 setbits_8(&gpio->par_cs, GPIO_PAR_CS1);
241 out_be32(&fbcs->csar1, CONFIG_SYS_CS1_BASE);
242 out_be32(&fbcs->cscr1, CONFIG_SYS_CS1_CTRL);
243 out_be32(&fbcs->csmr1, CONFIG_SYS_CS1_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500244#endif
245
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000246#if (defined(CONFIG_SYS_CS2_BASE) && defined(CONFIG_SYS_CS2_MASK) \
247 && defined(CONFIG_SYS_CS2_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000248 setbits_8(&gpio->par_cs, GPIO_PAR_CS2);
249 out_be32(&fbcs->csar2, CONFIG_SYS_CS2_BASE);
250 out_be32(&fbcs->cscr2, CONFIG_SYS_CS2_CTRL);
251 out_be32(&fbcs->csmr2, CONFIG_SYS_CS2_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500252#endif
253
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000254#if (defined(CONFIG_SYS_CS3_BASE) && defined(CONFIG_SYS_CS3_MASK) \
255 && defined(CONFIG_SYS_CS3_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000256 setbits_8(&gpio->par_cs, GPIO_PAR_CS3);
257 out_be32(&fbcs->csar3, CONFIG_SYS_CS3_BASE);
258 out_be32(&fbcs->cscr3, CONFIG_SYS_CS3_CTRL);
259 out_be32(&fbcs->csmr3, CONFIG_SYS_CS3_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500260#endif
261
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000262#if (defined(CONFIG_SYS_CS4_BASE) && defined(CONFIG_SYS_CS4_MASK) \
263 && defined(CONFIG_SYS_CS4_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000264 setbits_8(&gpio->par_cs, GPIO_PAR_CS4);
265 out_be32(&fbcs->csar4, CONFIG_SYS_CS4_BASE);
266 out_be32(&fbcs->cscr4, CONFIG_SYS_CS4_CTRL);
267 out_be32(&fbcs->csmr4, CONFIG_SYS_CS4_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500268#endif
269
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000270#if (defined(CONFIG_SYS_CS5_BASE) && defined(CONFIG_SYS_CS5_MASK) \
271 && defined(CONFIG_SYS_CS5_CTRL))
Alison Wang35d23df2012-03-26 21:49:05 +0000272 setbits_8(&gpio->par_cs, GPIO_PAR_CS5);
273 out_be32(&fbcs->csar5, CONFIG_SYS_CS5_BASE);
274 out_be32(&fbcs->cscr5, CONFIG_SYS_CS5_CTRL);
275 out_be32(&fbcs->csmr5, CONFIG_SYS_CS5_MASK);
TsiChung Liewf6afe722007-06-18 13:50:13 -0500276#endif
TsiChung6373c0c2007-07-10 15:45:43 -0500277
Heiko Schocherf2850742012-10-24 13:48:22 +0200278#ifdef CONFIG_SYS_I2C_FSL
Alison Wang35d23df2012-03-26 21:49:05 +0000279 out_8(&gpio->par_feci2c,
280 GPIO_PAR_FECI2C_SCL_SCL | GPIO_PAR_FECI2C_SDA_SDA);
TsiChungLiew2325c9f2007-08-05 05:15:18 -0500281#endif
282
TsiChung6373c0c2007-07-10 15:45:43 -0500283 icache_enable();
TsiChung Liewf6afe722007-06-18 13:50:13 -0500284}
285
286/*
287 * initialize higher level parts of CPU like timers
288 */
289int cpu_init_r(void)
290{
TsiChung Liewf6afe722007-06-18 13:50:13 -0500291 return (0);
292}
TsiChungLiew74634c82007-08-05 03:55:21 -0500293
TsiChung Liewf9556a72010-03-09 19:17:52 -0600294void uart_port_conf(int port)
TsiChungLiew74634c82007-08-05 03:55:21 -0500295{
Alison Wang35d23df2012-03-26 21:49:05 +0000296 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChungLiew74634c82007-08-05 03:55:21 -0500297
298 /* Setup Ports: */
TsiChung Liewf9556a72010-03-09 19:17:52 -0600299 switch (port) {
TsiChungLiew74634c82007-08-05 03:55:21 -0500300 case 0:
Alison Wang35d23df2012-03-26 21:49:05 +0000301 clrbits_be16(&gpio->par_uart,
302 GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
303 setbits_be16(&gpio->par_uart,
304 GPIO_PAR_UART_TXD0 | GPIO_PAR_UART_RXD0);
TsiChungLiew74634c82007-08-05 03:55:21 -0500305 break;
306 case 1:
Alison Wang35d23df2012-03-26 21:49:05 +0000307 clrbits_be16(&gpio->par_uart,
308 GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
309 setbits_be16(&gpio->par_uart,
310 GPIO_PAR_UART_TXD1(3) | GPIO_PAR_UART_RXD1(3));
TsiChungLiew74634c82007-08-05 03:55:21 -0500311 break;
312 case 2:
TsiChung Liewf9556a72010-03-09 19:17:52 -0600313#ifdef CONFIG_SYS_UART2_ALT1_GPIO
Alison Wang35d23df2012-03-26 21:49:05 +0000314 clrbits_8(&gpio->par_timer, 0xf0);
315 setbits_8(&gpio->par_timer,
316 GPIO_PAR_TIN3_URXD2 | GPIO_PAR_TIN2_UTXD2);
TsiChung Liewf9556a72010-03-09 19:17:52 -0600317#elif defined(CONFIG_SYS_UART2_ALT2_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000318 clrbits_8(&gpio->par_feci2c, 0x00ff);
319 setbits_8(&gpio->par_feci2c,
320 GPIO_PAR_FECI2C_SCL_UTXD2 | GPIO_PAR_FECI2C_SDA_URXD2);
TsiChung Liewf9556a72010-03-09 19:17:52 -0600321#elif defined(CONFIG_SYS_UART2_ALT3_GPIO)
Alison Wang35d23df2012-03-26 21:49:05 +0000322 clrbits_be16(&gpio->par_ssi, 0x0f00);
323 setbits_be16(&gpio->par_ssi,
324 GPIO_PAR_SSI_RXD(2) | GPIO_PAR_SSI_TXD(2));
TsiChung Liewf9556a72010-03-09 19:17:52 -0600325#endif
TsiChungLiew74634c82007-08-05 03:55:21 -0500326 break;
327 }
TsiChung Liew69b17572008-10-21 13:47:54 +0000328}
329
330#if defined(CONFIG_CMD_NET)
331int fecpin_setclear(struct eth_device *dev, int setclear)
332{
Alison Wang35d23df2012-03-26 21:49:05 +0000333 gpio_t *gpio = (gpio_t *) MMAP_GPIO;
TsiChung Liew69b17572008-10-21 13:47:54 +0000334
335 if (setclear) {
Alison Wang35d23df2012-03-26 21:49:05 +0000336 setbits_8(&gpio->par_fec,
337 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
338 setbits_8(&gpio->par_feci2c,
339 GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);
TsiChung Liew69b17572008-10-21 13:47:54 +0000340 } else {
Alison Wang35d23df2012-03-26 21:49:05 +0000341 clrbits_8(&gpio->par_fec,
342 GPIO_PAR_FEC_7W_FEC | GPIO_PAR_FEC_MII_FEC);
343 clrbits_8(&gpio->par_feci2c,
344 GPIO_PAR_FECI2C_MDC_EMDC | GPIO_PAR_FECI2C_MDIO_EMDIO);
TsiChung Liew69b17572008-10-21 13:47:54 +0000345 }
346 return 0;
TsiChungLiew74634c82007-08-05 03:55:21 -0500347}
TsiChung Liew69b17572008-10-21 13:47:54 +0000348#endif
TsiChung Liewe7e4fc82008-10-22 11:38:21 +0000349#endif /* CONFIG_MCF532x */