platform.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * MTX-1 platform devices registration
  3. *
  4. * Copyright (C) 2007, Florian Fainelli <florian@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  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 St, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include <linux/init.h>
  21. #include <linux/types.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/leds.h>
  24. #include <asm/gpio.h>
  25. static struct resource mtx1_wdt_res[] = {
  26. [0] = {
  27. .start = 15,
  28. .end = 15,
  29. .name = "mtx1-wdt-gpio",
  30. .flags = IORESOURCE_IRQ,
  31. }
  32. };
  33. static struct resource mtx1_sys_btn[] = {
  34. [0] = {
  35. .start = 7,
  36. .end = 7,
  37. .name = "mtx1-sys-btn-gpio",
  38. .flags = IORESOURCE_IRQ,
  39. }
  40. };
  41. static struct platform_device mtx1_wdt = {
  42. .name = "mtx1-wdt",
  43. .id = 0,
  44. .num_resources = ARRAY_SIZE(mtx1_wdt_res),
  45. .resource = mtx1_wdt_res,
  46. };
  47. static struct gpio_led default_leds[] = {
  48. {
  49. .name = "mtx1:green",
  50. .gpio = 211,
  51. }, {
  52. .name = "mtx1:red",
  53. .gpio = 212,
  54. },
  55. };
  56. static struct gpio_led_platform_data mtx1_led_data = {
  57. .num_leds = ARRAY_SIZE(default_leds),
  58. .leds = default_leds,
  59. };
  60. static struct platform_device mtx1_gpio_leds = {
  61. .name = "leds-gpio",
  62. .id = -1,
  63. .dev = {
  64. .platform_data = &mtx1_led_data,
  65. }
  66. };
  67. static struct __initdata platform_device * mtx1_devs[] = {
  68. &mtx1_gpio_leds,
  69. &mtx1_wdt
  70. };
  71. static int __init mtx1_register_devices(void)
  72. {
  73. return platform_add_devices(mtx1_devs, ARRAY_SIZE(mtx1_devs));
  74. }
  75. arch_initcall(mtx1_register_devices);