diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-pnx.c')
-rw-r--r-- | drivers/i2c/busses/i2c-pnx.c | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index f8d0dff0de7e..1ca21084ffcf 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c | |||
@@ -76,7 +76,7 @@ static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | |||
76 | { | 76 | { |
77 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 77 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; |
78 | 78 | ||
79 | dev_dbg(&adap->dev, "%s(): addr 0x%x mode %d\n", __FUNCTION__, | 79 | dev_dbg(&adap->dev, "%s(): addr 0x%x mode %d\n", __func__, |
80 | slave_addr, alg_data->mif.mode); | 80 | slave_addr, alg_data->mif.mode); |
81 | 81 | ||
82 | /* Check for 7 bit slave addresses only */ | 82 | /* Check for 7 bit slave addresses only */ |
@@ -110,14 +110,14 @@ static int i2c_pnx_start(unsigned char slave_addr, struct i2c_adapter *adap) | |||
110 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, | 110 | iowrite32(ioread32(I2C_REG_STS(alg_data)) | mstatus_tdi | mstatus_afi, |
111 | I2C_REG_STS(alg_data)); | 111 | I2C_REG_STS(alg_data)); |
112 | 112 | ||
113 | dev_dbg(&adap->dev, "%s(): sending %#x\n", __FUNCTION__, | 113 | dev_dbg(&adap->dev, "%s(): sending %#x\n", __func__, |
114 | (slave_addr << 1) | start_bit | alg_data->mif.mode); | 114 | (slave_addr << 1) | start_bit | alg_data->mif.mode); |
115 | 115 | ||
116 | /* Write the slave address, START bit and R/W bit */ | 116 | /* Write the slave address, START bit and R/W bit */ |
117 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, | 117 | iowrite32((slave_addr << 1) | start_bit | alg_data->mif.mode, |
118 | I2C_REG_TX(alg_data)); | 118 | I2C_REG_TX(alg_data)); |
119 | 119 | ||
120 | dev_dbg(&adap->dev, "%s(): exit\n", __FUNCTION__); | 120 | dev_dbg(&adap->dev, "%s(): exit\n", __func__); |
121 | 121 | ||
122 | return 0; | 122 | return 0; |
123 | } | 123 | } |
@@ -135,7 +135,7 @@ static void i2c_pnx_stop(struct i2c_adapter *adap) | |||
135 | long timeout = 1000; | 135 | long timeout = 1000; |
136 | 136 | ||
137 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 137 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", |
138 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 138 | __func__, ioread32(I2C_REG_STS(alg_data))); |
139 | 139 | ||
140 | /* Write a STOP bit to TX FIFO */ | 140 | /* Write a STOP bit to TX FIFO */ |
141 | iowrite32(0xff | stop_bit, I2C_REG_TX(alg_data)); | 141 | iowrite32(0xff | stop_bit, I2C_REG_TX(alg_data)); |
@@ -149,7 +149,7 @@ static void i2c_pnx_stop(struct i2c_adapter *adap) | |||
149 | } | 149 | } |
150 | 150 | ||
151 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 151 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", |
152 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 152 | __func__, ioread32(I2C_REG_STS(alg_data))); |
153 | } | 153 | } |
154 | 154 | ||
155 | /** | 155 | /** |
@@ -164,7 +164,7 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
164 | u32 val; | 164 | u32 val; |
165 | 165 | ||
166 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 166 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", |
167 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 167 | __func__, ioread32(I2C_REG_STS(alg_data))); |
168 | 168 | ||
169 | if (alg_data->mif.len > 0) { | 169 | if (alg_data->mif.len > 0) { |
170 | /* We still have something to talk about... */ | 170 | /* We still have something to talk about... */ |
@@ -179,7 +179,7 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
179 | alg_data->mif.len--; | 179 | alg_data->mif.len--; |
180 | iowrite32(val, I2C_REG_TX(alg_data)); | 180 | iowrite32(val, I2C_REG_TX(alg_data)); |
181 | 181 | ||
182 | dev_dbg(&adap->dev, "%s(): xmit %#x [%d]\n", __FUNCTION__, | 182 | dev_dbg(&adap->dev, "%s(): xmit %#x [%d]\n", __func__, |
183 | val, alg_data->mif.len + 1); | 183 | val, alg_data->mif.len + 1); |
184 | 184 | ||
185 | if (alg_data->mif.len == 0) { | 185 | if (alg_data->mif.len == 0) { |
@@ -197,7 +197,7 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
197 | del_timer_sync(&alg_data->mif.timer); | 197 | del_timer_sync(&alg_data->mif.timer); |
198 | 198 | ||
199 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine.\n", | 199 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine.\n", |
200 | __FUNCTION__); | 200 | __func__); |
201 | 201 | ||
202 | complete(&alg_data->mif.complete); | 202 | complete(&alg_data->mif.complete); |
203 | } | 203 | } |
@@ -213,13 +213,13 @@ static int i2c_pnx_master_xmit(struct i2c_adapter *adap) | |||
213 | /* Stop timer. */ | 213 | /* Stop timer. */ |
214 | del_timer_sync(&alg_data->mif.timer); | 214 | del_timer_sync(&alg_data->mif.timer); |
215 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine after " | 215 | dev_dbg(&adap->dev, "%s(): Waking up xfer routine after " |
216 | "zero-xfer.\n", __FUNCTION__); | 216 | "zero-xfer.\n", __func__); |
217 | 217 | ||
218 | complete(&alg_data->mif.complete); | 218 | complete(&alg_data->mif.complete); |
219 | } | 219 | } |
220 | 220 | ||
221 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 221 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", |
222 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 222 | __func__, ioread32(I2C_REG_STS(alg_data))); |
223 | 223 | ||
224 | return 0; | 224 | return 0; |
225 | } | 225 | } |
@@ -237,14 +237,14 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
237 | u32 ctl = 0; | 237 | u32 ctl = 0; |
238 | 238 | ||
239 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", | 239 | dev_dbg(&adap->dev, "%s(): entering: stat = %04x.\n", |
240 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 240 | __func__, ioread32(I2C_REG_STS(alg_data))); |
241 | 241 | ||
242 | /* Check, whether there is already data, | 242 | /* Check, whether there is already data, |
243 | * or we didn't 'ask' for it yet. | 243 | * or we didn't 'ask' for it yet. |
244 | */ | 244 | */ |
245 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { | 245 | if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { |
246 | dev_dbg(&adap->dev, "%s(): Write dummy data to fill " | 246 | dev_dbg(&adap->dev, "%s(): Write dummy data to fill " |
247 | "Rx-fifo...\n", __FUNCTION__); | 247 | "Rx-fifo...\n", __func__); |
248 | 248 | ||
249 | if (alg_data->mif.len == 1) { | 249 | if (alg_data->mif.len == 1) { |
250 | /* Last byte, do not acknowledge next rcv. */ | 250 | /* Last byte, do not acknowledge next rcv. */ |
@@ -276,7 +276,7 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
276 | if (alg_data->mif.len > 0) { | 276 | if (alg_data->mif.len > 0) { |
277 | val = ioread32(I2C_REG_RX(alg_data)); | 277 | val = ioread32(I2C_REG_RX(alg_data)); |
278 | *alg_data->mif.buf++ = (u8) (val & 0xff); | 278 | *alg_data->mif.buf++ = (u8) (val & 0xff); |
279 | dev_dbg(&adap->dev, "%s(): rcv 0x%x [%d]\n", __FUNCTION__, val, | 279 | dev_dbg(&adap->dev, "%s(): rcv 0x%x [%d]\n", __func__, val, |
280 | alg_data->mif.len); | 280 | alg_data->mif.len); |
281 | 281 | ||
282 | alg_data->mif.len--; | 282 | alg_data->mif.len--; |
@@ -300,7 +300,7 @@ static int i2c_pnx_master_rcv(struct i2c_adapter *adap) | |||
300 | } | 300 | } |
301 | 301 | ||
302 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", | 302 | dev_dbg(&adap->dev, "%s(): exiting: stat = %04x.\n", |
303 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 303 | __func__, ioread32(I2C_REG_STS(alg_data))); |
304 | 304 | ||
305 | return 0; | 305 | return 0; |
306 | } | 306 | } |
@@ -312,7 +312,7 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
312 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; | 312 | struct i2c_pnx_algo_data *alg_data = adap->algo_data; |
313 | 313 | ||
314 | dev_dbg(&adap->dev, "%s(): mstat = %x mctrl = %x, mode = %d\n", | 314 | dev_dbg(&adap->dev, "%s(): mstat = %x mctrl = %x, mode = %d\n", |
315 | __FUNCTION__, | 315 | __func__, |
316 | ioread32(I2C_REG_STS(alg_data)), | 316 | ioread32(I2C_REG_STS(alg_data)), |
317 | ioread32(I2C_REG_CTL(alg_data)), | 317 | ioread32(I2C_REG_CTL(alg_data)), |
318 | alg_data->mif.mode); | 318 | alg_data->mif.mode); |
@@ -336,7 +336,7 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
336 | /* Slave did not acknowledge, generate a STOP */ | 336 | /* Slave did not acknowledge, generate a STOP */ |
337 | dev_dbg(&adap->dev, "%s(): " | 337 | dev_dbg(&adap->dev, "%s(): " |
338 | "Slave did not acknowledge, generating a STOP.\n", | 338 | "Slave did not acknowledge, generating a STOP.\n", |
339 | __FUNCTION__); | 339 | __func__); |
340 | i2c_pnx_stop(adap); | 340 | i2c_pnx_stop(adap); |
341 | 341 | ||
342 | /* Disable master interrupts. */ | 342 | /* Disable master interrupts. */ |
@@ -375,7 +375,7 @@ static irqreturn_t i2c_pnx_interrupt(int irq, void *dev_id) | |||
375 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); | 375 | iowrite32(stat | mstatus_tdi | mstatus_afi, I2C_REG_STS(alg_data)); |
376 | 376 | ||
377 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x ctrl = %x.\n", | 377 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x ctrl = %x.\n", |
378 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data)), | 378 | __func__, ioread32(I2C_REG_STS(alg_data)), |
379 | ioread32(I2C_REG_CTL(alg_data))); | 379 | ioread32(I2C_REG_CTL(alg_data))); |
380 | 380 | ||
381 | return IRQ_HANDLED; | 381 | return IRQ_HANDLED; |
@@ -447,7 +447,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
447 | u32 stat = ioread32(I2C_REG_STS(alg_data)); | 447 | u32 stat = ioread32(I2C_REG_STS(alg_data)); |
448 | 448 | ||
449 | dev_dbg(&adap->dev, "%s(): entering: %d messages, stat = %04x.\n", | 449 | dev_dbg(&adap->dev, "%s(): entering: %d messages, stat = %04x.\n", |
450 | __FUNCTION__, num, ioread32(I2C_REG_STS(alg_data))); | 450 | __func__, num, ioread32(I2C_REG_STS(alg_data))); |
451 | 451 | ||
452 | bus_reset_if_active(adap); | 452 | bus_reset_if_active(adap); |
453 | 453 | ||
@@ -473,7 +473,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
473 | alg_data->mif.ret = 0; | 473 | alg_data->mif.ret = 0; |
474 | alg_data->last = (i == num - 1); | 474 | alg_data->last = (i == num - 1); |
475 | 475 | ||
476 | dev_dbg(&adap->dev, "%s(): mode %d, %d bytes\n", __FUNCTION__, | 476 | dev_dbg(&adap->dev, "%s(): mode %d, %d bytes\n", __func__, |
477 | alg_data->mif.mode, | 477 | alg_data->mif.mode, |
478 | alg_data->mif.len); | 478 | alg_data->mif.len); |
479 | 479 | ||
@@ -498,7 +498,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
498 | if (!(rc = alg_data->mif.ret)) | 498 | if (!(rc = alg_data->mif.ret)) |
499 | completed++; | 499 | completed++; |
500 | dev_dbg(&adap->dev, "%s(): Complete, return code = %d.\n", | 500 | dev_dbg(&adap->dev, "%s(): Complete, return code = %d.\n", |
501 | __FUNCTION__, rc); | 501 | __func__, rc); |
502 | 502 | ||
503 | /* Clear TDI and AFI bits in case they are set. */ | 503 | /* Clear TDI and AFI bits in case they are set. */ |
504 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { | 504 | if ((stat = ioread32(I2C_REG_STS(alg_data))) & mstatus_tdi) { |
@@ -522,7 +522,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) | |||
522 | alg_data->mif.len = 0; | 522 | alg_data->mif.len = 0; |
523 | 523 | ||
524 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x\n", | 524 | dev_dbg(&adap->dev, "%s(): exiting, stat = %x\n", |
525 | __FUNCTION__, ioread32(I2C_REG_STS(alg_data))); | 525 | __func__, ioread32(I2C_REG_STS(alg_data))); |
526 | 526 | ||
527 | if (completed != num) | 527 | if (completed != num) |
528 | return ((rc < 0) ? rc : -EREMOTEIO); | 528 | return ((rc < 0) ? rc : -EREMOTEIO); |
@@ -563,7 +563,7 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) | |||
563 | 563 | ||
564 | if (!i2c_pnx || !i2c_pnx->adapter) { | 564 | if (!i2c_pnx || !i2c_pnx->adapter) { |
565 | dev_err(&pdev->dev, "%s: no platform data supplied\n", | 565 | dev_err(&pdev->dev, "%s: no platform data supplied\n", |
566 | __FUNCTION__); | 566 | __func__); |
567 | ret = -EINVAL; | 567 | ret = -EINVAL; |
568 | goto out; | 568 | goto out; |
569 | } | 569 | } |
@@ -697,6 +697,7 @@ static void __exit i2c_adap_pnx_exit(void) | |||
697 | MODULE_AUTHOR("Vitaly Wool, Dennis Kovalev <source@mvista.com>"); | 697 | MODULE_AUTHOR("Vitaly Wool, Dennis Kovalev <source@mvista.com>"); |
698 | MODULE_DESCRIPTION("I2C driver for Philips IP3204-based I2C busses"); | 698 | MODULE_DESCRIPTION("I2C driver for Philips IP3204-based I2C busses"); |
699 | MODULE_LICENSE("GPL"); | 699 | MODULE_LICENSE("GPL"); |
700 | MODULE_ALIAS("platform:pnx-i2c"); | ||
700 | 701 | ||
701 | /* We need to make sure I2C is initialized before USB */ | 702 | /* We need to make sure I2C is initialized before USB */ |
702 | subsys_initcall(i2c_adap_pnx_init); | 703 | subsys_initcall(i2c_adap_pnx_init); |