aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/arm/palm_bk3710.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-10 18:32:12 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-10 18:32:12 -0500
commit7824bc6b474caca6d74489498d9c2c2dfcc86d10 (patch)
treea7d5abdcde9d7385986d6336a4088ea33cf8a3a7 /drivers/ide/arm/palm_bk3710.c
parentd30a426dc5fd8801dbd05485788a001de623d487 (diff)
palm_bk3710: ide_register_hw() -> ide_device_add()
* Convert palm_bk3710 host driver to use ide_device_add() instead of ide_register_hw() (while at it drop doing "ide_unregister()" loop which tries to unregister _all_ IDE interfaces if useable ide_hwifs[] slot cannot be find). [ identical change as done to bast-ide/ide-cs/delkin_cb host drivers by commit 9e016a719209d95338e314b46c3012cc7feaaeec ] * Rename 'ide_ctlr_info' to 'hw' and 'index' to 'i' while at it. Cc: Anton Salnikov <asalnikov@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.c45
1 files changed, 32 insertions, 13 deletions
diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c
index c3069970a012..08029662106f 100644
--- a/drivers/ide/arm/palm_bk3710.c
+++ b/drivers/ide/arm/palm_bk3710.c
@@ -313,13 +313,13 @@ static void __devinit palm_bk3710_chipinit(void __iomem *base)
313} 313}
314static int __devinit palm_bk3710_probe(struct platform_device *pdev) 314static int __devinit palm_bk3710_probe(struct platform_device *pdev)
315{ 315{
316 hw_regs_t ide_ctlr_info;
317 int index = 0;
318 int pribase;
319 struct clk *clkp; 316 struct clk *clkp;
320 struct resource *mem, *irq; 317 struct resource *mem, *irq;
321 ide_hwif_t *hwif; 318 ide_hwif_t *hwif;
322 void __iomem *base; 319 void __iomem *base;
320 int pribase, i;
321 hw_regs_t hw;
322 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
323 323
324 clkp = clk_get(NULL, "IDECLK"); 324 clkp = clk_get(NULL, "IDECLK");
325 if (IS_ERR(clkp)) 325 if (IS_ERR(clkp))
@@ -330,7 +330,7 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
330 ide_palm_clk = clk_get_rate(ideclkp)/100000; 330 ide_palm_clk = clk_get_rate(ideclkp)/100000;
331 ide_palm_clk = (10000/ide_palm_clk) + 1; 331 ide_palm_clk = (10000/ide_palm_clk) + 1;
332 /* Register the IDE interface with Linux ATA Interface */ 332 /* Register the IDE interface with Linux ATA Interface */
333 memset(&ide_ctlr_info, 0, sizeof(ide_ctlr_info)); 333 memset(&hw, 0, sizeof(hw));
334 334
335 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 335 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
336 if (mem == NULL) { 336 if (mem == NULL) {
@@ -349,17 +349,33 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
349 palm_bk3710_chipinit(base); 349 palm_bk3710_chipinit(base);
350 350
351 pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET; 351 pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET;
352 for (index = 0; index < IDE_NR_PORTS - 2; index++) 352 for (i = 0; i < IDE_NR_PORTS - 2; i++)
353 ide_ctlr_info.io_ports[index] = pribase + index; 353 hw.io_ports[i] = pribase + i;
354 ide_ctlr_info.io_ports[IDE_CONTROL_OFFSET] = mem->start + 354 hw.io_ports[IDE_CONTROL_OFFSET] = mem->start +
355 IDE_PALM_ATA_PRI_CTL_OFFSET; 355 IDE_PALM_ATA_PRI_CTL_OFFSET;
356 ide_ctlr_info.irq = irq->start; 356 hw.irq = irq->start;
357 ide_ctlr_info.chipset = ide_palm3710; 357 hw.chipset = ide_palm3710;
358 358
359 if (ide_register_hw(&ide_ctlr_info, NULL, &hwif) < 0) { 359 hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
360 printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n"); 360 if (hwif == NULL)
361 return -ENODEV; 361 goto out;
362 } 362
363 i = hwif->index;
364
365 if (hwif->present)
366 ide_unregister(i, 0, 1);
367 else if (!hwif->hold)
368 ide_init_port_data(hwif, i);
369
370 ide_init_port_hw(hwif, &hw);
371 hwif->quirkproc = NULL;
372
373 idx[0] = i;
374
375 ide_device_add(idx, NULL);
376
377 if (!hwif->present)
378 goto out;
363 379
364 hwif->set_pio_mode = &palm_bk3710_set_pio_mode; 380 hwif->set_pio_mode = &palm_bk3710_set_pio_mode;
365 hwif->set_dma_mode = &palm_bk3710_set_dma_mode; 381 hwif->set_dma_mode = &palm_bk3710_set_dma_mode;
@@ -375,6 +391,9 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
375 ide_setup_dma(hwif, mem->start); 391 ide_setup_dma(hwif, mem->start);
376 392
377 return 0; 393 return 0;
394out:
395 printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n");
396 return -ENODEV;
378} 397}
379 398
380static struct platform_driver platform_bk_driver = { 399static struct platform_driver platform_bk_driver = {