misc-cpci690.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * arch/ppc/boot/simple/misc-cpci690.c
  3. *
  4. * Add birec data for Force CPCI690 board.
  5. *
  6. * Author: Mark A. Greer <source@mvista.com>
  7. *
  8. * 2003 (c) MontaVista Software, Inc. This file is licensed under
  9. * the terms of the GNU General Public License version 2. This program
  10. * is licensed "as is" without any warranty of any kind, whether express
  11. * or implied.
  12. */
  13. #include <linux/types.h>
  14. #include <asm/io.h>
  15. #include <platforms/cpci690.h>
  16. #define KB (1024UL)
  17. #define MB (1024UL*KB)
  18. #define GB (1024UL*MB)
  19. extern u32 mv64x60_console_baud;
  20. extern u32 mv64x60_mpsc_clk_src;
  21. extern u32 mv64x60_mpsc_clk_freq;
  22. u32 mag = 0xffff;
  23. unsigned long
  24. get_mem_size(void)
  25. {
  26. u32 size;
  27. switch (in_8(((void __iomem *)CPCI690_BR_BASE + CPCI690_BR_MEM_CTLR))
  28. & 0x07) {
  29. case 0x01:
  30. size = 256*MB;
  31. break;
  32. case 0x02:
  33. size = 512*MB;
  34. break;
  35. case 0x03:
  36. size = 768*MB;
  37. break;
  38. case 0x04:
  39. size = 1*GB;
  40. break;
  41. case 0x05:
  42. size = 1*GB + 512*MB;
  43. break;
  44. case 0x06:
  45. size = 2*GB;
  46. break;
  47. default:
  48. size = 0;
  49. }
  50. return size;
  51. }
  52. void
  53. mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
  54. {
  55. mv64x60_console_baud = CPCI690_MPSC_BAUD;
  56. mv64x60_mpsc_clk_src = CPCI690_MPSC_CLK_SRC;
  57. mv64x60_mpsc_clk_freq =
  58. (get_mem_size() >= (1*GB)) ? 100000000 : 133333333;
  59. }