platform.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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_pnx8xxx.h>
  21. #include <linux/platform_device.h>
  22. #include <int.h>
  23. #include <usb.h>
  24. #include <uart.h>
  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 pnx8xxx_port pnx8xxx_ports[] = {
  61. [0] = {
  62. .port = {
  63. .type = PORT_PNX8XXX,
  64. .iotype = UPIO_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. .flags = UPF_BOOT_AUTOCONF,
  71. .line = 0,
  72. },
  73. },
  74. [1] = {
  75. .port = {
  76. .type = PORT_PNX8XXX,
  77. .iotype = UPIO_MEM,
  78. .membase = (void __iomem *)PNX8550_UART_PORT1,
  79. .mapbase = PNX8550_UART_PORT1,
  80. .irq = PNX8550_UART_INT(1),
  81. .uartclk = 3692300,
  82. .fifosize = 16,
  83. .flags = UPF_BOOT_AUTOCONF,
  84. .line = 1,
  85. },
  86. },
  87. };
  88. /* The dmamask must be set for OHCI to work */
  89. static u64 ohci_dmamask = ~(u32)0;
  90. static u64 uart_dmamask = ~(u32)0;
  91. static struct platform_device pnx8550_usb_ohci_device = {
  92. .name = "pnx8550-ohci",
  93. .id = -1,
  94. .dev = {
  95. .dma_mask = &ohci_dmamask,
  96. .coherent_dma_mask = 0xffffffff,
  97. },
  98. .num_resources = ARRAY_SIZE(pnx8550_usb_ohci_resources),
  99. .resource = pnx8550_usb_ohci_resources,
  100. };
  101. static struct platform_device pnx8550_uart_device = {
  102. .name = "pnx8xxx-uart",
  103. .id = -1,
  104. .dev = {
  105. .dma_mask = &uart_dmamask,
  106. .coherent_dma_mask = 0xffffffff,
  107. .platform_data = pnx8xxx_ports,
  108. },
  109. .num_resources = ARRAY_SIZE(pnx8550_uart_resources),
  110. .resource = pnx8550_uart_resources,
  111. };
  112. static struct platform_device *pnx8550_platform_devices[] __initdata = {
  113. &pnx8550_usb_ohci_device,
  114. &pnx8550_uart_device,
  115. };
  116. int pnx8550_platform_init(void)
  117. {
  118. return platform_add_devices(pnx8550_platform_devices,
  119. ARRAY_SIZE(pnx8550_platform_devices));
  120. }
  121. arch_initcall(pnx8550_platform_init);