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

17 18
#include "sh_pfc.h"

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

25
struct sh_pfc_chip;
26
struct sh_pfc_pinctrl;
27

28
struct sh_pfc {
29
	struct device *dev;
L
Laurent Pinchart 已提交
30
	const struct sh_pfc_soc_info *info;
31 32
	spinlock_t lock;

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

36 37
	unsigned int nr_pins;

38
	struct sh_pfc_chip *gpio;
39 40
	struct sh_pfc_chip *func;

41
	struct sh_pfc_pinctrl *pinctrl;
42 43 44
};

int sh_pfc_register_gpiochip(struct sh_pfc *pfc);
45
int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc);
46 47

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

50 51 52 53 54
unsigned long sh_pfc_read_raw_reg(void __iomem *mapped_reg,
				  unsigned long reg_width);
void sh_pfc_write_raw_reg(void __iomem *mapped_reg, unsigned long reg_width,
			  unsigned long data);

55
int sh_pfc_get_pin_index(struct sh_pfc *pfc, unsigned int pin);
56
int sh_pfc_config_mux(struct sh_pfc *pfc, unsigned mark, int pinmux_type);
57

M
Magnus Damm 已提交
58
extern const struct sh_pfc_soc_info r8a73a4_pinmux_info;
L
Laurent Pinchart 已提交
59 60
extern const struct sh_pfc_soc_info r8a7740_pinmux_info;
extern const struct sh_pfc_soc_info r8a7779_pinmux_info;
61
extern const struct sh_pfc_soc_info r8a7790_pinmux_info;
L
Laurent Pinchart 已提交
62 63 64 65 66 67 68 69 70 71 72 73 74 75
extern const struct sh_pfc_soc_info sh7203_pinmux_info;
extern const struct sh_pfc_soc_info sh7264_pinmux_info;
extern const struct sh_pfc_soc_info sh7269_pinmux_info;
extern const struct sh_pfc_soc_info sh7372_pinmux_info;
extern const struct sh_pfc_soc_info sh73a0_pinmux_info;
extern const struct sh_pfc_soc_info sh7720_pinmux_info;
extern const struct sh_pfc_soc_info sh7722_pinmux_info;
extern const struct sh_pfc_soc_info sh7723_pinmux_info;
extern const struct sh_pfc_soc_info sh7724_pinmux_info;
extern const struct sh_pfc_soc_info sh7734_pinmux_info;
extern const struct sh_pfc_soc_info sh7757_pinmux_info;
extern const struct sh_pfc_soc_info sh7785_pinmux_info;
extern const struct sh_pfc_soc_info sh7786_pinmux_info;
extern const struct sh_pfc_soc_info shx3_pinmux_info;
76

77
#endif /* __SH_PFC_CORE_H__ */