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 9e016a7192
]
* 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>
This commit is contained in:
parent
d30a426dc5
commit
7824bc6b47
|
@ -313,13 +313,13 @@ static void __devinit palm_bk3710_chipinit(void __iomem *base)
|
||||||
}
|
}
|
||||||
static int __devinit palm_bk3710_probe(struct platform_device *pdev)
|
static int __devinit palm_bk3710_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
hw_regs_t ide_ctlr_info;
|
|
||||||
int index = 0;
|
|
||||||
int pribase;
|
|
||||||
struct clk *clkp;
|
struct clk *clkp;
|
||||||
struct resource *mem, *irq;
|
struct resource *mem, *irq;
|
||||||
ide_hwif_t *hwif;
|
ide_hwif_t *hwif;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
int pribase, i;
|
||||||
|
hw_regs_t hw;
|
||||||
|
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
|
||||||
|
|
||||||
clkp = clk_get(NULL, "IDECLK");
|
clkp = clk_get(NULL, "IDECLK");
|
||||||
if (IS_ERR(clkp))
|
if (IS_ERR(clkp))
|
||||||
|
@ -330,7 +330,7 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
|
||||||
ide_palm_clk = clk_get_rate(ideclkp)/100000;
|
ide_palm_clk = clk_get_rate(ideclkp)/100000;
|
||||||
ide_palm_clk = (10000/ide_palm_clk) + 1;
|
ide_palm_clk = (10000/ide_palm_clk) + 1;
|
||||||
/* Register the IDE interface with Linux ATA Interface */
|
/* Register the IDE interface with Linux ATA Interface */
|
||||||
memset(&ide_ctlr_info, 0, sizeof(ide_ctlr_info));
|
memset(&hw, 0, sizeof(hw));
|
||||||
|
|
||||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (mem == NULL) {
|
if (mem == NULL) {
|
||||||
|
@ -349,17 +349,33 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
|
||||||
palm_bk3710_chipinit(base);
|
palm_bk3710_chipinit(base);
|
||||||
|
|
||||||
pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET;
|
pribase = mem->start + IDE_PALM_ATA_PRI_REG_OFFSET;
|
||||||
for (index = 0; index < IDE_NR_PORTS - 2; index++)
|
for (i = 0; i < IDE_NR_PORTS - 2; i++)
|
||||||
ide_ctlr_info.io_ports[index] = pribase + index;
|
hw.io_ports[i] = pribase + i;
|
||||||
ide_ctlr_info.io_ports[IDE_CONTROL_OFFSET] = mem->start +
|
hw.io_ports[IDE_CONTROL_OFFSET] = mem->start +
|
||||||
IDE_PALM_ATA_PRI_CTL_OFFSET;
|
IDE_PALM_ATA_PRI_CTL_OFFSET;
|
||||||
ide_ctlr_info.irq = irq->start;
|
hw.irq = irq->start;
|
||||||
ide_ctlr_info.chipset = ide_palm3710;
|
hw.chipset = ide_palm3710;
|
||||||
|
|
||||||
if (ide_register_hw(&ide_ctlr_info, NULL, &hwif) < 0) {
|
hwif = ide_deprecated_find_port(hw.io_ports[IDE_DATA_OFFSET]);
|
||||||
printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n");
|
if (hwif == NULL)
|
||||||
return -ENODEV;
|
goto out;
|
||||||
}
|
|
||||||
|
i = hwif->index;
|
||||||
|
|
||||||
|
if (hwif->present)
|
||||||
|
ide_unregister(i, 0, 1);
|
||||||
|
else if (!hwif->hold)
|
||||||
|
ide_init_port_data(hwif, i);
|
||||||
|
|
||||||
|
ide_init_port_hw(hwif, &hw);
|
||||||
|
hwif->quirkproc = NULL;
|
||||||
|
|
||||||
|
idx[0] = i;
|
||||||
|
|
||||||
|
ide_device_add(idx, NULL);
|
||||||
|
|
||||||
|
if (!hwif->present)
|
||||||
|
goto out;
|
||||||
|
|
||||||
hwif->set_pio_mode = &palm_bk3710_set_pio_mode;
|
hwif->set_pio_mode = &palm_bk3710_set_pio_mode;
|
||||||
hwif->set_dma_mode = &palm_bk3710_set_dma_mode;
|
hwif->set_dma_mode = &palm_bk3710_set_dma_mode;
|
||||||
|
@ -375,6 +391,9 @@ static int __devinit palm_bk3710_probe(struct platform_device *pdev)
|
||||||
ide_setup_dma(hwif, mem->start);
|
ide_setup_dma(hwif, mem->start);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
out:
|
||||||
|
printk(KERN_WARNING "Palm Chip BK3710 IDE Register Fail\n");
|
||||||
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct platform_driver platform_bk_driver = {
|
static struct platform_driver platform_bk_driver = {
|
||||||
|
|
Loading…
Reference in New Issue