pinctrl-imx.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 a single i.MX pin
  19. * @pin: the pin_id of this pin
  20. * @mux_mode: the mux mode for this pin.
  21. * @input_reg: the select input register offset for this pin if any
  22. * 0 if no select input setting needed.
  23. * @input_val: the select input value for this pin.
  24. * @configs: the config for this pin.
  25. */
  26. struct imx_pin {
  27. unsigned int pin;
  28. unsigned int mux_mode;
  29. u16 input_reg;
  30. unsigned int input_val;
  31. unsigned long config;
  32. };
  33. /**
  34. * struct imx_pin_group - describes an IMX pin group
  35. * @name: the name of this specific pin group
  36. * @npins: the number of pins in this group array, i.e. the number of
  37. * elements in .pins so we can iterate over that array
  38. * @pin_ids: array of pin_ids. pinctrl forces us to maintain such an array
  39. * @pins: array of pins
  40. */
  41. struct imx_pin_group {
  42. const char *name;
  43. unsigned npins;
  44. unsigned int *pin_ids;
  45. struct imx_pin *pins;
  46. };
  47. /**
  48. * struct imx_pmx_func - describes IMX pinmux functions
  49. * @name: the name of this specific function
  50. * @groups: corresponding pin groups
  51. * @num_groups: the number of groups
  52. */
  53. struct imx_pmx_func {
  54. const char *name;
  55. const char **groups;
  56. unsigned num_groups;
  57. };
  58. /**
  59. * struct imx_pin_reg - describe a pin reg map
  60. * @mux_reg: mux register offset
  61. * @conf_reg: config register offset
  62. */
  63. struct imx_pin_reg {
  64. s16 mux_reg;
  65. s16 conf_reg;
  66. };
  67. struct imx_pinctrl_soc_info {
  68. struct device *dev;
  69. const struct pinctrl_pin_desc *pins;
  70. unsigned int npins;
  71. struct imx_pin_reg *pin_regs;
  72. struct imx_pin_group *groups;
  73. unsigned int ngroups;
  74. unsigned int group_index;
  75. struct imx_pmx_func *functions;
  76. unsigned int nfunctions;
  77. unsigned int flags;
  78. };
  79. #define SHARE_MUX_CONF_REG 0x1
  80. #define ZERO_OFFSET_VALID 0x2
  81. #define NO_MUX 0x0
  82. #define NO_PAD 0x0
  83. #define IMX_PINCTRL_PIN(pin) PINCTRL_PIN(pin, #pin)
  84. #define PAD_CTL_MASK(len) ((1 << len) - 1)
  85. #define IMX_MUX_MASK 0x7
  86. #define IOMUXC_CONFIG_SION (0x1 << 4)
  87. int imx_pinctrl_probe(struct platform_device *pdev,
  88. struct imx_pinctrl_soc_info *info);
  89. int imx_pinctrl_remove(struct platform_device *pdev);
  90. #endif /* __DRIVERS_PINCTRL_IMX_H */