Commit 65795efb authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'next-i2c' of git://aeryn.fluff.org.uk/bjdooks/linux

* 'next-i2c' of git://aeryn.fluff.org.uk/bjdooks/linux:
  i2c-stu300: Make driver depend on MACH_U300
  i2c-s3c2410: use resource_size()
  i2c: Use resource_size macro
  i2c: ST DDC I2C U300 bus driver v3
  i2c-bfin-twi: pull in io.h for ioremap()
parents 8d15b0ec 4eaad8ad
...@@ -513,6 +513,19 @@ config I2C_SIMTEC ...@@ -513,6 +513,19 @@ config I2C_SIMTEC
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called i2c-simtec. will be called i2c-simtec.
config I2C_STU300
tristate "ST Microelectronics DDC I2C interface"
depends on MACH_U300
default y if MACH_U300
help
If you say yes to this option, support will be included for the
I2C interface from ST Microelectronics simply called "DDC I2C"
supporting both I2C and DDC, used in e.g. the U300 series
mobile platforms.
This driver can also be built as a module. If so, the module
will be called i2c-stu300.
config I2C_VERSATILE config I2C_VERSATILE
tristate "ARM Versatile/Realview I2C bus support" tristate "ARM Versatile/Realview I2C bus support"
depends on ARCH_VERSATILE || ARCH_REALVIEW depends on ARCH_VERSATILE || ARCH_REALVIEW
......
...@@ -48,6 +48,7 @@ obj-$(CONFIG_I2C_S6000) += i2c-s6000.o ...@@ -48,6 +48,7 @@ obj-$(CONFIG_I2C_S6000) += i2c-s6000.o
obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o obj-$(CONFIG_I2C_SH7760) += i2c-sh7760.o
obj-$(CONFIG_I2C_SH_MOBILE) += i2c-sh_mobile.o obj-$(CONFIG_I2C_SH_MOBILE) += i2c-sh_mobile.o
obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o obj-$(CONFIG_I2C_SIMTEC) += i2c-simtec.o
obj-$(CONFIG_I2C_STU300) += i2c-stu300.o
obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o obj-$(CONFIG_I2C_VERSATILE) += i2c-versatile.o
# External I2C/SMBus adapter drivers # External I2C/SMBus adapter drivers
......
...@@ -200,10 +200,10 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev) ...@@ -200,10 +200,10 @@ static int __devinit at91_i2c_probe(struct platform_device *pdev)
if (!res) if (!res)
return -ENXIO; return -ENXIO;
if (!request_mem_region(res->start, res->end - res->start + 1, "at91_i2c")) if (!request_mem_region(res->start, resource_size(res), "at91_i2c"))
return -EBUSY; return -EBUSY;
twi_base = ioremap(res->start, res->end - res->start + 1); twi_base = ioremap(res->start, resource_size(res));
if (!twi_base) { if (!twi_base) {
rc = -ENOMEM; rc = -ENOMEM;
goto fail0; goto fail0;
...@@ -252,7 +252,7 @@ fail2: ...@@ -252,7 +252,7 @@ fail2:
fail1: fail1:
iounmap(twi_base); iounmap(twi_base);
fail0: fail0:
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
return rc; return rc;
} }
...@@ -268,7 +268,7 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev) ...@@ -268,7 +268,7 @@ static int __devexit at91_i2c_remove(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iounmap(twi_base); iounmap(twi_base);
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
clk_disable(twi_clk); /* disable peripheral clock */ clk_disable(twi_clk); /* disable peripheral clock */
clk_put(twi_clk); clk_put(twi_clk);
......
...@@ -389,7 +389,7 @@ i2c_au1550_probe(struct platform_device *pdev) ...@@ -389,7 +389,7 @@ i2c_au1550_probe(struct platform_device *pdev)
goto out; goto out;
} }
priv->ioarea = request_mem_region(r->start, r->end - r->start + 1, priv->ioarea = request_mem_region(r->start, resource_size(r),
pdev->name); pdev->name);
if (!priv->ioarea) { if (!priv->ioarea) {
ret = -EBUSY; ret = -EBUSY;
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/io.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
...@@ -651,7 +652,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) ...@@ -651,7 +652,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
goto out_error_get_res; goto out_error_get_res;
} }
iface->regs_base = ioremap(res->start, res->end - res->start + 1); iface->regs_base = ioremap(res->start, resource_size(res));
if (iface->regs_base == NULL) { if (iface->regs_base == NULL) {
dev_err(&pdev->dev, "Cannot map IO\n"); dev_err(&pdev->dev, "Cannot map IO\n");
rc = -ENXIO; rc = -ENXIO;
......
...@@ -373,7 +373,7 @@ static int __devinit highlander_i2c_probe(struct platform_device *pdev) ...@@ -373,7 +373,7 @@ static int __devinit highlander_i2c_probe(struct platform_device *pdev)
if (unlikely(!dev)) if (unlikely(!dev))
return -ENOMEM; return -ENOMEM;
dev->base = ioremap_nocache(res->start, res->end - res->start + 1); dev->base = ioremap_nocache(res->start, resource_size(res));
if (unlikely(!dev->base)) { if (unlikely(!dev->base)) {
ret = -ENXIO; ret = -ENXIO;
goto err; goto err;
......
...@@ -469,7 +469,7 @@ mv64xxx_i2c_map_regs(struct platform_device *pd, ...@@ -469,7 +469,7 @@ mv64xxx_i2c_map_regs(struct platform_device *pd,
if (!r) if (!r)
return -ENODEV; return -ENODEV;
size = r->end - r->start + 1; size = resource_size(r);
if (!request_mem_region(r->start, size, drv_data->adapter.name)) if (!request_mem_region(r->start, size, drv_data->adapter.name))
return -EBUSY; return -EBUSY;
......
...@@ -234,14 +234,14 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev) ...@@ -234,14 +234,14 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
if (!i2c) if (!i2c)
return -ENOMEM; return -ENOMEM;
if (!request_mem_region(res->start, res->end - res->start + 1, if (!request_mem_region(res->start, resource_size(res),
pdev->name)) { pdev->name)) {
dev_err(&pdev->dev, "Memory region busy\n"); dev_err(&pdev->dev, "Memory region busy\n");
ret = -EBUSY; ret = -EBUSY;
goto request_mem_failed; goto request_mem_failed;
} }
i2c->base = ioremap(res->start, res->end - res->start + 1); i2c->base = ioremap(res->start, resource_size(res));
if (!i2c->base) { if (!i2c->base) {
dev_err(&pdev->dev, "Unable to map registers\n"); dev_err(&pdev->dev, "Unable to map registers\n");
ret = -EIO; ret = -EIO;
...@@ -283,7 +283,7 @@ add_adapter_failed: ...@@ -283,7 +283,7 @@ add_adapter_failed:
request_irq_failed: request_irq_failed:
iounmap(i2c->base); iounmap(i2c->base);
map_failed: map_failed:
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
request_mem_failed: request_mem_failed:
kfree(i2c); kfree(i2c);
...@@ -311,7 +311,7 @@ static int __devexit ocores_i2c_remove(struct platform_device* pdev) ...@@ -311,7 +311,7 @@ static int __devexit ocores_i2c_remove(struct platform_device* pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res) if (res)
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
kfree(i2c); kfree(i2c);
......
...@@ -828,7 +828,7 @@ omap_i2c_probe(struct platform_device *pdev) ...@@ -828,7 +828,7 @@ omap_i2c_probe(struct platform_device *pdev)
dev->idle = 1; dev->idle = 1;
dev->dev = &pdev->dev; dev->dev = &pdev->dev;
dev->irq = irq->start; dev->irq = irq->start;
dev->base = ioremap(mem->start, mem->end - mem->start + 1); dev->base = ioremap(mem->start, resource_size(mem));
if (!dev->base) { if (!dev->base) {
r = -ENOMEM; r = -ENOMEM;
goto err_free_mem; goto err_free_mem;
......
...@@ -27,8 +27,6 @@ ...@@ -27,8 +27,6 @@
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/io.h> #include <asm/io.h>
#define res_len(r) ((r)->end - (r)->start + 1)
struct i2c_pca_pf_data { struct i2c_pca_pf_data {
void __iomem *reg_base; void __iomem *reg_base;
int irq; /* if 0, use polling */ int irq; /* if 0, use polling */
...@@ -148,7 +146,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) ...@@ -148,7 +146,7 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev)
goto e_print; goto e_print;
} }
if (!request_mem_region(res->start, res_len(res), res->name)) { if (!request_mem_region(res->start, resource_size(res), res->name)) {
ret = -ENOMEM; ret = -ENOMEM;
goto e_print; goto e_print;
} }
...@@ -161,13 +159,13 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) ...@@ -161,13 +159,13 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev)
init_waitqueue_head(&i2c->wait); init_waitqueue_head(&i2c->wait);
i2c->reg_base = ioremap(res->start, res_len(res)); i2c->reg_base = ioremap(res->start, resource_size(res));
if (!i2c->reg_base) { if (!i2c->reg_base) {
ret = -ENOMEM; ret = -ENOMEM;
goto e_remap; goto e_remap;
} }
i2c->io_base = res->start; i2c->io_base = res->start;
i2c->io_size = res_len(res); i2c->io_size = resource_size(res);
i2c->irq = irq; i2c->irq = irq;
i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0; i2c->adap.nr = pdev->id >= 0 ? pdev->id : 0;
...@@ -250,7 +248,7 @@ e_reqirq: ...@@ -250,7 +248,7 @@ e_reqirq:
e_remap: e_remap:
kfree(i2c); kfree(i2c);
e_alloc: e_alloc:
release_mem_region(res->start, res_len(res)); release_mem_region(res->start, resource_size(res));
e_print: e_print:
printk(KERN_ERR "Registering PCA9564/PCA9665 FAILED! (%d)\n", ret); printk(KERN_ERR "Registering PCA9564/PCA9665 FAILED! (%d)\n", ret);
return ret; return ret;
......
...@@ -283,7 +283,7 @@ static int __devinit pmcmsptwi_probe(struct platform_device *pldev) ...@@ -283,7 +283,7 @@ static int __devinit pmcmsptwi_probe(struct platform_device *pldev)
} }
/* reserve the memory region */ /* reserve the memory region */
if (!request_mem_region(res->start, res->end - res->start + 1, if (!request_mem_region(res->start, resource_size(res),
pldev->name)) { pldev->name)) {
dev_err(&pldev->dev, dev_err(&pldev->dev,
"Unable to get memory/io address region 0x%08x\n", "Unable to get memory/io address region 0x%08x\n",
...@@ -294,7 +294,7 @@ static int __devinit pmcmsptwi_probe(struct platform_device *pldev) ...@@ -294,7 +294,7 @@ static int __devinit pmcmsptwi_probe(struct platform_device *pldev)
/* remap the memory */ /* remap the memory */
pmcmsptwi_data.iobase = ioremap_nocache(res->start, pmcmsptwi_data.iobase = ioremap_nocache(res->start,
res->end - res->start + 1); resource_size(res));
if (!pmcmsptwi_data.iobase) { if (!pmcmsptwi_data.iobase) {
dev_err(&pldev->dev, dev_err(&pldev->dev,
"Unable to ioremap address 0x%08x\n", res->start); "Unable to ioremap address 0x%08x\n", res->start);
...@@ -360,7 +360,7 @@ ret_unmap: ...@@ -360,7 +360,7 @@ ret_unmap:
iounmap(pmcmsptwi_data.iobase); iounmap(pmcmsptwi_data.iobase);
ret_unreserve: ret_unreserve:
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
ret_err: ret_err:
return rc; return rc;
...@@ -385,7 +385,7 @@ static int __devexit pmcmsptwi_remove(struct platform_device *pldev) ...@@ -385,7 +385,7 @@ static int __devexit pmcmsptwi_remove(struct platform_device *pldev)
iounmap(pmcmsptwi_data.iobase); iounmap(pmcmsptwi_data.iobase);
res = platform_get_resource(pldev, IORESOURCE_MEM, 0); res = platform_get_resource(pldev, IORESOURCE_MEM, 0);
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, resource_size(res));
return 0; return 0;
} }
......
...@@ -993,7 +993,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = { ...@@ -993,7 +993,6 @@ static const struct i2c_algorithm i2c_pxa_pio_algorithm = {
.functionality = i2c_pxa_functionality, .functionality = i2c_pxa_functionality,
}; };
#define res_len(r) ((r)->end - (r)->start + 1)
static int i2c_pxa_probe(struct platform_device *dev) static int i2c_pxa_probe(struct platform_device *dev)
{ {
struct pxa_i2c *i2c; struct pxa_i2c *i2c;
...@@ -1008,7 +1007,7 @@ static int i2c_pxa_probe(struct platform_device *dev) ...@@ -1008,7 +1007,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
if (res == NULL || irq < 0) if (res == NULL || irq < 0)
return -ENODEV; return -ENODEV;
if (!request_mem_region(res->start, res_len(res), res->name)) if (!request_mem_region(res->start, resource_size(res), res->name))
return -ENOMEM; return -ENOMEM;
i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL); i2c = kzalloc(sizeof(struct pxa_i2c), GFP_KERNEL);
...@@ -1038,7 +1037,7 @@ static int i2c_pxa_probe(struct platform_device *dev) ...@@ -1038,7 +1037,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
goto eclk; goto eclk;
} }
i2c->reg_base = ioremap(res->start, res_len(res)); i2c->reg_base = ioremap(res->start, resource_size(res));
if (!i2c->reg_base) { if (!i2c->reg_base) {
ret = -EIO; ret = -EIO;
goto eremap; goto eremap;
...@@ -1046,7 +1045,7 @@ static int i2c_pxa_probe(struct platform_device *dev) ...@@ -1046,7 +1045,7 @@ static int i2c_pxa_probe(struct platform_device *dev)
i2c->reg_shift = REG_SHIFT(id->driver_data); i2c->reg_shift = REG_SHIFT(id->driver_data);
i2c->iobase = res->start; i2c->iobase = res->start;
i2c->iosize = res_len(res); i2c->iosize = resource_size(res);
i2c->irq = irq; i2c->irq = irq;
...@@ -1110,7 +1109,7 @@ eremap: ...@@ -1110,7 +1109,7 @@ eremap:
eclk: eclk:
kfree(i2c); kfree(i2c);
emalloc: emalloc:
release_mem_region(res->start, res_len(res)); release_mem_region(res->start, resource_size(res));
return ret; return ret;
} }
......
...@@ -828,7 +828,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) ...@@ -828,7 +828,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
goto err_clk; goto err_clk;
} }
i2c->ioarea = request_mem_region(res->start, (res->end-res->start)+1, i2c->ioarea = request_mem_region(res->start, resource_size(res),
pdev->name); pdev->name);
if (i2c->ioarea == NULL) { if (i2c->ioarea == NULL) {
...@@ -837,7 +837,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) ...@@ -837,7 +837,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
goto err_clk; goto err_clk;
} }
i2c->regs = ioremap(res->start, (res->end-res->start)+1); i2c->regs = ioremap(res->start, resource_size(res));
if (i2c->regs == NULL) { if (i2c->regs == NULL) {
dev_err(&pdev->dev, "cannot map IO\n"); dev_err(&pdev->dev, "cannot map IO\n");
......
This diff is collapsed.
...@@ -76,7 +76,7 @@ static int i2c_versatile_probe(struct platform_device *dev) ...@@ -76,7 +76,7 @@ static int i2c_versatile_probe(struct platform_device *dev)
goto err_out; goto err_out;
} }
if (!request_mem_region(r->start, r->end - r->start + 1, "versatile-i2c")) { if (!request_mem_region(r->start, resource_size(r), "versatile-i2c")) {
ret = -EBUSY; ret = -EBUSY;
goto err_out; goto err_out;
} }
...@@ -87,7 +87,7 @@ static int i2c_versatile_probe(struct platform_device *dev) ...@@ -87,7 +87,7 @@ static int i2c_versatile_probe(struct platform_device *dev)
goto err_release; goto err_release;
} }
i2c->base = ioremap(r->start, r->end - r->start + 1); i2c->base = ioremap(r->start, resource_size(r));
if (!i2c->base) { if (!i2c->base) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_free; goto err_free;
...@@ -118,7 +118,7 @@ static int i2c_versatile_probe(struct platform_device *dev) ...@@ -118,7 +118,7 @@ static int i2c_versatile_probe(struct platform_device *dev)
err_free: err_free:
kfree(i2c); kfree(i2c);
err_release: err_release:
release_mem_region(r->start, r->end - r->start + 1); release_mem_region(r->start, resource_size(r));
err_out: err_out:
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment