core.h 2.2 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*
 * SuperH Pin Function Controller support.
 *
 * Copyright (C) 2012  Renesas Solutions Corp.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#ifndef __SH_PFC_CORE_H__
#define __SH_PFC_CORE_H__

#include <linux/compiler.h>
#include <linux/types.h>

16 17
#include "sh_pfc.h"

18
struct sh_pfc_window {
19 20 21 22 23
	phys_addr_t phys;
	void __iomem *virt;
	unsigned long size;
};

24
struct sh_pfc_chip;
25
struct sh_pfc_pinctrl;
26

27
struct sh_pfc {
28
	struct device *dev;
29
	struct sh_pfc_soc_info *info;
30 31
	spinlock_t lock;

32
	unsigned int num_windows;
33
	struct sh_pfc_window *window;
34

35
	struct sh_pfc_chip *gpio;
36 37
	struct sh_pfc_chip *func;

38
	struct sh_pfc_pinctrl *pinctrl;
39 40 41
};

int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
42
int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
43 44

int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
45
int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
46 47 48 49

int sh_pfc_read_bit(struct pinmux_data_reg *dr, unsigned long in_pos);
void sh_pfc_write_bit(struct pinmux_data_reg *dr, unsigned long in_pos,
		      unsigned long value);
50 51
void sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
			 struct pinmux_data_reg **drp, int *bitp);
52
struct sh_pfc_pin *sh_pfc_get_pin(struct sh_pfc *pfc, unsigned int pin);
53 54
int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type,
		      int cfg_mode);
55

56
extern struct sh_pfc_soc_info r8a7740_pinmux_info;
57
extern struct sh_pfc_soc_info r8a7779_pinmux_info;
58
extern struct sh_pfc_soc_info sh7203_pinmux_info;
59
extern struct sh_pfc_soc_info sh7264_pinmux_info;
60
extern struct sh_pfc_soc_info sh7269_pinmux_info;
61
extern struct sh_pfc_soc_info sh7372_pinmux_info;
62
extern struct sh_pfc_soc_info sh73a0_pinmux_info;
63
extern struct sh_pfc_soc_info sh7720_pinmux_info;
64
extern struct sh_pfc_soc_info sh7722_pinmux_info;
65
extern struct sh_pfc_soc_info sh7723_pinmux_info;
66
extern struct sh_pfc_soc_info sh7724_pinmux_info;
67
extern struct sh_pfc_soc_info sh7734_pinmux_info;
68
extern struct sh_pfc_soc_info sh7757_pinmux_info;
69
extern struct sh_pfc_soc_info sh7785_pinmux_info;
70
extern struct sh_pfc_soc_info sh7786_pinmux_info;
71
extern struct sh_pfc_soc_info shx3_pinmux_info;
72

73
#endif /* __SH_PFC_CORE_H__ */