pinmux.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. * Abhilash Kesavan <a.kesavan@samsung.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __ASM_ARM_ARCH_PINMUX_H
  8. #define __ASM_ARM_ARCH_PINMUX_H
  9. #include "periph.h"
  10. /*
  11. * Flags for setting specific configarations of peripherals.
  12. * List will grow with support for more devices getting added.
  13. */
  14. enum {
  15. PINMUX_FLAG_NONE = 0x00000000,
  16. /* Flags for eMMC */
  17. PINMUX_FLAG_8BIT_MODE = 1 << 0, /* SDMMC 8-bit mode */
  18. /* Flags for SROM controller */
  19. PINMUX_FLAG_BANK = 3 << 0, /* bank number (0-3) */
  20. PINMUX_FLAG_16BIT = 1 << 2, /* 16-bit width */
  21. /* Flags for I2C */
  22. PINMUX_FLAG_HS_MODE = 1 << 1, /* I2C High Speed Mode */
  23. };
  24. /**
  25. * Configures the pinmux for a particular peripheral.
  26. *
  27. * Each gpio can be configured in many different ways (4 bits on exynos)
  28. * such as "input", "output", "special function", "external interrupt"
  29. * etc. This function will configure the peripheral pinmux along with
  30. * pull-up/down and drive strength.
  31. *
  32. * @param peripheral peripheral to be configured
  33. * @param flags configure flags
  34. * @return 0 if ok, -1 on error (e.g. unsupported peripheral)
  35. */
  36. int exynos_pinmux_config(int peripheral, int flags);
  37. /**
  38. * Decode the peripheral id using the interrpt numbers.
  39. *
  40. * @param blob Device tree blob
  41. * @param node FDT I2C node to find
  42. * @return peripheral id if ok, PERIPH_ID_NONE on error
  43. */
  44. int pinmux_decode_periph_id(const void *blob, int node);
  45. #endif