sbc85xx.c 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. /*
  2. * arch/ppc/platform/85xx/sbc85xx.c
  3. *
  4. * WindRiver PowerQUICC III SBC85xx board common routines
  5. *
  6. * Copyright 2002, 2003 Motorola Inc.
  7. * Copyright 2004 Red Hat, Inc.
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. */
  14. #include <linux/config.h>
  15. #include <linux/stddef.h>
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/errno.h>
  19. #include <linux/reboot.h>
  20. #include <linux/pci.h>
  21. #include <linux/kdev_t.h>
  22. #include <linux/major.h>
  23. #include <linux/console.h>
  24. #include <linux/delay.h>
  25. #include <linux/seq_file.h>
  26. #include <linux/serial.h>
  27. #include <linux/module.h>
  28. #include <asm/system.h>
  29. #include <asm/pgtable.h>
  30. #include <asm/page.h>
  31. #include <asm/atomic.h>
  32. #include <asm/time.h>
  33. #include <asm/io.h>
  34. #include <asm/machdep.h>
  35. #include <asm/open_pic.h>
  36. #include <asm/bootinfo.h>
  37. #include <asm/pci-bridge.h>
  38. #include <asm/mpc85xx.h>
  39. #include <asm/irq.h>
  40. #include <asm/immap_85xx.h>
  41. #include <asm/ppc_sys.h>
  42. #include <mm/mmu_decl.h>
  43. #include <platforms/85xx/sbc85xx.h>
  44. unsigned char __res[sizeof (bd_t)];
  45. #ifndef CONFIG_PCI
  46. unsigned long isa_io_base = 0;
  47. unsigned long isa_mem_base = 0;
  48. unsigned long pci_dram_offset = 0;
  49. #endif
  50. extern unsigned long total_memory; /* in mm/init */
  51. /* Internal interrupts are all Level Sensitive, and Positive Polarity */
  52. static u_char sbc8560_openpic_initsenses[] __initdata = {
  53. MPC85XX_INTERNAL_IRQ_SENSES,
  54. 0x0, /* External 0: */
  55. 0x0, /* External 1: */
  56. #if defined(CONFIG_PCI)
  57. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI slot 0 */
  58. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI slot 1 */
  59. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 4: PCI slot 2 */
  60. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 5: PCI slot 3 */
  61. #else
  62. 0x0, /* External 2: */
  63. 0x0, /* External 3: */
  64. 0x0, /* External 4: */
  65. 0x0, /* External 5: */
  66. #endif
  67. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 6: PHY */
  68. (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 7: PHY */
  69. 0x0, /* External 8: */
  70. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* External 9: PHY */
  71. (IRQ_SENSE_LEVEL | IRQ_POLARITY_POSITIVE), /* External 10: PHY */
  72. 0x0, /* External 11: */
  73. };
  74. /* ************************************************************************ */
  75. int
  76. sbc8560_show_cpuinfo(struct seq_file *m)
  77. {
  78. uint pvid, svid, phid1;
  79. uint memsize = total_memory;
  80. bd_t *binfo = (bd_t *) __res;
  81. unsigned int freq;
  82. /* get the core frequency */
  83. freq = binfo->bi_intfreq;
  84. pvid = mfspr(SPRN_PVR);
  85. svid = mfspr(SPRN_SVR);
  86. seq_printf(m, "Vendor\t\t: Wind River\n");
  87. seq_printf(m, "Machine\t\t: SBC%s\n", cur_ppc_sys_spec->ppc_sys_name);
  88. seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
  89. seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
  90. seq_printf(m, "SVR\t\t: 0x%x\n", svid);
  91. /* Display cpu Pll setting */
  92. phid1 = mfspr(SPRN_HID1);
  93. seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
  94. /* Display the amount of memory */
  95. seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
  96. return 0;
  97. }
  98. void __init
  99. sbc8560_init_IRQ(void)
  100. {
  101. bd_t *binfo = (bd_t *) __res;
  102. /* Determine the Physical Address of the OpenPIC regs */
  103. phys_addr_t OpenPIC_PAddr =
  104. binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
  105. OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
  106. OpenPIC_InitSenses = sbc8560_openpic_initsenses;
  107. OpenPIC_NumInitSenses = sizeof (sbc8560_openpic_initsenses);
  108. /* Skip reserved space and internal sources */
  109. openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
  110. /* Map PIC IRQs 0-11 */
  111. openpic_set_sources(48, 12, OpenPIC_Addr + 0x10000);
  112. /* we let openpic interrupts starting from an offset, to
  113. * leave space for cascading interrupts underneath.
  114. */
  115. openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
  116. return;
  117. }
  118. /*
  119. * interrupt routing
  120. */
  121. #ifdef CONFIG_PCI
  122. int mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel,
  123. unsigned char pin)
  124. {
  125. static char pci_irq_table[][4] =
  126. /*
  127. * PCI IDSEL/INTPIN->INTLINE
  128. * A B C D
  129. */
  130. {
  131. {PIRQA, PIRQB, PIRQC, PIRQD},
  132. {PIRQD, PIRQA, PIRQB, PIRQC},
  133. {PIRQC, PIRQD, PIRQA, PIRQB},
  134. {PIRQB, PIRQC, PIRQD, PIRQA},
  135. };
  136. const long min_idsel = 12, max_idsel = 15, irqs_per_slot = 4;
  137. return PCI_IRQ_TABLE_LOOKUP;
  138. }
  139. int mpc85xx_exclude_device(u_char bus, u_char devfn)
  140. {
  141. if (bus == 0 && PCI_SLOT(devfn) == 0)
  142. return PCIBIOS_DEVICE_NOT_FOUND;
  143. else
  144. return PCIBIOS_SUCCESSFUL;
  145. }
  146. #endif /* CONFIG_PCI */