mgsuvd.c 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. *
  3. * Platform setup for the Keymile mgsuvd board
  4. *
  5. * Heiko Schocher <hs@denx.de>
  6. *
  7. * Copyright 2008 DENX Software Engineering GmbH
  8. *
  9. * This file is licensed under the terms of the GNU General Public License
  10. * version 2. This program is licensed "as is" without any warranty of any
  11. * kind, whether express or implied.
  12. */
  13. #include <linux/ioport.h>
  14. #include <linux/of_platform.h>
  15. #include <asm/io.h>
  16. #include <asm/machdep.h>
  17. #include <asm/processor.h>
  18. #include <asm/cpm1.h>
  19. #include <asm/prom.h>
  20. #include <asm/fs_pd.h>
  21. #include "mpc8xx.h"
  22. struct cpm_pin {
  23. int port, pin, flags;
  24. };
  25. static __initdata struct cpm_pin mgsuvd_pins[] = {
  26. /* SMC1 */
  27. {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
  28. {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
  29. /* SCC3 */
  30. {CPM_PORTA, 10, CPM_PIN_INPUT},
  31. {CPM_PORTA, 11, CPM_PIN_INPUT},
  32. {CPM_PORTA, 3, CPM_PIN_INPUT},
  33. {CPM_PORTA, 2, CPM_PIN_INPUT},
  34. {CPM_PORTC, 13, CPM_PIN_INPUT},
  35. };
  36. static void __init init_ioports(void)
  37. {
  38. int i;
  39. for (i = 0; i < ARRAY_SIZE(mgsuvd_pins); i++) {
  40. struct cpm_pin *pin = &mgsuvd_pins[i];
  41. cpm1_set_pin(pin->port, pin->pin, pin->flags);
  42. }
  43. setbits16(&mpc8xx_immr->im_ioport.iop_pcso, 0x300);
  44. cpm1_clk_setup(CPM_CLK_SCC3, CPM_CLK5, CPM_CLK_RX);
  45. cpm1_clk_setup(CPM_CLK_SCC3, CPM_CLK6, CPM_CLK_TX);
  46. cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
  47. }
  48. static void __init mgsuvd_setup_arch(void)
  49. {
  50. cpm_reset();
  51. init_ioports();
  52. }
  53. static __initdata struct of_device_id of_bus_ids[] = {
  54. { .compatible = "simple-bus" },
  55. {},
  56. };
  57. static int __init declare_of_platform_devices(void)
  58. {
  59. of_platform_bus_probe(NULL, of_bus_ids, NULL);
  60. return 0;
  61. }
  62. machine_device_initcall(mgsuvd, declare_of_platform_devices);
  63. static int __init mgsuvd_probe(void)
  64. {
  65. unsigned long root = of_get_flat_dt_root();
  66. return of_flat_dt_is_compatible(root, "keymile,mgsuvd");
  67. }
  68. define_machine(mgsuvd) {
  69. .name = "MGSUVD",
  70. .probe = mgsuvd_probe,
  71. .setup_arch = mgsuvd_setup_arch,
  72. .init_IRQ = mpc8xx_pics_init,
  73. .get_irq = mpc8xx_get_irq,
  74. .restart = mpc8xx_restart,
  75. .calibrate_decr = mpc8xx_calibrate_decr,
  76. .set_rtc_time = mpc8xx_set_rtc_time,
  77. .get_rtc_time = mpc8xx_get_rtc_time,
  78. };