ddr.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright 2008 Freescale Semiconductor, Inc.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * Version 2 as published by the Free Software Foundation.
  7. */
  8. #include <common.h>
  9. #include <i2c.h>
  10. #include <asm/fsl_ddr_sdram.h>
  11. #include <asm/fsl_ddr_dimm_params.h>
  12. void get_spd(ddr2_spd_eeprom_t *spd, unsigned char i2c_address)
  13. {
  14. i2c_read(i2c_address, 0, 1, (uchar *)spd, sizeof(ddr2_spd_eeprom_t));
  15. /* We use soldered memory, but use an SPD EEPROM to describe it.
  16. * The SPD has an unspecified dimm type, but the DDR2 initialization
  17. * code requires a specific type to be specified. This sets the type
  18. * as a standard unregistered SO-DIMM. */
  19. if (spd->dimm_type == 0) {
  20. spd->dimm_type = 0x4;
  21. ((uchar *)spd)[63] += 0x4;
  22. }
  23. }
  24. void fsl_ddr_board_options(memctl_options_t *popts,
  25. dimm_params_t *pdimm,
  26. unsigned int ctrl_num)
  27. {
  28. /*
  29. * Factors to consider for clock adjust:
  30. * - number of chips on bus
  31. * - position of slot
  32. * - DDR1 vs. DDR2?
  33. * - ???
  34. *
  35. * This needs to be determined on a board-by-board basis.
  36. * 0110 3/4 cycle late
  37. * 0111 7/8 cycle late
  38. */
  39. popts->clk_adjust = 7;
  40. /*
  41. * Factors to consider for CPO:
  42. * - frequency
  43. * - ddr1 vs. ddr2
  44. */
  45. popts->cpo_override = 9;
  46. /*
  47. * Factors to consider for write data delay:
  48. * - number of DIMMs
  49. *
  50. * 1 = 1/4 clock delay
  51. * 2 = 1/2 clock delay
  52. * 3 = 3/4 clock delay
  53. * 4 = 1 clock delay
  54. * 5 = 5/4 clock delay
  55. * 6 = 3/2 clock delay
  56. */
  57. popts->write_data_delay = 3;
  58. /*
  59. * Factors to consider for half-strength driver enable:
  60. * - number of DIMMs installed
  61. */
  62. popts->half_strength_driver_enable = 0;
  63. }