adder875.c 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /* Analogue & Micro Adder MPC875 board support
  3. *
  4. * Author: Scott Wood <[email protected]>
  5. *
  6. * Copyright (c) 2007 Freescale Semiconductor, Inc.
  7. */
  8. #include <linux/init.h>
  9. #include <linux/fs_enet_pd.h>
  10. #include <linux/of_platform.h>
  11. #include <asm/time.h>
  12. #include <asm/machdep.h>
  13. #include <asm/cpm1.h>
  14. #include <asm/fs_pd.h>
  15. #include <asm/udbg.h>
  16. #include "mpc8xx.h"
  17. #include "pic.h"
  18. struct cpm_pin {
  19. int port, pin, flags;
  20. };
  21. static __initdata struct cpm_pin adder875_pins[] = {
  22. /* SMC1 */
  23. {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
  24. {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
  25. /* MII1 */
  26. {CPM_PORTA, 0, CPM_PIN_INPUT},
  27. {CPM_PORTA, 1, CPM_PIN_INPUT},
  28. {CPM_PORTA, 2, CPM_PIN_INPUT},
  29. {CPM_PORTA, 3, CPM_PIN_INPUT},
  30. {CPM_PORTA, 4, CPM_PIN_OUTPUT},
  31. {CPM_PORTA, 10, CPM_PIN_OUTPUT},
  32. {CPM_PORTA, 11, CPM_PIN_OUTPUT},
  33. {CPM_PORTB, 19, CPM_PIN_INPUT},
  34. {CPM_PORTB, 31, CPM_PIN_INPUT},
  35. {CPM_PORTC, 12, CPM_PIN_INPUT},
  36. {CPM_PORTC, 13, CPM_PIN_INPUT},
  37. {CPM_PORTE, 30, CPM_PIN_OUTPUT},
  38. {CPM_PORTE, 31, CPM_PIN_OUTPUT},
  39. /* MII2 */
  40. {CPM_PORTE, 14, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  41. {CPM_PORTE, 15, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  42. {CPM_PORTE, 16, CPM_PIN_OUTPUT},
  43. {CPM_PORTE, 17, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  44. {CPM_PORTE, 18, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  45. {CPM_PORTE, 19, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  46. {CPM_PORTE, 20, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
  47. {CPM_PORTE, 21, CPM_PIN_OUTPUT},
  48. {CPM_PORTE, 22, CPM_PIN_OUTPUT},
  49. {CPM_PORTE, 23, CPM_PIN_OUTPUT},
  50. {CPM_PORTE, 24, CPM_PIN_OUTPUT},
  51. {CPM_PORTE, 25, CPM_PIN_OUTPUT},
  52. {CPM_PORTE, 26, CPM_PIN_OUTPUT},
  53. {CPM_PORTE, 27, CPM_PIN_OUTPUT},
  54. {CPM_PORTE, 28, CPM_PIN_OUTPUT},
  55. {CPM_PORTE, 29, CPM_PIN_OUTPUT},
  56. };
  57. static void __init init_ioports(void)
  58. {
  59. int i;
  60. for (i = 0; i < ARRAY_SIZE(adder875_pins); i++) {
  61. const struct cpm_pin *pin = &adder875_pins[i];
  62. cpm1_set_pin(pin->port, pin->pin, pin->flags);
  63. }
  64. cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
  65. /* Set FEC1 and FEC2 to MII mode */
  66. clrbits32(&mpc8xx_immr->im_cpm.cp_cptr, 0x00000180);
  67. }
  68. static void __init adder875_setup(void)
  69. {
  70. cpm_reset();
  71. init_ioports();
  72. }
  73. static int __init adder875_probe(void)
  74. {
  75. return of_machine_is_compatible("analogue-and-micro,adder875");
  76. }
  77. static const struct of_device_id of_bus_ids[] __initconst = {
  78. { .compatible = "simple-bus", },
  79. {},
  80. };
  81. static int __init declare_of_platform_devices(void)
  82. {
  83. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  84. return 0;
  85. }
  86. machine_device_initcall(adder875, declare_of_platform_devices);
  87. define_machine(adder875) {
  88. .name = "Adder MPC875",
  89. .probe = adder875_probe,
  90. .setup_arch = adder875_setup,
  91. .init_IRQ = mpc8xx_pic_init,
  92. .get_irq = mpc8xx_get_irq,
  93. .restart = mpc8xx_restart,
  94. .calibrate_decr = generic_calibrate_decr,
  95. .progress = udbg_progress,
  96. };