pinctrl-sirf.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /*
  2. * pinmux driver shared headfile for CSR SiRFsoc
  3. *
  4. * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
  5. *
  6. * Licensed under GPLv2 or later.
  7. */
  8. #ifndef __PINMUX_SIRF_H__
  9. #define __PINMUX_SIRF_H__
  10. #define SIRFSOC_NUM_PADS 622
  11. #define SIRFSOC_RSC_USB_UART_SHARE 0
  12. #define SIRFSOC_RSC_PIN_MUX 0x4
  13. #define SIRFSOC_GPIO_PAD_EN(g) ((g)*0x100 + 0x84)
  14. #define SIRFSOC_GPIO_PAD_EN_CLR(g) ((g)*0x100 + 0x90)
  15. #define SIRFSOC_GPIO_CTRL(g, i) ((g)*0x100 + (i)*4)
  16. #define SIRFSOC_GPIO_DSP_EN0 (0x80)
  17. #define SIRFSOC_GPIO_INT_STATUS(g) ((g)*0x100 + 0x8C)
  18. #define SIRFSOC_GPIO_CTL_INTR_LOW_MASK 0x1
  19. #define SIRFSOC_GPIO_CTL_INTR_HIGH_MASK 0x2
  20. #define SIRFSOC_GPIO_CTL_INTR_TYPE_MASK 0x4
  21. #define SIRFSOC_GPIO_CTL_INTR_EN_MASK 0x8
  22. #define SIRFSOC_GPIO_CTL_INTR_STS_MASK 0x10
  23. #define SIRFSOC_GPIO_CTL_OUT_EN_MASK 0x20
  24. #define SIRFSOC_GPIO_CTL_DATAOUT_MASK 0x40
  25. #define SIRFSOC_GPIO_CTL_DATAIN_MASK 0x80
  26. #define SIRFSOC_GPIO_CTL_PULL_MASK 0x100
  27. #define SIRFSOC_GPIO_CTL_PULL_HIGH 0x200
  28. #define SIRFSOC_GPIO_CTL_DSP_INT 0x400
  29. #define SIRFSOC_GPIO_NO_OF_BANKS 5
  30. #define SIRFSOC_GPIO_BANK_SIZE 32
  31. #define SIRFSOC_GPIO_NUM(bank, index) (((bank)*(32)) + (index))
  32. /**
  33. * @dev: a pointer back to containing device
  34. * @virtbase: the offset to the controller in virtual memory
  35. */
  36. struct sirfsoc_pmx {
  37. struct device *dev;
  38. struct pinctrl_dev *pmx;
  39. void __iomem *gpio_virtbase;
  40. void __iomem *rsc_virtbase;
  41. u32 gpio_regs[SIRFSOC_GPIO_NO_OF_BANKS][SIRFSOC_GPIO_BANK_SIZE];
  42. u32 ints_regs[SIRFSOC_GPIO_NO_OF_BANKS];
  43. u32 paden_regs[SIRFSOC_GPIO_NO_OF_BANKS];
  44. u32 dspen_regs;
  45. u32 rsc_regs[3];
  46. };
  47. /* SIRFSOC_GPIO_PAD_EN set */
  48. struct sirfsoc_muxmask {
  49. unsigned long group;
  50. unsigned long mask;
  51. };
  52. struct sirfsoc_padmux {
  53. unsigned long muxmask_counts;
  54. const struct sirfsoc_muxmask *muxmask;
  55. /* RSC_PIN_MUX set */
  56. unsigned long ctrlreg;
  57. unsigned long funcmask;
  58. unsigned long funcval;
  59. };
  60. /**
  61. * struct sirfsoc_pin_group - describes a SiRFprimaII pin group
  62. * @name: the name of this specific pin group
  63. * @pins: an array of discrete physical pins used in this group, taken
  64. * from the driver-local pin enumeration space
  65. * @num_pins: the number of pins in this group array, i.e. the number of
  66. * elements in .pins so we can iterate over that array
  67. */
  68. struct sirfsoc_pin_group {
  69. const char *name;
  70. const unsigned int *pins;
  71. const unsigned num_pins;
  72. };
  73. #define SIRFSOC_PIN_GROUP(n, p) \
  74. { \
  75. .name = n, \
  76. .pins = p, \
  77. .num_pins = ARRAY_SIZE(p), \
  78. }
  79. struct sirfsoc_pmx_func {
  80. const char *name;
  81. const char * const *groups;
  82. const unsigned num_groups;
  83. const struct sirfsoc_padmux *padmux;
  84. };
  85. #define SIRFSOC_PMX_FUNCTION(n, g, m) \
  86. { \
  87. .name = n, \
  88. .groups = g, \
  89. .num_groups = ARRAY_SIZE(g), \
  90. .padmux = &m, \
  91. }
  92. struct sirfsoc_pinctrl_data {
  93. struct pinctrl_pin_desc *pads;
  94. int pads_cnt;
  95. struct sirfsoc_pin_group *grps;
  96. int grps_cnt;
  97. struct sirfsoc_pmx_func *funcs;
  98. int funcs_cnt;
  99. };
  100. extern struct sirfsoc_pinctrl_data prima2_pinctrl_data;
  101. extern struct sirfsoc_pinctrl_data atlas6_pinctrl_data;
  102. #endif