[lantiq] update 3.2 patches
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches-3.2 / 0053-MIPS-lantiq-pci-move-pcibios-code-into-fixup-lantiq..patch
1 From e6b9f3ea5f2f3f8a66d6650c16f3537288806c0b Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Thu, 8 Mar 2012 15:53:10 +0100
4 Subject: [PATCH 53/73] MIPS: lantiq: pci: move pcibios code into
5 fixup-lantiq.c
6
7 ---
8 arch/mips/pci/Makefile | 1 +
9 arch/mips/pci/fixup-lantiq.c | 42 ++++++++++++++++++++++++++++++++++++++++++
10 arch/mips/pci/pci-lantiq.c | 24 ++----------------------
11 3 files changed, 45 insertions(+), 22 deletions(-)
12 create mode 100644 arch/mips/pci/fixup-lantiq.c
13
14 diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
15 index afad91d..3ca5f75 100644
16 --- a/arch/mips/pci/Makefile
17 +++ b/arch/mips/pci/Makefile
18 @@ -40,6 +40,7 @@ obj-$(CONFIG_SIBYTE_SB1250) += fixup-sb1250.o pci-sb1250.o
19 obj-$(CONFIG_SIBYTE_BCM112X) += fixup-sb1250.o pci-sb1250.o
20 obj-$(CONFIG_SIBYTE_BCM1x80) += pci-bcm1480.o pci-bcm1480ht.o
21 obj-$(CONFIG_SNI_RM) += fixup-sni.o ops-sni.o
22 +obj-$(CONFIG_LANTIQ) += fixup-lantiq.o
23 obj-$(CONFIG_PCI_LANTIQ) += pci-lantiq.o ops-lantiq.o
24 obj-$(CONFIG_TANBAC_TB0219) += fixup-tb0219.o
25 obj-$(CONFIG_TANBAC_TB0226) += fixup-tb0226.o
26 diff --git a/arch/mips/pci/fixup-lantiq.c b/arch/mips/pci/fixup-lantiq.c
27 new file mode 100644
28 index 0000000..daf5ae9
29 --- /dev/null
30 +++ b/arch/mips/pci/fixup-lantiq.c
31 @@ -0,0 +1,42 @@
32 +/*
33 + * This program is free software; you can redistribute it and/or modify it
34 + * under the terms of the GNU General Public License version 2 as published
35 + * by the Free Software Foundation.
36 + *
37 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
38 + */
39 +
40 +#include <linux/of_irq.h>
41 +#include <linux/of_pci.h>
42 +
43 +int (*ltqpci_map_irq)(const struct pci_dev *dev, u8 slot, u8 pin) = NULL;
44 +int (*ltqpci_plat_arch_init)(struct pci_dev *dev) = NULL;
45 +int (*ltqpci_plat_dev_init)(struct pci_dev *dev) = NULL;
46 +int *ltq_pci_irq_map;
47 +
48 +int pcibios_plat_dev_init(struct pci_dev *dev)
49 +{
50 + if (ltqpci_plat_arch_init)
51 + return ltqpci_plat_arch_init(dev);
52 +
53 + if (ltqpci_plat_dev_init)
54 + return ltqpci_plat_dev_init(dev);
55 +
56 + return 0;
57 +}
58 +
59 +int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
60 +{
61 + if (ltqpci_map_irq)
62 + return ltqpci_map_irq(dev, slot, pin);
63 + if (ltq_pci_irq_map[slot]) {
64 + dev_info(&dev->dev, "SLOT:%d PIN:%d IRQ:%d\n", slot, pin, ltq_pci_irq_map[slot]);
65 + return ltq_pci_irq_map[slot];
66 + }
67 + printk(KERN_ERR "lq_pci: trying to map irq for unknown slot %d\n",
68 + slot);
69 +
70 + return 0;
71 +}
72 +
73 +
74 diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
75 index efcdd45..7a29738 100644
76 --- a/arch/mips/pci/pci-lantiq.c
77 +++ b/arch/mips/pci/pci-lantiq.c
78 @@ -93,16 +93,14 @@ static struct ltq_pci_gpio_map ltq_pci_gpio_map[] = {
79 { 37, 2, 0, "pci-req4" },
80 };
81
82 -__iomem void *ltq_pci_mapped_cfg;
83 +__iomem void *ltq_pci_cfgbase;
84 static __iomem void *ltq_pci_membase;
85
86 -int (*ltqpci_plat_dev_init)(struct pci_dev *dev) = NULL;
87 -
88 /* Since the PCI REQ pins can be reused for other functionality, make it
89 possible to exclude those from interpretation by the PCI controller */
90 static int ltq_pci_req_mask = 0xf;
91
92 -static int *ltq_pci_irq_map;
93 +extern int *ltq_pci_irq_map;
94
95 struct pci_ops ltq_pci_ops = {
96 .read = ltq_pci_read_config_dword,
97 @@ -131,14 +129,6 @@ static struct pci_controller ltq_pci_controller = {
98 .io_offset = 0x00000000UL,
99 };
100
101 -int pcibios_plat_dev_init(struct pci_dev *dev)
102 -{
103 - if (ltqpci_plat_dev_init)
104 - return ltqpci_plat_dev_init(dev);
105 -
106 - return 0;
107 -}
108 -
109 static u32 ltq_calc_bar11mask(void)
110 {
111 u32 mem, bar11mask;
112 @@ -256,16 +246,6 @@ static int __devinit ltq_pci_startup(struct device *dev)
113 return 0;
114 }
115
116 -int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
117 -{
118 - if (ltq_pci_irq_map[slot])
119 - return ltq_pci_irq_map[slot];
120 - printk(KERN_ERR "lq_pci: trying to map irq for unknown slot %d\n",
121 - slot);
122 -
123 - return 0;
124 -}
125 -
126 static int __devinit ltq_pci_probe(struct platform_device *pdev)
127 {
128 struct ltq_pci_data *ltq_pci_data =
129 --
130 1.7.9.1
131