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>
17 /* Using sw10-PF5 as the hotkey */
18 int post_hotkeys_pressed(void)
24 gpio_request(GPIO_PF5, "post");
25 gpio_direction_input(GPIO_PF5);
27 printf("########Press SW10 to enter Memory POST########: %2d ", delay);
29 for (i = 0; i < 100; i++) {
30 value = gpio_get_value(GPIO_PF5);
36 printf("\b\b\b%2d ", delay);
43 printf("Hotkey has been pressed, Enter POST . . . . . .\n");
50 int uart_post_test(int flags)
55 #define BLOCK_SIZE 0x10000
56 #define VERIFY_ADDR 0x2000000
57 extern int erase_block_flash(int);
58 extern int write_data(long lStart, long lCount, uchar * pnData);
59 int flash_post_test(int flags)
61 unsigned short *pbuf, *temp;
66 pbuf = (unsigned short *)VERIFY_ADDR;
68 for (n = FLASH_START_POST_BLOCK; n < FLASH_END_POST_BLOCK; n++) {
69 offset = (n - 7) * BLOCK_SIZE;
70 printf("--------Erase block:%2d..", n);
73 printf("--------Program block:%2d...", n);
74 write_data(CONFIG_SYS_FLASH_BASE + offset, BLOCK_SIZE, pbuf);
76 printf("--------Verify block:%2d...", n);
77 for (i = 0; i < BLOCK_SIZE; i += 2) {
78 if (*(unsigned short *)(CONFIG_SYS_FLASH_BASE + offset + i) !=
90 FLASH_START_POST_BLOCK) *
91 100 / (FLASH_END_POST_BLOCK -
92 FLASH_START_POST_BLOCK)));
104 /****************************************************
105 * LED1 ---- PF6 LED2 ---- PF7 *
106 * LED3 ---- PF8 LED4 ---- PF9 *
107 * LED5 ---- PF10 LED6 ---- PF11 *
108 ****************************************************/
109 int led_post_test(int flags)
111 unsigned int leds[] = {
112 GPIO_PF6, GPIO_PF7, GPIO_PF8,
113 GPIO_PF9, GPIO_PF10, GPIO_PF11,
117 for (i = 0; i < ARRAY_SIZE(leds); ++i) {
118 gpio_request(leds[i], "post");
119 gpio_direction_output(leds[i], 0);
121 printf("LED%i on", i + 1);
122 gpio_set_value(leds[i], 1);
124 printf("\b\b\b\b\b\b\b");
132 /************************************************
133 * SW10 ---- PF5 SW11 ---- PF4 *
134 * SW12 ---- PF3 SW13 ---- PF2 *
135 ************************************************/
136 int button_post_test(int flags)
138 unsigned int buttons[] = {
139 GPIO_PF2, GPIO_PF3, GPIO_PF4, GPIO_PF5,
141 unsigned int sws[] = { 13, 12, 11, 10, };
143 unsigned short value = 0;
146 for (i = 0; i < ARRAY_SIZE(buttons); ++i) {
147 gpio_request(buttons[i], "post");
148 gpio_direction_input(buttons[i]);
151 printf("\n--------Press SW%i: %2d ", sws[i], delay);
153 for (i = 0; i < 100; i++) {
154 value = gpio_get_value(buttons[i]);
159 printf("\b\b\b%2d ", delay);
168 gpio_free(buttons[i]);