m5329evb.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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-2007, 2012 Freescale Semiconductor, Inc.
  7. * TsiChung Liew (Tsi-Chung.Liew@freescale.com)
  8. */
  9. #include <config.h>
  10. #include <common.h>
  11. #include <init.h>
  12. #include <asm/immap.h>
  13. #include <asm/io.h>
  14. #include <linux/delay.h>
  15. DECLARE_GLOBAL_DATA_PTR;
  16. int checkboard(void)
  17. {
  18. puts("Board: ");
  19. puts("Freescale FireEngine 5329 EVB\n");
  20. return 0;
  21. };
  22. int dram_init(void)
  23. {
  24. sdram_t *sdram = (sdram_t *)(MMAP_SDRAM);
  25. u32 dramsize, i;
  26. dramsize = CONFIG_SYS_SDRAM_SIZE * 0x100000;
  27. for (i = 0x13; i < 0x20; i++) {
  28. if (dramsize == (1 << i))
  29. break;
  30. }
  31. i--;
  32. out_be32(&sdram->cs0, CONFIG_SYS_SDRAM_BASE | i);
  33. out_be32(&sdram->cfg1, CONFIG_SYS_SDRAM_CFG1);
  34. out_be32(&sdram->cfg2, CONFIG_SYS_SDRAM_CFG2);
  35. /* Issue PALL */
  36. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  37. /* Issue LEMR */
  38. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_EMOD);
  39. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE | 0x04000000);
  40. udelay(500);
  41. /* Issue PALL */
  42. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 2);
  43. /* Perform two refresh cycles */
  44. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  45. out_be32(&sdram->ctrl, CONFIG_SYS_SDRAM_CTRL | 4);
  46. out_be32(&sdram->mode, CONFIG_SYS_SDRAM_MODE);
  47. out_be32(&sdram->ctrl,
  48. (CONFIG_SYS_SDRAM_CTRL & ~0x80000000) | 0x10000c00);
  49. udelay(100);
  50. gd->ram_size = dramsize;
  51. return 0;
  52. };
  53. int testdram(void)
  54. {
  55. /* TODO: XXX XXX XXX */
  56. printf("DRAM test not implemented!\n");
  57. return (0);
  58. }