m54xx.c 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /***************************************************************************/
  2. /*
  3. * m54xx.c -- platform support for ColdFire 54xx based boards
  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/clk.h>
  15. #include <linux/bootmem.h>
  16. #include <asm/pgalloc.h>
  17. #include <asm/machdep.h>
  18. #include <asm/coldfire.h>
  19. #include <asm/m54xxsim.h>
  20. #include <asm/mcfuart.h>
  21. #include <asm/mcfclk.h>
  22. #include <asm/m54xxgpt.h>
  23. #ifdef CONFIG_MMU
  24. #include <asm/mmu_context.h>
  25. #endif
  26. /***************************************************************************/
  27. DEFINE_CLK(pll, "pll.0", MCF_CLK);
  28. DEFINE_CLK(sys, "sys.0", MCF_BUSCLK);
  29. DEFINE_CLK(mcfslt0, "mcfslt.0", MCF_BUSCLK);
  30. DEFINE_CLK(mcfslt1, "mcfslt.1", MCF_BUSCLK);
  31. DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK);
  32. DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK);
  33. DEFINE_CLK(mcfuart2, "mcfuart.2", MCF_BUSCLK);
  34. DEFINE_CLK(mcfuart3, "mcfuart.3", MCF_BUSCLK);
  35. struct clk *mcf_clks[] = {
  36. &clk_pll,
  37. &clk_sys,
  38. &clk_mcfslt0,
  39. &clk_mcfslt1,
  40. &clk_mcfuart0,
  41. &clk_mcfuart1,
  42. &clk_mcfuart2,
  43. &clk_mcfuart3,
  44. NULL
  45. };
  46. /***************************************************************************/
  47. static void __init m54xx_uarts_init(void)
  48. {
  49. /* enable io pins */
  50. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC0);
  51. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS,
  52. MCFGPIO_PAR_PSC1);
  53. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD | MCF_PAR_PSC_RTS_RTS |
  54. MCF_PAR_PSC_CTS_CTS, MCFGPIO_PAR_PSC2);
  55. __raw_writeb(MCF_PAR_PSC_TXD | MCF_PAR_PSC_RXD, MCFGPIO_PAR_PSC3);
  56. }
  57. /***************************************************************************/
  58. static void mcf54xx_reset(void)
  59. {
  60. /* disable interrupts and enable the watchdog */
  61. asm("movew #0x2700, %sr\n");
  62. __raw_writel(0, MCF_GPT_GMS0);
  63. __raw_writel(MCF_GPT_GCIR_CNT(1), MCF_GPT_GCIR0);
  64. __raw_writel(MCF_GPT_GMS_WDEN | MCF_GPT_GMS_CE | MCF_GPT_GMS_TMS(4),
  65. MCF_GPT_GMS0);
  66. }
  67. /***************************************************************************/
  68. void __init config_BSP(char *commandp, int size)
  69. {
  70. #ifdef CONFIG_MMU
  71. cf_bootmem_alloc();
  72. mmu_context_init();
  73. #endif
  74. mach_reset = mcf54xx_reset;
  75. mach_sched_init = hw_timer_init;
  76. m54xx_uarts_init();
  77. }
  78. /***************************************************************************/