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