m5307.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // SPDX-License-Identifier: GPL-2.0
  2. /***************************************************************************/
  3. /*
  4. * m5307.c -- platform support for ColdFire 5307 based boards
  5. *
  6. * Copyright (C) 1999-2002, Greg Ungerer ([email protected])
  7. * Copyright (C) 2000, Lineo (www.lineo.com)
  8. */
  9. /***************************************************************************/
  10. #include <linux/clkdev.h>
  11. #include <linux/kernel.h>
  12. #include <linux/param.h>
  13. #include <linux/init.h>
  14. #include <linux/io.h>
  15. #include <asm/machdep.h>
  16. #include <asm/coldfire.h>
  17. #include <asm/mcfsim.h>
  18. #include <asm/mcfwdebug.h>
  19. #include <asm/mcfclk.h>
  20. /***************************************************************************/
  21. /*
  22. * Some platforms need software versions of the GPIO data registers.
  23. */
  24. unsigned short ppdata;
  25. unsigned char ledbank = 0xff;
  26. /***************************************************************************/
  27. DEFINE_CLK(pll, "pll.0", MCF_CLK);
  28. DEFINE_CLK(sys, "sys.0", MCF_BUSCLK);
  29. static struct clk_lookup m5307_clk_lookup[] = {
  30. CLKDEV_INIT(NULL, "pll.0", &clk_pll),
  31. CLKDEV_INIT(NULL, "sys.0", &clk_sys),
  32. CLKDEV_INIT("mcftmr.0", NULL, &clk_sys),
  33. CLKDEV_INIT("mcftmr.1", NULL, &clk_sys),
  34. CLKDEV_INIT("mcfuart.0", NULL, &clk_sys),
  35. CLKDEV_INIT("mcfuart.1", NULL, &clk_sys),
  36. CLKDEV_INIT("imx1-i2c.0", NULL, &clk_sys),
  37. };
  38. /***************************************************************************/
  39. static void __init m5307_i2c_init(void)
  40. {
  41. #if IS_ENABLED(CONFIG_I2C_IMX)
  42. writeb(MCFSIM_ICR_AUTOVEC | MCFSIM_ICR_LEVEL5 | MCFSIM_ICR_PRI0,
  43. MCFSIM_I2CICR);
  44. mcf_mapirq2imr(MCF_IRQ_I2C0, MCFINTC_I2C);
  45. #endif /* IS_ENABLED(CONFIG_I2C_IMX) */
  46. }
  47. /***************************************************************************/
  48. void __init config_BSP(char *commandp, int size)
  49. {
  50. #if defined(CONFIG_NETtel) || \
  51. defined(CONFIG_SECUREEDGEMP3) || defined(CONFIG_CLEOPATRA)
  52. /* Copy command line from FLASH to local buffer... */
  53. memcpy(commandp, (char *) 0xf0004000, size);
  54. commandp[size-1] = 0;
  55. #endif
  56. mach_sched_init = hw_timer_init;
  57. /* Only support the external interrupts on their primary level */
  58. mcf_mapirq2imr(25, MCFINTC_EINT1);
  59. mcf_mapirq2imr(27, MCFINTC_EINT3);
  60. mcf_mapirq2imr(29, MCFINTC_EINT5);
  61. mcf_mapirq2imr(31, MCFINTC_EINT7);
  62. #ifdef CONFIG_BDM_DISABLE
  63. /*
  64. * Disable the BDM clocking. This also turns off most of the rest of
  65. * the BDM device. This is good for EMC reasons. This option is not
  66. * incompatible with the memory protection option.
  67. */
  68. wdebug(MCFDEBUG_CSR, MCFDEBUG_CSR_PSTCLK);
  69. #endif
  70. m5307_i2c_init();
  71. clkdev_add_table(m5307_clk_lookup, ARRAY_SIZE(m5307_clk_lookup));
  72. }
  73. /***************************************************************************/