Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 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 | |
| 13 | #include <linux/compiler.h> |
| 14 | #include <linux/sh_pfc.h> |
| 15 | #include <linux/types.h> |
| 16 | |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 17 | struct sh_pfc_window { |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 18 | phys_addr_t phys; |
| 19 | void __iomem *virt; |
| 20 | unsigned long size; |
| 21 | }; |
| 22 | |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 23 | struct sh_pfc_chip; |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 24 | struct sh_pfc_pinctrl; |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 25 | |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 26 | struct sh_pfc { |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 27 | struct device *dev; |
Laurent Pinchart | 19bb7fe3 | 2012-12-15 23:51:20 +0100 | [diff] [blame] | 28 | struct sh_pfc_soc_info *info; |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 29 | spinlock_t lock; |
| 30 | |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame] | 31 | unsigned int num_windows; |
Laurent Pinchart | 4aeacd5 | 2012-12-15 23:50:53 +0100 | [diff] [blame] | 32 | struct sh_pfc_window *window; |
Laurent Pinchart | 973931a | 2012-12-15 23:50:55 +0100 | [diff] [blame] | 33 | |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 34 | struct sh_pfc_chip *gpio; |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 35 | struct sh_pfc_pinctrl *pinctrl; |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | int sh_pfc_register_gpiochip(struct sh_pfc *pfc); |
Laurent Pinchart | 6f6a4a6 | 2012-12-15 23:50:46 +0100 | [diff] [blame] | 39 | int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc); |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 40 | |
| 41 | int sh_pfc_register_pinctrl(struct sh_pfc *pfc); |
Laurent Pinchart | c6193ea | 2012-12-15 23:50:47 +0100 | [diff] [blame] | 42 | int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc); |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 43 | |
| 44 | int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos); |
| 45 | void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos, |
| 46 | unsigned long value); |
| 47 | int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio, |
| 48 | struct pinmux_data_reg **drp, int *bitp); |
| 49 | int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos, |
| 50 | pinmux_enum_t *enum_idp); |
| 51 | int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type, |
| 52 | int cfg_mode); |
| 53 | |
Laurent Pinchart | d5b1521 | 2012-12-15 23:51:21 +0100 | [diff] [blame] | 54 | extern struct sh_pfc_soc_info r8a7740_pinmux_info; |
Laurent Pinchart | 881023d | 2012-12-15 23:51:22 +0100 | [diff] [blame] | 55 | extern struct sh_pfc_soc_info r8a7779_pinmux_info; |
Laurent Pinchart | ccda552 | 2012-12-15 23:51:29 +0100 | [diff] [blame] | 56 | extern struct sh_pfc_soc_info sh7203_pinmux_info; |
Laurent Pinchart | a8d42fc | 2012-12-15 23:51:30 +0100 | [diff] [blame^] | 57 | extern struct sh_pfc_soc_info sh7264_pinmux_info; |
Laurent Pinchart | 6e5469a | 2012-12-15 23:51:23 +0100 | [diff] [blame] | 58 | extern struct sh_pfc_soc_info sh7372_pinmux_info; |
Laurent Pinchart | 5d5166d | 2012-12-15 23:51:24 +0100 | [diff] [blame] | 59 | extern struct sh_pfc_soc_info sh73a0_pinmux_info; |
Laurent Pinchart | d5b1521 | 2012-12-15 23:51:21 +0100 | [diff] [blame] | 60 | |
Laurent Pinchart | f916513 | 2012-12-15 23:50:44 +0100 | [diff] [blame] | 61 | #endif /* __SH_PFC_CORE_H__ */ |