mpc5200_simple.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Support for 'mpc5200-simple-platform' compatible boards.
  3. *
  4. * Written by Marian Balakowicz <m8@semihalf.com>
  5. * Copyright (C) 2007 Semihalf
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * Description:
  13. * This code implements support for a simple MPC52xx based boards which
  14. * do not need a custom platform specific setup. Such boards are
  15. * supported assuming the following:
  16. *
  17. * - GPIO pins are configured by the firmware,
  18. * - CDM configuration (clocking) is setup correctly by firmware,
  19. * - if the 'fsl,has-wdt' property is present in one of the
  20. * gpt nodes, then it is safe to use such gpt to reset the board,
  21. * - PCI is supported if enabled in the kernel configuration
  22. * and if there is a PCI bus node defined in the device tree.
  23. *
  24. * Boards that are compatible with this generic platform support
  25. * are listed in a 'board' table.
  26. */
  27. #undef DEBUG
  28. #include <asm/time.h>
  29. #include <asm/prom.h>
  30. #include <asm/machdep.h>
  31. #include <asm/mpc52xx.h>
  32. /*
  33. * Setup the architecture
  34. */
  35. static void __init mpc5200_simple_setup_arch(void)
  36. {
  37. if (ppc_md.progress)
  38. ppc_md.progress("mpc5200_simple_setup_arch()", 0);
  39. /* Map important registers from the internal memory map */
  40. mpc52xx_map_common_devices();
  41. /* Some mpc5200 & mpc5200b related configuration */
  42. mpc5200_setup_xlb_arbiter();
  43. mpc52xx_setup_pci();
  44. }
  45. /* list of the supported boards */
  46. static char *board[] __initdata = {
  47. "promess,motionpro",
  48. "phytec,pcm030",
  49. "schindler,cm5200",
  50. "tqc,tqm5200",
  51. NULL
  52. };
  53. /*
  54. * Called very early, MMU is off, device-tree isn't unflattened
  55. */
  56. static int __init mpc5200_simple_probe(void)
  57. {
  58. unsigned long node = of_get_flat_dt_root();
  59. int i = 0;
  60. while (board[i]) {
  61. if (of_flat_dt_is_compatible(node, board[i]))
  62. break;
  63. i++;
  64. }
  65. return (board[i] != NULL);
  66. }
  67. define_machine(mpc5200_simple_platform) {
  68. .name = "mpc5200-simple-platform",
  69. .probe = mpc5200_simple_probe,
  70. .setup_arch = mpc5200_simple_setup_arch,
  71. .init = mpc52xx_declare_of_platform_devices,
  72. .init_IRQ = mpc52xx_init_irq,
  73. .get_irq = mpc52xx_get_irq,
  74. .restart = mpc52xx_restart,
  75. .calibrate_decr = generic_calibrate_decr,
  76. };