summaryrefslogtreecommitdiff
path: root/arch/arm/plat-spear/include/plat/padmux.h
blob: 877f3adcf61070d8ef2ba44b0658029645e89433 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/*
 * arch/arm/plat-spear/include/plat/padmux.h
 *
 * SPEAr platform specific gpio pads muxing file
 *
 * Copyright (C) 2009 ST Microelectronics
 * Viresh Kumar<viresh.kumar@st.com>
 *
 * This file is licensed under the terms of the GNU General Public
 * License version 2. This program is licensed "as is" without any
 * warranty of any kind, whether express or implied.
 */

#ifndef __PLAT_PADMUX_H
#define __PLAT_PADMUX_H

#include <linux/types.h>

/*
 * struct pmx_reg: configuration structure for mode reg and mux reg
 *
 * offset: offset of mode reg
 * mask: mask of mode reg
 */
struct pmx_reg {
	u32 offset;
	u32 mask;
};

/*
 * struct pmx_dev_mode: configuration structure every group of modes of a device
 *
 * ids: all modes for this configuration
 * mask: mask for supported mode
 */
struct pmx_dev_mode {
	u32 ids;
	u32 mask;
};

/*
 * struct pmx_mode: mode definition structure
 *
 * name: mode name
 * mask: mode mask
 */
struct pmx_mode {
	char *name;
	u32 id;
	u32 mask;
};

/*
 * struct pmx_dev: device definition structure
 *
 * name: device name
 * modes: device configuration array for different modes supported
 * mode_count: size of modes array
 * is_active: is peripheral active/enabled
 * enb_on_reset: if 1, mask bits to be cleared in reg otherwise to be set in reg
 */
struct pmx_dev {
	char *name;
	struct pmx_dev_mode *modes;
	u8 mode_count;
	bool is_active;
	bool enb_on_reset;
};

/*
 * struct pmx_driver: driver definition structure
 *
 * mode: mode to be set
 * devs: array of pointer to pmx devices
 * devs_count: ARRAY_SIZE of devs
 * base: base address of soc config registers
 * mode_reg: structure of mode config register
 * mux_reg: structure of device mux config register
 */
struct pmx_driver {
	struct pmx_mode *mode;
	struct pmx_dev **devs;
	u8 devs_count;
	u32 *base;
	struct pmx_reg mode_reg;
	struct pmx_reg mux_reg;
};

/* pmx functions */
int pmx_register(struct pmx_driver *driver);

#endif /* __PLAT_PADMUX_H */