platform.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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 <int.h>
  22. #include <usb.h>
  23. #include <uart.h>
  24. extern struct uart_ops ip3106_pops;
  25. static struct resource pnx8550_usb_ohci_resources[] = {
  26. [0] = {
  27. .start = PNX8550_USB_OHCI_OP_BASE,
  28. .end = PNX8550_USB_OHCI_OP_BASE +
  29. PNX8550_USB_OHCI_OP_LEN,
  30. .flags = IORESOURCE_MEM,
  31. },
  32. [1] = {
  33. .start = PNX8550_INT_USB,
  34. .end = PNX8550_INT_USB,
  35. .flags = IORESOURCE_IRQ,
  36. },
  37. };
  38. static struct resource pnx8550_uart_resources[] = {
  39. [0] = {
  40. .start = PNX8550_UART_PORT0,
  41. .end = PNX8550_UART_PORT0 + 0xfff,
  42. .flags = IORESOURCE_MEM,
  43. },
  44. [1] = {
  45. .start = PNX8550_UART_INT(0),
  46. .end = PNX8550_UART_INT(0),
  47. .flags = IORESOURCE_IRQ,
  48. },
  49. [2] = {
  50. .start = PNX8550_UART_PORT1,
  51. .end = PNX8550_UART_PORT1 + 0xfff,
  52. .flags = IORESOURCE_MEM,
  53. },
  54. [3] = {
  55. .start = PNX8550_UART_INT(1),
  56. .end = PNX8550_UART_INT(1),
  57. .flags = IORESOURCE_IRQ,
  58. },
  59. };
  60. struct ip3106_port ip3106_ports[] = {
  61. [0] = {
  62. .port = {
  63. .type = PORT_IP3106,
  64. .iotype = SERIAL_IO_MEM,
  65. .membase = (void __iomem *)PNX8550_UART_PORT0,
  66. .mapbase = PNX8550_UART_PORT0,
  67. .irq = PNX8550_UART_INT(0),
  68. .uartclk = 3692300,
  69. .fifosize = 16,
  70. .ops = &ip3106_pops,
  71. .flags = ASYNC_BOOT_AUTOCONF,
  72. .line = 0,
  73. },
  74. },
  75. [1] = {
  76. .port = {
  77. .type = PORT_IP3106,
  78. .iotype = SERIAL_IO_MEM,
  79. .membase = (void __iomem *)PNX8550_UART_PORT1,
  80. .mapbase = PNX8550_UART_PORT1,
  81. .irq = PNX8550_UART_INT(1),
  82. .uartclk = 3692300,
  83. .fifosize = 16,
  84. .ops = &ip3106_pops,
  85. .flags = ASYNC_BOOT_AUTOCONF,
  86. .line = 1,
  87. },
  88. },
  89. };
  90. /* The dmamask must be set for OHCI to work */
  91. static u64 ohci_dmamask = ~(u32)0;
  92. static u64 uart_dmamask = ~(u32)0;
  93. static struct platform_device pnx8550_usb_ohci_device = {
  94. .name = "pnx8550-ohci",
  95. .id = -1,
  96. .dev = {
  97. .dma_mask = &ohci_dmamask,
  98. .coherent_dma_mask = 0xffffffff,
  99. },
  100. .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),
  101. .resource = pnx8550_usb_ohci_resources,
  102. };
  103. static struct platform_device pnx8550_uart_device = {
  104. .name = "ip3106-uart",
  105. .id = -1,
  106. .dev = {
  107. .dma_mask = &uart_dmamask,
  108. .coherent_dma_mask = 0xffffffff,
  109. .platform_data = ip3106_ports,
  110. },
  111. .num_resources = ARRAY_SIZE(pnx8550_uart_resources),
  112. .resource = pnx8550_uart_resources,
  113. };
  114. static struct platform_device *pnx8550_platform_devices[] __initdata = {
  115. &pnx8550_usb_ohci_device,
  116. &pnx8550_uart_device,
  117. };
  118. int pnx8550_platform_init(void)
  119. {
  120. return platform_add_devices(pnx8550_platform_devices,
  121. ARRAY_SIZE(pnx8550_platform_devices));
  122. }
  123. arch_initcall(pnx8550_platform_init);