summaryrefslogtreecommitdiffstats
path: root/drivers/mfd/asic3.c
diff options
context:
space:
mode:
authorPhilipp Zabel <philipp.zabel@gmail.com>2008-07-10 02:17:02 +0200
committerSamuel Ortiz <samuel@sortiz.org>2008-07-20 19:56:44 +0200
commit99cdb0c8c5e0e43652d25951a85bac82a1231591 (patch)
treef3fb18cc928869393b80ac7feac86bd090ad54d4 /drivers/mfd/asic3.c
parent279cac484e55317456900fe3567c7cb5bd46fd5f (diff)
downloadop-kernel-dev-99cdb0c8c5e0e43652d25951a85bac82a1231591.zip
op-kernel-dev-99cdb0c8c5e0e43652d25951a85bac82a1231591.tar.gz
mfd: let asic3 use mem resource instead of bus_shift
The bus_shift parameter in platform_data is not needed as we can tell the driver with the IOMEM_RESOURCE whether the ASIC is located on a 16bit or 32bit memory bus. The htc-egpio driver uses a more descriptive bus_width parameter, but for drivers where the register map size fixed, we don't even need this. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
Diffstat (limited to 'drivers/mfd/asic3.c')
-rw-r--r--drivers/mfd/asic3.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index f2fb233..3b870e7 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -313,6 +313,7 @@ static int __init asic3_irq_probe(struct platform_device *pdev)
struct asic3 *asic = platform_get_drvdata(pdev);
unsigned long clksel = 0;
unsigned int irq, irq_base;
+ int map_size;
asic->irq_nr = platform_get_irq(pdev, 0);
if (asic->irq_nr < 0)
@@ -551,8 +552,8 @@ static int __init asic3_probe(struct platform_device *pdev)
goto out_free;
}
-
- asic->mapping = ioremap(mem->start, PAGE_SIZE);
+ map_size = mem->end - mem->start + 1;
+ asic->mapping = ioremap(mem->start, map_size);
if (!asic->mapping) {
ret = -ENOMEM;
dev_err(asic->dev, "Couldn't ioremap\n");
@@ -561,10 +562,8 @@ static int __init asic3_probe(struct platform_device *pdev)
asic->irq_base = pdata->irq_base;
- if (pdata && pdata->bus_shift)
- asic->bus_shift = 2 - pdata->bus_shift;
- else
- asic->bus_shift = 0;
+ /* calculate bus shift from mem resource */
+ asic->bus_shift = 2 - (map_size >> 12);
clksel = 0;
asic3_write_register(asic, ASIC3_OFFSET(CLOCK, SEL), clksel);
OpenPOWER on IntegriCloud