linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* problem with register_hw_with_fixup
@ 2007-01-23  8:51 Stefan Althoefer
  2007-01-23  9:53 ` Alan
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Althoefer @ 2007-01-23  8:51 UTC (permalink / raw)
  To: linux-ide

hi,

I'm currently developing a ide driver for an embedded ARM device.
The device hardware is somewhat wired, as all IDE access must
be done 16bit, even the control bytes. I therefore need special
access functions.

I do this to register special IN/OUT functions:

-----%<---some code delete for brevity-------------
void empca400_fixup(
     ide_hwif_t *hwif
)
{
     hwif->mmio = 2;
     hwif->OUTB = &empca400_ide_outb;
     hwif->OUTBSYNC = &empca400_ide_outbsync;
     hwif->OUTW = &empca400_ide_outw;
     hwif->OUTSW = &empca400_ide_outsw;
     :
}


static int __init empca400ide_init(void)
{
	:

         memset(&hw, 0, sizeof(hw));

         base = 0x56000000;
         aux  = base + 0x10;

         vbase = (unsigned long) ioremap(base, 0x10);
         vaux  = vbase + 0x20;

         for (i = IDE_DATA_OFFSET; i <= IDE_STATUS_OFFSET; i++) {
                 hw.io_ports[i] = (unsigned long)vbase;
                 vbase += 4;
         }
         hw.io_ports[IDE_CONTROL_OFFSET] = vaux + (6 * 0x2);
         hw.irq = 20;  /* GPIO3 = IRQ20 */
         hw.dma = NO_DMA;
         hw.chipset = ide_generic;

         ret = ide_register_hw_with_fixup(&hw, &hwif, empca400_fixup);

	:
}
-----------------------------------------------------

However, in probe_hwif_init_with_fixup() I find this sequence:

-----%<-----------------
int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif))
{
	probe_hwif(hwif);

	if (fixup)
		fixup(hwif);
-------------------------

fixup() gets called after probe_hwif, hence my special function
pointers will not be installed in time.

Shouldn't probe_hwif_init_with_fixup() call the fixup() first? If
not, what is fixup() good for, and how can I get my function
pointers registered before probe_hwif()?


mfg

-- 
----------------------
Stefan Althöfer (stefan.althoefer@janz.de)
Janz Automationssysteme AG
   - Automation Intelligence -
Member of the Janz company group
Im Doerener Feld 8
33100 Paderborn - Germany

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-01-23  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-23  8:51 problem with register_hw_with_fixup Stefan Althoefer
2007-01-23  9:53 ` Alan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).