misc-cpci690.c 1.2 KB

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