m523x.c 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /***************************************************************************/
  2. /*
  3. * m523x.c -- platform support for ColdFire 523x based boards
  4. *
  5. * Sub-architcture dependent initialization code for the Freescale
  6. * 523x CPUs.
  7. *
  8. * Copyright (C) 1999-2005, Greg Ungerer (gerg@snapgear.com)
  9. * Copyright (C) 2001-2003, SnapGear Inc. (www.snapgear.com)
  10. */
  11. /***************************************************************************/
  12. #include <linux/kernel.h>
  13. #include <linux/param.h>
  14. #include <linux/init.h>
  15. #include <linux/io.h>
  16. #include <asm/machdep.h>
  17. #include <asm/coldfire.h>
  18. #include <asm/mcfsim.h>
  19. #include <asm/mcfclk.h>
  20. /***************************************************************************/
  21. DEFINE_CLK(pll, "pll.0", MCF_CLK);
  22. DEFINE_CLK(sys, "sys.0", MCF_BUSCLK);
  23. DEFINE_CLK(mcfpit0, "mcfpit.0", MCF_CLK);
  24. DEFINE_CLK(mcfpit1, "mcfpit.1", MCF_CLK);
  25. DEFINE_CLK(mcfpit2, "mcfpit.2", MCF_CLK);
  26. DEFINE_CLK(mcfpit3, "mcfpit.3", MCF_CLK);
  27. DEFINE_CLK(mcfuart0, "mcfuart.0", MCF_BUSCLK);
  28. DEFINE_CLK(mcfuart1, "mcfuart.1", MCF_BUSCLK);
  29. DEFINE_CLK(mcfuart2, "mcfuart.2", MCF_BUSCLK);
  30. DEFINE_CLK(mcfqspi0, "mcfqspi.0", MCF_BUSCLK);
  31. DEFINE_CLK(fec0, "fec.0", MCF_BUSCLK);
  32. struct clk *mcf_clks[] = {
  33. &clk_pll,
  34. &clk_sys,
  35. &clk_mcfpit0,
  36. &clk_mcfpit1,
  37. &clk_mcfpit2,
  38. &clk_mcfpit3,
  39. &clk_mcfuart0,
  40. &clk_mcfuart1,
  41. &clk_mcfuart2,
  42. &clk_mcfqspi0,
  43. &clk_fec0,
  44. NULL
  45. };
  46. /***************************************************************************/
  47. static void __init m523x_qspi_init(void)
  48. {
  49. #if IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI)
  50. u16 par;
  51. /* setup QSPS pins for QSPI with gpio CS control */
  52. writeb(0x1f, MCFGPIO_PAR_QSPI);
  53. /* and CS2 & CS3 as gpio */
  54. par = readw(MCFGPIO_PAR_TIMER);
  55. par &= 0x3f3f;
  56. writew(par, MCFGPIO_PAR_TIMER);
  57. #endif /* IS_ENABLED(CONFIG_SPI_COLDFIRE_QSPI) */
  58. }
  59. /***************************************************************************/
  60. static void __init m523x_fec_init(void)
  61. {
  62. /* Set multi-function pins to ethernet use */
  63. writeb(readb(MCFGPIO_PAR_FECI2C) | 0xf0, MCFGPIO_PAR_FECI2C);
  64. }
  65. /***************************************************************************/
  66. void __init config_BSP(char *commandp, int size)
  67. {
  68. mach_sched_init = hw_timer_init;
  69. m523x_fec_init();
  70. m523x_qspi_init();
  71. }
  72. /***************************************************************************/