pq2.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 <asm/system.h>
  20. #include <platforms/82xx/pq2.h>
  21. #define RMR_CSRE 0x00000001
  22. void pq2_restart(char *cmd)
  23. {
  24. local_irq_disable();
  25. setbits32(&cpm2_immr->im_clkrst.car_rmr, RMR_CSRE);
  26. /* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
  27. mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
  28. in_8(&cpm2_immr->im_clkrst.res[0]);
  29. panic("Restart failed\n");
  30. }
  31. #ifdef CONFIG_PCI
  32. static int pq2_pci_exclude_device(struct pci_controller *hose,
  33. u_char bus, u8 devfn)
  34. {
  35. if (bus == 0 && PCI_SLOT(devfn) == 0)
  36. return PCIBIOS_DEVICE_NOT_FOUND;
  37. else
  38. return PCIBIOS_SUCCESSFUL;
  39. }
  40. static void __init pq2_pci_add_bridge(struct device_node *np)
  41. {
  42. struct pci_controller *hose;
  43. struct resource r;
  44. if (of_address_to_resource(np, 0, &r) || r.end - r.start < 0x10b)
  45. goto err;
  46. ppc_pci_add_flags(PPC_PCI_REASSIGN_ALL_BUS);
  47. hose = pcibios_alloc_controller(np);
  48. if (!hose)
  49. return;
  50. hose->dn = np;
  51. setup_indirect_pci(hose, r.start + 0x100, r.start + 0x104, 0);
  52. pci_process_bridge_OF_ranges(hose, np, 1);
  53. return;
  54. err:
  55. printk(KERN_ERR "No valid PCI reg property in device tree\n");
  56. }
  57. void __init pq2_init_pci(void)
  58. {
  59. struct device_node *np = NULL;
  60. ppc_md.pci_exclude_device = pq2_pci_exclude_device;
  61. while ((np = of_find_compatible_node(np, NULL, "fsl,pq2-pci")))
  62. pq2_pci_add_bridge(np);
  63. }
  64. #endif