padmux.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * arch/arm/plat-spear/include/plat/padmux.h
  3. *
  4. * SPEAr platform specific gpio pads muxing file
  5. *
  6. * Copyright (C) 2009 ST Microelectronics
  7. * Viresh Kumar<viresh.kumar@st.com>
  8. *
  9. * This file is licensed under the terms of the GNU General Public
  10. * License version 2. This program is licensed "as is" without any
  11. * warranty of any kind, whether express or implied.
  12. */
  13. #ifndef __PLAT_PADMUX_H
  14. #define __PLAT_PADMUX_H
  15. #include <linux/types.h>
  16. /*
  17. * struct pmx_reg: configuration structure for mode reg and mux reg
  18. *
  19. * offset: offset of mode reg
  20. * mask: mask of mode reg
  21. */
  22. struct pmx_reg {
  23. u32 offset;
  24. u32 mask;
  25. };
  26. /*
  27. * struct pmx_dev_mode: configuration structure every group of modes of a device
  28. *
  29. * ids: all modes for this configuration
  30. * mask: mask for supported mode
  31. */
  32. struct pmx_dev_mode {
  33. u32 ids;
  34. u32 mask;
  35. };
  36. /*
  37. * struct pmx_mode: mode definition structure
  38. *
  39. * name: mode name
  40. * mask: mode mask
  41. */
  42. struct pmx_mode {
  43. char *name;
  44. u32 id;
  45. u32 mask;
  46. };
  47. /*
  48. * struct pmx_dev: device definition structure
  49. *
  50. * name: device name
  51. * modes: device configuration array for different modes supported
  52. * mode_count: size of modes array
  53. * is_active: is peripheral active/enabled
  54. * enb_on_reset: if 1, mask bits to be cleared in reg otherwise to be set in reg
  55. */
  56. struct pmx_dev {
  57. char *name;
  58. struct pmx_dev_mode *modes;
  59. u8 mode_count;
  60. bool is_active;
  61. bool enb_on_reset;
  62. };
  63. /*
  64. * struct pmx_driver: driver definition structure
  65. *
  66. * mode: mode to be set
  67. * devs: array of pointer to pmx devices
  68. * devs_count: ARRAY_SIZE of devs
  69. * base: base address of soc config registers
  70. * mode_reg: structure of mode config register
  71. * mux_reg: structure of device mux config register
  72. */
  73. struct pmx_driver {
  74. struct pmx_mode *mode;
  75. struct pmx_dev **devs;
  76. u8 devs_count;
  77. u32 *base;
  78. struct pmx_reg mode_reg;
  79. struct pmx_reg mux_reg;
  80. };
  81. /* pmx functions */
  82. int pmx_register(struct pmx_driver *driver);
  83. #endif /* __PLAT_PADMUX_H */