diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:41 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-07-16 14:33:41 -0400 |
commit | b25afdf1336237fb0e4021eb35744e577e19bd14 (patch) | |
tree | e69180271d1c3b5b74096461bcc767b13ce5e4f6 /drivers/ide | |
parent | 26839f09ca2d0f4239e546cd912bc9f4694f3c5e (diff) |
icside: use ide_init_port_hw()
* Move ide_find_port() and default_hwif_mmiops() calls from icside_setup()
to icside_register_v{5,6}().
* Convert icside_setup() to initialize hw_regs_t instead ide_hwif_t
and icside_register_v{5,6}() to use ide_init_port_hw().
* Rename icside_setup() to icside_setup_ports().
There should be no functional changes caused by this patch.
Cc: Russell King <rmk@arm.linux.org.uk>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide')
-rw-r--r-- | drivers/ide/arm/icside.c | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index 743958044278..c8d860060329 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c | |||
@@ -415,36 +415,24 @@ static int icside_dma_off_init(ide_hwif_t *hwif, const struct ide_port_info *d) | |||
415 | return -EOPNOTSUPP; | 415 | return -EOPNOTSUPP; |
416 | } | 416 | } |
417 | 417 | ||
418 | static ide_hwif_t * | 418 | static void icside_setup_ports(hw_regs_t *hw, void __iomem *base, |
419 | icside_setup(void __iomem *base, struct cardinfo *info, struct expansion_card *ec) | 419 | struct cardinfo *info, struct expansion_card *ec) |
420 | { | 420 | { |
421 | unsigned long port = (unsigned long)base + info->dataoffset; | 421 | unsigned long port = (unsigned long)base + info->dataoffset; |
422 | ide_hwif_t *hwif; | ||
423 | 422 | ||
424 | hwif = ide_find_port(); | 423 | hw->io_ports.data_addr = port; |
425 | if (hwif) { | 424 | hw->io_ports.error_addr = port + (1 << info->stepping); |
426 | /* | 425 | hw->io_ports.nsect_addr = port + (2 << info->stepping); |
427 | * Ensure we're using MMIO | 426 | hw->io_ports.lbal_addr = port + (3 << info->stepping); |
428 | */ | 427 | hw->io_ports.lbam_addr = port + (4 << info->stepping); |
429 | default_hwif_mmiops(hwif); | 428 | hw->io_ports.lbah_addr = port + (5 << info->stepping); |
430 | 429 | hw->io_ports.device_addr = port + (6 << info->stepping); | |
431 | hwif->io_ports.data_addr = port; | 430 | hw->io_ports.status_addr = port + (7 << info->stepping); |
432 | hwif->io_ports.error_addr = port + (1 << info->stepping); | 431 | hw->io_ports.ctl_addr = (unsigned long)base + info->ctrloffset; |
433 | hwif->io_ports.nsect_addr = port + (2 << info->stepping); | 432 | |
434 | hwif->io_ports.lbal_addr = port + (3 << info->stepping); | 433 | hw->irq = ec->irq; |
435 | hwif->io_ports.lbam_addr = port + (4 << info->stepping); | 434 | hw->dev = &ec->dev; |
436 | hwif->io_ports.lbah_addr = port + (5 << info->stepping); | 435 | hw->chipset = ide_acorn; |
437 | hwif->io_ports.device_addr = port + (6 << info->stepping); | ||
438 | hwif->io_ports.status_addr = port + (7 << info->stepping); | ||
439 | hwif->io_ports.ctl_addr = | ||
440 | (unsigned long)base + info->ctrloffset; | ||
441 | hwif->irq = ec->irq; | ||
442 | hwif->chipset = ide_acorn; | ||
443 | hwif->gendev.parent = &ec->dev; | ||
444 | hwif->dev = &ec->dev; | ||
445 | } | ||
446 | |||
447 | return hwif; | ||
448 | } | 436 | } |
449 | 437 | ||
450 | static int __init | 438 | static int __init |
@@ -453,6 +441,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
453 | ide_hwif_t *hwif; | 441 | ide_hwif_t *hwif; |
454 | void __iomem *base; | 442 | void __iomem *base; |
455 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 443 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
444 | hw_regs_t hw; | ||
456 | 445 | ||
457 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); | 446 | base = ecardm_iomap(ec, ECARD_RES_MEMC, 0, 0); |
458 | if (!base) | 447 | if (!base) |
@@ -470,10 +459,15 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) | |||
470 | */ | 459 | */ |
471 | icside_irqdisable_arcin_v5(ec, 0); | 460 | icside_irqdisable_arcin_v5(ec, 0); |
472 | 461 | ||
473 | hwif = icside_setup(base, &icside_cardinfo_v5, ec); | 462 | icside_setup_ports(&hw, base, &icside_cardinfo_v5, ec); |
463 | |||
464 | hwif = ide_find_port(); | ||
474 | if (!hwif) | 465 | if (!hwif) |
475 | return -ENODEV; | 466 | return -ENODEV; |
476 | 467 | ||
468 | ide_init_port_hw(hwif, &hw); | ||
469 | default_hwif_mmiops(hwif); | ||
470 | |||
477 | state->hwif[0] = hwif; | 471 | state->hwif[0] = hwif; |
478 | 472 | ||
479 | ecard_set_drvdata(ec, state); | 473 | ecard_set_drvdata(ec, state); |
@@ -503,6 +497,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
503 | int ret; | 497 | int ret; |
504 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; | 498 | u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; |
505 | struct ide_port_info d = icside_v6_port_info; | 499 | struct ide_port_info d = icside_v6_port_info; |
500 | hw_regs_t hw[2]; | ||
506 | 501 | ||
507 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); | 502 | ioc_base = ecardm_iomap(ec, ECARD_RES_IOCFAST, 0, 0); |
508 | if (!ioc_base) { | 503 | if (!ioc_base) { |
@@ -538,16 +533,25 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) | |||
538 | */ | 533 | */ |
539 | icside_irqdisable_arcin_v6(ec, 0); | 534 | icside_irqdisable_arcin_v6(ec, 0); |
540 | 535 | ||
536 | icside_setup_ports(&hw[0], easi_base, &icside_cardinfo_v6_1, ec); | ||
537 | icside_setup_ports(&hw[1], easi_base, &icside_cardinfo_v6_2, ec); | ||
538 | |||
541 | /* | 539 | /* |
542 | * Find and register the interfaces. | 540 | * Find and register the interfaces. |
543 | */ | 541 | */ |
544 | hwif = icside_setup(easi_base, &icside_cardinfo_v6_1, ec); | 542 | hwif = ide_find_port(); |
545 | mate = icside_setup(easi_base, &icside_cardinfo_v6_2, ec); | 543 | if (hwif == NULL) |
544 | return -ENODEV; | ||
546 | 545 | ||
547 | if (!hwif || !mate) { | 546 | ide_init_port_hw(hwif, &hw[0]); |
548 | ret = -ENODEV; | 547 | default_hwif_mmiops(hwif); |
549 | goto out; | 548 | |
550 | } | 549 | mate = ide_find_port(); |
550 | if (mate == NULL) | ||
551 | return -ENODEV; | ||
552 | |||
553 | ide_init_port_hw(mate, &hw[1]); | ||
554 | default_hwif_mmiops(mate); | ||
551 | 555 | ||
552 | state->hwif[0] = hwif; | 556 | state->hwif[0] = hwif; |
553 | state->hwif[1] = mate; | 557 | state->hwif[1] = mate; |