44x.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright 2007 David Gibson, IBM Corporation.
  3. *
  4. * Based on earlier code:
  5. * Matt Porter <mporter@kernel.crashing.org>
  6. * Copyright 2002-2005 MontaVista Software Inc.
  7. *
  8. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  9. * Copyright (c) 2003, 2004 Zultys Technologies
  10. *
  11. * This program is free software; you can redistribute it and/or
  12. * modify it under the terms of the GNU General Public License
  13. * as published by the Free Software Foundation; either version
  14. * 2 of the License, or (at your option) any later version.
  15. */
  16. #include <stddef.h>
  17. #include "types.h"
  18. #include "string.h"
  19. #include "stdio.h"
  20. #include "ops.h"
  21. #include "reg.h"
  22. #include "dcr.h"
  23. /* Read the 44x memory controller to get size of system memory. */
  24. void ibm44x_fixup_memsize(void)
  25. {
  26. int i;
  27. unsigned long memsize, bank_config;
  28. memsize = 0;
  29. for (i = 0; i < ARRAY_SIZE(sdram_bxcr); i++) {
  30. mtdcr(DCRN_SDRAM0_CFGADDR, sdram_bxcr[i]);
  31. bank_config = mfdcr(DCRN_SDRAM0_CFGDATA);
  32. if (bank_config & SDRAM_CONFIG_BANK_ENABLE)
  33. memsize += SDRAM_CONFIG_BANK_SIZE(bank_config);
  34. }
  35. dt_fixup_memory(0, memsize);
  36. }