pq2.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Common PowerQUICC II code.
  3. *
  4. * Author: Scott Wood <scottwood@freescale.com>
  5. * Copyright (c) 2007 Freescale Semiconductor
  6. *
  7. * Based on code by Vitaly Bordug <vbordug@ru.mvista.com>
  8. * pq2_restart fix by Wade Farnsworth <wfarnsworth@mvista.com>
  9. * Copyright (c) 2006 MontaVista Software, Inc.
  10. *
  11. * This program is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the
  13. * Free Software Foundation; either version 2 of the License, or (at your
  14. * option) any later version.
  15. */
  16. #include <asm/cpm2.h>
  17. #include <asm/io.h>
  18. #include <asm/pci-bridge.h>
  19. #include <platforms/82xx/pq2.h>
  20. #define RMR_CSRE 0x00000001
  21. void pq2_restart(char *cmd)
  22. {
  23. local_irq_disable();
  24. setbits32(&cpm2_immr->im_clkrst.car_rmr, RMR_CSRE);
  25. /* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
  26. mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
  27. in_8(&cpm2_immr->im_clkrst.res[0]);
  28. panic("Restart failed\n");
  29. }
  30. #ifdef CONFIG_PCI
  31. static int pq2_pci_exclude_device(struct pci_controller *hose,
  32. u_char bus, u8 devfn)
  33. {
  34. if (bus == 0 && PCI_SLOT(devfn) == 0)
  35. return PCIBIOS_DEVICE_NOT_FOUND;
  36. else
  37. return PCIBIOS_SUCCESSFUL;
  38. }
  39. static void __init pq2_pci_add_bridge(struct device_node *np)
  40. {
  41. struct pci_controller *hose;
  42. struct resource r;
  43. if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b)
  44. goto err;
  45. pci_add_flags(PCI_REASSIGN_ALL_BUS);
  46. hose = pcibios_alloc_controller(np);
  47. if (!hose)
  48. return;
  49. hose->dn = np;
  50. setup_indirect_pci(hose, r.start + 0x100, r.start + 0x104, 0);
  51. pci_process_bridge_OF_ranges(hose, np, 1);
  52. return;
  53. err:
  54. printk(KERN_ERR "No valid PCI reg property in device tree\n");
  55. }
  56. void __init pq2_init_pci(void)
  57. {
  58. struct device_node *np;
  59. ppc_md.pci_exclude_device = pq2_pci_exclude_device;
  60. for_each_compatible_node(np, NULL, "fsl,pq2-pci")
  61. pq2_pci_add_bridge(np);
  62. }
  63. #endif