mpc837x_rdb.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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. {},
  66. };
  67. static int __init mpc837x_declare_of_platform_devices(void)
  68. {
  69. /* Publish of_device */
  70. of_platform_bus_probe(NULL, mpc837x_ids, NULL);
  71. return 0;
  72. }
  73. machine_device_initcall(mpc837x_rdb, mpc837x_declare_of_platform_devices);
  74. static void __init mpc837x_rdb_init_IRQ(void)
  75. {
  76. struct device_node *np;
  77. np = of_find_compatible_node(NULL, NULL, "fsl,ipic");
  78. if (!np)
  79. return;
  80. ipic_init(np, 0);
  81. /* Initialize the default interrupt mapping priorities,
  82. * in case the boot rom changed something on us.
  83. */
  84. ipic_set_default_priority();
  85. }
  86. /*
  87. * Called very early, MMU is off, device-tree isn't unflattened
  88. */
  89. static int __init mpc837x_rdb_probe(void)
  90. {
  91. unsigned long root = of_get_flat_dt_root();
  92. return of_flat_dt_is_compatible(root, "fsl,mpc8377rdb") ||
  93. of_flat_dt_is_compatible(root, "fsl,mpc8378rdb") ||
  94. of_flat_dt_is_compatible(root, "fsl,mpc8379rdb") ||
  95. of_flat_dt_is_compatible(root, "fsl,mpc8377wlan");
  96. }
  97. define_machine(mpc837x_rdb) {
  98. .name = "MPC837x RDB/WLAN",
  99. .probe = mpc837x_rdb_probe,
  100. .setup_arch = mpc837x_rdb_setup_arch,
  101. .init_IRQ = mpc837x_rdb_init_IRQ,
  102. .get_irq = ipic_get_irq,
  103. .restart = mpc83xx_restart,
  104. .time_init = mpc83xx_time_init,
  105. .calibrate_decr = generic_calibrate_decr,
  106. .progress = udbg_progress,
  107. };