rte_ma1_cb.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * arch/v850/kernel/rte_ma1_cb.c -- Midas labs RTE-V850E/MA1-CB board
  3. *
  4. * Copyright (C) 2001,02,03 NEC Electronics Corporation
  5. * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org>
  6. *
  7. * This file is subject to the terms and conditions of the GNU General
  8. * Public License. See the file COPYING in the main directory of this
  9. * archive for more details.
  10. *
  11. * Written by Miles Bader <miles@gnu.org>
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/bootmem.h>
  16. #include <asm/atomic.h>
  17. #include <asm/page.h>
  18. #include <asm/ma1.h>
  19. #include <asm/rte_ma1_cb.h>
  20. #include <asm/v850e_timer_c.h>
  21. #include "mach.h"
  22. /* SRAM and SDRAM are almost contiguous (with a small hole in between;
  23. see mach_reserve_bootmem for details), so just use both as one big area. */
  24. #define RAM_START SRAM_ADDR
  25. #define RAM_END (SDRAM_ADDR + SDRAM_SIZE)
  26. void __init mach_early_init (void)
  27. {
  28. rte_cb_early_init ();
  29. }
  30. void __init mach_get_physical_ram (unsigned long *ram_start,
  31. unsigned long *ram_len)
  32. {
  33. *ram_start = RAM_START;
  34. *ram_len = RAM_END - RAM_START;
  35. }
  36. void __init mach_reserve_bootmem ()
  37. {
  38. #ifdef CONFIG_RTE_CB_MULTI
  39. /* Prevent the kernel from touching the monitor's scratch RAM. */
  40. reserve_bootmem (MON_SCRATCH_ADDR, MON_SCRATCH_SIZE);
  41. #endif
  42. /* The space between SRAM and SDRAM is filled with duplicate
  43. images of SRAM. Prevent the kernel from using them. */
  44. reserve_bootmem (SRAM_ADDR + SRAM_SIZE,
  45. SDRAM_ADDR - (SRAM_ADDR + SRAM_SIZE));
  46. }
  47. void mach_gettimeofday (struct timespec *tv)
  48. {
  49. tv->tv_sec = 0;
  50. tv->tv_nsec = 0;
  51. }
  52. /* Called before configuring an on-chip UART. */
  53. void rte_ma1_cb_uart_pre_configure (unsigned chan,
  54. unsigned cflags, unsigned baud)
  55. {
  56. /* The RTE-MA1-CB connects some general-purpose I/O pins on the
  57. CPU to the RTS/CTS lines of UART 0's serial connection.
  58. I/O pins P42 and P43 are RTS and CTS respectively. */
  59. if (chan == 0) {
  60. /* Put P42 & P43 in I/O port mode. */
  61. MA_PORT4_PMC &= ~0xC;
  62. /* Make P42 an output, and P43 an input. */
  63. MA_PORT4_PM = (MA_PORT4_PM & ~0xC) | 0x8;
  64. }
  65. /* Do pre-configuration for the actual UART. */
  66. ma_uart_pre_configure (chan, cflags, baud);
  67. }
  68. void __init mach_init_irqs (void)
  69. {
  70. unsigned tc;
  71. /* Initialize interrupts. */
  72. ma_init_irqs ();
  73. rte_cb_init_irqs ();
  74. /* Use falling-edge-sensitivity for interrupts . */
  75. V850E_TIMER_C_SESC (0) &= ~0xC;
  76. V850E_TIMER_C_SESC (1) &= ~0xF;
  77. /* INTP000-INTP011 are shared with `Timer C', so we have to set
  78. up Timer C to pass them through as raw interrupts. */
  79. for (tc = 0; tc < 2; tc++)
  80. /* Turn on the timer. */
  81. V850E_TIMER_C_TMCC0 (tc) |= V850E_TIMER_C_TMCC0_CAE;
  82. /* Make sure the relevant port0/port1 pins are assigned
  83. interrupt duty. We used INTP001-INTP011 (don't screw with
  84. INTP000 because the monitor uses it). */
  85. MA_PORT0_PMC |= 0x4; /* P02 (INTP001) in IRQ mode. */
  86. MA_PORT1_PMC |= 0x6; /* P11 (INTP010) & P12 (INTP011) in IRQ mode.*/
  87. }