diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-12 14:21:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-12 14:21:51 -0400 |
commit | 816dc3c82b34f709dc1c29ea0a6f417d739a3487 (patch) | |
tree | bcb85e4446195215f0ad4511956b0770383d501d /drivers | |
parent | 3b4334e200ba50cd02e53b122ef56214b170ea23 (diff) | |
parent | 36521c271e5f93b249329ee7f321d27825970e31 (diff) |
Merge branch 'i2c-for-2630-rc5' of git://aeryn.fluff.org.uk/bjdooks/linux
* 'i2c-for-2630-rc5' of git://aeryn.fluff.org.uk/bjdooks/linux:
i2c-cpm: Pass dev ptr to dma_*_coherent rather than NULL
i2c: Enable i2c-s3c2410 for S3C64XX too
i2c-mpc: bug fix for MPC52xx clock setting and printout
i2c-pxa.c: timeouts off by 1
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/Kconfig | 2 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-cpm.c | 16 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 34 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 6 |
4 files changed, 32 insertions, 26 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index a48c8aee0218..f1c6ca7e2852 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -467,7 +467,7 @@ config I2C_PXA_SLAVE | |||
467 | 467 | ||
468 | config I2C_S3C2410 | 468 | config I2C_S3C2410 |
469 | tristate "S3C2410 I2C Driver" | 469 | tristate "S3C2410 I2C Driver" |
470 | depends on ARCH_S3C2410 | 470 | depends on ARCH_S3C2410 || ARCH_S3C64XX |
471 | help | 471 | help |
472 | Say Y here to include support for I2C controller in the | 472 | Say Y here to include support for I2C controller in the |
473 | Samsung S3C2410 based System-on-Chip devices. | 473 | Samsung S3C2410 based System-on-Chip devices. |
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 3fcf78e906db..b5db8b883615 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -531,16 +531,16 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
531 | rbdf = cpm->rbase; | 531 | rbdf = cpm->rbase; |
532 | 532 | ||
533 | for (i = 0; i < CPM_MAXBD; i++) { | 533 | for (i = 0; i < CPM_MAXBD; i++) { |
534 | cpm->rxbuf[i] = dma_alloc_coherent( | 534 | cpm->rxbuf[i] = dma_alloc_coherent(&cpm->ofdev->dev, |
535 | NULL, CPM_MAX_READ + 1, &cpm->rxdma[i], GFP_KERNEL); | 535 | CPM_MAX_READ + 1, |
536 | &cpm->rxdma[i], GFP_KERNEL); | ||
536 | if (!cpm->rxbuf[i]) { | 537 | if (!cpm->rxbuf[i]) { |
537 | ret = -ENOMEM; | 538 | ret = -ENOMEM; |
538 | goto out_muram; | 539 | goto out_muram; |
539 | } | 540 | } |
540 | out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1)); | 541 | out_be32(&rbdf[i].cbd_bufaddr, ((cpm->rxdma[i] + 1) & ~1)); |
541 | 542 | ||
542 | cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent( | 543 | cpm->txbuf[i] = (unsigned char *)dma_alloc_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL); |
543 | NULL, CPM_MAX_READ + 1, &cpm->txdma[i], GFP_KERNEL); | ||
544 | if (!cpm->txbuf[i]) { | 544 | if (!cpm->txbuf[i]) { |
545 | ret = -ENOMEM; | 545 | ret = -ENOMEM; |
546 | goto out_muram; | 546 | goto out_muram; |
@@ -585,10 +585,10 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
585 | out_muram: | 585 | out_muram: |
586 | for (i = 0; i < CPM_MAXBD; i++) { | 586 | for (i = 0; i < CPM_MAXBD; i++) { |
587 | if (cpm->rxbuf[i]) | 587 | if (cpm->rxbuf[i]) |
588 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 588 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
589 | cpm->rxbuf[i], cpm->rxdma[i]); | 589 | cpm->rxbuf[i], cpm->rxdma[i]); |
590 | if (cpm->txbuf[i]) | 590 | if (cpm->txbuf[i]) |
591 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 591 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
592 | cpm->txbuf[i], cpm->txdma[i]); | 592 | cpm->txbuf[i], cpm->txdma[i]); |
593 | } | 593 | } |
594 | cpm_muram_free(cpm->dp_addr); | 594 | cpm_muram_free(cpm->dp_addr); |
@@ -619,9 +619,9 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm) | |||
619 | 619 | ||
620 | /* Free all memory */ | 620 | /* Free all memory */ |
621 | for (i = 0; i < CPM_MAXBD; i++) { | 621 | for (i = 0; i < CPM_MAXBD; i++) { |
622 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 622 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
623 | cpm->rxbuf[i], cpm->rxdma[i]); | 623 | cpm->rxbuf[i], cpm->rxdma[i]); |
624 | dma_free_coherent(NULL, CPM_MAX_READ + 1, | 624 | dma_free_coherent(&cpm->ofdev->dev, CPM_MAX_READ + 1, |
625 | cpm->txbuf[i], cpm->txdma[i]); | 625 | cpm->txbuf[i], cpm->txdma[i]); |
626 | } | 626 | } |
627 | 627 | ||
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 4af5c09f0e8f..dd778d7ae047 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -164,7 +164,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing) | |||
164 | return 0; | 164 | return 0; |
165 | } | 165 | } |
166 | 166 | ||
167 | #ifdef CONFIG_PPC_52xx | 167 | #ifdef CONFIG_PPC_MPC52xx |
168 | static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { | 168 | static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { |
169 | {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, | 169 | {20, 0x20}, {22, 0x21}, {24, 0x22}, {26, 0x23}, |
170 | {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, | 170 | {28, 0x24}, {30, 0x01}, {32, 0x25}, {34, 0x02}, |
@@ -188,7 +188,7 @@ static const struct mpc_i2c_divider mpc_i2c_dividers_52xx[] = { | |||
188 | 188 | ||
189 | int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) | 189 | int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) |
190 | { | 190 | { |
191 | const struct mpc52xx_i2c_divider *div = NULL; | 191 | const struct mpc_i2c_divider *div = NULL; |
192 | unsigned int pvr = mfspr(SPRN_PVR); | 192 | unsigned int pvr = mfspr(SPRN_PVR); |
193 | u32 divider; | 193 | u32 divider; |
194 | int i; | 194 | int i; |
@@ -203,7 +203,7 @@ int mpc_i2c_get_fdr_52xx(struct device_node *node, u32 clock, int prescaler) | |||
203 | * We want to choose an FDR/DFSR that generates an I2C bus speed that | 203 | * We want to choose an FDR/DFSR that generates an I2C bus speed that |
204 | * is equal to or lower than the requested speed. | 204 | * is equal to or lower than the requested speed. |
205 | */ | 205 | */ |
206 | for (i = 0; i < ARRAY_SIZE(mpc52xx_i2c_dividers); i++) { | 206 | for (i = 0; i < ARRAY_SIZE(mpc_i2c_dividers_52xx); i++) { |
207 | div = &mpc_i2c_dividers_52xx[i]; | 207 | div = &mpc_i2c_dividers_52xx[i]; |
208 | /* Old MPC5200 rev A CPUs do not support the high bits */ | 208 | /* Old MPC5200 rev A CPUs do not support the high bits */ |
209 | if (div->fdr & 0xc0 && pvr == 0x80822011) | 209 | if (div->fdr & 0xc0 && pvr == 0x80822011) |
@@ -219,20 +219,23 @@ static void mpc_i2c_setclock_52xx(struct device_node *node, | |||
219 | struct mpc_i2c *i2c, | 219 | struct mpc_i2c *i2c, |
220 | u32 clock, u32 prescaler) | 220 | u32 clock, u32 prescaler) |
221 | { | 221 | { |
222 | int fdr = mpc52xx_i2c_get_fdr(node, clock, prescaler); | 222 | int ret, fdr; |
223 | |||
224 | ret = mpc_i2c_get_fdr_52xx(node, clock, prescaler); | ||
225 | fdr = (ret >= 0) ? ret : 0x3f; /* backward compatibility */ | ||
223 | 226 | ||
224 | if (fdr < 0) | ||
225 | fdr = 0x3f; /* backward compatibility */ | ||
226 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); | 227 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); |
227 | dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr); | 228 | |
229 | if (ret >= 0) | ||
230 | dev_info(i2c->dev, "clock %d Hz (fdr=%d)\n", clock, fdr); | ||
228 | } | 231 | } |
229 | #else /* !CONFIG_PPC_52xx */ | 232 | #else /* !CONFIG_PPC_MPC52xx */ |
230 | static void mpc_i2c_setclock_52xx(struct device_node *node, | 233 | static void mpc_i2c_setclock_52xx(struct device_node *node, |
231 | struct mpc_i2c *i2c, | 234 | struct mpc_i2c *i2c, |
232 | u32 clock, u32 prescaler) | 235 | u32 clock, u32 prescaler) |
233 | { | 236 | { |
234 | } | 237 | } |
235 | #endif /* CONFIG_PPC_52xx*/ | 238 | #endif /* CONFIG_PPC_MPC52xx*/ |
236 | 239 | ||
237 | #ifdef CONFIG_FSL_SOC | 240 | #ifdef CONFIG_FSL_SOC |
238 | static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = { | 241 | static const struct mpc_i2c_divider mpc_i2c_dividers_8xxx[] = { |
@@ -321,14 +324,17 @@ static void mpc_i2c_setclock_8xxx(struct device_node *node, | |||
321 | struct mpc_i2c *i2c, | 324 | struct mpc_i2c *i2c, |
322 | u32 clock, u32 prescaler) | 325 | u32 clock, u32 prescaler) |
323 | { | 326 | { |
324 | int fdr = mpc_i2c_get_fdr_8xxx(node, clock, prescaler); | 327 | int ret, fdr; |
328 | |||
329 | ret = mpc_i2c_get_fdr_8xxx(node, clock, prescaler); | ||
330 | fdr = (ret >= 0) ? ret : 0x1031; /* backward compatibility */ | ||
325 | 331 | ||
326 | if (fdr < 0) | ||
327 | fdr = 0x1031; /* backward compatibility */ | ||
328 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); | 332 | writeb(fdr & 0xff, i2c->base + MPC_I2C_FDR); |
329 | writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR); | 333 | writeb((fdr >> 8) & 0xff, i2c->base + MPC_I2C_DFSRR); |
330 | dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n", | 334 | |
331 | clock, fdr >> 8, fdr & 0xff); | 335 | if (ret >= 0) |
336 | dev_info(i2c->dev, "clock %d Hz (dfsrr=%d fdr=%d)\n", | ||
337 | clock, fdr >> 8, fdr & 0xff); | ||
332 | } | 338 | } |
333 | 339 | ||
334 | #else /* !CONFIG_FSL_SOC */ | 340 | #else /* !CONFIG_FSL_SOC */ |
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index c1405c8f6ba5..acc7143d9655 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -265,10 +265,10 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c) | |||
265 | show_state(i2c); | 265 | show_state(i2c); |
266 | } | 266 | } |
267 | 267 | ||
268 | if (timeout <= 0) | 268 | if (timeout < 0) |
269 | show_state(i2c); | 269 | show_state(i2c); |
270 | 270 | ||
271 | return timeout <= 0 ? I2C_RETRY : 0; | 271 | return timeout < 0 ? I2C_RETRY : 0; |
272 | } | 272 | } |
273 | 273 | ||
274 | static int i2c_pxa_wait_master(struct pxa_i2c *i2c) | 274 | static int i2c_pxa_wait_master(struct pxa_i2c *i2c) |
@@ -612,7 +612,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c) | |||
612 | show_state(i2c); | 612 | show_state(i2c); |
613 | } | 613 | } |
614 | 614 | ||
615 | if (timeout <= 0) { | 615 | if (timeout < 0) { |
616 | show_state(i2c); | 616 | show_state(i2c); |
617 | dev_err(&i2c->adap.dev, | 617 | dev_err(&i2c->adap.dev, |
618 | "i2c_pxa: timeout waiting for bus free\n"); | 618 | "i2c_pxa: timeout waiting for bus free\n"); |