fdt_gpio.h 937 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * SPDX-License-Identifier: BSD-2-Clause
  3. *
  4. * Copyright (c) 2021 Western Digital Corporation or its affiliates.
  5. *
  6. * Authors:
  7. * Anup Patel <anup.patel@wdc.com>
  8. */
  9. #ifndef __FDT_GPIO_H__
  10. #define __FDT_GPIO_H__
  11. #include <sbi_utils/gpio/gpio.h>
  12. struct fdt_phandle_args;
  13. /** FDT based GPIO driver */
  14. struct fdt_gpio {
  15. const struct fdt_match *match_table;
  16. int (*xlate)(struct gpio_chip *chip,
  17. const struct fdt_phandle_args *pargs,
  18. struct gpio_pin *out_pin);
  19. int (*init)(void *fdt, int nodeoff, u32 phandle,
  20. const struct fdt_match *match);
  21. };
  22. /** Get a GPIO pin using "gpios" DT property of client DT node */
  23. int fdt_gpio_pin_get(void *fdt, int nodeoff, int index,
  24. struct gpio_pin *out_pin);
  25. /** Simple xlate function to convert two GPIO FDT cells into GPIO pin */
  26. int fdt_gpio_simple_xlate(struct gpio_chip *chip,
  27. const struct fdt_phandle_args *pargs,
  28. struct gpio_pin *out_pin);
  29. #endif