diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-18 00:46:29 +0200 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-04-18 00:46:29 +0200 |
commit | 2661b13a21f609b279b4048978f8625d518df6e1 (patch) | |
tree | 20cce5d8ff0f970402b33202755dde4bec41f4fb /drivers/ide/ppc/mpc8xx.c | |
parent | 5c58666fae58cd69f862beaeb88d293ad00f6e37 (diff) |
ppc/mpc8xx: remove ppc_ide_md hooks
* Initialize IDE ports in mpc8xx_ide_probe().
* Remove m8xx_ide_init() and ppc_ide_md hooks - no need for them
(IDE mpc8xx host driver takes care of all this setup).
* Remove needless 'if (irq)' and 'if (data_port >= MAX_HWIFS)' checks
from m8xx_ide_init_hwif_ports().
* Remove 'ctrl_port' and 'irq' arguments from m8xx_ide_init_hwif_ports().
* Rename m8xx_ide_init_hwif_ports() to m8xx_ide_init_ports().
* Add __init tag to m8xx_ide_init_ports().
This patch fixes hwif->irq always being overriden to 0 (== auto-probe, is
this even working on PPC?) because of ide_init_default_irq() call in ide.c.
There should be no other functional changes.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Acked-by: Vitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ppc/mpc8xx.c')
-rw-r--r-- | drivers/ide/ppc/mpc8xx.c | 86 |
1 files changed, 22 insertions, 64 deletions
diff --git a/drivers/ide/ppc/mpc8xx.c b/drivers/ide/ppc/mpc8xx.c index ebaba01c7551..a784a97ca7ec 100644 --- a/drivers/ide/ppc/mpc8xx.c +++ b/drivers/ide/ppc/mpc8xx.c @@ -99,32 +99,6 @@ static int _slot_ = -1; /* will be read from PCMCIA registers */ /* Make clock cycles and always round up */ #define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U ) - - -/* - * IDE stuff. - */ -static int -m8xx_ide_default_irq(unsigned long base) -{ -#ifdef CONFIG_BLK_DEV_MPC8xx_IDE - if (base >= MAX_HWIFS) - return 0; - - printk("[%d] m8xx_ide_default_irq %d\n",__LINE__,ioport_dsc[base].irq); - - return (ioport_dsc[base].irq); -#else - return 9; -#endif -} - -static unsigned long -m8xx_ide_default_io_base(int index) -{ - return index; -} - #define M8XX_PCMCIA_CD2(slot) (0x10000000 >> (slot << 4)) #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4)) @@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL; */ /* - * m8xx_ide_init_hwif_ports for a direct IDE interface _using_ + * m8xx_ide_init_ports() for a direct IDE interface _using_ + * MPC8xx's internal PCMCIA interface */ #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) -static void -m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, - unsigned long ctrl_port, int *irq) +static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) { unsigned long *p = hw->io_ports; int i; @@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, unsigned long base; *p = 0; - if (irq) - *irq = 0; pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia)); @@ -248,9 +219,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, } } - if (data_port >= MAX_HWIFS) - return; - if (_slot_ == -1) { printk ("PCMCIA slot has not been defined! Using A as default\n"); _slot_ = 0; @@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, *p++ = base + ioport_dsc[data_port].reg_off[i]; } - if (irq) { + hw->irq = ioport_dsc[data_port].irq; + hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; + #ifdef CONFIG_IDE_8xx_PCCARD + { unsigned int reg; - *irq = ioport_dsc[data_port].irq; if (_slot_) pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb; else @@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, reg |= mk_int_int_mask (pcmcia_schlvl) << 24; reg |= mk_int_int_mask (pcmcia_schlvl) << 16; *pgcrx = reg; -#else /* direct connected IDE drive, i.e. external IRQ, not the PCMCIA irq */ - *irq = ioport_dsc[data_port].irq; -#endif /* CONFIG_IDE_8xx_PCCARD */ } +#endif /* CONFIG_IDE_8xx_PCCARD */ ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; - ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; /* Enable Harddisk Interrupt, * and make it edge sensitive @@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, /* Enable falling edge irq */ pcmp->pcmc_per = 0x100000 >> (16 * _slot_); #endif /* CONFIG_IDE_8xx_PCCARD */ -} /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */ +} #endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ /* - * m8xx_ide_init_hwif_ports for a direct IDE interface _not_ using + * m8xx_ide_init_ports() for a direct IDE interface _not_ using * MPC8xx's internal PCMCIA interface */ #if defined(CONFIG_IDE_EXT_DIRECT) -void m8xx_ide_init_hwif_ports (hw_regs_t *hw, - unsigned long data_port, unsigned long ctrl_port, int *irq) +static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port) { unsigned long *p = hw->io_ports; int i; @@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, unsigned long base; *p = 0; - if (irq) - *irq = 0; if (!ide_base) { @@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, #endif } - if (data_port >= MAX_HWIFS) - return; - base = ide_base + ioport_dsc[data_port].base_off; #ifdef DEBUG printk ("base: %08x + %08x = %08x\n", @@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, *p++ = base + ioport_dsc[data_port].reg_off[i]; } - if (irq) { - /* direct connected IDE drive, i.e. external IRQ */ - *irq = ioport_dsc[data_port].irq; - } + /* direct connected IDE drive, i.e. external IRQ */ + hw->irq = ioport_dsc[data_port].irq; + hw->ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; ide_hwifs[data_port].pio_mask = ATA_PIO4; ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; - ide_hwifs[data_port].ack_intr = (ide_ack_intr_t *)ide_interrupt_ack; /* Enable Harddisk Interrupt, * and make it edge sensitive @@ -407,8 +366,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, /* (11-18) Set edge detect for irq, no wakeup from low power mode */ ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= (0x80000000 >> ioport_dsc[data_port].irq); -} /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ - +} #endif /* CONFIG_IDE_8xx_DIRECT */ @@ -829,20 +787,20 @@ static int identify (volatile u8 *p) return (0); /* don't know */ } -void m8xx_ide_init(void) -{ - ppc_ide_md.default_irq = m8xx_ide_default_irq; - ppc_ide_md.default_io_base = m8xx_ide_default_io_base; - ppc_ide_md.ide_init_hwif = m8xx_ide_init_hwif_ports; -} - static int __init mpc8xx_ide_probe(void) { + hw_regs_t hw; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; #ifdef IDE0_BASE_OFFSET + memset(&hw, 0, sizeof(hw)); + m8xx_ide_init_ports(&hw, 0); + ide_init_port_hw(&ide_hwifs[0], &hw); idx[0] = 0; #ifdef IDE1_BASE_OFFSET + memset(&hw, 0, sizeof(hw)); + m8xx_ide_init_ports(&hw, 1); + ide_init_port_hw(&ide_hwifs[1], &hw); idx[1] = 1; #endif #endif |