tqm85xx.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /*
  2. * Based on MPC8560 ADS and arch/ppc tqm85xx ports
  3. *
  4. * Maintained by Kumar Gala (see MAINTAINERS for contact information)
  5. *
  6. * Copyright 2008 Freescale Semiconductor Inc.
  7. *
  8. * Copyright (c) 2005-2006 DENX Software Engineering
  9. * Stefan Roese <sr@denx.de>
  10. *
  11. * Based on original work by
  12. * Kumar Gala <kumar.gala@freescale.com>
  13. * Copyright 2004 Freescale Semiconductor Inc.
  14. *
  15. * This program is free software; you can redistribute it and/or modify it
  16. * under the terms of the GNU General Public License as published by the
  17. * Free Software Foundation; either version 2 of the License, or (at your
  18. * option) any later version.
  19. */
  20. #include <linux/stddef.h>
  21. #include <linux/kernel.h>
  22. #include <linux/pci.h>
  23. #include <linux/kdev_t.h>
  24. #include <linux/delay.h>
  25. #include <linux/seq_file.h>
  26. #include <linux/of_platform.h>
  27. #include <asm/time.h>
  28. #include <asm/machdep.h>
  29. #include <asm/pci-bridge.h>
  30. #include <asm/mpic.h>
  31. #include <asm/prom.h>
  32. #include <mm/mmu_decl.h>
  33. #include <asm/udbg.h>
  34. #include <sysdev/fsl_soc.h>
  35. #include <sysdev/fsl_pci.h>
  36. #include "mpc85xx.h"
  37. #ifdef CONFIG_CPM2
  38. #include <asm/cpm2.h>
  39. #endif /* CONFIG_CPM2 */
  40. static void __init tqm85xx_pic_init(void)
  41. {
  42. struct mpic *mpic = mpic_alloc(NULL, 0,
  43. MPIC_BIG_ENDIAN,
  44. 0, 256, " OpenPIC ");
  45. BUG_ON(mpic == NULL);
  46. mpic_init(mpic);
  47. mpc85xx_cpm2_pic_init();
  48. }
  49. /*
  50. * Setup the architecture
  51. */
  52. static void __init tqm85xx_setup_arch(void)
  53. {
  54. if (ppc_md.progress)
  55. ppc_md.progress("tqm85xx_setup_arch()", 0);
  56. #ifdef CONFIG_CPM2
  57. cpm2_reset();
  58. #endif
  59. fsl_pci_assign_primary();
  60. }
  61. static void tqm85xx_show_cpuinfo(struct seq_file *m)
  62. {
  63. uint pvid, svid, phid1;
  64. pvid = mfspr(SPRN_PVR);
  65. svid = mfspr(SPRN_SVR);
  66. seq_printf(m, "Vendor\t\t: TQ Components\n");
  67. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  68. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  69. /* Display cpu Pll setting */
  70. phid1 = mfspr(SPRN_HID1);
  71. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  72. }
  73. static void tqm85xx_ti1520_fixup(struct pci_dev *pdev)
  74. {
  75. unsigned int val;
  76. /* Do not do the fixup on other platforms! */
  77. if (!machine_is(tqm85xx))
  78. return;
  79. dev_info(&pdev->dev, "Using TI 1520 fixup on TQM85xx\n");
  80. /*
  81. * Enable P2CCLK bit in system control register
  82. * to enable CLOCK output to power chip
  83. */
  84. pci_read_config_dword(pdev, 0x80, &val);
  85. pci_write_config_dword(pdev, 0x80, val | (1 << 27));
  86. }
  87. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
  88. tqm85xx_ti1520_fixup);
  89. machine_arch_initcall(tqm85xx, mpc85xx_common_publish_devices);
  90. static const char * const board[] __initconst = {
  91. "tqc,tqm8540",
  92. "tqc,tqm8541",
  93. "tqc,tqm8548",
  94. "tqc,tqm8555",
  95. "tqc,tqm8560",
  96. NULL
  97. };
  98. /*
  99. * Called very early, device-tree isn't unflattened
  100. */
  101. static int __init tqm85xx_probe(void)
  102. {
  103. return of_device_compatible_match(of_root, board);
  104. }
  105. define_machine(tqm85xx) {
  106. .name = "TQM85xx",
  107. .probe = tqm85xx_probe,
  108. .setup_arch = tqm85xx_setup_arch,
  109. .init_IRQ = tqm85xx_pic_init,
  110. .show_cpuinfo = tqm85xx_show_cpuinfo,
  111. .get_irq = mpic_get_irq,
  112. .calibrate_decr = generic_calibrate_decr,
  113. .progress = udbg_progress,
  114. };