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 int uart_post_test(int flags)
22 #define BLOCK_SIZE 0x10000
23 #define VERIFY_ADDR 0x2000000
24 extern int erase_block_flash(int);
25 extern int write_data(long lStart, long lCount, uchar * pnData);
26 int flash_post_test(int flags)
28 unsigned short *pbuf, *temp;
33 pbuf = (unsigned short *)VERIFY_ADDR;
35 for (n = FLASH_START_POST_BLOCK; n < FLASH_END_POST_BLOCK; n++) {
36 offset = (n - 7) * BLOCK_SIZE;
37 printf("--------Erase block:%2d..", n);
40 printf("--------Program block:%2d...", n);
41 write_data(CONFIG_SYS_FLASH_BASE + offset, BLOCK_SIZE, pbuf);
43 printf("--------Verify block:%2d...", n);
44 for (i = 0; i < BLOCK_SIZE; i += 2) {
45 if (*(unsigned short *)(CONFIG_SYS_FLASH_BASE + offset + i) !=
57 FLASH_START_POST_BLOCK) *
58 100 / (FLASH_END_POST_BLOCK -
59 FLASH_START_POST_BLOCK)));
71 /****************************************************
72 * LED1 ---- PF6 LED2 ---- PF7 *
73 * LED3 ---- PF8 LED4 ---- PF9 *
74 * LED5 ---- PF10 LED6 ---- PF11 *
75 ****************************************************/
76 int led_post_test(int flags)
78 unsigned int leds[] = {
79 GPIO_PF6, GPIO_PF7, GPIO_PF8,
80 GPIO_PF9, GPIO_PF10, GPIO_PF11,
84 for (i = 0; i < ARRAY_SIZE(leds); ++i) {
85 gpio_request(leds[i], "post");
86 gpio_direction_output(leds[i], 0);
88 printf("LED%i on", i + 1);
89 gpio_set_value(leds[i], 1);
91 printf("\b\b\b\b\b\b\b");
99 /************************************************
100 * SW10 ---- PF5 SW11 ---- PF4 *
101 * SW12 ---- PF3 SW13 ---- PF2 *
102 ************************************************/
103 int button_post_test(int flags)
105 unsigned int buttons[] = {
106 GPIO_PF2, GPIO_PF3, GPIO_PF4, GPIO_PF5,
108 unsigned int sws[] = { 13, 12, 11, 10, };
110 unsigned short value = 0;
113 for (i = 0; i < ARRAY_SIZE(buttons); ++i) {
114 gpio_request(buttons[i], "post");
115 gpio_direction_input(buttons[i]);
118 printf("\n--------Press SW%i: %2d ", sws[i], delay);
120 for (i = 0; i < 100; i++) {
121 value = gpio_get_value(buttons[i]);
126 printf("\b\b\b%2d ", delay);
135 gpio_free(buttons[i]);