slarmUnprocessedDataOperation.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*
  2. * Buffalo Terastation Pro II/Live Board Setup
  3. *
  4. * Maintainer: Sylver Bruneau <sylver.bruneau@googlemail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version
  9. * 2 of the License, or (at your option) any later version.
  10. */
  11. #include <linux/gpio.h>
  12. #include <linux/kernel.h>
  13. #include <linux/init.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/pci.h>
  16. #include <linux/irq.h>
  17. #include <linux/delay.h>
  18. #include <linux/mtd/physmap.h>
  19. #include <linux/mv643xx_eth.h>
  20. #include <linux/i2c.h>
  21. #include <linux/serial_reg.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/pci.h>
  25. #include <mach/orion5x.h>
  26. #include "common.h"
  27. #include "mpp.h"
  28. /*****************************************************************************
  29. * Terastation Pro 2/Live Info
  30. ****************************************************************************/
  31. /*
  32. * Terastation Pro 2 hardware :
  33. * - Marvell 88F5281-D0
  34. * - Marvell 88SX6042 SATA controller (PCI)
  35. * - Marvell 88E1118 Gigabit Ethernet PHY
  36. * - 256KB NOR flash
  37. * - 128MB of DDR RAM
  38. * - PCIe port (not equipped)
  39. */
  40. /*
  41. * 256K NOR flash Device bus boot chip select
  42. */
  43. #define TSP2_NOR_BOOT_BASE 0xf4000000
  44. #define TSP2_NOR_BOOT_SIZE SZ_256K
  45. /*****************************************************************************
  46. * 256KB NOR Flash on BOOT Device
  47. ****************************************************************************/
  48. static struct physmap_flash_data tsp2_nor_flash_data = {
  49. .width = 1,
  50. };
  51. static struct resource tsp2_nor_flash_resource = {
  52. .flags = IORESOURCE_MEM,
  53. .start = TSP2_NOR_BOOT_BASE,
  54. .end = TSP2_NOR_BOOT_BASE + TSP2_NOR_BOOT_SIZE - 1,
  55. };
  56. static struct platform_device tsp2_nor_flash = {
  57. .name = "physmap-flash",
  58. .id = 0,
  59. .dev = {
  60. .platform_data = &tsp2_nor_flash_data,
  61. },
  62. .num_resources = 1,
  63. .resource = &tsp2_nor_flash_resource,
  64. };
  65. /*****************************************************************************
  66. * PCI
  67. ****************************************************************************/
  68. #define TSP2_PCI_SLOT0_OFFS 7
  69. #define TSP2_PCI_SLOT0_IRQ_PIN 11
  70. void __init tsp2_pci_preinit(void)
  71. {
  72. int pin;
  73. /*
  74. * Configure PCI GPIO IRQ pins
  75. */
  76. pin = TSP2_PCI_SLOT0_IRQ_PIN;
  77. if (gpio_request(pin, "PCI Int1") == 0) {
  78. if (gpio_direction_input(pin) == 0) {
  79. irq_set_irq_type(gpio_to_irq(pin), IRQ_TYPE_LEVEL_LOW);
  80. } else {
  81. printk(KERN_ERR "tsp2_pci_preinit failed "
  82. "to set_irq_type pin %d\n", pin);
  83. gpio_free(pin);
  84. }
  85. } else {
  86. printk(KERN_ERR "tsp2_pci_preinit failed to "
  87. "gpio_request %d\n", pin);
  88. }
  89. }
  90. static int __init tsp2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  91. {
  92. int irq;
  93. /*
  94. * Check for devices with hard-wired IRQs.
  95. */
  96. irq = orion5x_pci_map_irq(dev, slot, pin);
  97. if (irq != -1)
  98. return irq;
  99. /*
  100. * PCI IRQs are connected via GPIOs.
  101. */
  102. if (slot == TSP2_PCI_SLOT0_OFFS)
  103. return gpio_to_irq(TSP2_PCI_SLOT0_IRQ_PIN);
  104. return -1;
  105. }
  106. static struct hw_pci tsp2_pci __initdata = {
  107. .nr_controllers = 2,
  108. .preinit = tsp2_pci_preinit,
  109. .setup = orion5x_pci_sys_setup,
  110. .scan = orion5x_pci_sys_scan_bus,
  111. .map_irq = tsp2_pci_map_irq,
  112. };
  113. static int __init tsp2_pci_init(void)
  114. {
  115. if (machine_is_terastation_pro2())
  116. pci_common_init(&tsp2_pci);
  117. return 0;
  118. }
  119. subsys_initcall(tsp2_pci_init);