eukrea_mbimxsd-baseboard.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /*
  2. * Copyright (C) 2010 Eric Benard - eric@eukrea.com
  3. *
  4. * Based on pcm970-baseboard.c which is :
  5. * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  19. * MA 02110-1301, USA.
  20. */
  21. #include <linux/types.h>
  22. #include <linux/init.h>
  23. #include <linux/gpio.h>
  24. #include <linux/interrupt.h>
  25. #include <linux/irq.h>
  26. #include <linux/leds.h>
  27. #include <linux/platform_device.h>
  28. #include <linux/input.h>
  29. #include <linux/i2c.h>
  30. #include <asm/mach-types.h>
  31. #include <asm/mach/arch.h>
  32. #include <asm/mach/time.h>
  33. #include <asm/mach/map.h>
  34. #include <mach/hardware.h>
  35. #include <mach/common.h>
  36. #include <mach/iomux-mx51.h>
  37. #include <mach/audmux.h>
  38. #include "devices-imx51.h"
  39. #include "devices.h"
  40. static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = {
  41. /* LED */
  42. MX51_PAD_NANDF_D10__GPIO3_30,
  43. /* SWITCH */
  44. _MX51_PAD_NANDF_D9__GPIO3_31 | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP |
  45. PAD_CTL_PKE | PAD_CTL_SRE_FAST |
  46. PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
  47. /* UART2 */
  48. MX51_PAD_UART2_RXD__UART2_RXD,
  49. MX51_PAD_UART2_TXD__UART2_TXD,
  50. /* UART 3 */
  51. MX51_PAD_UART3_RXD__UART3_RXD,
  52. MX51_PAD_UART3_TXD__UART3_TXD,
  53. MX51_PAD_KEY_COL4__UART3_RTS,
  54. MX51_PAD_KEY_COL5__UART3_CTS,
  55. /* SD */
  56. MX51_PAD_SD1_CMD__SD1_CMD,
  57. MX51_PAD_SD1_CLK__SD1_CLK,
  58. MX51_PAD_SD1_DATA0__SD1_DATA0,
  59. MX51_PAD_SD1_DATA1__SD1_DATA1,
  60. MX51_PAD_SD1_DATA2__SD1_DATA2,
  61. MX51_PAD_SD1_DATA3__SD1_DATA3,
  62. /* SD1 CD */
  63. _MX51_PAD_GPIO1_0__SD1_CD | MUX_PAD_CTRL(PAD_CTL_PUS_22K_UP |
  64. PAD_CTL_PKE | PAD_CTL_SRE_FAST |
  65. PAD_CTL_DSE_HIGH | PAD_CTL_PUE | PAD_CTL_HYS),
  66. };
  67. #define GPIO_LED1 IMX_GPIO_NR(3, 30)
  68. #define GPIO_SWITCH1 IMX_GPIO_NR(3, 31)
  69. static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = {
  70. {
  71. .name = "led1",
  72. .default_trigger = "heartbeat",
  73. .active_low = 1,
  74. .gpio = GPIO_LED1,
  75. },
  76. };
  77. static const struct gpio_led_platform_data
  78. eukrea_mbimxsd_led_info __initconst = {
  79. .leds = eukrea_mbimxsd_leds,
  80. .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
  81. };
  82. static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
  83. {
  84. .gpio = GPIO_SWITCH1,
  85. .code = BTN_0,
  86. .desc = "BP1",
  87. .active_low = 1,
  88. .wakeup = 1,
  89. },
  90. };
  91. static const struct gpio_keys_platform_data
  92. eukrea_mbimxsd_button_data __initconst = {
  93. .buttons = eukrea_mbimxsd_gpio_buttons,
  94. .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
  95. };
  96. static const struct imxuart_platform_data uart_pdata __initconst = {
  97. .flags = IMXUART_HAVE_RTSCTS,
  98. };
  99. static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
  100. {
  101. I2C_BOARD_INFO("tlv320aic23", 0x1a),
  102. },
  103. };
  104. /*
  105. * system init for baseboard usage. Will be called by cpuimx51sd init.
  106. *
  107. * Add platform devices present on this baseboard and init
  108. * them from CPU side as far as required to use them later on
  109. */
  110. void __init eukrea_mbimxsd51_baseboard_init(void)
  111. {
  112. if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
  113. ARRAY_SIZE(eukrea_mbimxsd_pads)))
  114. printk(KERN_ERR "error setting mbimxsd pads !\n");
  115. imx51_add_imx_uart(1, NULL);
  116. imx51_add_imx_uart(2, &uart_pdata);
  117. imx51_add_sdhci_esdhc_imx(0, NULL);
  118. gpio_request(GPIO_LED1, "LED1");
  119. gpio_direction_output(GPIO_LED1, 1);
  120. gpio_free(GPIO_LED1);
  121. gpio_request(GPIO_SWITCH1, "SWITCH1");
  122. gpio_direction_input(GPIO_SWITCH1);
  123. gpio_free(GPIO_SWITCH1);
  124. i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
  125. ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
  126. gpio_led_register_device(-1, &eukrea_mbimxsd_led_info);
  127. imx_add_gpio_keys(&eukrea_mbimxsd_button_data);
  128. }