blob: 0ba0e5da30b49aff3d3f8225699404540271f7cb [file] [log] [blame]
Laurent Pinchartf9165132012-12-15 23:50:44 +01001/*
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 Pinchart4aeacd52012-12-15 23:50:53 +010017struct sh_pfc_window {
Laurent Pinchartf9165132012-12-15 23:50:44 +010018 phys_addr_t phys;
19 void __iomem *virt;
20 unsigned long size;
21};
22
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010023struct sh_pfc_chip;
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010024struct sh_pfc_pinctrl;
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010025
Laurent Pinchartf9165132012-12-15 23:50:44 +010026struct sh_pfc {
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010027 struct device *dev;
Laurent Pinchart19bb7fe32012-12-15 23:51:20 +010028 struct sh_pfc_soc_info *info;
Laurent Pinchartf9165132012-12-15 23:50:44 +010029 spinlock_t lock;
30
Laurent Pinchart973931a2012-12-15 23:50:55 +010031 unsigned int num_windows;
Laurent Pinchart4aeacd52012-12-15 23:50:53 +010032 struct sh_pfc_window *window;
Laurent Pinchart973931a2012-12-15 23:50:55 +010033
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010034 struct sh_pfc_chip *gpio;
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010035 struct sh_pfc_pinctrl *pinctrl;
Laurent Pinchartf9165132012-12-15 23:50:44 +010036};
37
38int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010039int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
Laurent Pinchartf9165132012-12-15 23:50:44 +010040
41int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010042int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
Laurent Pinchartf9165132012-12-15 23:50:44 +010043
44int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos);
45void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
46 unsigned long value);
47int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
48 struct pinmux_data_reg **drp, int *bitp);
49int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
50 pinmux_enum_t *enum_idp);
51int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
52 int cfg_mode);
53
Laurent Pinchartd5b15212012-12-15 23:51:21 +010054extern struct sh_pfc_soc_info r8a7740_pinmux_info;
Laurent Pinchart881023d2012-12-15 23:51:22 +010055extern struct sh_pfc_soc_info r8a7779_pinmux_info;
Laurent Pinchart6e5469a2012-12-15 23:51:23 +010056extern struct sh_pfc_soc_info sh7372_pinmux_info;
Laurent Pinchartd5b15212012-12-15 23:51:21 +010057
Laurent Pinchartf9165132012-12-15 23:50:44 +010058#endif /* __SH_PFC_CORE_H__ */