board-dnskw.c 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright 2012 (C), Jamie Lentin <jm@lentin.co.uk>
  3. *
  4. * arch/arm/mach-kirkwood/board-dnskw.c
  5. *
  6. * D-link DNS-320 & DNS-325 NAS Init for drivers not converted to
  7. * flattened device tree yet.
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/init.h>
  15. #include <linux/platform_device.h>
  16. #include <linux/mv643xx_eth.h>
  17. #include <linux/gpio.h>
  18. #include "common.h"
  19. static struct mv643xx_eth_platform_data dnskw_ge00_data = {
  20. .phy_addr = MV643XX_ETH_PHY_ADDR(8),
  21. };
  22. /* Register any GPIO for output and set the value */
  23. static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
  24. {
  25. if (gpio_request(gpio, name) == 0 &&
  26. gpio_direction_output(gpio, 0) == 0) {
  27. gpio_set_value(gpio, def);
  28. if (gpio_export(gpio, 0) != 0)
  29. pr_err("dnskw: Failed to export GPIO %s\n", name);
  30. } else
  31. pr_err("dnskw: Failed to register %s\n", name);
  32. }
  33. void __init dnskw_init(void)
  34. {
  35. kirkwood_ge00_init(&dnskw_ge00_data);
  36. /* Set NAS to turn back on after a power failure */
  37. dnskw_gpio_register(37, "dnskw:power:recover", 1);
  38. }