uboot/board/freescale/m53017evb/m53017evb.c
<<
>>
Prefs
   1// SPDX-License-Identifier: GPL-2.0+
   2/*
   3 * (C) Copyright 2000-2003
   4 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
   5 *
   6 * Copyright (C) 2004-2008, 2012 Freescale Semiconductor, Inc.
   7 * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
   8 */
   9
  10#include <config.h>
  11#include <common.h>
  12#include <init.h>
  13#include <asm/global_data.h>
  14#include <asm/immap.h>
  15#include <asm/io.h>
  16#include <linux/delay.h>
  17
  18DECLARE_GLOBAL_DATA_PTR;
  19
  20int checkboard(void)
  21{
  22        puts("Board: ");
  23        puts("Freescale M53017EVB\n");
  24        return 0;
  25};
  26
  27int dram_init(void)
  28{
  29        sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
  30        u32 dramsize, i;
  31
  32        dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
  33
  34        for (i = 0x13; i < 0x20; i++) {
  35                if (dramsize == (1 << i))
  36                        break;
  37        }
  38        i--;
  39
  40        out_be32(&sdram->cs0, CONFIG_SYS_SDRAM_BASE | i);
  41#ifdef CONFIG_SYS_SDRAM_BASE1
  42        out_be32(&sdram->cs1, CONFIG_SYS_SDRAM_BASE | i);
  43#endif
  44        out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
  45        out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
  46
  47        udelay(500);
  48
  49        /* Issue PALL */
  50        out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  51        asm("nop");
  52
  53        /* Perform two refresh cycles */
  54        out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  55        out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  56        asm("nop");
  57
  58        /* Issue LEMR */
  59        out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
  60        asm("nop");
  61        out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
  62        asm("nop");
  63
  64        out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  65        asm("nop");
  66
  67        out_be32(&sdram->ctrl,
  68                (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000c00);
  69        asm("nop");
  70
  71        udelay(100);
  72
  73        gd->ram_size = dramsize;
  74
  75        return 0;
  76};
  77
  78int testdram(void)
  79{
  80        /* TODO: XXX XXX XXX */
  81        printf("DRAM test not implemented!\n");
  82
  83        return (0);
  84}
  85