preliminaryDataProcessing.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * arch/arm/mach-at91/at91rm9200_devices.c
  3. *
  4. * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
  5. * Copyright (C) 2005 David Brownell
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. */
  13. #include <asm/mach/arch.h>
  14. #include <asm/mach/map.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/gpio.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/i2c-gpio.h>
  19. #include <mach/at91rm9200.h>
  20. #include <mach/at91rm9200_mc.h>
  21. #include <mach/at91_ramc.h>
  22. #include "board.h"
  23. #include "generic.h"
  24. /* --------------------------------------------------------------------
  25. * USB Host
  26. * -------------------------------------------------------------------- */
  27. #if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
  28. static u64 ohci_dmamask = DMA_BIT_MASK(32);
  29. static struct at91_usbh_data usbh_data;
  30. static struct resource usbh_resources[] = {
  31. [0] = {
  32. .start = AT91RM9200_UHP_BASE,
  33. .end = AT91RM9200_UHP_BASE + SZ_1M - 1,
  34. .flags = IORESOURCE_MEM,
  35. },
  36. [1] = {
  37. .start = NR_IRQS_LEGACY + AT91RM9200_ID_UHP,
  38. .end = NR_IRQS_LEGACY + AT91RM9200_ID_UHP,
  39. .flags = IORESOURCE_IRQ,
  40. },
  41. };
  42. static struct platform_device at91rm9200_usbh_device = {
  43. .name = "at91_ohci",
  44. .id = -1,
  45. .dev = {
  46. .dma_mask = &ohci_dmamask,
  47. .coherent_dma_mask = DMA_BIT_MASK(32),
  48. .platform_data = &usbh_data,
  49. },
  50. .resource = usbh_resources,
  51. .num_resources = ARRAY_SIZE(usbh_resources),
  52. };
  53. void __init at91_add_device_usbh(struct at91_usbh_data *data)
  54. {
  55. int i;
  56. if (!data)
  57. return;
  58. /* Enable overcurrent notification */
  59. for (i = 0; i < data->ports; i++) {
  60. if (gpio_is_valid(data->overcurrent_pin[i]))
  61. at91_set_gpio_input(data->overcurrent_pin[i], 1);
  62. }
  63. usbh_data = *data;
  64. platform_device_register(&at91rm9200_usbh_device);
  65. }
  66. #else
  67. void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
  68. #endif
  69. /* --------------------------------------------------------------------
  70. * USB Device (Gadget)
  71. * -------------------------------------------------------------------- */
  72. #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
  73. static struct at91_udc_data udc_data;
  74. static struct resource udc_resources[] = {
  75. [0] = {
  76. .start = AT91RM9200_BASE_UDP,
  77. .end = AT91RM9200_BASE_UDP + SZ_16K - 1,
  78. .flags = IORESOURCE_MEM,
  79. },
  80. [1] = {
  81. .start = NR_IRQS_LEGACY + AT91RM9200_ID_UDP,
  82. .end = NR_IRQS_LEGACY + AT91RM9200_ID_UDP,
  83. .flags = IORESOURCE_IRQ,
  84. },
  85. };
  86. static struct platform_device at91rm9200_udc_device = {
  87. .name = "at91_udc",
  88. .id = -1,
  89. .dev = {
  90. .platform_data = &udc_data,
  91. },
  92. .resource = udc_resources,
  93. .num_resources = ARRAY_SIZE(udc_resources),
  94. };
  95. void __init at91_add_device_udc(struct at91_udc_data *data)
  96. {
  97. if (!data)
  98. return;
  99. if (gpio_is_valid(data->vbus_pin)) {
  100. at91_set_gpio_input(data->vbus_pin, 0);
  101. at91_set_deglitch(data->vbus_pin, 1);
  102. }
  103. if (gpio_is_valid(data->pullup_pin))
  104. at91_set_gpio_output(data->pullup_pin, 0);
  105. udc_data = *data;
  106. platform_device_register(&at91rm9200_udc_device);
  107. }
  108. #else
  109. void __init at91_add_device_udc(struct at91_udc_data *data) {}
  110. #endif
  111. /* --------------------------------------------------------------------
  112. * Ethernet
  113. * -------------------------------------------------------------------- */
  114. #if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
  115. static u64 eth_dmamask = DMA_BIT_MASK(32);
  116. static struct macb_platform_data eth_data;
  117. static struct resource eth_resources[] = {
  118. [0] = {
  119. .start = AT91RM9200_BASE_EMAC,
  120. .end = AT91RM9200_BASE_EMAC + SZ_16K - 1,
  121. .flags = IORESOURCE_MEM,
  122. },
  123. [1] = {
  124. .start = NR_IRQS_LEGACY + AT91RM9200_ID_EMAC,
  125. .end = NR_IRQS_LEGACY + AT91RM9200_ID_EMAC,
  126. .flags = IORESOURCE_IRQ,
  127. },
  128. };
  129. static struct platform_device at91rm9200_eth_device = {
  130. .name = "at91_ether",
  131. .id = -1,
  132. .dev = {
  133. .dma_mask = &eth_dmamask,
  134. .coherent_dma_mask = DMA_BIT_MASK(32),
  135. .platform_data = &eth_data,
  136. },
  137. .resource = eth_resources,
  138. .num_resources = ARRAY_SIZE(eth_resources),
  139. };
  140. void __init at91_add_device_eth(struct macb_platform_data *data)
  141. {
  142. if (!data)
  143. return;
  144. if (gpio_is_valid(data->phy_irq_pin)) {
  145. at91_set_gpio_input(data->phy_irq_pin, 0);
  146. at91_set_deglitch(data->phy_irq_pin, 1);
  147. }
  148. /* Pins used for MII and RMII */
  149. at91_set_A_periph(AT91_PIN_PA16, 0); /* EMDIO */
  150. at91_set_A_periph(AT91_PIN_PA15, 0); /* EMDC */
  151. at91_set_A_periph(AT91_PIN_PA14, 0); /* ERXER */
  152. at91_set_A_periph(AT91_PIN_PA13, 0); /* ERX1 */
  153. at91_set_A_periph(AT91_PIN_PA12, 0); /* ERX0 */
  154. at91_set_A_periph(AT91_PIN_PA11, 0); /* ECRS_ECRSDV */
  155. at91_set_A_periph(AT91_PIN_PA10, 0); /* ETX1 */
  156. at91_set_A_periph(AT91_PIN_PA9, 0); /* ETX0 */
  157. at91_set_A_periph(AT91_PIN_PA8, 0); /* ETXEN */
  158. at91_set_A_periph(AT91_PIN_PA7, 0); /* ETXCK_EREFCK */
  159. if (!data->is_rmii) {
  160. at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
  161. at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
  162. at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
  163. at91_set_B_periph(AT91_PIN_PB16, 0); /* ERX3 */
  164. at91_set_B_periph(AT91_PIN_PB15, 0); /* ERX2 */
  165. at91_set_B_periph(AT91_PIN_PB14, 0); /* ETXER */
  166. at91_set_B_periph(AT91_PIN_PB13, 0); /* ETX3 */
  167. at91_set_B_periph(AT91_PIN_PB12, 0); /* ETX2 */
  168. }
  169. eth_data = *data;
  170. platform_device_register(&at91rm9200_eth_device);
  171. }
  172. #else
  173. void __init at91_add_device_eth(struct macb_platform_data *data) {}
  174. #endif
  175. /* --------------------------------------------------------------------
  176. * Compact Flash / PCMCIA
  177. * -------------------------------------------------------------------- */
  178. #if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
  179. static struct at91_cf_data cf_data;