pinmux.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (C) 2012 Samsung Electronics
  3. * Abhilash Kesavan <a.kesavan@samsung.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __ASM_ARM_ARCH_PINMUX_H
  24. #define __ASM_ARM_ARCH_PINMUX_H
  25. #include "periph.h"
  26. /*
  27. * Flags for setting specific configarations of peripherals.
  28. * List will grow with support for more devices getting added.
  29. */
  30. enum {
  31. PINMUX_FLAG_NONE = 0x00000000,
  32. /* Flags for eMMC */
  33. PINMUX_FLAG_8BIT_MODE = 1 << 0, /* SDMMC 8-bit mode */
  34. /* Flags for SROM controller */
  35. PINMUX_FLAG_BANK = 3 << 0, /* bank number (0-3) */
  36. PINMUX_FLAG_16BIT = 1 << 2, /* 16-bit width */
  37. };
  38. /**
  39. * Configures the pinmux for a particular peripheral.
  40. *
  41. * Each gpio can be configured in many different ways (4 bits on exynos)
  42. * such as "input", "output", "special function", "external interrupt"
  43. * etc. This function will configure the peripheral pinmux along with
  44. * pull-up/down and drive strength.
  45. *
  46. * @param peripheral peripheral to be configured
  47. * @param flags configure flags
  48. * @return 0 if ok, -1 on error (e.g. unsupported peripheral)
  49. */
  50. int exynos_pinmux_config(int peripheral, int flags);
  51. /**
  52. * Decode the peripheral id using the interrpt numbers.
  53. *
  54. * @param blob Device tree blob
  55. * @param node FDT I2C node to find
  56. * @return peripheral id if ok, PERIPH_ID_NONE on error
  57. */
  58. int pinmux_decode_periph_id(const void *blob, int node);
  59. #endif