blob: ba7c33c33599920d404801ad86e01989a042e24a [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>
Laurent Pinchartf9165132012-12-15 23:50:44 +010014#include <linux/types.h>
15
Laurent Pinchartc3323802012-12-15 23:51:55 +010016#include "sh_pfc.h"
17
Laurent Pinchart4aeacd52012-12-15 23:50:53 +010018struct sh_pfc_window {
Laurent Pinchartf9165132012-12-15 23:50:44 +010019 phys_addr_t phys;
20 void __iomem *virt;
21 unsigned long size;
22};
23
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010024struct sh_pfc_chip;
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010025struct sh_pfc_pinctrl;
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010026
Laurent Pinchartf9165132012-12-15 23:50:44 +010027struct sh_pfc {
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010028 struct device *dev;
Laurent Pinchart19bb7fe32012-12-15 23:51:20 +010029 struct sh_pfc_soc_info *info;
Laurent Pinchartf9165132012-12-15 23:50:44 +010030 spinlock_t lock;
31
Laurent Pinchart973931a2012-12-15 23:50:55 +010032 unsigned int num_windows;
Laurent Pinchart4aeacd52012-12-15 23:50:53 +010033 struct sh_pfc_window *window;
Laurent Pinchart973931a2012-12-15 23:50:55 +010034
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010035 struct sh_pfc_chip *gpio;
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010036 struct sh_pfc_pinctrl *pinctrl;
Laurent Pinchartf9165132012-12-15 23:50:44 +010037};
38
39int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010040int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
Laurent Pinchartf9165132012-12-15 23:50:44 +010041
42int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010043int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
Laurent Pinchartf9165132012-12-15 23:50:44 +010044
45int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos);
46void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
47 unsigned long value);
48int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
49 struct pinmux_data_reg **drp, int *bitp);
50int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
51 pinmux_enum_t *enum_idp);
52int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
53 int cfg_mode);
54
Laurent Pinchartd5b15212012-12-15 23:51:21 +010055extern struct sh_pfc_soc_info r8a7740_pinmux_info;
Laurent Pinchart881023d2012-12-15 23:51:22 +010056extern struct sh_pfc_soc_info r8a7779_pinmux_info;
Laurent Pinchartccda5522012-12-15 23:51:29 +010057extern struct sh_pfc_soc_info sh7203_pinmux_info;
Laurent Pincharta8d42fc2012-12-15 23:51:30 +010058extern struct sh_pfc_soc_info sh7264_pinmux_info;
Laurent Pinchartf5e811f2012-12-15 23:51:31 +010059extern struct sh_pfc_soc_info sh7269_pinmux_info;
Laurent Pinchart6e5469a2012-12-15 23:51:23 +010060extern struct sh_pfc_soc_info sh7372_pinmux_info;
Laurent Pinchart5d5166d2012-12-15 23:51:24 +010061extern struct sh_pfc_soc_info sh73a0_pinmux_info;
Laurent Pinchart74cad602012-12-15 23:51:32 +010062extern struct sh_pfc_soc_info sh7720_pinmux_info;
Laurent Pinchartf5e25ae2012-12-15 23:51:33 +010063extern struct sh_pfc_soc_info sh7722_pinmux_info;
Laurent Pinchartd05afa02012-12-15 23:51:34 +010064extern struct sh_pfc_soc_info sh7723_pinmux_info;
Laurent Pinchart0ff25ba2012-12-15 23:51:35 +010065extern struct sh_pfc_soc_info sh7724_pinmux_info;
Laurent Pinchartac1ebc22012-12-15 23:51:36 +010066extern struct sh_pfc_soc_info sh7734_pinmux_info;
Laurent Pinchart0bb92672012-12-15 23:51:37 +010067extern struct sh_pfc_soc_info sh7757_pinmux_info;
Laurent Pincharta56398e2012-12-15 23:51:38 +010068extern struct sh_pfc_soc_info sh7785_pinmux_info;
Laurent Pinchartd2a31bd2012-12-15 23:51:39 +010069extern struct sh_pfc_soc_info sh7786_pinmux_info;
Laurent Pinchartd5d9a812012-12-15 23:51:40 +010070extern struct sh_pfc_soc_info shx3_pinmux_info;
Laurent Pinchartd5b15212012-12-15 23:51:21 +010071
Laurent Pinchartf9165132012-12-15 23:50:44 +010072#endif /* __SH_PFC_CORE_H__ */