Blame view

include/linux/sm501.h 4.63 KB
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
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
  /* include/linux/sm501.h
   *
   * Copyright (c) 2006 Simtec Electronics
   *	Ben Dooks <ben@simtec.co.uk>
   *	Vincent Sanders <vince@simtec.co.uk>
   *
   * This program is free software; you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation; either version 2 of the License
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   * GNU General Public License for more details.
   *
   * You should have received a copy of the GNU General Public License
   * along with this program; if not, write to the Free Software
   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
  
  extern int sm501_unit_power(struct device *dev,
  			    unsigned int unit, unsigned int to);
  
  extern unsigned long sm501_set_clock(struct device *dev,
  				     int clksrc, unsigned long freq);
3149be50d   Ville Syrjala   sm501: add suppor...
26
27
  extern unsigned long sm501_find_clock(struct device *dev,
  				      int clksrc, unsigned long req_freq);
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
  
  /* sm501_misc_control
   *
   * Modify the SM501's MISC_CONTROL register
  */
  
  extern int sm501_misc_control(struct device *dev,
  			      unsigned long set, unsigned long clear);
  
  /* sm501_modify_reg
   *
   * Modify a register in the SM501 which may be shared with other
   * drivers.
  */
  
  extern unsigned long sm501_modify_reg(struct device *dev,
  				      unsigned long reg,
  				      unsigned long set,
  				      unsigned long clear);
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
47
48
49
50
51
52
53
  
  /* Platform data definitions */
  
  #define SM501FB_FLAG_USE_INIT_MODE	(1<<0)
  #define SM501FB_FLAG_DISABLE_AT_EXIT	(1<<1)
  #define SM501FB_FLAG_USE_HWCURSOR	(1<<2)
  #define SM501FB_FLAG_USE_HWACCEL	(1<<3)
cdc83ae24   Ben Dooks   SM501: reverse FP...
54
55
  #define SM501FB_FLAG_PANEL_NO_FPEN	(1<<4)
  #define SM501FB_FLAG_PANEL_NO_VBIASEN	(1<<5)
206c5d69d   Ben Dooks   sm501: add invers...
56
57
  #define SM501FB_FLAG_PANEL_INV_FPEN	(1<<6)
  #define SM501FB_FLAG_PANEL_INV_VBIASEN	(1<<7)
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
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
  
  struct sm501_platdata_fbsub {
  	struct fb_videomode	*def_mode;
  	unsigned int		 def_bpp;
  	unsigned long		 max_mem;
  	unsigned int		 flags;
  };
  
  enum sm501_fb_routing {
  	SM501_FB_OWN		= 0,	/* CRT=>CRT, Panel=>Panel */
  	SM501_FB_CRT_PANEL	= 1,	/* Panel=>CRT, Panel=>Panel */
  };
  
  /* sm501_platdata_fb flag field bit definitions */
  
  #define SM501_FBPD_SWAP_FB_ENDIAN	(1<<0)	/* need to endian swap */
  
  /* sm501_platdata_fb
   *
   * configuration data for the framebuffer driver
  */
  
  struct sm501_platdata_fb {
  	enum sm501_fb_routing		 fb_route;
  	unsigned int			 flags;
  	struct sm501_platdata_fbsub	*fb_crt;
  	struct sm501_platdata_fbsub	*fb_pnl;
  };
42cd2366f   Ben Dooks   sm501: gpio I2C s...
86
87
88
89
90
91
  /* gpio i2c
   *
   * Note, we have to pass in the bus number, as the number used will be
   * passed to the i2c-gpio driver's platform_device.id, subsequently used
   * to register the i2c bus.
  */
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
92
93
  
  struct sm501_platdata_gpio_i2c {
42cd2366f   Ben Dooks   sm501: gpio I2C s...
94
  	unsigned int		bus_num;
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
95
96
  	unsigned int		pin_sda;
  	unsigned int		pin_scl;
42cd2366f   Ben Dooks   sm501: gpio I2C s...
97
98
  	int			udelay;
  	int			timeout;
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
  };
  
  /* sm501_initdata
   *
   * use for initialising values that may not have been setup
   * before the driver is loaded.
  */
  
  struct sm501_reg_init {
  	unsigned long		set;
  	unsigned long		mask;
  };
  
  #define SM501_USE_USB_HOST	(1<<0)
  #define SM501_USE_USB_SLAVE	(1<<1)
  #define SM501_USE_SSP0		(1<<2)
  #define SM501_USE_SSP1		(1<<3)
  #define SM501_USE_UART0		(1<<4)
  #define SM501_USE_UART1		(1<<5)
  #define SM501_USE_FBACCEL	(1<<6)
  #define SM501_USE_AC97		(1<<7)
  #define SM501_USE_I2S		(1<<8)
f61be273d   Ben Dooks   sm501: add gpioli...
121
  #define SM501_USE_GPIO		(1<<9)
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
  
  #define SM501_USE_ALL		(0xffffffff)
  
  struct sm501_initdata {
  	struct sm501_reg_init	gpio_low;
  	struct sm501_reg_init	gpio_high;
  	struct sm501_reg_init	misc_timing;
  	struct sm501_reg_init	misc_control;
  
  	unsigned long		devices;
  	unsigned long		mclk;		/* non-zero to modify */
  	unsigned long		m1xclk;		/* non-zero to modify */
  };
  
  /* sm501_init_gpio
   *
   * default gpio settings
  */
  
  struct sm501_init_gpio {
  	struct sm501_reg_init	gpio_data_low;
  	struct sm501_reg_init	gpio_data_high;
  	struct sm501_reg_init	gpio_ddr_low;
  	struct sm501_reg_init	gpio_ddr_high;
  };
472dba7d1   Ben Dooks   sm501: add power ...
147
  #define SM501_FLAG_SUSPEND_OFF		(1<<4)
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
148
149
150
151
152
153
154
155
156
157
158
159
  /* sm501_platdata
   *
   * This is passed with the platform device to allow the board
   * to control the behaviour of the SM501 driver(s) which attach
   * to the device.
   *
  */
  
  struct sm501_platdata {
  	struct sm501_initdata		*init;
  	struct sm501_init_gpio		*init_gpiop;
  	struct sm501_platdata_fb	*fb;
472dba7d1   Ben Dooks   sm501: add power ...
160
  	int				 flags;
60e540d61   Arnaud Patard   sm501: gpio dynam...
161
  	int				 gpio_base;
472dba7d1   Ben Dooks   sm501: add power ...
162
163
164
  
  	int	(*get_power)(struct device *dev);
  	int	(*set_power)(struct device *dev, unsigned int on);
b6d6454fd   Ben Dooks   [PATCH] mfd: SM50...
165
166
167
  	struct sm501_platdata_gpio_i2c	*gpio_i2c;
  	unsigned int			 gpio_i2c_nr;
  };
bf5f00190   Heiko Schocher   video, sm501: add...
168
169
170
171
172
173
174
175
  
  #if defined(CONFIG_PPC32)
  #define smc501_readl(addr)		ioread32be((addr))
  #define smc501_writel(val, addr)	iowrite32be((val), (addr))
  #else
  #define smc501_readl(addr)		readl(addr)
  #define smc501_writel(val, addr)	writel(val, addr)
  #endif