^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * linux/arch/arm/mach-footbridge/netwinder-pci.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * PCI bios-type initialisation for PCI machines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Bits taken from various places.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm/irq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/mach/pci.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) * We now use the slot ID instead of the device identifiers to select
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * which interrupt is routed where.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) static int netwinder_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) switch (slot) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) case 0: /* host bridge */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) case 9: /* CyberPro */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) return IRQ_NETWINDER_VGA;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) case 10: /* DC21143 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) return IRQ_NETWINDER_ETHER100;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) case 12: /* Winbond 553 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) return IRQ_ISA_HARDDISK1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) case 13: /* Winbond 89C940F */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) return IRQ_NETWINDER_ETHER10;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) printk(KERN_ERR "PCI: unknown device in slot %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) pci_name(dev));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) static struct hw_pci netwinder_pci __initdata = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) .map_irq = netwinder_map_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) .nr_controllers = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) .ops = &dc21285_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) .setup = dc21285_setup,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) .preinit = dc21285_preinit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) .postinit = dc21285_postinit,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) static int __init netwinder_pci_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) if (machine_is_netwinder())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) pci_common_init(&netwinder_pci);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) subsys_initcall(netwinder_pci_init);