stmp37xx_devb.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * Freescale STMP37XX development board support
  3. *
  4. * Embedded Alley Solutions, Inc <source@embeddedalley.com>
  5. *
  6. * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
  7. * Copyright 2008 Embedded Alley Solutions, Inc All Rights Reserved.
  8. */
  9. /*
  10. * The code contained herein is licensed under the GNU General Public
  11. * License. You may obtain a copy of the GNU General Public License
  12. * Version 2 or later at the following locations:
  13. *
  14. * http://www.opensource.org/licenses/gpl-license.html
  15. * http://www.gnu.org/copyleft/gpl.html
  16. */
  17. #include <linux/kernel.h>
  18. #include <linux/init.h>
  19. #include <linux/device.h>
  20. #include <linux/platform_device.h>
  21. #include <asm/setup.h>
  22. #include <asm/mach-types.h>
  23. #include <asm/mach/arch.h>
  24. #include <mach/stmp3xxx.h>
  25. #include <mach/pins.h>
  26. #include <mach/pinmux.h>
  27. #include "stmp37xx.h"
  28. /*
  29. * List of STMP37xx development board specific devices
  30. */
  31. static struct platform_device *stmp37xx_devb_devices[] = {
  32. &stmp3xxx_dbguart,
  33. &stmp3xxx_appuart,
  34. };
  35. static struct pin_desc dbguart_pins_0[] = {
  36. { PINID_PWM0, PIN_FUN3, },
  37. { PINID_PWM1, PIN_FUN3, },
  38. };
  39. struct pin_desc appuart_pins_0[] = {
  40. { PINID_UART2_CTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
  41. { PINID_UART2_RTS, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
  42. { PINID_UART2_RX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
  43. { PINID_UART2_TX, PIN_FUN1, PIN_4MA, PIN_1_8V, 0, },
  44. };
  45. static struct pin_group appuart_pins[] = {
  46. [0] = {
  47. .pins = appuart_pins_0,
  48. .nr_pins = ARRAY_SIZE(appuart_pins_0),
  49. },
  50. /* 37xx has the only app uart */
  51. };
  52. static struct pin_group dbguart_pins[] = {
  53. [0] = {
  54. .pins = dbguart_pins_0,
  55. .nr_pins = ARRAY_SIZE(dbguart_pins_0),
  56. },
  57. };
  58. static int dbguart_pins_control(int id, int request)
  59. {
  60. int r = 0;
  61. if (request)
  62. r = stmp3xxx_request_pin_group(&dbguart_pins[id], "debug uart");
  63. else
  64. stmp3xxx_release_pin_group(&dbguart_pins[id], "debug uart");
  65. return r;
  66. }
  67. static void __init stmp37xx_devb_init(void)
  68. {
  69. stmp3xxx_pinmux_init(NR_REAL_IRQS);
  70. /* Init STMP3xxx platform */
  71. stmp3xxx_init();
  72. stmp3xxx_dbguart.dev.platform_data = dbguart_pins_control;
  73. stmp3xxx_appuart.dev.platform_data = appuart_pins;
  74. /* Add STMP37xx development board devices */
  75. platform_add_devices(stmp37xx_devb_devices,
  76. ARRAY_SIZE(stmp37xx_devb_devices));
  77. }
  78. MACHINE_START(STMP37XX, "STMP37XX")
  79. .phys_io = 0x80000000,
  80. .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc,
  81. .boot_params = 0x40000100,
  82. .map_io = stmp37xx_map_io,
  83. .init_irq = stmp37xx_init_irq,
  84. .timer = &stmp3xxx_timer,
  85. .init_machine = stmp37xx_devb_init,
  86. MACHINE_END