]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/stamp/stamp.c
3fe0134d6816842d28eb93516d7efbff14888116
2 * U-boot - stamp.c STAMP board specific routines
4 * Copyright (c) 2005 blackfin.uclinux.org
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/mem_init.h>
32 #define STATUS_LED_OFF 0
33 #define STATUS_LED_ON 1
35 #ifdef CONFIG_SHOW_BOOT_PROGRESS
36 # define SHOW_BOOT_PROGRESS(arg) show_boot_progress(arg)
38 # define SHOW_BOOT_PROGRESS(arg)
43 printf ("CPU: ADSP BF533 Rev.: 0.%d\n", *pCHIPID
>> 28);
44 printf ("Board: ADI BF533 Stamp board\n");
45 printf (" Support: http://blackfin.uclinux.org/\n");
46 printf (" Richard Klingler <richard@uclinux.net>\n");
50 long int initdram (int board_type
)
52 DECLARE_GLOBAL_DATA_PTR
;
54 printf ("SDRAM attributes:\n");
55 printf (" tRCD:%d Cycles; tRP:%d Cycles; tRAS:%d Cycles; tWR:%d Cycles; "
56 "CAS Latency:%d cycles\n",
62 printf ("SDRAM Begin: 0x%x\n", CFG_SDRAM_BASE
);
63 printf ("Bank size = %d MB\n", 128);
65 gd
->bd
->bi_memstart
= CFG_SDRAM_BASE
;
66 gd
->bd
->bi_memsize
= CFG_MAX_RAM_SIZE
;
67 return (gd
->bd
->bi_memsize
);
70 void swap_to (int device_id
)
73 if (device_id
== ETHERNET
) {
78 } else if (device_id
== FLASH
) {
79 *pFIO_DIR
= (PF4
| PF3
| PF2
| PF1
| PF0
);
80 *pFIO_FLAG_S
= (PF4
| PF3
| PF2
);
81 *pFIO_MASKA_D
= (PF8
| PF6
| PF5
);
82 *pFIO_MASKB_D
= (PF7
);
83 *pFIO_POLAR
= (PF8
| PF6
| PF5
);
84 *pFIO_EDGE
= (PF8
| PF7
| PF6
| PF5
);
85 *pFIO_INEN
= (PF8
| PF7
| PF6
| PF5
);
86 *pFIO_FLAG_D
= (PF4
| PF3
| PF2
);
89 printf ("Unknown bank to switch\n");
95 #if defined(CONFIG_MISC_INIT_R)
96 /* miscellaneous platform dependent initialisations */
97 int misc_init_r (void)
102 /* Check whether CF card is inserted */
103 *pFIO_EDGE
= FIO_EDGE_CF_BITS
;
104 *pFIO_POLAR
= FIO_POLAR_CF_BITS
;
105 for (i
= 0; i
< 0x300; i
++)
108 if ((*pFIO_FLAG_S
) & CF_STAT_BITS
) {
114 *pFIO_EDGE
= FIO_EDGE_BITS
;
115 *pFIO_POLAR
= FIO_POLAR_BITS
;
119 printf ("Booting from COMPACT flash\n");
121 /* Set cycle time for CF */
122 *(volatile unsigned long *) ambctl1
= CF_AMBCTL1VAL
;
124 for (i
= 0; i
< 0x1000; i
++)
126 for (i
= 0; i
< 0x1000; i
++)
128 for (i
= 0; i
< 0x1000; i
++)
134 setenv ("bootargs", "");
136 "fatload ide 0:1 0x1000000 uImage-stamp;bootm 0x1000000;bootm 0x20100000");
138 printf ("Booting from FLASH\n");
145 #ifdef CONFIG_STAMP_CF
147 void cf_outb (unsigned char val
, volatile unsigned char *addr
)
150 * Set PF1 PF0 respectively to 0 1 to divert address
151 * to the expansion memory banks
153 *pFIO_FLAG_S
= CF_PF0
;
154 *pFIO_FLAG_C
= CF_PF1
;
160 /* Setback PF1 PF0 to 0 0 to address external
162 *(volatile unsigned short *) pFIO_FLAG_C
= CF_PF1_PF0
;
166 unsigned char cf_inb (volatile unsigned char *addr
)
168 volatile unsigned char c
;
170 *pFIO_FLAG_S
= CF_PF0
;
171 *pFIO_FLAG_C
= CF_PF1
;
177 *pFIO_FLAG_C
= CF_PF1_PF0
;
183 void cf_insw (unsigned short *sect_buf
, unsigned short *addr
, int words
)
187 *pFIO_FLAG_S
= CF_PF0
;
188 *pFIO_FLAG_C
= CF_PF1
;
191 for (i
= 0; i
< words
; i
++) {
192 *(sect_buf
+ i
) = *(addr
);
196 *pFIO_FLAG_C
= CF_PF1_PF0
;
200 void cf_outsw (unsigned short *addr
, unsigned short *sect_buf
, int words
)
204 *pFIO_FLAG_S
= CF_PF0
;
205 *pFIO_FLAG_C
= CF_PF1
;
208 for (i
= 0; i
< words
; i
++) {
209 *(addr
) = *(sect_buf
+ i
);
213 *pFIO_FLAG_C
= CF_PF1_PF0
;
218 void stamp_led_set (int LED1
, int LED2
, int LED3
)
220 *pFIO_INEN
&= ~(PF2
| PF3
| PF4
);
221 *pFIO_DIR
|= (PF2
| PF3
| PF4
);
223 if (LED1
== STATUS_LED_OFF
)
227 if (LED2
== STATUS_LED_OFF
)
231 if (LED3
== STATUS_LED_OFF
)
238 void show_boot_progress (int status
)
242 stamp_led_set (STATUS_LED_OFF
, STATUS_LED_OFF
, STATUS_LED_ON
);
245 stamp_led_set (STATUS_LED_OFF
, STATUS_LED_ON
, STATUS_LED_OFF
);
248 stamp_led_set (STATUS_LED_OFF
, STATUS_LED_ON
, STATUS_LED_ON
);
251 stamp_led_set (STATUS_LED_ON
, STATUS_LED_OFF
, STATUS_LED_OFF
);
255 stamp_led_set (STATUS_LED_ON
, STATUS_LED_OFF
, STATUS_LED_ON
);
259 stamp_led_set (STATUS_LED_ON
, STATUS_LED_ON
, STATUS_LED_OFF
);
268 stamp_led_set (STATUS_LED_OFF
, STATUS_LED_OFF
,
272 stamp_led_set (STATUS_LED_ON
, STATUS_LED_ON
, STATUS_LED_ON
);