emc.c 808 B

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