mach-stmp378x_devb.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * board setup for STMP378x-Development-Board
  3. *
  4. * based on mx23evk board setup and information gained form the original
  5. * plat-stmp based board setup, now converted to mach-mxs.
  6. *
  7. * Copyright 2010 Freescale Semiconductor, Inc. All Rights Reserved.
  8. * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K.
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; version 2 of the License.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. */
  19. #include <linux/platform_device.h>
  20. #include <linux/gpio.h>
  21. #include <linux/spi/spi.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <asm/mach/time.h>
  25. #include <mach/common.h>
  26. #include <mach/iomux-mx23.h>
  27. #include "devices-mx23.h"
  28. #define STMP378X_DEVB_MMC0_WRITE_PROTECT MXS_GPIO_NR(1, 30)
  29. #define STMP378X_DEVB_MMC0_SLOT_POWER MXS_GPIO_NR(1, 29)
  30. #define STMP378X_DEVB_PAD_AUART (MXS_PAD_4MA | MXS_PAD_1V8 | MXS_PAD_NOPULL)
  31. static const iomux_cfg_t stmp378x_dvb_pads[] __initconst = {
  32. /* duart (extended setup missing in old boardcode, too */
  33. MX23_PAD_PWM0__DUART_RX,
  34. MX23_PAD_PWM1__DUART_TX,
  35. /* auart */
  36. MX23_PAD_AUART1_RX__AUART1_RX | STMP378X_DEVB_PAD_AUART,
  37. MX23_PAD_AUART1_TX__AUART1_TX | STMP378X_DEVB_PAD_AUART,
  38. MX23_PAD_AUART1_CTS__AUART1_CTS | STMP378X_DEVB_PAD_AUART,
  39. MX23_PAD_AUART1_RTS__AUART1_RTS | STMP378X_DEVB_PAD_AUART,
  40. /* mmc */
  41. MX23_PAD_SSP1_DATA0__SSP1_DATA0 |
  42. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  43. MX23_PAD_SSP1_DATA1__SSP1_DATA1 |
  44. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  45. MX23_PAD_SSP1_DATA2__SSP1_DATA2 |
  46. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  47. MX23_PAD_SSP1_DATA3__SSP1_DATA3 |
  48. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  49. MX23_PAD_SSP1_CMD__SSP1_CMD |
  50. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_PULLUP),
  51. MX23_PAD_SSP1_DETECT__SSP1_DETECT |
  52. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
  53. MX23_PAD_SSP1_SCK__SSP1_SCK |
  54. (MXS_PAD_8MA | MXS_PAD_3V3 | MXS_PAD_NOPULL),
  55. MX23_PAD_PWM4__GPIO_1_30 | MXS_PAD_CTRL, /* write protect */
  56. MX23_PAD_PWM3__GPIO_1_29 | MXS_PAD_CTRL, /* power enable */
  57. };
  58. static struct mxs_mmc_platform_data stmp378x_dvb_mmc_pdata __initdata = {
  59. .wp_gpio = STMP378X_DEVB_MMC0_WRITE_PROTECT,
  60. };
  61. static struct spi_board_info spi_board_info[] __initdata = {
  62. #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
  63. {
  64. .modalias = "enc28j60",
  65. .max_speed_hz = 6 * 1000 * 1000,
  66. .bus_num = 1,
  67. .chip_select = 0,
  68. .platform_data = NULL,
  69. },
  70. #endif
  71. };
  72. static void __init stmp378x_dvb_init(void)
  73. {
  74. int ret;
  75. mxs_iomux_setup_multiple_pads(stmp378x_dvb_pads,
  76. ARRAY_SIZE(stmp378x_dvb_pads));
  77. mx23_add_duart();
  78. mx23_add_auart0();
  79. mx23_add_rtc_stmp3xxx();
  80. /* power on mmc slot */
  81. ret = gpio_request_one(STMP378X_DEVB_MMC0_SLOT_POWER,
  82. GPIOF_OUT_INIT_LOW, "mmc0-slot-power");
  83. if (ret)
  84. pr_warn("could not power mmc (%d)\n", ret);
  85. mx23_add_mxs_mmc(0, &stmp378x_dvb_mmc_pdata);
  86. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  87. }
  88. static void __init stmp378x_dvb_timer_init(void)
  89. {
  90. mx23_clocks_init();
  91. }
  92. static struct sys_timer stmp378x_dvb_timer = {
  93. .init = stmp378x_dvb_timer_init,
  94. };
  95. MACHINE_START(STMP378X, "STMP378X")
  96. .map_io = mx23_map_io,
  97. .init_irq = mx23_init_irq,
  98. .timer = &stmp378x_dvb_timer,
  99. .init_machine = stmp378x_dvb_init,
  100. .restart = mxs_restart,
  101. MACHINE_END