core.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /*
  2. * SuperH Pin Function Controller support.
  3. *
  4. * Copyright (C) 2012 Renesas Solutions Corp.
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #ifndef __SH_PFC_CORE_H__
  11. #define __SH_PFC_CORE_H__
  12. #include <linux/compiler.h>
  13. #include <linux/spinlock.h>
  14. #include <linux/types.h>
  15. #include "sh_pfc.h"
  16. struct sh_pfc_window {
  17. phys_addr_t phys;
  18. void __iomem *virt;
  19. unsigned long size;
  20. };
  21. struct sh_pfc_chip;
  22. struct sh_pfc_pinctrl;
  23. struct sh_pfc_pin_range {
  24. u16 start;
  25. u16 end;
  26. };
  27. struct sh_pfc {
  28. struct device *dev;
  29. const struct sh_pfc_soc_info *info;
  30. spinlock_t lock;
  31. unsigned int num_windows;
  32. struct sh_pfc_window *windows;
  33. unsigned int num_irqs;
  34. unsigned int *irqs;
  35. struct sh_pfc_pin_range *ranges;
  36. unsigned int nr_ranges;
  37. unsigned int nr_gpio_pins;
  38. struct sh_pfc_chip *gpio;
  39. #ifdef CONFIG_SUPERH
  40. struct sh_pfc_chip *func;
  41. #endif
  42. struct sh_pfc_pinctrl *pinctrl;
  43. };
  44. int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
  45. int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
  46. int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
  47. int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
  48. u32 sh_pfc_read_raw_reg(void __iomem *mapped_reg, unsigned int reg_width);
  49. void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned int reg_width,
  50. u32 data);
  51. int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
  52. int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
  53. extern const struct sh_pfc_soc_info emev2_pinmux_info;
  54. extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
  55. extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
  56. extern const struct sh_pfc_soc_info r8a7778_pinmux_info;
  57. extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
  58. extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
  59. extern const struct sh_pfc_soc_info r8a7791_pinmux_info;
  60. extern const struct sh_pfc_soc_info r8a7793_pinmux_info;
  61. extern const struct sh_pfc_soc_info r8a7794_pinmux_info;
  62. extern const struct sh_pfc_soc_info r8a7795_pinmux_info;
  63. extern const struct sh_pfc_soc_info sh7203_pinmux_info;
  64. extern const struct sh_pfc_soc_info sh7264_pinmux_info;
  65. extern const struct sh_pfc_soc_info sh7269_pinmux_info;
  66. extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
  67. extern const struct sh_pfc_soc_info sh7720_pinmux_info;
  68. extern const struct sh_pfc_soc_info sh7722_pinmux_info;
  69. extern const struct sh_pfc_soc_info sh7723_pinmux_info;
  70. extern const struct sh_pfc_soc_info sh7724_pinmux_info;
  71. extern const struct sh_pfc_soc_info sh7734_pinmux_info;
  72. extern const struct sh_pfc_soc_info sh7757_pinmux_info;
  73. extern const struct sh_pfc_soc_info sh7785_pinmux_info;
  74. extern const struct sh_pfc_soc_info sh7786_pinmux_info;
  75. extern const struct sh_pfc_soc_info shx3_pinmux_info;
  76. #endif /* __SH_PFC_CORE_H__ */