ibm440sp_common.c 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * PPC440SP/PPC440SPe system library
  3. *
  4. * Matt Porter <mporter@kernel.crashing.org>
  5. * Copyright 2002-2005 MontaVista Software Inc.
  6. *
  7. * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
  8. * Copyright (c) 2003, 2004 Zultys Technologies
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. */
  16. #include <linux/types.h>
  17. #include <linux/serial.h>
  18. #include <asm/param.h>
  19. #include <asm/ibm44x.h>
  20. #include <asm/mmu.h>
  21. #include <asm/machdep.h>
  22. #include <asm/time.h>
  23. #include <asm/ppc4xx_pic.h>
  24. /*
  25. * Read the 440SP memory controller to get size of system memory.
  26. */
  27. unsigned long __init ibm440sp_find_end_of_memory(void)
  28. {
  29. u32 i;
  30. u32 mem_size = 0;
  31. /* Read two bank sizes and sum */
  32. for (i=0; i< MQ0_NUM_BANKS; i++)
  33. switch (mfdcr(DCRN_MQ0_BS0BAS + i) & MQ0_CONFIG_SIZE_MASK) {
  34. case MQ0_CONFIG_SIZE_8M:
  35. mem_size += PPC44x_MEM_SIZE_8M;
  36. break;
  37. case MQ0_CONFIG_SIZE_16M:
  38. mem_size += PPC44x_MEM_SIZE_16M;
  39. break;
  40. case MQ0_CONFIG_SIZE_32M:
  41. mem_size += PPC44x_MEM_SIZE_32M;
  42. break;
  43. case MQ0_CONFIG_SIZE_64M:
  44. mem_size += PPC44x_MEM_SIZE_64M;
  45. break;
  46. case MQ0_CONFIG_SIZE_128M:
  47. mem_size += PPC44x_MEM_SIZE_128M;
  48. break;
  49. case MQ0_CONFIG_SIZE_256M:
  50. mem_size += PPC44x_MEM_SIZE_256M;
  51. break;
  52. case MQ0_CONFIG_SIZE_512M:
  53. mem_size += PPC44x_MEM_SIZE_512M;
  54. break;
  55. case MQ0_CONFIG_SIZE_1G:
  56. mem_size += PPC44x_MEM_SIZE_1G;
  57. break;
  58. case MQ0_CONFIG_SIZE_2G:
  59. mem_size += PPC44x_MEM_SIZE_2G;
  60. break;
  61. default:
  62. break;
  63. }
  64. return mem_size;
  65. }