All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Althoefer <as@janz.de>
To: linux-ide@vger.kernel.org
Subject: problem with register_hw_with_fixup
Date: Tue, 23 Jan 2007 09:51:52 +0100	[thread overview]
Message-ID: <45B5CCA8.7010603@janz.de> (raw)

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

             reply	other threads:[~2007-01-23  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-23  8:51 Stefan Althoefer [this message]
2007-01-23  9:53 ` problem with register_hw_with_fixup Alan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45B5CCA8.7010603@janz.de \
    --to=as@janz.de \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.