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: default avatarVitaly Bordug <vitb@kernel.crashing.org>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 5c58666f
...@@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void); ...@@ -87,8 +87,6 @@ void m8xx_calibrate_decr(void);
unsigned char __res[sizeof(bd_t)]; unsigned char __res[sizeof(bd_t)];
extern void m8xx_ide_init(void);
extern unsigned long find_available_memory(void); extern unsigned long find_available_memory(void);
extern void m8xx_cpm_reset(void); extern void m8xx_cpm_reset(void);
extern void m8xx_wdt_handler_install(bd_t *bp); extern void m8xx_wdt_handler_install(bd_t *bp);
...@@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -474,8 +472,4 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
ppc_md.find_end_of_memory = m8xx_find_end_of_memory; ppc_md.find_end_of_memory = m8xx_find_end_of_memory;
ppc_md.setup_io_mappings = m8xx_map_io; ppc_md.setup_io_mappings = m8xx_map_io;
#if defined(CONFIG_BLK_DEV_MPC8xx_IDE)
m8xx_ide_init();
#endif
} }
...@@ -99,32 +99,6 @@ static int _slot_ = -1; /* will be read from PCMCIA registers */ ...@@ -99,32 +99,6 @@ static int _slot_ = -1; /* will be read from PCMCIA registers */
/* Make clock cycles and always round up */ /* Make clock cycles and always round up */
#define PCMCIA_MK_CLKS( t, T ) (( (t) * ((T)/1000000) + 999U ) / 1000U ) #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_CD2(slot) (0x10000000 >> (slot << 4))
#define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4)) #define M8XX_PCMCIA_CD1(slot) (0x08000000 >> (slot << 4))
...@@ -149,12 +123,11 @@ static int pcmcia_schlvl = PCMCIA_SCHLVL; ...@@ -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) #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT)
static void static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long ctrl_port, int *irq)
{ {
unsigned long *p = hw->io_ports; unsigned long *p = hw->io_ports;
int i; int i;
...@@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, ...@@ -173,8 +146,6 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
unsigned long base; unsigned long base;
*p = 0; *p = 0;
if (irq)
*irq = 0;
pcmp = (pcmconf8xx_t *)(&(((immap_t *)IMAP_ADDR)->im_pcmcia)); 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, ...@@ -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) { if (_slot_ == -1) {
printk ("PCMCIA slot has not been defined! Using A as default\n"); printk ("PCMCIA slot has not been defined! Using A as default\n");
_slot_ = 0; _slot_ = 0;
...@@ -292,11 +260,13 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, ...@@ -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]; *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 #ifdef CONFIG_IDE_8xx_PCCARD
{
unsigned int reg; unsigned int reg;
*irq = ioport_dsc[data_port].irq;
if (_slot_) if (_slot_)
pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb; pgcrx = &((immap_t *) IMAP_ADDR)->im_pcmcia.pcmc_pgcrb;
else else
...@@ -306,14 +276,11 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, ...@@ -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) << 24;
reg |= mk_int_int_mask (pcmcia_schlvl) << 16; reg |= mk_int_int_mask (pcmcia_schlvl) << 16;
*pgcrx = reg; *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].pio_mask = ATA_PIO4;
ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 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, /* Enable Harddisk Interrupt,
* and make it edge sensitive * and make it edge sensitive
...@@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port, ...@@ -329,16 +296,15 @@ m8xx_ide_init_hwif_ports(hw_regs_t *hw, unsigned long data_port,
/* Enable falling edge irq */ /* Enable falling edge irq */
pcmp->pcmc_per = 0x100000 >> (16 * _slot_); pcmp->pcmc_per = 0x100000 >> (16 * _slot_);
#endif /* CONFIG_IDE_8xx_PCCARD */ #endif /* CONFIG_IDE_8xx_PCCARD */
} /* m8xx_ide_init_hwif_ports() using 8xx internal PCMCIA interface */ }
#endif /* CONFIG_IDE_8xx_PCCARD || CONFIG_IDE_8xx_DIRECT */ #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 * MPC8xx's internal PCMCIA interface
*/ */
#if defined(CONFIG_IDE_EXT_DIRECT) #if defined(CONFIG_IDE_EXT_DIRECT)
void m8xx_ide_init_hwif_ports (hw_regs_t *hw, static void __init m8xx_ide_init_ports(hw_regs_t *hw, unsigned long data_port)
unsigned long data_port, unsigned long ctrl_port, int *irq)
{ {
unsigned long *p = hw->io_ports; unsigned long *p = hw->io_ports;
int i; int i;
...@@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, ...@@ -349,8 +315,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
unsigned long base; unsigned long base;
*p = 0; *p = 0;
if (irq)
*irq = 0;
if (!ide_base) { if (!ide_base) {
...@@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, ...@@ -372,9 +336,6 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
#endif #endif
} }
if (data_port >= MAX_HWIFS)
return;
base = ide_base + ioport_dsc[data_port].base_off; base = ide_base + ioport_dsc[data_port].base_off;
#ifdef DEBUG #ifdef DEBUG
printk ("base: %08x + %08x = %08x\n", printk ("base: %08x + %08x = %08x\n",
...@@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, ...@@ -392,14 +353,12 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw,
*p++ = base + ioport_dsc[data_port].reg_off[i]; *p++ = base + ioport_dsc[data_port].reg_off[i];
} }
if (irq) { /* direct connected IDE drive, i.e. external IRQ */
/* direct connected IDE drive, i.e. external IRQ */ hw->irq = ioport_dsc[data_port].irq;
*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].pio_mask = ATA_PIO4;
ide_hwifs[data_port].set_pio_mode = m8xx_ide_set_pio_mode; 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, /* Enable Harddisk Interrupt,
* and make it edge sensitive * and make it edge sensitive
...@@ -407,8 +366,7 @@ void m8xx_ide_init_hwif_ports (hw_regs_t *hw, ...@@ -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 */ /* (11-18) Set edge detect for irq, no wakeup from low power mode */
((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |= ((immap_t *) IMAP_ADDR)->im_siu_conf.sc_siel |=
(0x80000000 >> ioport_dsc[data_port].irq); (0x80000000 >> ioport_dsc[data_port].irq);
} /* m8xx_ide_init_hwif_ports() for CONFIG_IDE_8xx_DIRECT */ }
#endif /* CONFIG_IDE_8xx_DIRECT */ #endif /* CONFIG_IDE_8xx_DIRECT */
...@@ -829,20 +787,20 @@ static int identify (volatile u8 *p) ...@@ -829,20 +787,20 @@ static int identify (volatile u8 *p)
return (0); /* don't know */ 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) static int __init mpc8xx_ide_probe(void)
{ {
hw_regs_t hw;
u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
#ifdef IDE0_BASE_OFFSET #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; idx[0] = 0;
#ifdef IDE1_BASE_OFFSET #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; idx[1] = 1;
#endif #endif
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment