m54xx.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /***************************************************************************/
  2. /*
  3. * linux/arch/m68knommu/platform/54xx/config.c
  4. *
  5. * Copyright (C) 2010, Philippe De Muyter <phdm@macqel.be>
  6. */
  7. /***************************************************************************/
  8. #include <linux/kernel.h>
  9. #include <linux/param.h>
  10. #include <linux/init.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/io.h>
  13. #include <linux/mm.h>
  14. #include <linux/bootmem.h>
  15. #include <asm/pgalloc.h>
  16. #include <asm/machdep.h>
  17. #include <asm/coldfire.h>
  18. #include <asm/m54xxsim.h>
  19. #include <asm/mcfuart.h>
  20. #include <asm/m54xxgpt.h>
  21. #ifdef CONFIG_MMU
  22. #include <asm/mmu_context.h>
  23. #endif
  24. /***************************************************************************/
  25. static void __init m54xx_uarts_init(void)
  26. {
  27. /* enable io pins */
  28. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC0);
  29. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
  30. MCFGPIO_PAR_PSC1);
  31. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
  32. MCF_PAR_PSC_CTS_CTS, MCFGPIO_PAR_PSC2);
  33. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC3);
  34. }
  35. /***************************************************************************/
  36. static void mcf54xx_reset(void)
  37. {
  38. /* disable interrupts and enable the watchdog */
  39. asm("movew #0x2700, %sr\n");
  40. __raw_writel(0, MCF_GPT_GMS0);
  41. __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_GPT_GCIR0);
  42. __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
  43. MCF_GPT_GMS0);
  44. }
  45. /***************************************************************************/
  46. #ifdef CONFIG_MMU
  47. unsigned long num_pages;
  48. static void __init mcf54xx_bootmem_alloc(void)
  49. {
  50. unsigned long start_pfn;
  51. unsigned long memstart;
  52. /* _rambase and _ramend will be naturally page aligned */
  53. m68k_memory[0].addr = _rambase;
  54. m68k_memory[0].size = _ramend - _rambase;
  55. /* compute total pages in system */
  56. num_pages = (_ramend - _rambase) >> PAGE_SHIFT;
  57. /* page numbers */
  58. memstart = PAGE_ALIGN(_ramstart);
  59. min_low_pfn = _rambase >> PAGE_SHIFT;
  60. start_pfn = memstart >> PAGE_SHIFT;
  61. max_low_pfn = _ramend >> PAGE_SHIFT;
  62. high_memory = (void *)_ramend;
  63. m68k_virt_to_node_shift = fls(_ramend - _rambase - 1) - 6;
  64. module_fixup(NULL, __start_fixup, __stop_fixup);
  65. /* setup bootmem data */
  66. m68k_setup_node(0);
  67. memstart += init_bootmem_node(NODE_DATA(0), start_pfn,
  68. min_low_pfn, max_low_pfn);
  69. free_bootmem_node(NODE_DATA(0), memstart, _ramend - memstart);
  70. }
  71. #endif /* CONFIG_MMU */
  72. /***************************************************************************/
  73. void __init config_BSP(char *commandp, int size)
  74. {
  75. #ifdef CONFIG_MMU
  76. mcf54xx_bootmem_alloc();
  77. mmu_context_init();
  78. #endif
  79. mach_reset = mcf54xx_reset;
  80. mach_sched_init = hw_timer_init;
  81. m54xx_uarts_init();
  82. }
  83. /***************************************************************************/