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>

authored by Sergei Shtylyov and committed by Bartlomiej Zolnierkiewicz ce42a549 9bedbcb2

+13 -9
+13 -9
drivers/ide/arm/palm_bk3710.c
··· 353 struct clk *clkp; 354 struct resource *mem, *irq; 355 ide_hwif_t *hwif; 356 - void __iomem *base; 357 - int pribase, i; 358 hw_regs_t hw; 359 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 360 ··· 374 printk(KERN_ERR "failed to get memory region resource\n"); 375 return -ENODEV; 376 } 377 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 378 if (irq == NULL) { 379 printk(KERN_ERR "failed to get IRQ resource\n"); 380 return -ENODEV; 381 } 382 383 - base = (void *)mem->start; 384 385 /* Configure the Palm Chip controller */ 386 - palm_bk3710_chipinit(base); 387 388 - pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET; 389 for (i = 0; i < IDE_NR_PORTS - 2; i++) 390 - hw.io_ports_array[i] = pribase + i; 391 - hw.io_ports.ctl_addr = mem->start + 392 - IDE_PALM_ATA_PRI_CTL_OFFSET; 393 hw.irq = irq->start; 394 hw.chipset = ide_palm3710; 395 ··· 439 440 module_init(palm_bk3710_init); 441 MODULE_LICENSE("GPL"); 442 -
··· 353 struct clk *clkp; 354 struct resource *mem, *irq; 355 ide_hwif_t *hwif; 356 + unsigned long base; 357 + int i; 358 hw_regs_t hw; 359 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; 360 ··· 374 printk(KERN_ERR "failed to get memory region resource\n"); 375 return -ENODEV; 376 } 377 + 378 irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 379 if (irq == NULL) { 380 printk(KERN_ERR "failed to get IRQ resource\n"); 381 return -ENODEV; 382 } 383 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); 391 392 /* Configure the Palm Chip controller */ 393 + palm_bk3710_chipinit((void __iomem *)base); 394 395 for (i = 0; i < IDE_NR_PORTS - 2; i++) 396 + hw.io_ports_array[i] = base + IDE_PALM_ATA_PRI_REG_OFFSET + i; 397 + hw.io_ports.ctl_addr = base + IDE_PALM_ATA_PRI_CTL_OFFSET; 398 hw.irq = irq->start; 399 hw.chipset = ide_palm3710; 400 ··· 434 435 module_init(palm_bk3710_init); 436 MODULE_LICENSE("GPL");