tqm85xx.c 2.8 KB

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