blob: 145405bf9efad07d99900fbf14e244a1162966ed [file] [log] [blame]
Ben Dooksb6d64542007-02-20 13:58:01 -08001/* include/linux/sm501.h
2 *
3 * Copyright (c) 2006 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 * Vincent Sanders <vince@simtec.co.uk>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19*/
20
21extern int sm501_unit_power(struct device *dev,
22 unsigned int unit, unsigned int to);
23
24extern unsigned long sm501_set_clock(struct device *dev,
25 int clksrc, unsigned long freq);
26
Ville Syrjala3149be52008-03-04 14:28:50 -080027extern unsigned long sm501_find_clock(struct device *dev,
28 int clksrc, unsigned long req_freq);
Ben Dooksb6d64542007-02-20 13:58:01 -080029
30/* sm501_misc_control
31 *
32 * Modify the SM501's MISC_CONTROL register
33*/
34
35extern int sm501_misc_control(struct device *dev,
36 unsigned long set, unsigned long clear);
37
38/* sm501_modify_reg
39 *
40 * Modify a register in the SM501 which may be shared with other
41 * drivers.
42*/
43
44extern unsigned long sm501_modify_reg(struct device *dev,
45 unsigned long reg,
46 unsigned long set,
47 unsigned long clear);
48
49/* sm501_gpio_set
50 *
51 * set the state of the given GPIO line
52*/
53
54extern void sm501_gpio_set(struct device *dev,
55 unsigned long gpio,
56 unsigned int to,
57 unsigned int dir);
58
59/* sm501_gpio_get
60 *
61 * get the state of the given GPIO line
62*/
63
64extern unsigned long sm501_gpio_get(struct device *dev,
65 unsigned long gpio);
66
67
68/* Platform data definitions */
69
70#define SM501FB_FLAG_USE_INIT_MODE (1<<0)
71#define SM501FB_FLAG_DISABLE_AT_EXIT (1<<1)
72#define SM501FB_FLAG_USE_HWCURSOR (1<<2)
73#define SM501FB_FLAG_USE_HWACCEL (1<<3)
Ben Dookscdc83ae2008-05-23 13:04:53 -070074#define SM501FB_FLAG_PANEL_NO_FPEN (1<<4)
75#define SM501FB_FLAG_PANEL_NO_VBIASEN (1<<5)
Ben Dooks206c5d62008-07-23 21:31:35 -070076#define SM501FB_FLAG_PANEL_INV_FPEN (1<<6)
77#define SM501FB_FLAG_PANEL_INV_VBIASEN (1<<7)
Ben Dooksb6d64542007-02-20 13:58:01 -080078
79struct sm501_platdata_fbsub {
80 struct fb_videomode *def_mode;
81 unsigned int def_bpp;
82 unsigned long max_mem;
83 unsigned int flags;
84};
85
86enum sm501_fb_routing {
87 SM501_FB_OWN = 0, /* CRT=>CRT, Panel=>Panel */
88 SM501_FB_CRT_PANEL = 1, /* Panel=>CRT, Panel=>Panel */
89};
90
91/* sm501_platdata_fb flag field bit definitions */
92
93#define SM501_FBPD_SWAP_FB_ENDIAN (1<<0) /* need to endian swap */
94
95/* sm501_platdata_fb
96 *
97 * configuration data for the framebuffer driver
98*/
99
100struct sm501_platdata_fb {
101 enum sm501_fb_routing fb_route;
102 unsigned int flags;
103 struct sm501_platdata_fbsub *fb_crt;
104 struct sm501_platdata_fbsub *fb_pnl;
105};
106
107/* gpio i2c */
108
109struct sm501_platdata_gpio_i2c {
110 unsigned int pin_sda;
111 unsigned int pin_scl;
112};
113
114/* sm501_initdata
115 *
116 * use for initialising values that may not have been setup
117 * before the driver is loaded.
118*/
119
120struct sm501_reg_init {
121 unsigned long set;
122 unsigned long mask;
123};
124
125#define SM501_USE_USB_HOST (1<<0)
126#define SM501_USE_USB_SLAVE (1<<1)
127#define SM501_USE_SSP0 (1<<2)
128#define SM501_USE_SSP1 (1<<3)
129#define SM501_USE_UART0 (1<<4)
130#define SM501_USE_UART1 (1<<5)
131#define SM501_USE_FBACCEL (1<<6)
132#define SM501_USE_AC97 (1<<7)
133#define SM501_USE_I2S (1<<8)
134
135#define SM501_USE_ALL (0xffffffff)
136
137struct sm501_initdata {
138 struct sm501_reg_init gpio_low;
139 struct sm501_reg_init gpio_high;
140 struct sm501_reg_init misc_timing;
141 struct sm501_reg_init misc_control;
142
143 unsigned long devices;
144 unsigned long mclk; /* non-zero to modify */
145 unsigned long m1xclk; /* non-zero to modify */
146};
147
148/* sm501_init_gpio
149 *
150 * default gpio settings
151*/
152
153struct sm501_init_gpio {
154 struct sm501_reg_init gpio_data_low;
155 struct sm501_reg_init gpio_data_high;
156 struct sm501_reg_init gpio_ddr_low;
157 struct sm501_reg_init gpio_ddr_high;
158};
159
Ben Dooks472dba72008-07-25 01:45:58 -0700160#define SM501_FLAG_SUSPEND_OFF (1<<4)
161
Ben Dooksb6d64542007-02-20 13:58:01 -0800162/* sm501_platdata
163 *
164 * This is passed with the platform device to allow the board
165 * to control the behaviour of the SM501 driver(s) which attach
166 * to the device.
167 *
168*/
169
170struct sm501_platdata {
171 struct sm501_initdata *init;
172 struct sm501_init_gpio *init_gpiop;
173 struct sm501_platdata_fb *fb;
174
Ben Dooks472dba72008-07-25 01:45:58 -0700175 int flags;
176
177 int (*get_power)(struct device *dev);
178 int (*set_power)(struct device *dev, unsigned int on);
179
Ben Dooksb6d64542007-02-20 13:58:01 -0800180 struct sm501_platdata_gpio_i2c *gpio_i2c;
181 unsigned int gpio_i2c_nr;
182};