emc.c 811 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (c) 2011 The Chromium OS Authors.
  4. */
  5. #include <common.h>
  6. #include "emc.h"
  7. #include <asm/io.h>
  8. #include <asm/arch/clock.h>
  9. #include <asm/arch/emc.h>
  10. #include <asm/arch/tegra.h>
  11. #include <asm/arch-tegra/ap.h>
  12. #include <asm/arch-tegra/clk_rst.h>
  13. #include <asm/arch-tegra/pmu.h>
  14. #include <asm/arch-tegra/sys_proto.h>
  15. DECLARE_GLOBAL_DATA_PTR;
  16. /* These rates are hard-coded for now, until fdt provides them */
  17. #define EMC_SDRAM_RATE_T20 (333000 * 2 * 1000)
  18. #define EMC_SDRAM_RATE_T25 (380000 * 2 * 1000)
  19. int board_emc_init(void)
  20. {
  21. unsigned rate;
  22. switch (tegra_get_chip_sku()) {
  23. default:
  24. case TEGRA_SOC_T20:
  25. rate = EMC_SDRAM_RATE_T20;
  26. break;
  27. case TEGRA_SOC_T25:
  28. rate = EMC_SDRAM_RATE_T25;
  29. break;
  30. }
  31. return tegra_set_emc(gd->fdt_blob, rate);
  32. }