blob: 7b2b4f0accfcedf2c71a1330004dfe749eb404b5 [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 Pinchart63d57382013-02-15 01:33:38 +010035 unsigned int nr_pins;
36
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010037 struct sh_pfc_chip *gpio;
Laurent Pinchart16883812012-12-06 14:49:25 +010038 struct sh_pfc_chip *func;
39
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010040 struct sh_pfc_pinctrl *pinctrl;
Laurent Pinchartf9165132012-12-15 23:50:44 +010041};
42
43int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
Laurent Pinchart6f6a4a62012-12-15 23:50:46 +010044int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
Laurent Pinchartf9165132012-12-15 23:50:44 +010045
46int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
Laurent Pinchartc6193ea2012-12-15 23:50:47 +010047int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
Laurent Pinchartf9165132012-12-15 23:50:44 +010048
Laurent Pinchart41f12192013-02-15 02:04:55 +010049unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
50 unsigned long reg_width);
51void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
52 unsigned long data);
53
Laurent Pinchart1a0039d2013-03-08 17:43:54 +010054int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
Laurent Pinchart861601d2013-03-10 15:29:14 +010055int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
Laurent Pinchartf9165132012-12-15 23:50:44 +010056
Laurent Pinchartd5b15212012-12-15 23:51:21 +010057extern struct sh_pfc_soc_info r8a7740_pinmux_info;
Laurent Pinchart881023d2012-12-15 23:51:22 +010058extern struct sh_pfc_soc_info r8a7779_pinmux_info;
Laurent Pinchartccda5522012-12-15 23:51:29 +010059extern struct sh_pfc_soc_info sh7203_pinmux_info;
Laurent Pincharta8d42fc2012-12-15 23:51:30 +010060extern struct sh_pfc_soc_info sh7264_pinmux_info;
Laurent Pinchartf5e811f2012-12-15 23:51:31 +010061extern struct sh_pfc_soc_info sh7269_pinmux_info;
Laurent Pinchart6e5469a2012-12-15 23:51:23 +010062extern struct sh_pfc_soc_info sh7372_pinmux_info;
Laurent Pinchart5d5166d2012-12-15 23:51:24 +010063extern struct sh_pfc_soc_info sh73a0_pinmux_info;
Laurent Pinchart74cad602012-12-15 23:51:32 +010064extern struct sh_pfc_soc_info sh7720_pinmux_info;
Laurent Pinchartf5e25ae2012-12-15 23:51:33 +010065extern struct sh_pfc_soc_info sh7722_pinmux_info;
Laurent Pinchartd05afa02012-12-15 23:51:34 +010066extern struct sh_pfc_soc_info sh7723_pinmux_info;
Laurent Pinchart0ff25ba2012-12-15 23:51:35 +010067extern struct sh_pfc_soc_info sh7724_pinmux_info;
Laurent Pinchartac1ebc22012-12-15 23:51:36 +010068extern struct sh_pfc_soc_info sh7734_pinmux_info;
Laurent Pinchart0bb92672012-12-15 23:51:37 +010069extern struct sh_pfc_soc_info sh7757_pinmux_info;
Laurent Pincharta56398e2012-12-15 23:51:38 +010070extern struct sh_pfc_soc_info sh7785_pinmux_info;
Laurent Pinchartd2a31bd2012-12-15 23:51:39 +010071extern struct sh_pfc_soc_info sh7786_pinmux_info;
Laurent Pinchartd5d9a812012-12-15 23:51:40 +010072extern struct sh_pfc_soc_info shx3_pinmux_info;
Laurent Pinchartd5b15212012-12-15 23:51:21 +010073
Laurent Pinchartf9165132012-12-15 23:50:44 +010074#endif /* __SH_PFC_CORE_H__ */