ddr.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * (C) Copyright 2013 Keymile AG
  3. * Valentin Longchamp <valentin.longchamp@keymile.com>
  4. *
  5. * Copyright 2009-2011 Freescale Semiconductor, Inc.
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <common.h>
  10. #include <i2c.h>
  11. #include <hwconfig.h>
  12. #include <asm/mmu.h>
  13. #include <fsl_ddr_sdram.h>
  14. #include <fsl_ddr_dimm_params.h>
  15. void fsl_ddr_board_options(memctl_options_t *popts,
  16. dimm_params_t *pdimm,
  17. unsigned int ctrl_num)
  18. {
  19. if (ctrl_num) {
  20. printf("Wrong parameter for controller number %d", ctrl_num);
  21. return;
  22. }
  23. /* automatic calibration for nb of cycles between read and DQS pre */
  24. popts->cpo_override = 0xFF;
  25. /* 1/2 clk delay between wr command and data strobe */
  26. popts->write_data_delay = 4;
  27. /* clk lauched 1/2 applied cylcle after address command */
  28. popts->clk_adjust = 4;
  29. /* 1T timing: command/address held for only 1 cycle */
  30. popts->twot_en = 0;
  31. /* we have only one module, half str should be OK */
  32. popts->half_strength_driver_enable = 1;
  33. /* wrlvl values overridden as recommended by ddr init func */
  34. popts->wrlvl_override = 1;
  35. popts->wrlvl_sample = 0xf;
  36. popts->wrlvl_start = 0x6;
  37. /* Enable ZQ calibration */
  38. popts->zq_en = 1;
  39. /* DHC_EN =1, ODT = 75 Ohm */
  40. popts->ddr_cdr1 = DDR_CDR1_DHC_EN | DDR_CDR_ODT_75ohm;
  41. }
  42. phys_size_t initdram(int board_type)
  43. {
  44. phys_size_t dram_size = 0;
  45. puts("Initializing with SPD\n");
  46. dram_size = fsl_ddr_sdram();
  47. dram_size = setup_ddr_tlbs(dram_size / 0x100000);
  48. dram_size *= 0x100000;
  49. debug(" DDR: ");
  50. return dram_size;
  51. }