1 /*
2  * arch/arm/plat-spear/include/plat/padmux.h
3  *
4  * SPEAr platform specific gpio pads muxing file
5  *
6  * Copyright (C) 2009 ST Microelectronics
7  * Viresh Kumar<viresh.kumar@st.com>
8  *
9  * This file is licensed under the terms of the GNU General Public
10  * License version 2. This program is licensed "as is" without any
11  * warranty of any kind, whether express or implied.
12  */
13 
14 #ifndef __PLAT_PADMUX_H
15 #define __PLAT_PADMUX_H
16 
17 #include <linux/types.h>
18 
19 /*
20  * struct pmx_reg: configuration structure for mode reg and mux reg
21  *
22  * offset: offset of mode reg
23  * mask: mask of mode reg
24  */
25 struct pmx_reg {
26 	u32 offset;
27 	u32 mask;
28 };
29 
30 /*
31  * struct pmx_dev_mode: configuration structure every group of modes of a device
32  *
33  * ids: all modes for this configuration
34  * mask: mask for supported mode
35  */
36 struct pmx_dev_mode {
37 	u32 ids;
38 	u32 mask;
39 };
40 
41 /*
42  * struct pmx_mode: mode definition structure
43  *
44  * name: mode name
45  * mask: mode mask
46  */
47 struct pmx_mode {
48 	char *name;
49 	u32 id;
50 	u32 mask;
51 };
52 
53 /*
54  * struct pmx_dev: device definition structure
55  *
56  * name: device name
57  * modes: device configuration array for different modes supported
58  * mode_count: size of modes array
59  * is_active: is peripheral active/enabled
60  * enb_on_reset: if 1, mask bits to be cleared in reg otherwise to be set in reg
61  */
62 struct pmx_dev {
63 	char *name;
64 	struct pmx_dev_mode *modes;
65 	u8 mode_count;
66 	bool is_active;
67 	bool enb_on_reset;
68 };
69 
70 /*
71  * struct pmx_driver: driver definition structure
72  *
73  * mode: mode to be set
74  * devs: array of pointer to pmx devices
75  * devs_count: ARRAY_SIZE of devs
76  * base: base address of soc config registers
77  * mode_reg: structure of mode config register
78  * mux_reg: structure of device mux config register
79  */
80 struct pmx_driver {
81 	struct pmx_mode *mode;
82 	struct pmx_dev **devs;
83 	u8 devs_count;
84 	u32 *base;
85 	struct pmx_reg mode_reg;
86 	struct pmx_reg mux_reg;
87 };
88 
89 /* pmx functions */
90 int pmx_register(struct pmx_driver *driver);
91 
92 #endif /* __PLAT_PADMUX_H */
93