xref: /netbsd-src/sys/arch/evbarm/stand/board/smdk2800.c (revision b1bcd0ffae8a2d028e37c0afd25d14e4fe3244ff)
1 /*	$NetBSD: smdk2800.c,v 1.5 2006/01/16 19:34:53 he Exp $ */
2 
3 /*
4  * Copyright (c) 2002, 2003 Fujitsu Component Limited
5  * Copyright (c) 2002, 2003 Genetec Corporation
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither the name of The Fujitsu Component Limited nor the name of
17  *    Genetec corporation may not be used to endorse or promote products
18  *    derived from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY FUJITSU COMPONENT LIMITED AND GENETEC
21  * CORPORATION ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
22  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
23  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED.  IN NO EVENT SHALL FUJITSU COMPONENT LIMITED OR GENETEC
25  * CORPORATION BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
31  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34 
35 /*
36  * Board initialization routines for the Samsung's SMDK2800.
37  */
38 
39 #include <sys/types.h>
40 #include <lib/libsa/stand.h>
41 #include <arch/arm/s3c2xx0/s3c2800reg.h>
42 
43 #include "board.h"
44 
45 #define RAM_START	0x08000000
46 #define RAM_SIZE 	0x02000000
47 
48 void
board_init(void)49 board_init(void)
50 {
51 	mem_init();
52 }
53 
54 void
board_fini(void)55 board_fini(void)
56 {
57 
58 	/* Nothing to do here. */
59 }
60 
61 void
mem_init(void)62 mem_init(void)
63 {
64 	uint32_t start, size, heap;
65 
66 	start = RAM_START;
67 	size =  RAM_SIZE;
68 	/* ROM monitor uses top of SDRAM for page table. */
69 #define ROMMONITOR_PAGETABLE  (RAM_START+RAM_SIZE-0x8000)
70 
71 	heap = ROMMONITOR_PAGETABLE - BOARD_HEAP_SIZE;
72 
73 	printf(">> RAM 0x%x - 0x%x, heap at 0x%x\n",
74 	    start, (start + size) - 1, heap);
75 	setheap((void *)heap, (void *)(heap + BOARD_HEAP_SIZE - 1));
76 }
77 
78 #ifdef SELFCOPY_TO_FLASH
79 #include "flash.h"
80 
81 void
protect_flash(int protect_on)82 protect_flash(int protect_on)
83 {
84 	volatile uint8_t *gpdatc =
85 		(volatile uint8_t *)(S3C2800_GPIO_BASE+GPIO_PDATC);
86 
87 	if (protect_on)
88 		*gpdatc &= (1<<3);
89 	else
90 		*gpdatc |= (1<<3);
91 }
92 
93 int
get_flash_info(void * addr,struct flash_info * info)94 get_flash_info(void *addr, struct flash_info *info)
95 {
96 	get_flash_chip_info(addr, info);
97 
98 	info->page_size *= 2;
99 	info->data_width *= 2;
100 	info->writebuf_len *= 2;
101 
102 	return 0;
103 }
104 #endif
105