]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/bf537-stamp/post.c
4e844ba432677540b74fc295b2c7aee9a72d7f72
2 * BF537-STAMP POST code
4 * Enter bugs at http://blackfin.uclinux.org/
6 * Copyright (c) 2005-2009 Analog Devices Inc.
8 * Licensed under the GPL-2 or later.
14 #include <asm/blackfin.h>
16 #define POST_WORD_ADDR 0xFF903FFC
18 /* Using sw10-PF5 as the hotkey */
19 int post_hotkeys_pressed(void)
26 *pPORTFIO_DIR
&= ~PF5
;
27 *pPORTFIO_INEN
|= PF5
;
29 printf("########Press SW10 to enter Memory POST########: %2d ", delay
);
31 for (i
= 0; i
< 100; i
++) {
32 value
= *pPORTFIO
& PF5
;
38 printf("\b\b\b%2d ", delay
);
45 printf("Hotkey has been pressed, Enter POST . . . . . .\n");
50 void post_word_store(ulong a
)
52 volatile ulong
*save_addr
= (volatile ulong
*)POST_WORD_ADDR
;
56 ulong
post_word_load(void)
58 volatile ulong
*save_addr
= (volatile ulong
*)POST_WORD_ADDR
;
62 int uart_post_test(int flags
)
67 #define BLOCK_SIZE 0x10000
68 #define VERIFY_ADDR 0x2000000
69 extern int erase_block_flash(int);
70 extern int write_data(long lStart
, long lCount
, uchar
* pnData
);
71 int flash_post_test(int flags
)
73 unsigned short *pbuf
, *temp
;
78 pbuf
= (unsigned short *)VERIFY_ADDR
;
80 for (n
= FLASH_START_POST_BLOCK
; n
< FLASH_END_POST_BLOCK
; n
++) {
81 offset
= (n
- 7) * BLOCK_SIZE
;
82 printf("--------Erase block:%2d..", n
);
85 printf("--------Program block:%2d...", n
);
86 write_data(CONFIG_SYS_FLASH_BASE
+ offset
, BLOCK_SIZE
, pbuf
);
88 printf("--------Verify block:%2d...", n
);
89 for (i
= 0; i
< BLOCK_SIZE
; i
+= 2) {
90 if (*(unsigned short *)(CONFIG_SYS_FLASH_BASE
+ offset
+ i
) !=
102 FLASH_START_POST_BLOCK
) *
103 100 / (FLASH_END_POST_BLOCK
-
104 FLASH_START_POST_BLOCK
)));
116 /****************************************************
117 * LED1 ---- PF6 LED2 ---- PF7 *
118 * LED3 ---- PF8 LED4 ---- PF9 *
119 * LED5 ---- PF10 LED6 ---- PF11 *
120 ****************************************************/
121 int led_post_test(int flags
)
123 *pPORTF_FER
&= ~(PF6
| PF7
| PF8
| PF9
| PF10
| PF11
);
124 *pPORTFIO_DIR
|= PF6
| PF7
| PF8
| PF9
| PF10
| PF11
;
125 *pPORTFIO_INEN
&= ~(PF6
| PF7
| PF8
| PF9
| PF10
| PF11
);
126 *pPORTFIO
&= ~(PF6
| PF7
| PF8
| PF9
| PF10
| PF11
);
131 printf("\b\b\b\b\b\b\b");
135 printf("\b\b\b\b\b\b\b");
139 printf("\b\b\b\b\b\b\b");
143 printf("\b\b\b\b\b\b\b");
147 printf("\b\b\b\b\b\b\b");
150 printf("\b\b\b\b\b\b\b ");
154 /************************************************
155 * SW10 ---- PF5 SW11 ---- PF4 *
156 * SW12 ---- PF3 SW13 ---- PF2 *
157 ************************************************/
158 int button_post_test(int flags
)
161 unsigned short value
= 0;
164 *pPORTF_FER
&= ~(PF5
| PF4
| PF3
| PF2
);
165 *pPORTFIO_DIR
&= ~(PF5
| PF4
| PF3
| PF2
);
166 *pPORTFIO_INEN
|= (PF5
| PF4
| PF3
| PF2
);
168 printf("\n--------Press SW10: %2d ", delay
);
170 for (i
= 0; i
< 100; i
++) {
171 value
= *pPORTFIO
& PF5
;
177 printf("\b\b\b%2d ", delay
);
183 printf("\b\bfailed");
187 printf("\n--------Press SW11: %2d ", delay
);
189 for (i
= 0; i
< 100; i
++) {
190 value
= *pPORTFIO
& PF4
;
196 printf("\b\b\b%2d ", delay
);
202 printf("\b\bfailed");
206 printf("\n--------Press SW12: %2d ", delay
);
208 for (i
= 0; i
< 100; i
++) {
209 value
= *pPORTFIO
& PF3
;
215 printf("\b\b\b%2d ", delay
);
221 printf("\b\bfailed");
225 printf("\n--------Press SW13: %2d ", delay
);
227 for (i
= 0; i
< 100; i
++) {
228 value
= *pPORTFIO
& PF2
;
234 printf("\b\b\b%2d ", delay
);
240 printf("\b\bfailed");