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,
27 #include <at91rm9200_net.h>
34 void m501sk_gpio_init(void)
36 AT91C_BASE_PIOD->PIO_PER = 1 << (M501SK_DEBUG_LED1 - 96) |
37 1 << (M501SK_DEBUG_LED2 - 96) | 1 << (M501SK_DEBUG_LED3 - 96) |
38 1 << (M501SK_DEBUG_LED4 - 96) | 1 << (M501SK_READY_LED - 96);
40 AT91C_BASE_PIOD->PIO_OER = 1 << (M501SK_DEBUG_LED1 - 96) |
41 1 << (M501SK_DEBUG_LED2 - 96) | 1 << (M501SK_DEBUG_LED3 - 96) |
42 1 << (M501SK_DEBUG_LED4 - 96) | 1 << (M501SK_READY_LED - 96);
44 AT91C_BASE_PIOD->PIO_SODR = 1 << (M501SK_READY_LED - 96);
45 AT91C_BASE_PIOD->PIO_CODR = 1 << (M501SK_DEBUG_LED3 - 96);
46 AT91C_BASE_PIOB->PIO_PER = 1 << (M501SK_BUZZER - 32);
47 AT91C_BASE_PIOB->PIO_OER = 1 << (M501SK_BUZZER - 32);
48 AT91C_BASE_PIOC->PIO_PDR = (1 << 7) | (1 << 8);
50 /* Power OFF all USART's LEDs */
51 AT91C_BASE_PIOA->PIO_PER = AT91C_PA5_TXD3 | AT91C_PA6_RXD3 |
52 AT91C_PA17_TXD0 | AT91C_PA18_RXD0 | AT91C_PA22_RXD2 | \
55 AT91C_BASE_PIOA->PIO_OER = AT91C_PA5_TXD3 | AT91C_PA6_RXD3 |
56 AT91C_PA17_TXD0 | AT91C_PA18_RXD0 | AT91C_PA22_RXD2 | \
59 AT91C_BASE_PIOA->PIO_SODR = AT91C_PA5_TXD3 | AT91C_PA6_RXD3 |
60 AT91C_PA17_TXD0 | AT91C_PA18_RXD0 | AT91C_PA22_RXD2 | \
63 AT91C_BASE_PIOB->PIO_PER = AT91C_PB20_RXD1 | AT91C_PB21_TXD1;
64 AT91C_BASE_PIOB->PIO_OER = AT91C_PB20_RXD1 | AT91C_PB21_TXD1;
65 AT91C_BASE_PIOB->PIO_SODR = AT91C_PB20_RXD1 | AT91C_PB21_TXD1;
68 uchar m501sk_gpio_set(M501SK_PIO io)
72 case M501SK_DEBUG_LED1:
73 case M501SK_DEBUG_LED2:
74 case M501SK_DEBUG_LED3:
75 case M501SK_DEBUG_LED4:
76 case M501SK_READY_LED:
77 AT91C_BASE_PIOD->PIO_SODR = 1 << (io - 96);
78 status = AT91C_BASE_PIOD->PIO_ODSR & (1 << (io - 96));
81 AT91C_BASE_PIOB->PIO_SODR = 1 << (io - 32);
82 status = AT91C_BASE_PIOB->PIO_ODSR & (1 << (io - 32));
88 uchar m501sk_gpio_clear(M501SK_PIO io)
92 case M501SK_DEBUG_LED1:
93 case M501SK_DEBUG_LED2:
94 case M501SK_DEBUG_LED3:
95 case M501SK_DEBUG_LED4:
96 case M501SK_READY_LED:
97 AT91C_BASE_PIOD->PIO_CODR = 1 << (io - 96);
98 status = AT91C_BASE_PIOD->PIO_ODSR & (1 << (io - 96));
101 AT91C_BASE_PIOB->PIO_CODR = 1 << (io - 32);
102 status = AT91C_BASE_PIOB->PIO_ODSR & (1 << (io - 32));
109 * Miscelaneous platform dependent initialisations
111 DECLARE_GLOBAL_DATA_PTR;
118 /* Correct IRDA resistor problem */
119 /* Set PA23_TXD in Output */
120 ((AT91PS_PIO)AT91C_BASE_PIOA)->PIO_OER = AT91C_PA23_TXD2;
122 /* memory and cpu-speed are setup before relocation */
123 /* so we do _nothing_ here */
124 gd->bd->bi_arch_number = MACH_TYPE_M501;
125 /* adress of boot parameters */
126 gd->bd->bi_boot_params = PHYS_SDRAM + 0x100;
129 /* Do interrupt init here, because flash needs timers */
139 gd->bd->bi_dram[0].start = PHYS_SDRAM;
140 gd->bd->bi_dram[0].size = PHYS_SDRAM_SIZE;
142 for (i = 0; i < 500; i++) {
143 m501sk_gpio_clear(M501SK_DEBUG_LED3);
144 m501sk_gpio_clear(M501SK_BUZZER);
146 m501sk_gpio_set(M501SK_DEBUG_LED3);
147 m501sk_gpio_set(M501SK_BUZZER);
150 m501sk_gpio_clear(M501SK_BUZZER);
151 m501sk_gpio_clear(M501SK_DEBUG_LED3);
156 int board_late_init(void)
158 #if defined(CONFIG_CMD_NET)
163 /* Protect U-Boot, kernel & ramdisk memory addresses */
164 run_command("protect on 10000000 1041ffff", 0);
168 #ifdef CONFIG_DRIVER_ETHER
169 #if defined(CONFIG_CMD_NET)
172 * at91rm9200_GetPhyInterface
174 * Initialise the interface functions to the PHY
180 void at91rm9200_GetPhyInterface(AT91PS_PhyOps p_phyops)
182 p_phyops->Init = dm9161_InitPhy;
183 p_phyops->IsPhyConnected = dm9161_IsPhyConnected;
184 p_phyops->GetLinkSpeed = dm9161_GetLinkSpeed;
185 p_phyops->AutoNegotiate = dm9161_AutoNegotiate;
187 #endif /* CONFIG_CMD_NET */
188 #endif /* CONFIG_DRIVER_ETHER */
189 #endif /* CONFIG_M501SK */