tepla.c 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright 2004-2007 Analog Devices Inc.
  3. * 2005 National ICT Australia (NICTA)
  4. * Aidan Williams <aidan@nicta.com.au>
  5. *
  6. * Thanks to Jamey Hicks.
  7. *
  8. * Only SMSC91C1111 was registered, may do more later.
  9. *
  10. * Licensed under the GPL-2
  11. */
  12. #include <linux/device.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/irq.h>
  15. const char bfin_board_name[] = "Tepla-BF561";
  16. /*
  17. * Driver needs to know address, irq and flag pin.
  18. */
  19. static struct resource smc91x_resources[] = {
  20. {
  21. .start = 0x2C000300,
  22. .end = 0x2C000320,
  23. .flags = IORESOURCE_MEM,
  24. }, {
  25. .start = IRQ_PROG_INTB,
  26. .end = IRQ_PROG_INTB,
  27. .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
  28. }, {
  29. .start = IRQ_PF7,
  30. .end = IRQ_PF7,
  31. .flags = IORESOURCE_IRQ|IORESOURCE_IRQ_HIGHLEVEL,
  32. },
  33. };
  34. static struct platform_device smc91x_device = {
  35. .name = "smc91x",
  36. .id = 0,
  37. .num_resources = ARRAY_SIZE(smc91x_resources),
  38. .resource = smc91x_resources,
  39. };
  40. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  41. #ifdef CONFIG_SERIAL_BFIN_UART0
  42. static struct resource bfin_uart0_resources[] = {
  43. {
  44. .start = BFIN_UART_THR,
  45. .end = BFIN_UART_GCTL+2,
  46. .flags = IORESOURCE_MEM,
  47. },
  48. {
  49. .start = IRQ_UART_TX,
  50. .end = IRQ_UART_TX,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. {
  54. .start = IRQ_UART_RX,
  55. .end = IRQ_UART_RX,
  56. .flags = IORESOURCE_IRQ,
  57. },
  58. {
  59. .start = IRQ_UART_ERROR,
  60. .end = IRQ_UART_ERROR,
  61. .flags = IORESOURCE_IRQ,
  62. },
  63. {
  64. .start = CH_UART_TX,
  65. .end = CH_UART_TX,
  66. .flags = IORESOURCE_DMA,
  67. },
  68. {
  69. .start = CH_UART_RX,
  70. .end = CH_UART_RX,
  71. .flags = IORESOURCE_DMA,
  72. },
  73. };
  74. static unsigned short bfin_uart0_peripherals[] = {
  75. P_UART0_TX, P_UART0_RX, 0
  76. };
  77. static struct platform_device bfin_uart0_device = {
  78. .name = "bfin-uart",
  79. .id = 0,
  80. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  81. .resource = bfin_uart0_resources,
  82. .dev = {
  83. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  84. },
  85. };
  86. #endif
  87. #endif
  88. #if IS_ENABLED(CONFIG_BFIN_SIR)
  89. #ifdef CONFIG_BFIN_SIR0
  90. static struct resource bfin_sir0_resources[] = {
  91. {
  92. .start = 0xFFC00400,
  93. .end = 0xFFC004FF,
  94. .flags = IORESOURCE_MEM,
  95. },
  96. {
  97. .start = IRQ_UART0_RX,
  98. .end = IRQ_UART0_RX+1,
  99. .flags = IORESOURCE_IRQ,
  100. },
  101. {
  102. .start = CH_UART0_RX,
  103. .end = CH_UART0_RX+1,
  104. .flags = IORESOURCE_DMA,
  105. },
  106. };
  107. static struct platform_device bfin_sir0_device = {
  108. .name = "bfin_sir",
  109. .id = 0,
  110. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  111. .resource = bfin_sir0_resources,
  112. };
  113. #endif
  114. #endif
  115. static struct platform_device *tepla_devices[] __initdata = {
  116. &smc91x_device,
  117. #if IS_ENABLED(CONFIG_SERIAL_BFIN)
  118. #ifdef CONFIG_SERIAL_BFIN_UART0
  119. &bfin_uart0_device,
  120. #endif
  121. #endif
  122. #if IS_ENABLED(CONFIG_BFIN_SIR)
  123. #ifdef CONFIG_BFIN_SIR0
  124. &bfin_sir0_device,
  125. #endif
  126. #endif
  127. };
  128. static int __init tepla_init(void)
  129. {
  130. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  131. return platform_add_devices(tepla_devices, ARRAY_SIZE(tepla_devices));
  132. }
  133. arch_initcall(tepla_init);
  134. static struct platform_device *tepla_early_devices[] __initdata = {
  135. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  136. #ifdef CONFIG_SERIAL_BFIN_UART0
  137. &bfin_uart0_device,
  138. #endif
  139. #endif
  140. };
  141. void __init native_machine_early_platform_add_devices(void)
  142. {
  143. printk(KERN_INFO "register early platform devices\n");
  144. early_platform_add_devices(tepla_early_devices,
  145. ARRAY_SIZE(tepla_early_devices));
  146. }