]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/bf537-stamp/post.c
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 /* Using sw10-PF5 as the hotkey */
17 int post_hotkeys_pressed(void)
24 *pPORTFIO_DIR
&= ~PF5
;
25 *pPORTFIO_INEN
|= PF5
;
27 printf("########Press SW10 to enter Memory POST########: %2d ", delay
);
29 for (i
= 0; i
< 100; i
++) {
30 value
= *pPORTFIO
& PF5
;
36 printf("\b\b\b%2d ", delay
);
43 printf("Hotkey has been pressed, Enter POST . . . . . .\n");
48 int uart_post_test(int flags
)
53 #define BLOCK_SIZE 0x10000
54 #define VERIFY_ADDR 0x2000000
55 extern int erase_block_flash(int);
56 extern int write_data(long lStart
, long lCount
, uchar
* pnData
);
57 int flash_post_test(int flags
)
59 unsigned short *pbuf
, *temp
;
64 pbuf
= (unsigned short *)VERIFY_ADDR
;
66 for (n
= FLASH_START_POST_BLOCK
; n
< FLASH_END_POST_BLOCK
; n
++) {
67 offset
= (n
- 7) * BLOCK_SIZE
;
68 printf("--------Erase block:%2d..", n
);
71 printf("--------Program block:%2d...", n
);
72 write_data(CONFIG_SYS_FLASH_BASE
+ offset
, BLOCK_SIZE
, pbuf
);
74 printf("--------Verify block:%2d...", n
);
75 for (i
= 0; i
< BLOCK_SIZE
; i
+= 2) {
76 if (*(unsigned short *)(CONFIG_SYS_FLASH_BASE
+ offset
+ i
) !=
88 FLASH_START_POST_BLOCK
) *
89 100 / (FLASH_END_POST_BLOCK
-
90 FLASH_START_POST_BLOCK
)));
102 /****************************************************
103 * LED1 ---- PF6 LED2 ---- PF7 *
104 * LED3 ---- PF8 LED4 ---- PF9 *
105 * LED5 ---- PF10 LED6 ---- PF11 *
106 ****************************************************/
107 int led_post_test(int flags
)
109 *pPORTF_FER
&= ~(PF6
| PF7
| PF8
| PF9
| PF10
| PF11
);
110 *pPORTFIO_DIR
|= PF6
| PF7
| PF8
| PF9
| PF10
| PF11
;
111 *pPORTFIO_INEN
&= ~(PF6
| PF7
| PF8
| PF9
| PF10
| PF11
);
112 *pPORTFIO
&= ~(PF6
| PF7
| PF8
| PF9
| PF10
| PF11
);
117 printf("\b\b\b\b\b\b\b");
121 printf("\b\b\b\b\b\b\b");
125 printf("\b\b\b\b\b\b\b");
129 printf("\b\b\b\b\b\b\b");
133 printf("\b\b\b\b\b\b\b");
136 printf("\b\b\b\b\b\b\b ");
140 /************************************************
141 * SW10 ---- PF5 SW11 ---- PF4 *
142 * SW12 ---- PF3 SW13 ---- PF2 *
143 ************************************************/
144 int button_post_test(int flags
)
147 unsigned short value
= 0;
150 *pPORTF_FER
&= ~(PF5
| PF4
| PF3
| PF2
);
151 *pPORTFIO_DIR
&= ~(PF5
| PF4
| PF3
| PF2
);
152 *pPORTFIO_INEN
|= (PF5
| PF4
| PF3
| PF2
);
154 printf("\n--------Press SW10: %2d ", delay
);
156 for (i
= 0; i
< 100; i
++) {
157 value
= *pPORTFIO
& PF5
;
163 printf("\b\b\b%2d ", delay
);
169 printf("\b\bfailed");
173 printf("\n--------Press SW11: %2d ", delay
);
175 for (i
= 0; i
< 100; i
++) {
176 value
= *pPORTFIO
& PF4
;
182 printf("\b\b\b%2d ", delay
);
188 printf("\b\bfailed");
192 printf("\n--------Press SW12: %2d ", delay
);
194 for (i
= 0; i
< 100; i
++) {
195 value
= *pPORTFIO
& PF3
;
201 printf("\b\b\b%2d ", delay
);
207 printf("\b\bfailed");
211 printf("\n--------Press SW13: %2d ", delay
);
213 for (i
= 0; i
< 100; i
++) {
214 value
= *pPORTFIO
& PF2
;
220 printf("\b\b\b%2d ", delay
);
226 printf("\b\bfailed");