pcm970-baseboard.c 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  16. * MA 02110-1301, USA.
  17. */
  18. #include <linux/gpio.h>
  19. #include <linux/irq.h>
  20. #include <linux/platform_device.h>
  21. #include <asm/mach/arch.h>
  22. #include <mach/common.h>
  23. #include <mach/iomux.h>
  24. #include <mach/imxfb.h>
  25. #include <mach/hardware.h>
  26. #include <mach/mmc.h>
  27. #include "devices.h"
  28. static int pcm970_pins[] = {
  29. /* SDHC */
  30. PB4_PF_SD2_D0,
  31. PB5_PF_SD2_D1,
  32. PB6_PF_SD2_D2,
  33. PB7_PF_SD2_D3,
  34. PB8_PF_SD2_CMD,
  35. PB9_PF_SD2_CLK,
  36. GPIO_PORTC | 28 | GPIO_GPIO | GPIO_IN, /* card detect */
  37. /* display */
  38. PA5_PF_LSCLK,
  39. PA6_PF_LD0,
  40. PA7_PF_LD1,
  41. PA8_PF_LD2,
  42. PA9_PF_LD3,
  43. PA10_PF_LD4,
  44. PA11_PF_LD5,
  45. PA12_PF_LD6,
  46. PA13_PF_LD7,
  47. PA14_PF_LD8,
  48. PA15_PF_LD9,
  49. PA16_PF_LD10,
  50. PA17_PF_LD11,
  51. PA18_PF_LD12,
  52. PA19_PF_LD13,
  53. PA20_PF_LD14,
  54. PA21_PF_LD15,
  55. PA22_PF_LD16,
  56. PA23_PF_LD17,
  57. PA24_PF_REV,
  58. PA25_PF_CLS,
  59. PA26_PF_PS,
  60. PA27_PF_SPL_SPR,
  61. PA28_PF_HSYNC,
  62. PA29_PF_VSYNC,
  63. PA30_PF_CONTRAST,
  64. PA31_PF_OE_ACD,
  65. /*
  66. * it seems the data line misses a pullup, so we must enable
  67. * the internal pullup as a local workaround
  68. */
  69. PD17_PF_I2C_DATA | GPIO_PUEN,
  70. PD18_PF_I2C_CLK,
  71. /* Camera */
  72. PB10_PF_CSI_D0,
  73. PB11_PF_CSI_D1,
  74. PB12_PF_CSI_D2,
  75. PB13_PF_CSI_D3,
  76. PB14_PF_CSI_D4,
  77. PB15_PF_CSI_MCLK,
  78. PB16_PF_CSI_PIXCLK,
  79. PB17_PF_CSI_D5,
  80. PB18_PF_CSI_D6,
  81. PB19_PF_CSI_D7,
  82. PB20_PF_CSI_VSYNC,
  83. PB21_PF_CSI_HSYNC,
  84. };
  85. static int pcm970_sdhc2_get_ro(struct device *dev)
  86. {
  87. return gpio_get_value(GPIO_PORTC + 28);
  88. }
  89. static int pcm970_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
  90. {
  91. int ret;
  92. ret = request_irq(IRQ_GPIOC(29), detect_irq, IRQF_TRIGGER_FALLING,
  93. "imx-mmc-detect", data);
  94. if (ret)
  95. return ret;
  96. ret = gpio_request(GPIO_PORTC + 28, "imx-mmc-ro");
  97. if (ret) {
  98. free_irq(IRQ_GPIOC(29), data);
  99. return ret;
  100. }
  101. gpio_direction_input(GPIO_PORTC + 28);
  102. return 0;
  103. }
  104. static void pcm970_sdhc2_exit(struct device *dev, void *data)
  105. {
  106. free_irq(IRQ_GPIOC(29), data);
  107. gpio_free(GPIO_PORTC + 28);
  108. }
  109. static struct imxmmc_platform_data sdhc_pdata = {
  110. .get_ro = pcm970_sdhc2_get_ro,
  111. .init = pcm970_sdhc2_init,
  112. .exit = pcm970_sdhc2_exit,
  113. };
  114. /*
  115. * Connected is a portrait Sharp-QVGA display
  116. * of type: LQ035Q7DH06
  117. */
  118. static struct imx_fb_platform_data pcm038_fb_data = {
  119. .pixclock = 188679, /* in ps (5.3MHz) */
  120. .xres = 240,
  121. .yres = 320,
  122. .bpp = 16,
  123. .hsync_len = 7,
  124. .left_margin = 5,
  125. .right_margin = 16,
  126. .vsync_len = 1,
  127. .upper_margin = 7,
  128. .lower_margin = 9,
  129. .fixed_screen_cpu = 0,
  130. /*
  131. * - HSYNC active high
  132. * - VSYNC active high
  133. * - clk notenabled while idle
  134. * - clock not inverted
  135. * - data not inverted
  136. * - data enable low active
  137. * - enable sharp mode
  138. */
  139. .pcr = 0xFA0080C0,
  140. .pwmr = 0x00A903FF,
  141. .lscr1 = 0x00120300,
  142. .dmacr = 0x00020010,
  143. };
  144. /*
  145. * system init for baseboard usage. Will be called by pcm038 init.
  146. *
  147. * Add platform devices present on this baseboard and init
  148. * them from CPU side as far as required to use them later on
  149. */
  150. void __init pcm970_baseboard_init(void)
  151. {
  152. mxc_gpio_setup_multiple_pins(pcm970_pins, ARRAY_SIZE(pcm970_pins),
  153. "PCM970");
  154. mxc_register_device(&mxc_fb_device, &pcm038_fb_data);
  155. mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
  156. }