platform.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. /*
  2. * Platform device support for NXP 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/dma-mapping.h>
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/resource.h>
  20. #include <linux/serial.h>
  21. #include <linux/serial_pnx8xxx.h>
  22. #include <linux/platform_device.h>
  23. #include <int.h>
  24. #include <usb.h>
  25. #include <uart.h>
  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 pnx8xxx_port pnx8xxx_ports[] = {
  62. [0] = {
  63. .port = {
  64. .type = PORT_PNX8XXX,
  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. .flags = UPF_BOOT_AUTOCONF,
  72. .line = 0,
  73. },
  74. },
  75. [1] = {
  76. .port = {
  77. .type = PORT_PNX8XXX,
  78. .iotype = UPIO_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. .flags = UPF_BOOT_AUTOCONF,
  85. .line = 1,
  86. },
  87. },
  88. };
  89. /* The dmamask must be set for OHCI to work */
  90. static u64 ohci_dmamask = DMA_BIT_MASK(32);
  91. static u64 uart_dmamask = DMA_BIT_MASK(32);
  92. static struct platform_device pnx8550_usb_ohci_device = {
  93. .name = "pnx8550-ohci",
  94. .id = -1,
  95. .dev = {
  96. .dma_mask = &ohci_dmamask,
  97. .coherent_dma_mask = DMA_BIT_MASK(32),
  98. },
  99. .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),
  100. .resource = pnx8550_usb_ohci_resources,
  101. };
  102. static struct platform_device pnx8550_uart_device = {
  103. .name = "pnx8xxx-uart",
  104. .id = -1,
  105. .dev = {
  106. .dma_mask = &uart_dmamask,
  107. .coherent_dma_mask = DMA_BIT_MASK(32),
  108. .platform_data = pnx8xxx_ports,
  109. },
  110. .num_resources = ARRAY_SIZE(pnx8550_uart_resources),
  111. .resource = pnx8550_uart_resources,
  112. };
  113. static struct platform_device *pnx8550_platform_devices[] __initdata = {
  114. &pnx8550_usb_ohci_device,
  115. &pnx8550_uart_device,
  116. };
  117. static int __init pnx8550_platform_init(void)
  118. {
  119. return platform_add_devices(pnx8550_platform_devices,
  120. ARRAY_SIZE(pnx8550_platform_devices));
  121. }
  122. arch_initcall(pnx8550_platform_init);