ops-snapgear.c 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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/config.h>
  16. #include <linux/kernel.h>
  17. #include <linux/types.h>
  18. #include <linux/init.h>
  19. #include <linux/delay.h>
  20. #include <linux/pci.h>
  21. #include <asm/io.h>
  22. #include "pci-sh7751.h"
  23. #define SNAPGEAR_PCI_IO 0x4000
  24. #define SNAPGEAR_PCI_MEM 0xfd000000
  25. /* PCI: default LOCAL memory window sizes (seen from PCI bus) */
  26. #define SNAPGEAR_LSR0_SIZE (64*(1<<20)) //64MB
  27. #define SNAPGEAR_LSR1_SIZE (64*(1<<20)) //64MB
  28. static struct resource sh7751_io_resource = {
  29. .name = "SH7751 IO",
  30. .start = SNAPGEAR_PCI_IO,
  31. .end = SNAPGEAR_PCI_IO + (64*1024) - 1, /* 64KiB I/O */
  32. .flags = IORESOURCE_IO,
  33. };
  34. static struct resource sh7751_mem_resource = {
  35. .name = "SH7751 mem",
  36. .start = SNAPGEAR_PCI_MEM,
  37. .end = SNAPGEAR_PCI_MEM + (64*1024*1024) - 1, /* 64MiB mem */
  38. .flags = IORESOURCE_MEM,
  39. };
  40. extern struct pci_ops sh7751_pci_ops;
  41. struct pci_channel board_pci_channels[] = {
  42. { &sh7751_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff },
  43. { 0, }
  44. };
  45. static struct sh7751_pci_address_map sh7751_pci_map = {
  46. .window0 = {
  47. .base = SH7751_CS2_BASE_ADDR,
  48. .size = SNAPGEAR_LSR0_SIZE,
  49. },
  50. .window1 = {
  51. .base = SH7751_CS2_BASE_ADDR,
  52. .size = SNAPGEAR_LSR1_SIZE,
  53. },
  54. .flags = SH7751_PCIC_NO_RESET,
  55. };
  56. /*
  57. * Initialize the SnapGear PCI interface
  58. * Setup hardware to be Central Funtion
  59. * Copy the BSR regs to the PCI interface
  60. * Setup PCI windows into local RAM
  61. */
  62. int __init pcibios_init_platform(void)
  63. {
  64. return sh7751_pcic_init(&sh7751_pci_map);
  65. }
  66. int __init pcibios_map_platform_irq(u8 slot, u8 pin)
  67. {
  68. int irq = -1;
  69. switch (slot) {
  70. case 8: /* the PCI bridge */ break;
  71. case 11: irq = 8; break; /* USB */
  72. case 12: irq = 11; break; /* PCMCIA */
  73. case 13: irq = 5; break; /* eth0 */
  74. case 14: irq = 8; break; /* eth1 */
  75. case 15: irq = 11; break; /* safenet (unused) */
  76. }
  77. printk("PCI: Mapping SnapGear IRQ for slot %d, pin %c to irq %d\n",
  78. slot, pin - 1 + 'A', irq);
  79. return irq;
  80. }
  81. void __init pcibios_fixup(void)
  82. {
  83. /* Nothing to fixup .. */
  84. }