pinctrl-imx.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * IMX pinmux core definitions
  3. *
  4. * Copyright (C) 2012 Freescale Semiconductor, Inc.
  5. * Copyright (C) 2012 Linaro Ltd.
  6. *
  7. * Author: Dong Aisheng <dong.aisheng@linaro.org>
  8. *
  9. * This program is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version.
  13. */
  14. #ifndef __DRIVERS_PINCTRL_IMX_H
  15. #define __DRIVERS_PINCTRL_IMX_H
  16. struct platform_device;
  17. /**
  18. * struct imx_pin_group - describes an IMX pin group
  19. * @name: the name of this specific pin group
  20. * @pins: an array of discrete physical pins used in this group, taken
  21. * from the driver-local pin enumeration space
  22. * @npins: the number of pins in this group array, i.e. the number of
  23. * elements in .pins so we can iterate over that array
  24. * @mux_mode: the mux mode for each pin in this group. The size of this
  25. * array is the same as pins.
  26. * @input_reg: select input register offset for this mux if any
  27. * 0 if no select input setting needed.
  28. * @input_val: the select input value for each pin in this group. The size of
  29. * this array is the same as pins.
  30. * @configs: the config for each pin in this group. The size of this
  31. * array is the same as pins.
  32. */
  33. struct imx_pin_group {
  34. const char *name;
  35. unsigned int *pins;
  36. unsigned npins;
  37. unsigned int *mux_mode;
  38. u16 *input_reg;
  39. unsigned int *input_val;
  40. unsigned long *configs;
  41. };
  42. /**
  43. * struct imx_pmx_func - describes IMX pinmux functions
  44. * @name: the name of this specific function
  45. * @groups: corresponding pin groups
  46. * @num_groups: the number of groups
  47. */
  48. struct imx_pmx_func {
  49. const char *name;
  50. const char **groups;
  51. unsigned num_groups;
  52. };
  53. /**
  54. * struct imx_pin_reg - describe a pin reg map
  55. * @mux_reg: mux register offset
  56. * @conf_reg: config register offset
  57. */
  58. struct imx_pin_reg {
  59. u16 mux_reg;
  60. u16 conf_reg;
  61. };
  62. struct imx_pinctrl_soc_info {
  63. struct device *dev;
  64. const struct pinctrl_pin_desc *pins;
  65. unsigned int npins;
  66. struct imx_pin_reg *pin_regs;
  67. struct imx_pin_group *groups;
  68. unsigned int ngroups;
  69. struct imx_pmx_func *functions;
  70. unsigned int nfunctions;
  71. };
  72. #define NO_MUX 0x0
  73. #define NO_PAD 0x0
  74. #define IMX_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
  75. #define PAD_CTL_MASK(len) ((1 << len) - 1)
  76. #define IMX_MUX_MASK 0x7
  77. #define IOMUXC_CONFIG_SION (0x1 << 4)
  78. int imx_pinctrl_probe(struct platform_device *pdev,
  79. struct imx_pinctrl_soc_info *info);
  80. int imx_pinctrl_remove(struct platform_device *pdev);
  81. #endif /* __DRIVERS_PINCTRL_IMX_H */