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

* 'i2c-for-2631-rc3' of git://aeryn.fluff.org.uk/bjdooks/linux:
  i2c: Use resource_size
  i2c-davinci: behave with i2cdetect
  i2c-davinci: convert clock usage after clkdev conversion
This commit is contained in:
Linus Torvalds 2009-07-14 18:40:15 -07:00
commit e9e961c9a8
4 changed files with 23 additions and 13 deletions

View File

@ -187,6 +187,11 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev)
davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh); davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKH_REG, clkh);
davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl); davinci_i2c_write_reg(dev, DAVINCI_I2C_CLKL_REG, clkl);
/* Respond at reserved "SMBus Host" slave address" (and zero);
* we seem to have no option to not respond...
*/
davinci_i2c_write_reg(dev, DAVINCI_I2C_OAR_REG, 0x08);
dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk); dev_dbg(dev->dev, "input_clock = %d, CLK = %d\n", input_clock, clk);
dev_dbg(dev->dev, "PSC = %d\n", dev_dbg(dev->dev, "PSC = %d\n",
davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG)); davinci_i2c_read_reg(dev, DAVINCI_I2C_PSC_REG));
@ -387,7 +392,7 @@ static void terminate_write(struct davinci_i2c_dev *dev)
davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w); davinci_i2c_write_reg(dev, DAVINCI_I2C_MDR_REG, w);
if (!dev->terminate) if (!dev->terminate)
dev_err(dev->dev, "TDR IRQ while no data to send\n"); dev_dbg(dev->dev, "TDR IRQ while no data to send\n");
} }
/* /*
@ -473,9 +478,14 @@ static irqreturn_t i2c_davinci_isr(int this_irq, void *dev_id)
break; break;
case DAVINCI_I2C_IVR_AAS: case DAVINCI_I2C_IVR_AAS:
dev_warn(dev->dev, "Address as slave interrupt\n"); dev_dbg(dev->dev, "Address as slave interrupt\n");
}/* switch */ break;
}/* while */
default:
dev_warn(dev->dev, "Unrecognized irq stat %d\n", stat);
break;
}
}
return count ? IRQ_HANDLED : IRQ_NONE; return count ? IRQ_HANDLED : IRQ_NONE;
} }
@ -505,7 +515,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, ioarea = request_mem_region(mem->start, resource_size(mem),
pdev->name); pdev->name);
if (!ioarea) { if (!ioarea) {
dev_err(&pdev->dev, "I2C region already claimed\n"); dev_err(&pdev->dev, "I2C region already claimed\n");
@ -523,7 +533,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
dev->irq = irq->start; dev->irq = irq->start;
platform_set_drvdata(pdev, dev); platform_set_drvdata(pdev, dev);
dev->clk = clk_get(&pdev->dev, "I2CCLK"); dev->clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(dev->clk)) { if (IS_ERR(dev->clk)) {
r = -ENODEV; r = -ENODEV;
goto err_free_mem; goto err_free_mem;
@ -568,7 +578,7 @@ static int davinci_i2c_probe(struct platform_device *pdev)
put_device(&pdev->dev); put_device(&pdev->dev);
kfree(dev); kfree(dev);
err_release_region: err_release_region:
release_mem_region(mem->start, (mem->end - mem->start) + 1); release_mem_region(mem->start, resource_size(mem));
return r; return r;
} }
@ -591,7 +601,7 @@ static int davinci_i2c_remove(struct platform_device *pdev)
kfree(dev); kfree(dev);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, (mem->end - mem->start) + 1); release_mem_region(mem->start, resource_size(mem));
return 0; return 0;
} }

View File

@ -806,7 +806,7 @@ omap_i2c_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
ioarea = request_mem_region(mem->start, (mem->end - mem->start) + 1, ioarea = request_mem_region(mem->start, resource_size(mem),
pdev->name); pdev->name);
if (!ioarea) { if (!ioarea) {
dev_err(&pdev->dev, "I2C region already claimed\n"); dev_err(&pdev->dev, "I2C region already claimed\n");
@ -905,7 +905,7 @@ omap_i2c_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(dev); kfree(dev);
err_release_region: err_release_region:
release_mem_region(mem->start, (mem->end - mem->start) + 1); release_mem_region(mem->start, resource_size(mem));
return r; return r;
} }
@ -925,7 +925,7 @@ omap_i2c_remove(struct platform_device *pdev)
iounmap(dev->base); iounmap(dev->base);
kfree(dev); kfree(dev);
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(mem->start, (mem->end - mem->start) + 1); release_mem_region(mem->start, resource_size(mem));
return 0; return 0;
} }

View File

@ -563,7 +563,7 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
goto err_irq; goto err_irq;
} }
size = (res->end - res->start) + 1; size = resource_size(res);
pd->reg = ioremap(res->start, size); pd->reg = ioremap(res->start, size);
if (pd->reg == NULL) { if (pd->reg == NULL) {

View File

@ -92,7 +92,7 @@ static int simtec_i2c_probe(struct platform_device *dev)
goto err; goto err;
} }
size = (res->end-res->start)+1; size = resource_size(res);
pd->ioarea = request_mem_region(res->start, size, dev->name); pd->ioarea = request_mem_region(res->start, size, dev->name);
if (pd->ioarea == NULL) { if (pd->ioarea == NULL) {