mpc837x_rdb.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * arch/powerpc/platforms/83xx/mpc837x_rdb.c
  3. *
  4. * Copyright (C) 2007 Freescale Semicondutor, Inc. All rights reserved.
  5. *
  6. * MPC837x RDB board specific routines
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License as published by the
  10. * Free Software Foundation; either version 2 of the License, or (at your
  11. * option) any later version.
  12. */
  13. #include <linux/pci.h>
  14. #include <linux/of_platform.h>
  15. #include <asm/time.h>
  16. #include <asm/ipic.h>
  17. #include <asm/udbg.h>
  18. #include <sysdev/fsl_soc.h>
  19. #include <sysdev/fsl_pci.h>
  20. #include "mpc83xx.h"
  21. static void mpc837x_rdb_sd_cfg(void)
  22. {
  23. void __iomem *im;
  24. im = ioremap(get_immrbase(), 0x1000);
  25. if (!im) {
  26. WARN_ON(1);
  27. return;
  28. }
  29. /*
  30. * On RDB boards (in contrast to MDS) USBB pins are used for SD only,
  31. * so we can safely mux them away from the USB block.
  32. */
  33. clrsetbits_be32(im + MPC83XX_SICRL_OFFS, MPC837X_SICRL_USBB_MASK,
  34. MPC837X_SICRL_SD);
  35. clrsetbits_be32(im + MPC83XX_SICRH_OFFS, MPC837X_SICRH_SPI_MASK,
  36. MPC837X_SICRH_SD);
  37. iounmap(im);
  38. }
  39. /* ************************************************************************
  40. *
  41. * Setup the architecture
  42. *
  43. */
  44. static void __init mpc837x_rdb_setup_arch(void)
  45. {
  46. #ifdef CONFIG_PCI
  47. struct device_node *np;
  48. #endif
  49. if (ppc_md.progress)
  50. ppc_md.progress("mpc837x_rdb_setup_arch()", 0);
  51. #ifdef CONFIG_PCI
  52. for_each_compatible_node(np, "pci", "fsl,mpc8349-pci")
  53. mpc83xx_add_bridge(np);
  54. for_each_compatible_node(np, "pci", "fsl,mpc8314-pcie")
  55. mpc83xx_add_bridge(np);
  56. #endif
  57. mpc837x_usb_cfg();
  58. mpc837x_rdb_sd_cfg();
  59. }
  60. static struct of_device_id mpc837x_ids[] = {
  61. { .type = "soc", },
  62. { .compatible = "soc", },
  63. { .compatible = "simple-bus", },
  64. { .compatible = "gianfar", },
  65. { .compatible = "gpio-leds", },
  66. {},
  67. };
  68. static int __init mpc837x_declare_of_platform_devices(void)
  69. {
  70. /* Publish platform_device */
  71. of_platform_bus_probe(NULL, mpc837x_ids, NULL);
  72. return 0;
  73. }
  74. machine_device_initcall(mpc837x_rdb, mpc837x_declare_of_platform_devices);
  75. static void __init mpc837x_rdb_init_IRQ(void)
  76. {
  77. struct device_node *np;
  78. np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
  79. if (!np)
  80. return;
  81. ipic_init(np, 0);
  82. /* Initialize the default interrupt mapping priorities,
  83. * in case the boot rom changed something on us.
  84. */
  85. ipic_set_default_priority();
  86. }
  87. static const char *board[] __initdata = {
  88. "fsl,mpc8377rdb",
  89. "fsl,mpc8378rdb",
  90. "fsl,mpc8379rdb",
  91. "fsl,mpc8377wlan",
  92. NULL
  93. };
  94. /*
  95. * Called very early, MMU is off, device-tree isn't unflattened
  96. */
  97. static int __init mpc837x_rdb_probe(void)
  98. {
  99. return of_flat_dt_match(of_get_flat_dt_root(), board);
  100. }
  101. define_machine(mpc837x_rdb) {
  102. .name = "MPC837x RDB/WLAN",
  103. .probe = mpc837x_rdb_probe,
  104. .setup_arch = mpc837x_rdb_setup_arch,
  105. .init_IRQ = mpc837x_rdb_init_IRQ,
  106. .get_irq = ipic_get_irq,
  107. .restart = mpc83xx_restart,
  108. .time_init = mpc83xx_time_init,
  109. .calibrate_decr = generic_calibrate_decr,
  110. .progress = udbg_progress,
  111. };