platform.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Generic RDC321x platform devices
  3. *
  4. * Copyright (C) 2007 Florian Fainelli <florian@openwrt.org>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (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
  18. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  19. * Boston, MA 02110-1301, USA.
  20. *
  21. */
  22. #include <linux/init.h>
  23. #include <linux/kernel.h>
  24. #include <linux/list.h>
  25. #include <linux/device.h>
  26. #include <linux/platform_device.h>
  27. #include <linux/version.h>
  28. #include <linux/leds.h>
  29. #include <asm/gpio.h>
  30. /* LEDS */
  31. static struct gpio_led default_leds[] = {
  32. { .name = "rdc:dmz", .gpio = 1, },
  33. };
  34. static struct gpio_led_platform_data rdc321x_led_data = {
  35. .num_leds = ARRAY_SIZE(default_leds),
  36. .leds = default_leds,
  37. };
  38. static struct platform_device rdc321x_leds = {
  39. .name = "leds-gpio",
  40. .id = -1,
  41. .dev = {
  42. .platform_data = &rdc321x_led_data,
  43. }
  44. };
  45. /* Watchdog */
  46. static struct platform_device rdc321x_wdt = {
  47. .name = "rdc321x-wdt",
  48. .id = -1,
  49. .num_resources = 0,
  50. };
  51. static struct platform_device *rdc321x_devs[] = {
  52. &rdc321x_leds,
  53. &rdc321x_wdt
  54. };
  55. static int __init rdc_board_setup(void)
  56. {
  57. rdc321x_gpio_setup();
  58. return platform_add_devices(rdc321x_devs, ARRAY_SIZE(rdc321x_devs));
  59. }
  60. arch_initcall(rdc_board_setup);