linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: khc@pm.waw.pl (Krzysztof Halasa)
To: linux-arm-kernel@lists.infradead.org
Subject: IXP4xx: unneeded #include platform-specific include files?
Date: Tue, 17 Nov 2009 22:53:38 +0100	[thread overview]
Message-ID: <m3ws1o4y3h.fsf@intrepid.localdomain> (raw)
In-Reply-To: <op.u3j6cak02s3iss@richese> (Imre Kaloz's message of "Tue, 17 Nov 2009 22:37:13 +0100")

"Imre Kaloz" <kaloz@openwrt.org> writes:

> Ok, I should be completely missing the point here, but could someone enlighten
> me why would the following make sense? (nslu2 example)
>
> #define NSLU2_PCI_INTA_PIN	11
> #define NSLU2_PCI_INTB_PIN	10
> #define NSLU2_PCI_INTC_PIN	9
> #define NSLU2_PCI_INTD_PIN	8
>
> #define        IRQ_NSLU2_PCI_INTA      IRQ_IXP4XX_GPIO11
> #define        IRQ_NSLU2_PCI_INTB      IRQ_IXP4XX_GPIO10
> #define        IRQ_NSLU2_PCI_INTC      IRQ_IXP4XX_GPIO9

Well, this isn't something I really like because it duplicates the
assignments.

> Then do all the "fun" in the setup code, instead of simply using
> The already defined (and hardware wise more logical) IRQ_IXP4XX_GPIOx values like
> I do in arch/arch/mach-ixp4xx/wg302v2-pci.c for example?

void __init wg302v2_pci_preinit(void)
{
        set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW);
        set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);

        ixp4xx_pci_preinit();
}

static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
{
        if (slot == 1)
                return IRQ_IXP4XX_GPIO8;
        else if (slot == 2)
                return IRQ_IXP4XX_GPIO9;
        else return -1;
}

Not very different from what other platforms have, except that you have
to remember the assignment. When the code gets more complicated you
really don't want to remember that INTA is GPIO8, INTB is GPIO9, INTC,
INTD, IDE_IRQ, USB_IRQ etc. And this gets even more complicated when the
platform code supports more than one version of hw.
-- 
Krzysztof Halasa

  reply	other threads:[~2009-11-17 21:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-15 17:16 IXP4xx: unneeded #include platform-specific include files? Krzysztof Halasa
2009-11-15 18:27 ` Mikael Pettersson
2009-11-15 20:18   ` Imre Kaloz
2009-11-15 21:14     ` Krzysztof Halasa
2009-11-17 21:37       ` Imre Kaloz
2009-11-17 21:53         ` Krzysztof Halasa [this message]
2009-11-17 22:11           ` Imre Kaloz
2009-11-17 22:22             ` Krzysztof Halasa
2009-11-17 22:34               ` Imre Kaloz
2009-11-17 22:47                 ` Krzysztof Halasa
2009-11-17 23:05                   ` Imre Kaloz
2009-11-18  0:10                     ` Krzysztof Halasa
2009-11-15 18:41 ` Mike Westerhof

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=m3ws1o4y3h.fsf@intrepid.localdomain \
    --to=khc@pm.waw.pl \
    --cc=linux-arm-kernel@lists.infradead.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 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).