ibm440sp_common.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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/config.h>
  17. #include <linux/types.h>
  18. #include <linux/serial.h>
  19. #include <asm/param.h>
  20. #include <asm/ibm44x.h>
  21. #include <asm/mmu.h>
  22. #include <asm/machdep.h>
  23. #include <asm/time.h>
  24. #include <asm/ppc4xx_pic.h>
  25. /*
  26. * Read the 440SP memory controller to get size of system memory.
  27. */
  28. unsigned long __init ibm440sp_find_end_of_memory(void)
  29. {
  30. u32 i;
  31. u32 mem_size = 0;
  32. /* Read two bank sizes and sum */
  33. for (i=0; i< MQ0_NUM_BANKS; i++)
  34. switch (mfdcr(DCRN_MQ0_BS0BAS + i) & MQ0_CONFIG_SIZE_MASK) {
  35. case MQ0_CONFIG_SIZE_8M:
  36. mem_size += PPC44x_MEM_SIZE_8M;
  37. break;
  38. case MQ0_CONFIG_SIZE_16M:
  39. mem_size += PPC44x_MEM_SIZE_16M;
  40. break;
  41. case MQ0_CONFIG_SIZE_32M:
  42. mem_size += PPC44x_MEM_SIZE_32M;
  43. break;
  44. case MQ0_CONFIG_SIZE_64M:
  45. mem_size += PPC44x_MEM_SIZE_64M;
  46. break;
  47. case MQ0_CONFIG_SIZE_128M:
  48. mem_size += PPC44x_MEM_SIZE_128M;
  49. break;
  50. case MQ0_CONFIG_SIZE_256M:
  51. mem_size += PPC44x_MEM_SIZE_256M;
  52. break;
  53. case MQ0_CONFIG_SIZE_512M:
  54. mem_size += PPC44x_MEM_SIZE_512M;
  55. break;
  56. case MQ0_CONFIG_SIZE_1G:
  57. mem_size += PPC44x_MEM_SIZE_1G;
  58. break;
  59. case MQ0_CONFIG_SIZE_2G:
  60. mem_size += PPC44x_MEM_SIZE_2G;
  61. break;
  62. default:
  63. break;
  64. }
  65. return mem_size;
  66. }