core.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 {
  24. struct device *dev;
  25. const struct sh_pfc_soc_info *info;
  26. spinlock_t lock;
  27. unsigned int num_windows;
  28. struct sh_pfc_window *window;
  29. unsigned int nr_pins;
  30. struct sh_pfc_chip *gpio;
  31. struct sh_pfc_chip *func;
  32. struct sh_pfc_pinctrl *pinctrl;
  33. };
  34. int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
  35. int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
  36. int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
  37. int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
  38. unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
  39. unsigned long reg_width);
  40. void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
  41. unsigned long data);
  42. int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
  43. int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
  44. extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
  45. extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
  46. extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
  47. extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
  48. extern const struct sh_pfc_soc_info sh7203_pinmux_info;
  49. extern const struct sh_pfc_soc_info sh7264_pinmux_info;
  50. extern const struct sh_pfc_soc_info sh7269_pinmux_info;
  51. extern const struct sh_pfc_soc_info sh7372_pinmux_info;
  52. extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
  53. extern const struct sh_pfc_soc_info sh7720_pinmux_info;
  54. extern const struct sh_pfc_soc_info sh7722_pinmux_info;
  55. extern const struct sh_pfc_soc_info sh7723_pinmux_info;
  56. extern const struct sh_pfc_soc_info sh7724_pinmux_info;
  57. extern const struct sh_pfc_soc_info sh7734_pinmux_info;
  58. extern const struct sh_pfc_soc_info sh7757_pinmux_info;
  59. extern const struct sh_pfc_soc_info sh7785_pinmux_info;
  60. extern const struct sh_pfc_soc_info sh7786_pinmux_info;
  61. extern const struct sh_pfc_soc_info shx3_pinmux_info;
  62. #endif /* __SH_PFC_CORE_H__ */