gtwx5715-pci.c 1.66 KB
Newer Older
1
// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds's avatar
Linus Torvalds committed
2 3 4 5 6 7 8 9 10 11 12 13
/*
 * arch/arm/mach-ixp4xx/gtwx5715-pci.c
 *
 * Gemtek GTWX5715 (Linksys WRV54G) board setup
 *
 * Copyright (C) 2004 George T. Joseph
 * Derived from Coyote
 */

#include <linux/pci.h>
#include <linux/init.h>
#include <linux/delay.h>
14
#include <linux/irq.h>
Linus Torvalds's avatar
Linus Torvalds committed
15
#include <asm/mach-types.h>
16
#include <mach/hardware.h>
Linus Torvalds's avatar
Linus Torvalds committed
17 18
#include <asm/mach/pci.h>

19 20
#include "irqs.h"

21 22
#define SLOT0_DEVID	0
#define SLOT1_DEVID	1
23 24
#define INTA		10 /* slot 1 has INTA and INTB crossed */
#define INTB		11
25

26 27 28 29 30 31
/*
 * Slot 0 isn't actually populated with a card connector but
 * we initialize it anyway in case a future version has the
 * slot populated or someone with good soldering skills has
 * some free time.
 */
Linus Torvalds's avatar
Linus Torvalds committed
32 33
void __init gtwx5715_pci_preinit(void)
{
34 35
	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
Linus Torvalds's avatar
Linus Torvalds committed
36 37 38 39
	ixp4xx_pci_preinit();
}


40
static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Linus Torvalds's avatar
Linus Torvalds committed
41
{
42
	int rc = -1;
Linus Torvalds's avatar
Linus Torvalds committed
43

44 45 46 47 48 49
	if ((slot == SLOT0_DEVID && pin == 1) ||
	    (slot == SLOT1_DEVID && pin == 2))
		rc = IXP4XX_GPIO_IRQ(INTA);
	else if ((slot == SLOT0_DEVID && pin == 2) ||
		 (slot == SLOT1_DEVID && pin == 1))
		rc = IXP4XX_GPIO_IRQ(INTB);
Linus Torvalds's avatar
Linus Torvalds committed
50

51 52 53
	printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
	       __func__, slot, pin, rc);
	return rc;
Linus Torvalds's avatar
Linus Torvalds committed
54 55 56 57
}

struct hw_pci gtwx5715_pci __initdata = {
	.nr_controllers = 1,
58
	.ops		= &ixp4xx_ops,
Linus Torvalds's avatar
Linus Torvalds committed
59 60 61 62 63 64 65 66 67 68 69 70 71 72
	.preinit =        gtwx5715_pci_preinit,
	.setup =          ixp4xx_setup,
	.map_irq =        gtwx5715_map_irq,
};

int __init gtwx5715_pci_init(void)
{
	if (machine_is_gtwx5715())
		pci_common_init(&gtwx5715_pci);

	return 0;
}

subsys_initcall(gtwx5715_pci_init);