aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-iop3xx.c
diff options
context:
space:
mode:
authorRob Herring <rob.herring@calxeda.com>2012-07-04 15:14:16 -0400
committerRob Herring <rob.herring@calxeda.com>2012-07-25 10:26:40 -0400
commit67ac88ff10fa4253f716cb98ec43303f70711591 (patch)
treed5a5fb5dbb92b4f40cdecd2caf004237e16f6f38 /drivers/i2c/busses/i2c-iop3xx.c
parent84a1caf1453c3d44050bd22db958af4a7f99315c (diff)
i2c: iop3xx: clean-up trailing whitespace
Remove a bunch of trailing whitespace. No functional changes. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Cc: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org> Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org> Cc: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de> Cc: linux-i2c@vger.kernel.org
Diffstat (limited to 'drivers/i2c/busses/i2c-iop3xx.c')
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index 93f147a96b6..567d87389e3 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -4,13 +4,13 @@
4/* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd 4/* Copyright (C) 2003 Peter Milne, D-TACQ Solutions Ltd
5 * <Peter dot Milne at D hyphen TACQ dot com> 5 * <Peter dot Milne at D hyphen TACQ dot com>
6 * 6 *
7 * With acknowledgements to i2c-algo-ibm_ocp.c by 7 * With acknowledgements to i2c-algo-ibm_ocp.c by
8 * Ian DaSilva, MontaVista Software, Inc. idasilva@mvista.com 8 * Ian DaSilva, MontaVista Software, Inc. idasilva@mvista.com
9 * 9 *
10 * And i2c-algo-pcf.c, which was created by Simon G. Vogl and Hans Berglund: 10 * And i2c-algo-pcf.c, which was created by Simon G. Vogl and Hans Berglund:
11 * 11 *
12 * Copyright (C) 1995-1997 Simon G. Vogl, 1998-2000 Hans Berglund 12 * Copyright (C) 1995-1997 Simon G. Vogl, 1998-2000 Hans Berglund
13 * 13 *
14 * And which acknowledged Kyösti Mälkki <kmalkki@cc.hut.fi>, 14 * And which acknowledged Kyösti Mälkki <kmalkki@cc.hut.fi>,
15 * Frodo Looijaard <frodol@dds.nl>, Martin Bailey<mbailey@littlefeet-inc.com> 15 * Frodo Looijaard <frodol@dds.nl>, Martin Bailey<mbailey@littlefeet-inc.com>
16 * 16 *
@@ -45,8 +45,8 @@
45/* global unit counter */ 45/* global unit counter */
46static int i2c_id; 46static int i2c_id;
47 47
48static inline unsigned char 48static inline unsigned char
49iic_cook_addr(struct i2c_msg *msg) 49iic_cook_addr(struct i2c_msg *msg)
50{ 50{
51 unsigned char addr; 51 unsigned char addr;
52 52
@@ -55,24 +55,24 @@ iic_cook_addr(struct i2c_msg *msg)
55 if (msg->flags & I2C_M_RD) 55 if (msg->flags & I2C_M_RD)
56 addr |= 1; 56 addr |= 1;
57 57
58 return addr; 58 return addr;
59} 59}
60 60
61static void 61static void
62iop3xx_i2c_reset(struct i2c_algo_iop3xx_data *iop3xx_adap) 62iop3xx_i2c_reset(struct i2c_algo_iop3xx_data *iop3xx_adap)
63{ 63{
64 /* Follows devman 9.3 */ 64 /* Follows devman 9.3 */
65 __raw_writel(IOP3XX_ICR_UNIT_RESET, iop3xx_adap->ioaddr + CR_OFFSET); 65 __raw_writel(IOP3XX_ICR_UNIT_RESET, iop3xx_adap->ioaddr + CR_OFFSET);
66 __raw_writel(IOP3XX_ISR_CLEARBITS, iop3xx_adap->ioaddr + SR_OFFSET); 66 __raw_writel(IOP3XX_ISR_CLEARBITS, iop3xx_adap->ioaddr + SR_OFFSET);
67 __raw_writel(0, iop3xx_adap->ioaddr + CR_OFFSET); 67 __raw_writel(0, iop3xx_adap->ioaddr + CR_OFFSET);
68} 68}
69 69
70static void 70static void
71iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap) 71iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)
72{ 72{
73 u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE; 73 u32 cr = IOP3XX_ICR_GCD | IOP3XX_ICR_SCLEN | IOP3XX_ICR_UE;
74 74
75 /* 75 /*
76 * Every time unit enable is asserted, GPOD needs to be cleared 76 * Every time unit enable is asserted, GPOD needs to be cleared
77 * on IOP3XX to avoid data corruption on the bus. 77 * on IOP3XX to avoid data corruption on the bus.
78 */ 78 */
@@ -86,7 +86,7 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)
86 } 86 }
87#endif 87#endif
88 /* NB SR bits not same position as CR IE bits :-( */ 88 /* NB SR bits not same position as CR IE bits :-( */
89 iop3xx_adap->SR_enabled = 89 iop3xx_adap->SR_enabled =
90 IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD | 90 IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD |
91 IOP3XX_ISR_RXFULL | IOP3XX_ISR_TXEMPTY; 91 IOP3XX_ISR_RXFULL | IOP3XX_ISR_TXEMPTY;
92 92
@@ -96,23 +96,23 @@ iop3xx_i2c_enable(struct i2c_algo_iop3xx_data *iop3xx_adap)
96 __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET); 96 __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET);
97} 97}
98 98
99static void 99static void
100iop3xx_i2c_transaction_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap) 100iop3xx_i2c_transaction_cleanup(struct i2c_algo_iop3xx_data *iop3xx_adap)
101{ 101{
102 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); 102 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET);
103 103
104 cr &= ~(IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE | 104 cr &= ~(IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE |
105 IOP3XX_ICR_MSTOP | IOP3XX_ICR_SCLEN); 105 IOP3XX_ICR_MSTOP | IOP3XX_ICR_SCLEN);
106 106
107 __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET); 107 __raw_writel(cr, iop3xx_adap->ioaddr + CR_OFFSET);
108} 108}
109 109
110/* 110/*
111 * NB: the handler has to clear the source of the interrupt! 111 * NB: the handler has to clear the source of the interrupt!
112 * Then it passes the SR flags of interest to BH via adap data 112 * Then it passes the SR flags of interest to BH via adap data
113 */ 113 */
114static irqreturn_t 114static irqreturn_t
115iop3xx_i2c_irq_handler(int this_irq, void *dev_id) 115iop3xx_i2c_irq_handler(int this_irq, void *dev_id)
116{ 116{
117 struct i2c_algo_iop3xx_data *iop3xx_adap = dev_id; 117 struct i2c_algo_iop3xx_data *iop3xx_adap = dev_id;
118 u32 sr = __raw_readl(iop3xx_adap->ioaddr + SR_OFFSET); 118 u32 sr = __raw_readl(iop3xx_adap->ioaddr + SR_OFFSET);
@@ -126,7 +126,7 @@ iop3xx_i2c_irq_handler(int this_irq, void *dev_id)
126} 126}
127 127
128/* check all error conditions, clear them , report most important */ 128/* check all error conditions, clear them , report most important */
129static int 129static int
130iop3xx_i2c_error(u32 sr) 130iop3xx_i2c_error(u32 sr)
131{ 131{
132 int rc = 0; 132 int rc = 0;
@@ -135,12 +135,12 @@ iop3xx_i2c_error(u32 sr)
135 if ( !rc ) rc = -I2C_ERR_BERR; 135 if ( !rc ) rc = -I2C_ERR_BERR;
136 } 136 }
137 if ((sr & IOP3XX_ISR_ALD)) { 137 if ((sr & IOP3XX_ISR_ALD)) {
138 if ( !rc ) rc = -I2C_ERR_ALD; 138 if ( !rc ) rc = -I2C_ERR_ALD;
139 } 139 }
140 return rc; 140 return rc;
141} 141}
142 142
143static inline u32 143static inline u32
144iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap) 144iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap)
145{ 145{
146 unsigned long flags; 146 unsigned long flags;
@@ -161,8 +161,8 @@ iop3xx_i2c_get_srstat(struct i2c_algo_iop3xx_data *iop3xx_adap)
161typedef int (* compare_func)(unsigned test, unsigned mask); 161typedef int (* compare_func)(unsigned test, unsigned mask);
162/* returns 1 on correct comparison */ 162/* returns 1 on correct comparison */
163 163
164static int 164static int
165iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap, 165iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap,
166 unsigned flags, unsigned* status, 166 unsigned flags, unsigned* status,
167 compare_func compare) 167 compare_func compare)
168{ 168{
@@ -192,47 +192,47 @@ iop3xx_i2c_wait_event(struct i2c_algo_iop3xx_data *iop3xx_adap,
192} 192}
193 193
194/* 194/*
195 * Concrete compare_funcs 195 * Concrete compare_funcs
196 */ 196 */
197static int 197static int
198all_bits_clear(unsigned test, unsigned mask) 198all_bits_clear(unsigned test, unsigned mask)
199{ 199{
200 return (test & mask) == 0; 200 return (test & mask) == 0;
201} 201}
202 202
203static int 203static int
204any_bits_set(unsigned test, unsigned mask) 204any_bits_set(unsigned test, unsigned mask)
205{ 205{
206 return (test & mask) != 0; 206 return (test & mask) != 0;
207} 207}
208 208
209static int 209static int
210iop3xx_i2c_wait_tx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) 210iop3xx_i2c_wait_tx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status)
211{ 211{
212 return iop3xx_i2c_wait_event( 212 return iop3xx_i2c_wait_event(
213 iop3xx_adap, 213 iop3xx_adap,
214 IOP3XX_ISR_TXEMPTY | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD, 214 IOP3XX_ISR_TXEMPTY | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD,
215 status, any_bits_set); 215 status, any_bits_set);
216} 216}
217 217
218static int 218static int
219iop3xx_i2c_wait_rx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) 219iop3xx_i2c_wait_rx_done(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status)
220{ 220{
221 return iop3xx_i2c_wait_event( 221 return iop3xx_i2c_wait_event(
222 iop3xx_adap, 222 iop3xx_adap,
223 IOP3XX_ISR_RXFULL | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD, 223 IOP3XX_ISR_RXFULL | IOP3XX_ISR_ALD | IOP3XX_ISR_BERRD,
224 status, any_bits_set); 224 status, any_bits_set);
225} 225}
226 226
227static int 227static int
228iop3xx_i2c_wait_idle(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status) 228iop3xx_i2c_wait_idle(struct i2c_algo_iop3xx_data *iop3xx_adap, int *status)
229{ 229{
230 return iop3xx_i2c_wait_event( 230 return iop3xx_i2c_wait_event(
231 iop3xx_adap, IOP3XX_ISR_UNITBUSY, status, all_bits_clear); 231 iop3xx_adap, IOP3XX_ISR_UNITBUSY, status, all_bits_clear);
232} 232}
233 233
234static int 234static int
235iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap, 235iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap,
236 struct i2c_msg* msg) 236 struct i2c_msg* msg)
237{ 237{
238 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); 238 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET);
@@ -247,7 +247,7 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap,
247 } 247 }
248 248
249 __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET); 249 __raw_writel(iic_cook_addr(msg), iop3xx_adap->ioaddr + DBR_OFFSET);
250 250
251 cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK); 251 cr &= ~(IOP3XX_ICR_MSTOP | IOP3XX_ICR_NACK);
252 cr |= IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE; 252 cr |= IOP3XX_ICR_MSTART | IOP3XX_ICR_TBYTE;
253 253
@@ -257,8 +257,8 @@ iop3xx_i2c_send_target_addr(struct i2c_algo_iop3xx_data *iop3xx_adap,
257 return rc; 257 return rc;
258} 258}
259 259
260static int 260static int
261iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte, 261iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte,
262 int stop) 262 int stop)
263{ 263{
264 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); 264 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET);
@@ -277,10 +277,10 @@ iop3xx_i2c_write_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char byte,
277 rc = iop3xx_i2c_wait_tx_done(iop3xx_adap, &status); 277 rc = iop3xx_i2c_wait_tx_done(iop3xx_adap, &status);
278 278
279 return rc; 279 return rc;
280} 280}
281 281
282static int 282static int
283iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte, 283iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte,
284 int stop) 284 int stop)
285{ 285{
286 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET); 286 unsigned long cr = __raw_readl(iop3xx_adap->ioaddr + CR_OFFSET);
@@ -304,19 +304,19 @@ iop3xx_i2c_read_byte(struct i2c_algo_iop3xx_data *iop3xx_adap, char* byte,
304 return rc; 304 return rc;
305} 305}
306 306
307static int 307static int
308iop3xx_i2c_writebytes(struct i2c_adapter *i2c_adap, const char *buf, int count) 308iop3xx_i2c_writebytes(struct i2c_adapter *i2c_adap, const char *buf, int count)
309{ 309{
310 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; 310 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
311 int ii; 311 int ii;
312 int rc = 0; 312 int rc = 0;
313 313
314 for (ii = 0; rc == 0 && ii != count; ++ii) 314 for (ii = 0; rc == 0 && ii != count; ++ii)
315 rc = iop3xx_i2c_write_byte(iop3xx_adap, buf[ii], ii==count-1); 315 rc = iop3xx_i2c_write_byte(iop3xx_adap, buf[ii], ii==count-1);
316 return rc; 316 return rc;
317} 317}
318 318
319static int 319static int
320iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count) 320iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count)
321{ 321{
322 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; 322 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
@@ -325,7 +325,7 @@ iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count)
325 325
326 for (ii = 0; rc == 0 && ii != count; ++ii) 326 for (ii = 0; rc == 0 && ii != count; ++ii)
327 rc = iop3xx_i2c_read_byte(iop3xx_adap, &buf[ii], ii==count-1); 327 rc = iop3xx_i2c_read_byte(iop3xx_adap, &buf[ii], ii==count-1);
328 328
329 return rc; 329 return rc;
330} 330}
331 331
@@ -336,8 +336,8 @@ iop3xx_i2c_readbytes(struct i2c_adapter *i2c_adap, char *buf, int count)
336 * Each transfer (i.e. a read or a write) is separated by a repeated start 336 * Each transfer (i.e. a read or a write) is separated by a repeated start
337 * condition. 337 * condition.
338 */ 338 */
339static int 339static int
340iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg) 340iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg)
341{ 341{
342 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; 342 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
343 int rc; 343 int rc;
@@ -357,8 +357,8 @@ iop3xx_i2c_handle_msg(struct i2c_adapter *i2c_adap, struct i2c_msg* pmsg)
357/* 357/*
358 * master_xfer() - main read/write entry 358 * master_xfer() - main read/write entry
359 */ 359 */
360static int 360static int
361iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs, 361iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
362 int num) 362 int num)
363{ 363{
364 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data; 364 struct i2c_algo_iop3xx_data *iop3xx_adap = i2c_adap->algo_data;
@@ -375,14 +375,14 @@ iop3xx_i2c_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
375 } 375 }
376 376
377 iop3xx_i2c_transaction_cleanup(iop3xx_adap); 377 iop3xx_i2c_transaction_cleanup(iop3xx_adap);
378 378
379 if(ret) 379 if(ret)
380 return ret; 380 return ret;
381 381
382 return im; 382 return im;
383} 383}
384 384
385static u32 385static u32
386iop3xx_i2c_func(struct i2c_adapter *adap) 386iop3xx_i2c_func(struct i2c_adapter *adap)
387{ 387{
388 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 388 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
@@ -393,11 +393,11 @@ static const struct i2c_algorithm iop3xx_i2c_algo = {
393 .functionality = iop3xx_i2c_func, 393 .functionality = iop3xx_i2c_func,
394}; 394};
395 395
396static int 396static int
397iop3xx_i2c_remove(struct platform_device *pdev) 397iop3xx_i2c_remove(struct platform_device *pdev)
398{ 398{
399 struct i2c_adapter *padapter = platform_get_drvdata(pdev); 399 struct i2c_adapter *padapter = platform_get_drvdata(pdev);
400 struct i2c_algo_iop3xx_data *adapter_data = 400 struct i2c_algo_iop3xx_data *adapter_data =
401 (struct i2c_algo_iop3xx_data *)padapter->algo_data; 401 (struct i2c_algo_iop3xx_data *)padapter->algo_data;
402 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 402 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
403 unsigned long cr = __raw_readl(adapter_data->ioaddr + CR_OFFSET); 403 unsigned long cr = __raw_readl(adapter_data->ioaddr + CR_OFFSET);
@@ -419,7 +419,7 @@ iop3xx_i2c_remove(struct platform_device *pdev)
419 return 0; 419 return 0;
420} 420}
421 421
422static int 422static int
423iop3xx_i2c_probe(struct platform_device *pdev) 423iop3xx_i2c_probe(struct platform_device *pdev)
424{ 424{
425 struct resource *res; 425 struct resource *res;