mt481c2m32b2tg.c

Go to the documentation of this file.
00001 /* ***********************************************************************
00002 
00003 Copyright (c) 2006, Atmel Corporation All rights reserved.
00004 
00005 Redistribution and use in source and binary forms, with or without
00006 modification, are permitted provided that the following conditions are met:
00007 
00008 1. Redistributions of source code must retain the above copyright notice,
00009 this list of conditions and the
00010 following disclaimer.
00011 
00012 2. Redistributions in binary form must reproduce the above copyright notice,
00013 this list of conditions and the following disclaimer in the documentation
00014 and/or other materials provided with the distribution.
00015 
00016 3. The name of ATMEL may not be used to endorse or promote products
00017 derived from this software without specific prior written permission.
00018 
00019 THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS
00020 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00021 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00022 PARTICULAR PURPOSE ARE EXPRESSLY AND SPECIFICALLY
00023 DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT,
00024 INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00025 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00026 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00027 OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00028 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00029 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
00030 WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031 
00032 POSSIBILITY OF SUCH DAMAGE.
00033 
00034 ************************************************************************ */
00035 
00036 #include "sdram.h"
00037 #include "mt481c2m32b2tg.h"
00038 
00039 void mt481c2m32b2tg_init(const sdram_info *info)
00040 {
00041     volatile unsigned long *sdram = (unsigned long *) info->physical_address;
00042     unsigned long dummy_read;
00043     unsigned int i;
00044 
00045     volatile avr32_sdramc_t *sdramc = &AVR32_SDRAMC;
00046 
00047     // Precharge All command is issued to the SDRAM
00048     sdramc->mr = MODE_PRECHARGE;
00049     dummy_read = sdramc->mr;
00050     sdram[0] = 0;
00051 
00052     // Provide eight auto-refresh (CBR) cycles
00053     sdramc->mr = MODE_AUTOREFRESH;
00054     dummy_read = sdramc->mr;
00055     for (i = 0; i < 8; i++)
00056       {
00057         sdram[0] = 0;
00058       }
00059 
00060     // A mode register set (MRS) cycle is issued to program
00061     // SDRAM parameters, in particular CAS latency and burst
00062     // length.
00063     
00064     // CAS from info struct, burst length 1, serial burst type
00065     sdramc->mr = MODE_LOAD_MR;
00066     dummy_read = sdramc->mr;
00067     sdram[0x020] = 0;
00068 
00069     // A Normal Mode command is provided, 3 clocks after tMRD is met.
00070     dummy_read = sdramc->mr;
00071     sdramc->mr = MODE_NORMAL;
00072     dummy_read = sdramc->mr;
00073     sdram[0] = 0;
00074 
00075     // Write refresh rate into SDRAMC refresh timer count register
00076     sdramc->tr =  mt481c2m32b2tg_tr;
00077 }

Generated on Thu May 10 13:52:44 2007 for AVR32102 - Using the AVR32 SDRAM controller by  doxygen 1.5.1