aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-mv64xxx.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-01-28 08:21:30 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-01-28 08:21:30 -0500
commitc00d4ffdbace1bdc9fdd888e4ba6d207ffa3b679 (patch)
tree2c9ddd5ae9cd899758b0785d4c7eb4bc200d66df /drivers/i2c/busses/i2c-mv64xxx.c
parentd0d42df2a440003d96c8bf29991c2afb691ef720 (diff)
parent8f86dda3ed8f05748f2351ae967926227a91ca2a (diff)
Merge branch 'orion' into devel
* orion: (26 commits) [ARM] Orion: implement power-off method for QNAP TS-109/209 [ARM] Orion: add support for QNAP TS-109/TS-209 [ARM] Orion: I2C support [I2C] i2c-mv64xxx: Don't set i2c_adapter.retries [I2C] Split mv643xx I2C platform support [ARM] Orion: enable CONFIG_RTC_DRV_M41T80 for D-Link DNS-323 [ARM] Orion defconfig [ARM] Orion: add support for Orion/MV88F5181 based D-Link DNS-323 [ARM] Orion: MV88F5181 support bits [ARM] Orion: Buffalo/Revogear Kurobox Pro support [ARM] OrionNAS RD board support [ARM] Orion: support for Marvell Orion-2 (88F5281) Development Board [ARM] Orion: common platform setup for Gigabit Ethernet port [ARM] Orion: platform device registration for UART, USB and NAND [ARM] Orion: system timer support [ARM] Orion edge GPIO IRQ support [ARM] Orion: IRQ support [ARM] Orion: provide GPIO method for enabling hardware assisted blinking [ARM] Orion: GPIO support [ARM] Orion: programable address map support ... Conflicts: arch/arm/Kconfig arch/arm/Makefile Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/i2c/busses/i2c-mv64xxx.c')
-rw-r--r--drivers/i2c/busses/i2c-mv64xxx.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index bb7bf68a7fb6..036e6a883e67 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Driver for the i2c controller on the Marvell line of host bridges for MIPS 2 * Driver for the i2c controller on the Marvell line of host bridges
3 * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0). 3 * (e.g, gt642[46]0, mv643[46]0, mv644[46]0, and Orion SoC family).
4 * 4 *
5 * Author: Mark A. Greer <mgreer@mvista.com> 5 * Author: Mark A. Greer <mgreer@mvista.com>
6 * 6 *
@@ -14,7 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/mv643xx.h> 17#include <linux/mv643xx_i2c.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19 19
20#include <asm/io.h> 20#include <asm/io.h>
@@ -86,6 +86,7 @@ struct mv64xxx_i2c_data {
86 u32 cntl_bits; 86 u32 cntl_bits;
87 void __iomem *reg_base; 87 void __iomem *reg_base;
88 u32 reg_base_p; 88 u32 reg_base_p;
89 u32 reg_size;
89 u32 addr1; 90 u32 addr1;
90 u32 addr2; 91 u32 addr2;
91 u32 bytes_left; 92 u32 bytes_left;
@@ -463,17 +464,20 @@ static int __devinit
463mv64xxx_i2c_map_regs(struct platform_device *pd, 464mv64xxx_i2c_map_regs(struct platform_device *pd,
464 struct mv64xxx_i2c_data *drv_data) 465 struct mv64xxx_i2c_data *drv_data)
465{ 466{
466 struct resource *r; 467 int size;
468 struct resource *r = platform_get_resource(pd, IORESOURCE_MEM, 0);
467 469
468 if ((r = platform_get_resource(pd, IORESOURCE_MEM, 0)) && 470 if (!r)
469 request_mem_region(r->start, MV64XXX_I2C_REG_BLOCK_SIZE, 471 return -ENODEV;
470 drv_data->adapter.name)) {
471 472
472 drv_data->reg_base = ioremap(r->start, 473 size = r->end - r->start + 1;
473 MV64XXX_I2C_REG_BLOCK_SIZE); 474
474 drv_data->reg_base_p = r->start; 475 if (!request_mem_region(r->start, size, drv_data->adapter.name))
475 } else 476 return -EBUSY;
476 return -ENOMEM; 477
478 drv_data->reg_base = ioremap(r->start, size);
479 drv_data->reg_base_p = r->start;
480 drv_data->reg_size = size;
477 481
478 return 0; 482 return 0;
479} 483}
@@ -483,8 +487,7 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
483{ 487{
484 if (drv_data->reg_base) { 488 if (drv_data->reg_base) {
485 iounmap(drv_data->reg_base); 489 iounmap(drv_data->reg_base);
486 release_mem_region(drv_data->reg_base_p, 490 release_mem_region(drv_data->reg_base_p, drv_data->reg_size);
487 MV64XXX_I2C_REG_BLOCK_SIZE);
488 } 491 }
489 492
490 drv_data->reg_base = NULL; 493 drv_data->reg_base = NULL;
@@ -529,7 +532,6 @@ mv64xxx_i2c_probe(struct platform_device *pd)
529 drv_data->adapter.owner = THIS_MODULE; 532 drv_data->adapter.owner = THIS_MODULE;
530 drv_data->adapter.class = I2C_CLASS_HWMON; 533 drv_data->adapter.class = I2C_CLASS_HWMON;
531 drv_data->adapter.timeout = pdata->timeout; 534 drv_data->adapter.timeout = pdata->timeout;
532 drv_data->adapter.retries = pdata->retries;
533 drv_data->adapter.nr = pd->id; 535 drv_data->adapter.nr = pd->id;
534 platform_set_drvdata(pd, drv_data); 536 platform_set_drvdata(pd, drv_data);
535 i2c_set_adapdata(&drv_data->adapter, drv_data); 537 i2c_set_adapdata(&drv_data->adapter, drv_data);