adder875.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* Analogue & Micro Adder MPC875 board support
  2. *
  3. * Author: Scott Wood <scottwood@freescale.com>
  4. *
  5. * Copyright (c) 2007 Freescale Semiconductor, Inc.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License, version 2, as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/init.h>
  12. #include <linux/fs_enet_pd.h>
  13. #include <linux/of_platform.h>
  14. #include <asm/time.h>
  15. #include <asm/machdep.h>
  16. #include <asm/cpm1.h>
  17. #include <asm/fs_pd.h>
  18. #include <asm/udbg.h>
  19. #include <asm/prom.h>
  20. #include "mpc8xx.h"
  21. struct cpm_pin {
  22. int port, pin, flags;
  23. };
  24. static __initdata struct cpm_pin adder875_pins[] = {
  25. /* SMC1 */
  26. {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
  27. {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
  28. /* MII1 */
  29. {CPM_PORTA, 0, CPM_PIN_INPUT},
  30. {CPM_PORTA, 1, CPM_PIN_INPUT},
  31. {CPM_PORTA, 2, CPM_PIN_INPUT},
  32. {CPM_PORTA, 3, CPM_PIN_INPUT},
  33. {CPM_PORTA, 4, CPM_PIN_OUTPUT},
  34. {CPM_PORTA, 10, CPM_PIN_OUTPUT},
  35. {CPM_PORTA, 11, CPM_PIN_OUTPUT},
  36. {CPM_PORTB, 19, CPM_PIN_INPUT},
  37. {CPM_PORTB, 31, CPM_PIN_INPUT},
  38. {CPM_PORTC, 12, CPM_PIN_INPUT},
  39. {CPM_PORTC, 13, CPM_PIN_INPUT},
  40. {CPM_PORTE, 30, CPM_PIN_OUTPUT},
  41. {CPM_PORTE, 31, CPM_PIN_OUTPUT},
  42. /* MII2 */
  43. {CPM_PORTE, 14, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  44. {CPM_PORTE, 15, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  45. {CPM_PORTE, 16, CPM_PIN_OUTPUT},
  46. {CPM_PORTE, 17, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  47. {CPM_PORTE, 18, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  48. {CPM_PORTE, 19, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  49. {CPM_PORTE, 20, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  50. {CPM_PORTE, 21, CPM_PIN_OUTPUT},
  51. {CPM_PORTE, 22, CPM_PIN_OUTPUT},
  52. {CPM_PORTE, 23, CPM_PIN_OUTPUT},
  53. {CPM_PORTE, 24, CPM_PIN_OUTPUT},
  54. {CPM_PORTE, 25, CPM_PIN_OUTPUT},
  55. {CPM_PORTE, 26, CPM_PIN_OUTPUT},
  56. {CPM_PORTE, 27, CPM_PIN_OUTPUT},
  57. {CPM_PORTE, 28, CPM_PIN_OUTPUT},
  58. {CPM_PORTE, 29, CPM_PIN_OUTPUT},
  59. };
  60. static void __init init_ioports(void)
  61. {
  62. int i;
  63. for (i = 0; i < ARRAY_SIZE(adder875_pins); i++) {
  64. const struct cpm_pin *pin = &adder875_pins[i];
  65. cpm1_set_pin(pin->port, pin->pin, pin->flags);
  66. }
  67. cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
  68. /* Set FEC1 and FEC2 to MII mode */
  69. clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);
  70. }
  71. static void __init adder875_setup(void)
  72. {
  73. cpm_reset();
  74. init_ioports();
  75. }
  76. static int __init adder875_probe(void)
  77. {
  78. unsigned long root = of_get_flat_dt_root();
  79. return of_flat_dt_is_compatible(root, "analogue-and-micro,adder875");
  80. }
  81. static const struct of_device_id of_bus_ids[] __initconst = {
  82. { .compatible = "simple-bus", },
  83. {},
  84. };
  85. static int __init declare_of_platform_devices(void)
  86. {
  87. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  88. return 0;
  89. }
  90. machine_device_initcall(adder875, declare_of_platform_devices);
  91. define_machine(adder875) {
  92. .name = "Adder MPC875",
  93. .probe = adder875_probe,
  94. .setup_arch = adder875_setup,
  95. .init_IRQ = mpc8xx_pics_init,
  96. .get_irq = mpc8xx_get_irq,
  97. .restart = mpc8xx_restart,
  98. .calibrate_decr = generic_calibrate_decr,
  99. .set_rtc_time = mpc8xx_set_rtc_time,
  100. .get_rtc_time = mpc8xx_get_rtc_time,
  101. .progress = udbg_progress,
  102. };