ops-snapgear.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * arch/sh/drivers/pci/ops-snapgear.c
  3. *
  4. * Author: David McCullough <davidm@snapgear.com>
  5. *
  6. * Ported to new API by Paul Mundt <lethal@linux-sh.org>
  7. *
  8. * Highly leveraged from pci-bigsur.c, written by Dustin McIntire.
  9. *
  10. * May be copied or modified under the terms of the GNU General Public
  11. * License. See linux/COPYING for more information.
  12. *
  13. * PCI initialization for the SnapGear boards
  14. */
  15. #include <linux/kernel.h>
  16. #include <linux/types.h>
  17. #include <linux/init.h>
  18. #include <linux/pci.h>
  19. #include "pci-sh4.h"
  20. #define SNAPGEAR_PCI_IO 0x4000
  21. #define SNAPGEAR_PCI_MEM 0xfd000000
  22. /* PCI: default LOCAL memory window sizes (seen from PCI bus) */
  23. #define SNAPGEAR_LSR0_SIZE (64*(1<<20)) //64MB
  24. #define SNAPGEAR_LSR1_SIZE (64*(1<<20)) //64MB
  25. static struct resource sh7751_io_resource = {
  26. .name = "SH7751 IO",
  27. .start = SNAPGEAR_PCI_IO,
  28. .end = SNAPGEAR_PCI_IO + (64*1024) - 1, /* 64KiB I/O */
  29. .flags = IORESOURCE_IO,
  30. };
  31. static struct resource sh7751_mem_resource = {
  32. .name = "SH7751 mem",
  33. .start = SNAPGEAR_PCI_MEM,
  34. .end = SNAPGEAR_PCI_MEM + (64*1024*1024) - 1, /* 64MiB mem */
  35. .flags = IORESOURCE_MEM,
  36. };
  37. struct pci_channel board_pci_channels[] = {
  38. { sh7751_pci_init, &sh4_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
  39. { 0, }
  40. };
  41. static struct sh4_pci_address_map sh7751_pci_map = {
  42. .window0 = {
  43. .base = SH7751_CS2_BASE_ADDR,
  44. .size = SNAPGEAR_LSR0_SIZE,
  45. },
  46. .window1 = {
  47. .base = SH7751_CS2_BASE_ADDR,
  48. .size = SNAPGEAR_LSR1_SIZE,
  49. },
  50. };
  51. /*
  52. * Initialize the SnapGear PCI interface
  53. * Setup hardware to be Central Funtion
  54. * Copy the BSR regs to the PCI interface
  55. * Setup PCI windows into local RAM
  56. */
  57. int __init pcibios_init_platform(void)
  58. {
  59. return sh7751_pcic_init(&board_pci_channels[0], &sh7751_pci_map);
  60. }
  61. int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)
  62. {
  63. int irq = -1;
  64. switch (slot) {
  65. case 8: /* the PCI bridge */ break;
  66. case 11: irq = 8; break; /* USB */
  67. case 12: irq = 11; break; /* PCMCIA */
  68. case 13: irq = 5; break; /* eth0 */
  69. case 14: irq = 8; break; /* eth1 */
  70. case 15: irq = 11; break; /* safenet (unused) */
  71. }
  72. printk("PCI: Mapping SnapGear IRQ for slot %d, pin %c to irq %d\n",
  73. slot, pin - 1 + 'A', irq);
  74. return irq;
  75. }
  76. void __init pcibios_fixup(void)
  77. {
  78. /* Nothing to fixup .. */
  79. }