tepla.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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 defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  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_RX,
  50. .end = IRQ_UART_RX+1,
  51. .flags = IORESOURCE_IRQ,
  52. },
  53. {
  54. .start = IRQ_UART_ERROR,
  55. .end = IRQ_UART_ERROR,
  56. .flags = IORESOURCE_IRQ,
  57. },
  58. {
  59. .start = CH_UART_TX,
  60. .end = CH_UART_TX,
  61. .flags = IORESOURCE_DMA,
  62. },
  63. {
  64. .start = CH_UART_RX,
  65. .end = CH_UART_RX,
  66. .flags = IORESOURCE_DMA,
  67. },
  68. };
  69. static unsigned short bfin_uart0_peripherals[] = {
  70. P_UART0_TX, P_UART0_RX, 0
  71. };
  72. static struct platform_device bfin_uart0_device = {
  73. .name = "bfin-uart",
  74. .id = 0,
  75. .num_resources = ARRAY_SIZE(bfin_uart0_resources),
  76. .resource = bfin_uart0_resources,
  77. .dev = {
  78. .platform_data = &bfin_uart0_peripherals, /* Passed to driver */
  79. },
  80. };
  81. #endif
  82. #endif
  83. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  84. #ifdef CONFIG_BFIN_SIR0
  85. static struct resource bfin_sir0_resources[] = {
  86. {
  87. .start = 0xFFC00400,
  88. .end = 0xFFC004FF,
  89. .flags = IORESOURCE_MEM,
  90. },
  91. {
  92. .start = IRQ_UART0_RX,
  93. .end = IRQ_UART0_RX+1,
  94. .flags = IORESOURCE_IRQ,
  95. },
  96. {
  97. .start = CH_UART0_RX,
  98. .end = CH_UART0_RX+1,
  99. .flags = IORESOURCE_DMA,
  100. },
  101. };
  102. static struct platform_device bfin_sir0_device = {
  103. .name = "bfin_sir",
  104. .id = 0,
  105. .num_resources = ARRAY_SIZE(bfin_sir0_resources),
  106. .resource = bfin_sir0_resources,
  107. };
  108. #endif
  109. #endif
  110. static struct platform_device *tepla_devices[] __initdata = {
  111. &smc91x_device,
  112. #if defined(CONFIG_SERIAL_BFIN) || defined(CONFIG_SERIAL_BFIN_MODULE)
  113. #ifdef CONFIG_SERIAL_BFIN_UART0
  114. &bfin_uart0_device,
  115. #endif
  116. #endif
  117. #if defined(CONFIG_BFIN_SIR) || defined(CONFIG_BFIN_SIR_MODULE)
  118. #ifdef CONFIG_BFIN_SIR0
  119. &bfin_sir0_device,
  120. #endif
  121. #endif
  122. };
  123. static int __init tepla_init(void)
  124. {
  125. printk(KERN_INFO "%s(): registering device resources\n", __func__);
  126. return platform_add_devices(tepla_devices, ARRAY_SIZE(tepla_devices));
  127. }
  128. arch_initcall(tepla_init);
  129. static struct platform_device *tepla_early_devices[] __initdata = {
  130. #if defined(CONFIG_SERIAL_BFIN_CONSOLE) || defined(CONFIG_EARLY_PRINTK)
  131. #ifdef CONFIG_SERIAL_BFIN_UART0
  132. &bfin_uart0_device,
  133. #endif
  134. #endif
  135. };
  136. void __init native_machine_early_platform_add_devices(void)
  137. {
  138. printk(KERN_INFO "register early platform devices\n");
  139. early_platform_add_devices(tepla_early_devices,
  140. ARRAY_SIZE(tepla_early_devices));
  141. }