platform.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. /*
  2. * Platform device support for Philips PNX8550 SoCs
  3. *
  4. * Copyright 2005, Embedded Alley Solutions, Inc
  5. *
  6. * Based on arch/mips/au1000/common/platform.c
  7. * Platform device support for Au1x00 SoCs.
  8. *
  9. * Copyright 2004, Matt Porter <mporter@kernel.crashing.org>
  10. *
  11. * This file is licensed under the terms of the GNU General Public
  12. * License version 2. This program is licensed "as is" without any
  13. * warranty of any kind, whether express or implied.
  14. */
  15. #include <linux/device.h>
  16. #include <linux/kernel.h>
  17. #include <linux/init.h>
  18. #include <linux/resource.h>
  19. #include <linux/serial.h>
  20. #include <linux/serial_ip3106.h>
  21. #include <linux/platform_device.h>
  22. #include <int.h>
  23. #include <usb.h>
  24. #include <uart.h>
  25. extern struct uart_ops ip3106_pops;
  26. static struct resource pnx8550_usb_ohci_resources[] = {
  27. [0] = {
  28. .start = PNX8550_USB_OHCI_OP_BASE,
  29. .end = PNX8550_USB_OHCI_OP_BASE +
  30. PNX8550_USB_OHCI_OP_LEN,
  31. .flags = IORESOURCE_MEM,
  32. },
  33. [1] = {
  34. .start = PNX8550_INT_USB,
  35. .end = PNX8550_INT_USB,
  36. .flags = IORESOURCE_IRQ,
  37. },
  38. };
  39. static struct resource pnx8550_uart_resources[] = {
  40. [0] = {
  41. .start = PNX8550_UART_PORT0,
  42. .end = PNX8550_UART_PORT0 + 0xfff,
  43. .flags = IORESOURCE_MEM,
  44. },
  45. [1] = {
  46. .start = PNX8550_UART_INT(0),
  47. .end = PNX8550_UART_INT(0),
  48. .flags = IORESOURCE_IRQ,
  49. },
  50. [2] = {
  51. .start = PNX8550_UART_PORT1,
  52. .end = PNX8550_UART_PORT1 + 0xfff,
  53. .flags = IORESOURCE_MEM,
  54. },
  55. [3] = {
  56. .start = PNX8550_UART_INT(1),
  57. .end = PNX8550_UART_INT(1),
  58. .flags = IORESOURCE_IRQ,
  59. },
  60. };
  61. struct ip3106_port ip3106_ports[] = {
  62. [0] = {
  63. .port = {
  64. .type = PORT_IP3106,
  65. .iotype = UPIO_MEM,
  66. .membase = (void __iomem *)PNX8550_UART_PORT0,
  67. .mapbase = PNX8550_UART_PORT0,
  68. .irq = PNX8550_UART_INT(0),
  69. .uartclk = 3692300,
  70. .fifosize = 16,
  71. .ops = &ip3106_pops,
  72. .flags = UPF_BOOT_AUTOCONF,
  73. .line = 0,
  74. },
  75. },
  76. [1] = {
  77. .port = {
  78. .type = PORT_IP3106,
  79. .iotype = UPIO_MEM,
  80. .membase = (void __iomem *)PNX8550_UART_PORT1,
  81. .mapbase = PNX8550_UART_PORT1,
  82. .irq = PNX8550_UART_INT(1),
  83. .uartclk = 3692300,
  84. .fifosize = 16,
  85. .ops = &ip3106_pops,
  86. .flags = UPF_BOOT_AUTOCONF,
  87. .line = 1,
  88. },
  89. },
  90. };
  91. /* The dmamask must be set for OHCI to work */
  92. static u64 ohci_dmamask = ~(u32)0;
  93. static u64 uart_dmamask = ~(u32)0;
  94. static struct platform_device pnx8550_usb_ohci_device = {
  95. .name = "pnx8550-ohci",
  96. .id = -1,
  97. .dev = {
  98. .dma_mask = &ohci_dmamask,
  99. .coherent_dma_mask = 0xffffffff,
  100. },
  101. .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),
  102. .resource = pnx8550_usb_ohci_resources,
  103. };
  104. static struct platform_device pnx8550_uart_device = {
  105. .name = "ip3106-uart",
  106. .id = -1,
  107. .dev = {
  108. .dma_mask = &uart_dmamask,
  109. .coherent_dma_mask = 0xffffffff,
  110. .platform_data = ip3106_ports,
  111. },
  112. .num_resources = ARRAY_SIZE(pnx8550_uart_resources),
  113. .resource = pnx8550_uart_resources,
  114. };
  115. static struct platform_device *pnx8550_platform_devices[] __initdata = {
  116. &pnx8550_usb_ohci_device,
  117. &pnx8550_uart_device,
  118. };
  119. int pnx8550_platform_init(void)
  120. {
  121. return platform_add_devices(pnx8550_platform_devices,
  122. ARRAY_SIZE(pnx8550_platform_devices));
  123. }
  124. arch_initcall(pnx8550_platform_init);