diff options
author | Sergei Shtylyov <sshtylyov@ru.mvista.com> | 2008-06-20 14:53:32 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-06-20 14:53:32 -0400 |
commit | ce42a54946db338e43be9a89c0f7927e02aa3a16 (patch) | |
tree | 278d32be3b1bed64360b9acdf50de0e157fa24a3 /drivers/ide/arm/palm_bk3710.c | |
parent | 9bedbcb207ed9a571b239231d99c8fd4a34ae24d (diff) |
palm_bk3710: fix resource management
The driver expected a *virtual* address in the IDE platform device's memory
resource and didn't request the memory region for the register block. Fix this
taking into account the fact that DaVinci SoC devices are fixed-mapped to the
virtual memory early and we can get their virtual addresses using IO_ADDRESS()
macro, not having to call ioremap()...
While at it, also do some cosmetic changes...
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/arm/palm_bk3710.c')
-rw-r--r-- | drivers/ide/arm/palm_bk3710.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index d024ac8fad14..cc24803fadff 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c | |||
@@ -353,8 +353,8 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) | |||
353 | struct clk *clkp; | 353 | struct clk *clkp; |
354 | struct resource *mem, *irq; | 354 | struct resource *mem, *irq; |
355 | ide_hwif_t *hwif; | 355 | ide_hwif_t *hwif; |
356 | void __iomem *base; | 356 | unsigned long base; |
357 | int pribase, i; | 357 | int i; |
358 | hw_regs_t hw; | 358 | hw_regs_t hw; |
359 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 359 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
360 | 360 | ||
@@ -374,22 +374,27 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev) | |||
374 | printk(KERN_ERR "failed to get memory region resource\n"); | 374 | printk(KERN_ERR "failed to get memory region resource\n"); |
375 | return -ENODEV; | 375 | return -ENODEV; |
376 | } | 376 | } |
377 | |||
377 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 378 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
378 | if (irq == NULL) { | 379 | if (irq == NULL) { |
379 | printk(KERN_ERR "failed to get IRQ resource\n"); | 380 | printk(KERN_ERR "failed to get IRQ resource\n"); |
380 | return -ENODEV; | 381 | return -ENODEV; |
381 | } | 382 | } |
382 | 383 | ||
383 | base = (void *)mem->start; | 384 | if (request_mem_region(mem->start, mem->end - mem->start + 1, |
385 | "palm_bk3710") == NULL) { | ||
386 | printk(KERN_ERR "failed to request memory region\n"); | ||
387 | return -EBUSY; | ||
388 | } | ||
389 | |||
390 | base = IO_ADDRESS(mem->start); | ||
384 | 391 | ||
385 | /* Configure the Palm Chip controller */ | 392 | /* Configure the Palm Chip controller */ |
386 | palm_bk3710_chipinit(base); | 393 | palm_bk3710_chipinit((void __iomem *)base); |
387 | 394 | ||
388 | pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET; | ||
389 | for (i = 0; i < IDE_NR_PORTS - 2; i++) | 395 | for (i = 0; i < IDE_NR_PORTS - 2; i++) |
390 | hw.io_ports_array[i] = pribase + i; | 396 | hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i; |
391 | hw.io_ports.ctl_addr = mem->start + | 397 | hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; |
392 | IDE_PALM_ATA_PRI_CTL_OFFSET; | ||
393 | hw.irq = irq->start; | 398 | hw.irq = irq->start; |
394 | hw.chipset = ide_palm3710; | 399 | hw.chipset = ide_palm3710; |
395 | 400 | ||
@@ -434,4 +439,3 @@ static int __init palm_bk3710_init(void) | |||
434 | 439 | ||
435 | module_init(palm_bk3710_init); | 440 | module_init(palm_bk3710_init); |
436 | MODULE_LICENSE("GPL"); | 441 | MODULE_LICENSE("GPL"); |
437 | |||