root/arch/arm/mach-ixp4xx/gtwx5715-pci.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. gtwx5715_pci_preinit
  2. gtwx5715_map_irq
  3. gtwx5715_pci_init

   1 // SPDX-License-Identifier: GPL-2.0-or-later
   2 /*
   3  * arch/arm/mach-ixp4xx/gtwx5715-pci.c
   4  *
   5  * Gemtek GTWX5715 (Linksys WRV54G) board setup
   6  *
   7  * Copyright (C) 2004 George T. Joseph
   8  * Derived from Coyote
   9  */
  10 
  11 #include <linux/pci.h>
  12 #include <linux/init.h>
  13 #include <linux/delay.h>
  14 #include <linux/irq.h>
  15 #include <asm/mach-types.h>
  16 #include <mach/hardware.h>
  17 #include <asm/mach/pci.h>
  18 
  19 #include "irqs.h"
  20 
  21 #define SLOT0_DEVID     0
  22 #define SLOT1_DEVID     1
  23 #define INTA            10 /* slot 1 has INTA and INTB crossed */
  24 #define INTB            11
  25 
  26 /*
  27  * Slot 0 isn't actually populated with a card connector but
  28  * we initialize it anyway in case a future version has the
  29  * slot populated or someone with good soldering skills has
  30  * some free time.
  31  */
  32 void __init gtwx5715_pci_preinit(void)
  33 {
  34         irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW);
  35         irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);
  36         ixp4xx_pci_preinit();
  37 }
  38 
  39 
  40 static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  41 {
  42         int rc = -1;
  43 
  44         if ((slot == SLOT0_DEVID && pin == 1) ||
  45             (slot == SLOT1_DEVID && pin == 2))
  46                 rc = IXP4XX_GPIO_IRQ(INTA);
  47         else if ((slot == SLOT0_DEVID && pin == 2) ||
  48                  (slot == SLOT1_DEVID && pin == 1))
  49                 rc = IXP4XX_GPIO_IRQ(INTB);
  50 
  51         printk(KERN_INFO "%s: Mapped slot %d pin %d to IRQ %d\n",
  52                __func__, slot, pin, rc);
  53         return rc;
  54 }
  55 
  56 struct hw_pci gtwx5715_pci __initdata = {
  57         .nr_controllers = 1,
  58         .ops            = &ixp4xx_ops,
  59         .preinit =        gtwx5715_pci_preinit,
  60         .setup =          ixp4xx_setup,
  61         .map_irq =        gtwx5715_map_irq,
  62 };
  63 
  64 int __init gtwx5715_pci_init(void)
  65 {
  66         if (machine_is_gtwx5715())
  67                 pci_common_init(&gtwx5715_pci);
  68 
  69         return 0;
  70 }
  71 
  72 subsys_initcall(gtwx5715_pci_init);

/* [<][>][^][v][top][bottom][index][help] */