core.h 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
 * 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/sh_pfc.h>
#include <linux/types.h>

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

23
struct sh_pfc_chip;
24
struct sh_pfc_pinctrl;
25

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

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

34
	struct sh_pfc_chip *gpio;
35
	struct sh_pfc_pinctrl *pinctrl;
36 37 38
};

int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
39
int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
40 41

int sh_pfc_register_pinctrl(struct sh_pfc *pfc);
42
int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc);
43 44 45 46 47 48 49 50 51 52 53

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);
int sh_pfc_get_data_reg(struct sh_pfc *pfc, unsigned gpio,
			struct pinmux_data_reg **drp, int *bitp);
int sh_pfc_gpio_to_enum(struct sh_pfc *pfc, unsigned gpio, int pos,
			pinmux_enum_t *enum_idp);
int sh_pfc_config_gpio(struct sh_pfc *pfc, unsigned gpio, int pinmux_type,
		       int cfg_mode);

54
extern struct sh_pfc_soc_info r8a7740_pinmux_info;
55
extern struct sh_pfc_soc_info r8a7779_pinmux_info;
56
extern struct sh_pfc_soc_info sh7203_pinmux_info;
57
extern struct sh_pfc_soc_info sh7264_pinmux_info;
58
extern struct sh_pfc_soc_info sh7269_pinmux_info;
59
extern struct sh_pfc_soc_info sh7372_pinmux_info;
60
extern struct sh_pfc_soc_info sh73a0_pinmux_info;
61

62
#endif /* __SH_PFC_CORE_H__ */