3 * Based on modifications by Alan Lu / Artila
4 * Author : Timo Tuunainen / Sysart
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #if defined(CONFIG_DRIVER_ETHER)
30 #include <at91rm9200_net.h>
39 void m501sk_gpio_init(void)
41 AT91C_BASE_PIOD->PIO_PER = 1 << (M501SK_DEBUG_LED1 - 96) |
42 1 << (M501SK_DEBUG_LED2 - 96) | 1 << (M501SK_DEBUG_LED3 - 96) |
43 1 << (M501SK_DEBUG_LED4 - 96) | 1 << (M501SK_READY_LED - 96);
45 AT91C_BASE_PIOD->PIO_OER = 1 << (M501SK_DEBUG_LED1 - 96) |
46 1 << (M501SK_DEBUG_LED2 - 96) | 1 << (M501SK_DEBUG_LED3 - 96) |
47 1 << (M501SK_DEBUG_LED4 - 96) | 1 << (M501SK_READY_LED - 96);
49 AT91C_BASE_PIOD->PIO_SODR = 1 << (M501SK_READY_LED - 96);
50 AT91C_BASE_PIOD->PIO_CODR = 1 << (M501SK_DEBUG_LED3 - 96);
51 AT91C_BASE_PIOB->PIO_PER = 1 << (M501SK_BUZZER - 32);
52 AT91C_BASE_PIOB->PIO_OER = 1 << (M501SK_BUZZER - 32);
53 AT91C_BASE_PIOC->PIO_PDR = (1 << 7) | (1 << 8);
55 /* Power OFF all USART's LEDs */
56 AT91C_BASE_PIOA->PIO_PER = AT91C_PA5_TXD3 | AT91C_PA6_RXD3 |
57 AT91C_PA17_TXD0 | AT91C_PA18_RXD0 | AT91C_PA22_RXD2 | \
60 AT91C_BASE_PIOA->PIO_OER = AT91C_PA5_TXD3 | AT91C_PA6_RXD3 |
61 AT91C_PA17_TXD0 | AT91C_PA18_RXD0 | AT91C_PA22_RXD2 | \
64 AT91C_BASE_PIOA->PIO_SODR = AT91C_PA5_TXD3 | AT91C_PA6_RXD3 |
65 AT91C_PA17_TXD0 | AT91C_PA18_RXD0 | AT91C_PA22_RXD2 | \
68 AT91C_BASE_PIOB->PIO_PER = AT91C_PB20_RXD1 | AT91C_PB21_TXD1;
69 AT91C_BASE_PIOB->PIO_OER = AT91C_PB20_RXD1 | AT91C_PB21_TXD1;
70 AT91C_BASE_PIOB->PIO_SODR = AT91C_PB20_RXD1 | AT91C_PB21_TXD1;
73 uchar m501sk_gpio_set(M501SK_PIO io)
77 case M501SK_DEBUG_LED1:
78 case M501SK_DEBUG_LED2:
79 case M501SK_DEBUG_LED3:
80 case M501SK_DEBUG_LED4:
81 case M501SK_READY_LED:
82 AT91C_BASE_PIOD->PIO_SODR = 1 << (io - 96);
83 status = AT91C_BASE_PIOD->PIO_ODSR & (1 << (io - 96));
86 AT91C_BASE_PIOB->PIO_SODR = 1 << (io - 32);
87 status = AT91C_BASE_PIOB->PIO_ODSR & (1 << (io - 32));
93 uchar m501sk_gpio_clear(M501SK_PIO io)
97 case M501SK_DEBUG_LED1:
98 case M501SK_DEBUG_LED2:
99 case M501SK_DEBUG_LED3:
100 case M501SK_DEBUG_LED4:
101 case M501SK_READY_LED:
102 AT91C_BASE_PIOD->PIO_CODR = 1 << (io - 96);
103 status = AT91C_BASE_PIOD->PIO_ODSR & (1 << (io - 96));
106 AT91C_BASE_PIOB->PIO_CODR = 1 << (io - 32);
107 status = AT91C_BASE_PIOB->PIO_ODSR & (1 << (io - 32));
114 * Miscelaneous platform dependent initialisations
116 DECLARE_GLOBAL_DATA_PTR;
123 /* Correct IRDA resistor problem */
124 /* Set PA23_TXD in Output */
125 ((AT91PS_PIO)AT91C_BASE_PIOA)->PIO_OER = AT91C_PA23_TXD2;
127 /* memory and cpu-speed are setup before relocation */
128 /* so we do _nothing_ here */
129 gd->bd->bi_arch_number = MACH_TYPE_M501;
130 /* adress of boot parameters */
131 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
134 /* Do interrupt init here, because flash needs timers */
144 gd->bd->bi_dram[0].start = PHYS_SDRAM;
145 gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
147 for (i = 0; i < 500; i++) {
148 m501sk_gpio_clear(M501SK_DEBUG_LED3);
149 m501sk_gpio_clear(M501SK_BUZZER);
151 m501sk_gpio_set(M501SK_DEBUG_LED3);
152 m501sk_gpio_set(M501SK_BUZZER);
155 m501sk_gpio_clear(M501SK_BUZZER);
156 m501sk_gpio_clear(M501SK_DEBUG_LED3);
161 int board_late_init(void)
163 #if defined(CONFIG_CMD_NET)
168 /* Protect U-Boot, kernel & ramdisk memory addresses */
169 run_command("protect on 10000000 1041ffff", 0);
173 #ifdef CONFIG_DRIVER_ETHER
174 #if defined(CONFIG_CMD_NET)
177 * at91rm9200_GetPhyInterface
179 * Initialise the interface functions to the PHY
185 void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
187 p_phyops->Init = dm9161_InitPhy;
188 p_phyops->IsPhyConnected = dm9161_IsPhyConnected;
189 p_phyops->GetLinkSpeed = dm9161_GetLinkSpeed;
190 p_phyops->AutoNegotiate = dm9161_AutoNegotiate;
192 #endif /* CONFIG_CMD_NET */
193 #endif /* CONFIG_DRIVER_ETHER */
195 #ifdef CONFIG_DRIVER_AT91EMAC
196 int board_eth_init(bd_t *bis)
199 rc = at91emac_register(bis, 0);
203 #endif /* CONFIG_M501SK */