averageMemoryDefinition.c 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /*
  2. * linux/arch/arm/mach-pxa/balloon3.c
  3. *
  4. * Support for Balloonboard.org Balloon3 board.
  5. *
  6. * Author: Nick Bane, Wookey, Jonathan McDowell
  7. * Created: June, 2006
  8. * Copyright: Toby Churchill Ltd
  9. * Derived from mainstone.c, by Nico Pitre
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/export.h>
  16. #include <linux/init.h>
  17. #include <linux/platform_device.h>
  18. #include <linux/interrupt.h>
  19. #include <linux/sched.h>
  20. #include <linux/bitops.h>
  21. #include <linux/fb.h>
  22. #include <linux/gpio.h>
  23. #include <linux/ioport.h>
  24. #include <linux/ucb1400.h>
  25. #include <linux/mtd/mtd.h>
  26. #include <linux/mtd/partitions.h>
  27. #include <linux/types.h>
  28. #include <linux/i2c/pcf857x.h>
  29. #include <linux/i2c/pxa-i2c.h>
  30. #include <linux/mtd/nand.h>
  31. #include <linux/mtd/physmap.h>
  32. #include <linux/regulator/max1586.h>
  33. #include <asm/setup.h>
  34. #include <asm/mach-types.h>
  35. #include <asm/irq.h>
  36. #include <asm/sizes.h>
  37. #include <asm/mach/arch.h>
  38. #include <asm/mach/map.h>
  39. #include <asm/mach/irq.h>
  40. #include <asm/mach/flash.h>
  41. #include <mach/pxa27x.h>
  42. #include <mach/balloon3.h>
  43. #include <mach/audio.h>
  44. #include <linux/platform_data/video-pxafb.h>
  45. #include <linux/platform_data/mmc-pxamci.h>
  46. #include <mach/udc.h>
  47. #include <mach/pxa27x-udc.h>
  48. #include <linux/platform_data/irda-pxaficp.h>
  49. #include <linux/platform_data/usb-ohci-pxa27x.h>
  50. #include "generic.h"
  51. #include "devices.h"
  52. /******************************************************************************
  53. * Pin configuration
  54. ******************************************************************************/
  55. static unsigned long balloon3_pin_config[] __initdata = {
  56. /* Select BTUART 'COM1/ttyS0' as IO option for pins 42/43/44/45 */
  57. GPIO42_BTUART_RXD,
  58. GPIO43_BTUART_TXD,
  59. GPIO44_BTUART_CTS,
  60. GPIO45_BTUART_RTS,
  61. /* Reset, configured as GPIO wakeup source */
  62. GPIO1_GPIO | WAKEUP_ON_EDGE_BOTH,
  63. };
  64. /******************************************************************************
  65. * Compatibility: Parameter parsing
  66. ******************************************************************************/
  67. static unsigned long balloon3_irq_enabled;
  68. static unsigned long balloon3_features_present =
  69. (1 << BALLOON3_FEATURE_OHCI) | (1 << BALLOON3_FEATURE_CF) |
  70. (1 << BALLOON3_FEATURE_AUDIO) |
  71. (1 << BALLOON3_FEATURE_TOPPOLY);
  72. int balloon3_has(enum balloon3_features feature)
  73. {
  74. return (balloon3_features_present & (1 << feature)) ? 1 : 0;
  75. }
  76. EXPORT_SYMBOL_GPL(balloon3_has);
  77. int __init parse_balloon3_features(char *arg)
  78. {
  79. if (!arg)
  80. return 0;
  81. return strict_strtoul(arg, 0, &balloon3_features_present);
  82. }
  83. early_param("balloon3_features", parse_balloon3_features);
  84. /******************************************************************************
  85. * Compact Flash slot
  86. ******************************************************************************/
  87. #if defined(CONFIG_PCMCIA_PXA2XX) || defined(CONFIG_PCMCIA_PXA2XX_MODULE)
  88. static unsigned long balloon3_cf_pin_config[] __initdata = {
  89. GPIO48_nPOE,
  90. GPIO49_nPWE,
  91. GPIO50_nPIOR,
  92. GPIO51_nPIOW,
  93. GPIO85_nPCE_1,
  94. GPIO54_nPCE_2,
  95. GPIO79_PSKTSEL,
  96. GPIO55_nPREG,
  97. GPIO56_nPWAIT,
  98. GPIO57_nIOIS16,
  99. };
  100. static void __init balloon3_cf_init(void)
  101. {
  102. if (!balloon3_has(BALLOON3_FEATURE_CF))
  103. return;
  104. pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_cf_pin_config));
  105. }
  106. #else
  107. static inline void balloon3_cf_init(void) {}
  108. #endif
  109. /******************************************************************************
  110. * NOR Flash
  111. ******************************************************************************/
  112. #if defined(CONFIG_MTD_PHYSMAP) || defined(CONFIG_MTD_PHYSMAP_MODULE)
  113. static struct mtd_partition balloon3_nor_partitions[] = {
  114. {
  115. .name = "Flash",
  116. .offset = 0x00000000,
  117. .size = MTDPART_SIZ_FULL,
  118. }
  119. };
  120. static struct physmap_flash_data balloon3_flash_data[] = {
  121. {
  122. .width = 2, /* bankwidth in bytes */
  123. .parts = balloon3_nor_partitions,
  124. .nr_parts = ARRAY_SIZE(balloon3_nor_partitions)
  125. }
  126. };
  127. static struct resource balloon3_flash_resource = {
  128. .start = PXA_CS0_PHYS,
  129. .end = PXA_CS0_PHYS + SZ_64M - 1,
  130. .flags = IORESOURCE_MEM,
  131. };
  132. static struct platform_device balloon3_flash = {
  133. .name = "physmap-flash",
  134. .id = 0,
  135. .resource = &balloon3_flash_resource,
  136. .num_resources = 1,
  137. .dev = {
  138. .platform_data = balloon3_flash_data,
  139. },
  140. };
  141. static void __init balloon3_nor_init(void)
  142. {
  143. platform_device_register(&balloon3_flash);
  144. }
  145. #else
  146. static inline void balloon3_nor_init(void) {}
  147. #endif
  148. /******************************************************************************
  149. * Audio and Touchscreen
  150. ******************************************************************************/
  151. #if defined(CONFIG_TOUCHSCREEN_UCB1400) || \
  152. defined(CONFIG_TOUCHSCREEN_UCB1400_MODULE)
  153. static unsigned long balloon3_ac97_pin_config[] __initdata = {
  154. GPIO28_AC97_BITCLK,
  155. GPIO29_AC97_SDATA_IN_0,
  156. GPIO30_AC97_SDATA_OUT,
  157. GPIO31_AC97_SYNC,
  158. GPIO113_AC97_nRESET,
  159. GPIO95_GPIO,
  160. };
  161. static struct ucb1400_pdata vpac270_ucb1400_pdata = {
  162. .irq = PXA_GPIO_TO_IRQ(BALLOON3_GPIO_CODEC_IRQ),
  163. };
  164. static struct platform_device balloon3_ucb1400_device = {
  165. .name = "ucb1400_core",
  166. .id = -1,
  167. .dev = {
  168. .platform_data = &vpac270_ucb1400_pdata,
  169. },
  170. };
  171. static void __init balloon3_ts_init(void)
  172. {
  173. if (!balloon3_has(BALLOON3_FEATURE_AUDIO))
  174. return;
  175. pxa2xx_mfp_config(ARRAY_AND_SIZE(balloon3_ac97_pin_config));
  176. pxa_set_ac97_info(NULL);
  177. platform_device_register(&balloon3_ucb1400_device);
  178. }
  179. #else
  180. static inline void balloon3_ts_init(void) {}
  181. #endif
  182. /******************************************************************************
  183. * Framebuffer
  184. ******************************************************************************/
  185. #if defined(CONFIG_FB_PXA) || defined(CONFIG_FB_PXA_MODULE)
  186. static unsigned long balloon3_lcd_pin_config[] __initdata = {
  187. GPIOxx_LCD_TFT_16BPP,
  188. GPIO99_GPIO,
  189. };
  190. static struct pxafb_mode_info balloon3_lcd_modes[] = {
  191. {
  192. .pixclock = 38000,
  193. .xres = 480,
  194. .yres = 640,
  195. .bpp = 16,
  196. .hsync_len = 8,
  197. .left_margin = 8,
  198. .right_margin = 8,
  199. .vsync_len = 2,
  200. .upper_margin = 4,
  201. .lower_margin = 5,
  202. .sync = 0,
  203. },
  204. };
  205. static struct pxafb_mach_info balloon3_lcd_screen = {
  206. .modes = balloon3_lcd_modes,
  207. .num_modes = ARRAY_SIZE(balloon3_lcd_modes),
  208. .lcd_conn = LCD_COLOR_TFT_16BPP | LCD_PCLK_EDGE_FALL,
  209. };
  210. static void balloon3_backlight_power(int on)
  211. {
  212. gpio_set_value(BALLOON3_GPIO_RUN_BACKLIGHT, on);