blob: c250b59e8d4777215128af7d978119fd2cf56527 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001// SPDX-License-Identifier: GPL-2.0-only
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
Uwe Zeisbergerf30c2262006-10-03 23:01:26 +02003 * arch/arm/mach-ixp4xx/coyote-pci.c
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 *
5 * PCI setup routines for ADI Engineering Coyote platform
6 *
7 * Copyright (C) 2002 Jungo Software Technologies.
8 * Copyright (C) 2003 MontaVista Softwrae, Inc.
9 *
10 * Maintainer: Deepak Saxena <dsaxena@mvista.com>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
13#include <linux/kernel.h>
14#include <linux/pci.h>
15#include <linux/init.h>
Thomas Gleixner698dfe22006-07-01 23:01:49 +010016#include <linux/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070017#include <asm/mach-types.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010018#include <mach/hardware.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070019#include <asm/irq.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070020#include <asm/mach/pci.h>
21
Linus Walleijdc8ef8cd2018-12-29 15:47:52 +010022#include "irqs.h"
23
Krzysztof Hałasa8d3fdf32009-11-17 18:48:23 +010024#define SLOT0_DEVID 14
25#define SLOT1_DEVID 15
Krzysztof Hałasaf89f4492009-11-16 15:57:41 +010026
27/* PCI controller GPIO to IRQ pin mappings */
Krzysztof Hałasa8d3fdf32009-11-17 18:48:23 +010028#define SLOT0_INTA 6
29#define SLOT1_INTA 11
Krzysztof Hałasaf89f4492009-11-16 15:57:41 +010030
Linus Torvalds1da177e2005-04-16 15:20:36 -070031void __init coyote_pci_preinit(void)
32{
Thomas Gleixner6845664a2011-03-24 13:25:22 +010033 irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW);
34 irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW);
Linus Torvalds1da177e2005-04-16 15:20:36 -070035 ixp4xx_pci_preinit();
36}
37
Ralf Baechled5341942011-06-10 15:30:21 +010038static int __init coyote_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
Linus Torvalds1da177e2005-04-16 15:20:36 -070039{
Krzysztof Hałasa8d3fdf32009-11-17 18:48:23 +010040 if (slot == SLOT0_DEVID)
41 return IXP4XX_GPIO_IRQ(SLOT0_INTA);
42 else if (slot == SLOT1_DEVID)
43 return IXP4XX_GPIO_IRQ(SLOT1_INTA);
Linus Torvalds1da177e2005-04-16 15:20:36 -070044 else return -1;
45}
46
47struct hw_pci coyote_pci __initdata = {
48 .nr_controllers = 1,
Russell Kingc23bfc32012-03-10 12:49:16 +000049 .ops = &ixp4xx_ops,
Linus Torvalds1da177e2005-04-16 15:20:36 -070050 .preinit = coyote_pci_preinit,
Linus Torvalds1da177e2005-04-16 15:20:36 -070051 .setup = ixp4xx_setup,
Linus Torvalds1da177e2005-04-16 15:20:36 -070052 .map_irq = coyote_map_irq,
53};
54
55int __init coyote_pci_init(void)
56{
57 if (machine_is_adi_coyote())
58 pci_common_init(&coyote_pci);
59 return 0;
60}
61
62subsys_initcall(coyote_pci_init);