* [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
@ 2008-09-24 19:19 ` Aurelien Jarno
2008-09-24 21:17 ` Michael Buesch
` (2 more replies)
2008-09-24 19:20 ` [PATCH 2/6] [MIPS] WGT634U: Add machine detection message Aurelien Jarno
` (4 subsequent siblings)
5 siblings, 3 replies; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-24 19:19 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Michael Buesch
This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
pcibios_plat_dev_init() for the BCM47xx platform.
It fixes the regression introduced by commit
aab547ce0d1493d400b6468c521a0137cd8c1edf.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Michael Buesch <mb@bu3sch.de>
---
arch/mips/pci/Makefile | 1 +
arch/mips/pci/pci-bcm47xx.c | 58 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 arch/mips/pci/pci-bcm47xx.c
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 15e01ae..c8c32f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
+obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
#
# These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644
index 0000000..64ccb4f
--- /dev/null
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+ int res;
+
+ res = ssb_pcibios_map_irq(dev, slot, pin);
+ if (res < 0) {
+ printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+ dev->dev.bus_id);
+ return 0;
+ }
+ /* IRQ-0 and IRQ-1 are software interrupts. */
+ WARN_ON((res == 0) || (res == 1));
+
+ return res;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+ int err;
+
+ err = ssb_pcibios_plat_dev_init(dev);
+ if (err) {
+ printk(KERN_ALERT "PCI: Failed to init device %s\n",
+ pci_name(dev));
+ }
+
+ return err;
+}
+
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 19:19 ` [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code Aurelien Jarno
@ 2008-09-24 21:17 ` Michael Buesch
2008-09-24 22:14 ` Sergei Shtylyov
2008-09-26 18:23 ` [PATCH 1/6 v2] " Aurelien Jarno
2 siblings, 0 replies; 24+ messages in thread
From: Michael Buesch @ 2008-09-24 21:17 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: Ralf Baechle, linux-mips
On Wednesday 24 September 2008 21:19:55 Aurelien Jarno wrote:
> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
> pcibios_plat_dev_init() for the BCM47xx platform.
>
> It fixes the regression introduced by commit
> aab547ce0d1493d400b6468c521a0137cd8c1edf.
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> Reviewed-by: Michael Buesch <mb@bu3sch.de>
Is this STILL not merged?
Come on mips guys, WAKE UP!
This compiletime-regression is fixed since several months and this is the
third time (at least) that we submit this patch.
A kernel.org bugzilla entry does also exist.
I'll bypass the mips tree and send it to akpm, if this takes any further delay.
> ---
> arch/mips/pci/Makefile | 1 +
> arch/mips/pci/pci-bcm47xx.c | 58 +++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 59 insertions(+), 0 deletions(-)
> create mode 100644 arch/mips/pci/pci-bcm47xx.c
>
> diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
> index 15e01ae..c8c32f4 100644
> --- a/arch/mips/pci/Makefile
> +++ b/arch/mips/pci/Makefile
> @@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
> obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
> obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
> obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
> +obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
>
> #
> # These are still pretty much in the old state, watch, go blind.
> diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
> new file mode 100644
> index 0000000..64ccb4f
> --- /dev/null
> +++ b/arch/mips/pci/pci-bcm47xx.c
> @@ -0,0 +1,58 @@
> +/*
> + * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
> + * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +#include <linux/types.h>
> +#include <linux/pci.h>
> +#include <linux/ssb/ssb.h>
> +
> +int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
> +{
> + int res;
> +
> + res = ssb_pcibios_map_irq(dev, slot, pin);
> + if (res < 0) {
> + printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
> + dev->dev.bus_id);
> + return 0;
> + }
> + /* IRQ-0 and IRQ-1 are software interrupts. */
> + WARN_ON((res == 0) || (res == 1));
> +
> + return res;
> +}
> +
> +int pcibios_plat_dev_init(struct pci_dev *dev)
> +{
> + int err;
> +
> + err = ssb_pcibios_plat_dev_init(dev);
> + if (err) {
> + printk(KERN_ALERT "PCI: Failed to init device %s\n",
> + pci_name(dev));
> + }
> +
> + return err;
> +}
> +
> --
> 1.5.6.5
>
>
--
Greetings Michael.
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 19:19 ` [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code Aurelien Jarno
2008-09-24 21:17 ` Michael Buesch
@ 2008-09-24 22:14 ` Sergei Shtylyov
2008-09-24 22:31 ` Michael Buesch
` (3 more replies)
2008-09-26 18:23 ` [PATCH 1/6 v2] " Aurelien Jarno
2 siblings, 4 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2008-09-24 22:14 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: Ralf Baechle, linux-mips, Michael Buesch
Hello.
Aurelien Jarno wrote:
> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
> pcibios_plat_dev_init() for the BCM47xx platform.
>
> It fixes the regression introduced by commit
> aab547ce0d1493d400b6468c521a0137cd8c1edf.
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> Reviewed-by: Michael Buesch <mb@bu3sch.de>
>
[...]
> diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
> new file mode 100644
> index 0000000..64ccb4f
> --- /dev/null
> +++ b/arch/mips/pci/pci-bcm47xx.c
> @@ -0,0 +1,58 @@
> +/*
> + * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
> + * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the
> + * Free Software Foundation; either version 2 of the License, or (at your
> + * option) any later version.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
> + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
> + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
> + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
> + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
> + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + *
> + * You should have received a copy of the GNU General Public License along
> + * with this program; if not, write to the Free Software Foundation, Inc.,
> + * 675 Mass Ave, Cambridge, MA 02139, USA.
> + */
> +
> +#include <linux/types.h>
> +#include <linux/pci.h>
> +#include <linux/ssb/ssb.h>
> +
> +int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
> +{
> + int res;
> +
> + res = ssb_pcibios_map_irq(dev, slot, pin);
> + if (res < 0) {
> + printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
> + dev->dev.bus_id);
> + return 0;
> + }
> + /* IRQ-0 and IRQ-1 are software interrupts. */
> + WARN_ON((res == 0) || (res == 1));
>
Unneeded ()...
> +
> + return res;
> +}
> +
> +int pcibios_plat_dev_init(struct pci_dev *dev)
> +{
> + int err;
> +
> + err = ssb_pcibios_plat_dev_init(dev);
> + if (err) {
> + printk(KERN_ALERT "PCI: Failed to init device %s\n",
> + pci_name(dev));
> + }
>
Unneeded {}...
WBR, Sergei
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 22:14 ` Sergei Shtylyov
@ 2008-09-24 22:31 ` Michael Buesch
2008-09-25 0:14 ` John W. Linville
` (2 subsequent siblings)
3 siblings, 0 replies; 24+ messages in thread
From: Michael Buesch @ 2008-09-24 22:31 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Aurelien Jarno, Ralf Baechle, linux-mips
On Thursday 25 September 2008 00:14:22 Sergei Shtylyov wrote:
> > + WARN_ON((res == 0) || (res == 1));
>
> Unneeded ()...
> > + err = ssb_pcibios_plat_dev_init(dev);
> > + if (err) {
> > + printk(KERN_ALERT "PCI: Failed to init device %s\n",
> > + pci_name(dev));
> > + }
> >
>
> Unneeded {}...
You must me kidding.
Get this freaking regression fix upstream, please.
We're not going to respin it to fix trivial taste issues.
(The above code is _perfectly_ fine and doesn't violate any rule).
--
Greetings Michael.
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 22:14 ` Sergei Shtylyov
2008-09-24 22:31 ` Michael Buesch
@ 2008-09-25 0:14 ` John W. Linville
2008-09-25 9:54 ` Sergei Shtylyov
2008-09-25 0:18 ` John W. Linville
2008-09-26 15:42 ` Ralf Baechle
3 siblings, 1 reply; 24+ messages in thread
From: John W. Linville @ 2008-09-25 0:14 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Aurelien Jarno, Ralf Baechle, linux-mips, Michael Buesch
On Thu, Sep 25, 2008 at 02:14:22AM +0400, Sergei Shtylyov wrote:
> Aurelien Jarno wrote:
>
>> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
>> pcibios_plat_dev_init() for the BCM47xx platform.
>>
>> It fixes the regression introduced by commit
>> aab547ce0d1493d400b6468c521a0137cd8c1edf.
Did you read this part?
>> + /* IRQ-0 and IRQ-1 are software interrupts. */
>> + WARN_ON((res == 0) || (res == 1));
>>
>
> Unneeded ()...
Pffttt...
>> + if (err) {
>> + printk(KERN_ALERT "PCI: Failed to init device %s\n",
>> + pci_name(dev));
>> + }
>>
>
> Unneeded {}...
This is petty bullshit...
Is there a real reason why this hasn't been merged?
John
--
John W. Linville Linux should be at the core
linville@tuxdriver.com of your literate lifestyle.
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 0:14 ` John W. Linville
@ 2008-09-25 9:54 ` Sergei Shtylyov
0 siblings, 0 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2008-09-25 9:54 UTC (permalink / raw)
To: John W. Linville; +Cc: Aurelien Jarno, Ralf Baechle, linux-mips, Michael Buesch
Hello.
John W. Linville wrote:
>>> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
>>> pcibios_plat_dev_init() for the BCM47xx platform.
>>>
>>> It fixes the regression introduced by commit
>>> aab547ce0d1493d400b6468c521a0137cd8c1edf.
>>>
>
> Did you read this part?
>
I usually comment on the patches regardless of such stuff. Maybe I
shoudn't have this time in order to not take the blame for the patch bot
being merged...
>>> + if (err) {
>>> + printk(KERN_ALERT "PCI: Failed to init device %s\n",
>>> + pci_name(dev));
>>> + }
>>>
>>>
>> Unneeded {}...
>>
>
> This is petty bullshit...
>
No, just style nitpicking. :-)
> Is there a real reason why this hasn't been merged?
>
This question is not to me.
> John
>
WBR, Sergei
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
@ 2008-09-25 0:18 ` John W. Linville
0 siblings, 0 replies; 24+ messages in thread
From: John W. Linville @ 2008-09-25 0:18 UTC (permalink / raw)
To: Ralf Baechle, Ralf Baechle
Cc: linux-mips, Michael Buesch, Aurelien Jarno, Sergei Shtylyov,
linux-mips@linux-mips.org, Michael Buesch, John W. Linville
From: Aurelien Jarno <aurelien@aurel32.net>
This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
pcibios_plat_dev_init() for the BCM47xx platform.
It fixes the regression introduced by commit
aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
driver").
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
arch/mips/pci/Makefile | 1 +
arch/mips/pci/pci-bcm47xx.c | 58 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 arch/mips/pci/pci-bcm47xx.c
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 15e01ae..c8c32f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
+obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
#
# These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644
index 0000000..64ccb4f
--- /dev/null
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+ int res;
+
+ res = ssb_pcibios_map_irq(dev, slot, pin);
+ if (res < 0) {
+ printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+ dev->dev.bus_id);
+ return 0;
+ }
+ /* IRQ-0 and IRQ-1 are software interrupts. */
+ WARN_ON(res == 0 || res == 1);
+
+ return res;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+ int err;
+
+ err = ssb_pcibios_plat_dev_init(dev);
+ if (err)
+ printk(KERN_ALERT "PCI: Failed to init device %s\n",
+ pci_name(dev));
+
+ return err;
+}
+
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
@ 2008-09-25 0:18 ` John W. Linville
0 siblings, 0 replies; 24+ messages in thread
From: John W. Linville @ 2008-09-25 0:18 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Michael Buesch, Aurelien Jarno, Sergei Shtylyov
From: Aurelien Jarno <aurelien@aurel32.net>
This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
pcibios_plat_dev_init() for the BCM47xx platform.
It fixes the regression introduced by commit
aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
driver").
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Reviewed-by: Michael Buesch <mb@bu3sch.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
arch/mips/pci/Makefile | 1 +
arch/mips/pci/pci-bcm47xx.c | 58 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 arch/mips/pci/pci-bcm47xx.c
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 15e01ae..c8c32f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
+obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
#
# These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644
index 0000000..64ccb4f
--- /dev/null
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+ int res;
+
+ res = ssb_pcibios_map_irq(dev, slot, pin);
+ if (res < 0) {
+ printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+ dev->dev.bus_id);
+ return 0;
+ }
+ /* IRQ-0 and IRQ-1 are software interrupts. */
+ WARN_ON(res == 0 || res == 1);
+
+ return res;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+ int err;
+
+ err = ssb_pcibios_plat_dev_init(dev);
+ if (err)
+ printk(KERN_ALERT "PCI: Failed to init device %s\n",
+ pci_name(dev));
+
+ return err;
+}
+
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 0:18 ` John W. Linville
(?)
@ 2008-09-25 10:05 ` Sergei Shtylyov
2008-09-25 12:32 ` Aurelien Jarno
2008-09-25 17:24 ` John W. Linville
-1 siblings, 2 replies; 24+ messages in thread
From: Sergei Shtylyov @ 2008-09-25 10:05 UTC (permalink / raw)
To: John W. Linville; +Cc: Ralf Baechle, linux-mips, Michael Buesch, Aurelien Jarno
Hello.
John W. Linville wrote:
> From: Aurelien Jarno <aurelien@aurel32.net>
>
> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
> pcibios_plat_dev_init() for the BCM47xx platform.
>
> It fixes the regression introduced by commit
> aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
> driver").
>
> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> Reviewed-by: Michael Buesch <mb@bu3sch.de>
> Signed-off-by: John W. Linville <linville@tuxdriver.com>
>
Thanks for addessing my nitpicking (which you could have ignored :-).
I'm only seeing this patch posted on April 21st before yesterday (and
receiving no comments) -- probably Aurilen hasn't been persevering
enough for Ralf to merge it. I've been a victim of Ralf's
"forgetfullness" as well, so I can sympathise. :-)
WBR, Sergei
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 10:05 ` Sergei Shtylyov
@ 2008-09-25 12:32 ` Aurelien Jarno
2008-09-25 14:39 ` Sergei Shtylyov
2008-09-25 17:24 ` John W. Linville
1 sibling, 1 reply; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-25 12:32 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: John W. Linville, Ralf Baechle, linux-mips, Michael Buesch
Sergei Shtylyov a écrit :
> Hello.
>
> John W. Linville wrote:
>
>> From: Aurelien Jarno <aurelien@aurel32.net>
>>
>> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
>> pcibios_plat_dev_init() for the BCM47xx platform.
>>
>> It fixes the regression introduced by commit
>> aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
>> driver").
>>
>> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>> Reviewed-by: Michael Buesch <mb@bu3sch.de>
>> Signed-off-by: John W. Linville <linville@tuxdriver.com>
>>
>
> Thanks for addessing my nitpicking (which you could have ignored :-).
> I'm only seeing this patch posted on April 21st before yesterday (and
> receiving no comments) -- probably Aurilen hasn't been persevering
> enough for Ralf to merge it. I've been a victim of Ralf's
> "forgetfullness" as well, so I can sympathise. :-)
You probably forget messages like:
http://www.linux-mips.org/archives/linux-mips/2008-05/msg00300.html
http://www.linux-mips.org/archives/linux-mips/2008-06/msg00128.html
and the numerous IRC pings.
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 12:32 ` Aurelien Jarno
@ 2008-09-25 14:39 ` Sergei Shtylyov
2008-09-25 20:59 ` Michael Buesch
0 siblings, 1 reply; 24+ messages in thread
From: Sergei Shtylyov @ 2008-09-25 14:39 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: John W. Linville, Ralf Baechle, linux-mips, Michael Buesch
Hello.
Aurelien Jarno wrote:
>>>This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
>>>pcibios_plat_dev_init() for the BCM47xx platform.
>>>It fixes the regression introduced by commit
>>>aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
>>>driver").
>>>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>>>Reviewed-by: Michael Buesch <mb@bu3sch.de>
>>>Signed-off-by: John W. Linville <linville@tuxdriver.com>
>> Thanks for addessing my nitpicking (which you could have ignored :-).
>> I'm only seeing this patch posted on April 21st before yesterday (and
>>receiving no comments) -- probably Aurilen hasn't been persevering
>>enough for Ralf to merge it. I've been a victim of Ralf's
>>"forgetfullness" as well, so I can sympathise. :-)
> You probably forget messages like:
> http://www.linux-mips.org/archives/linux-mips/2008-05/msg00300.html
> http://www.linux-mips.org/archives/linux-mips/2008-06/msg00128.html
Yes, I have overlooked these since they had different subject.
> and the numerous IRC pings.
I've been thru that before. :-)
WBR, Sergei
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 14:39 ` Sergei Shtylyov
@ 2008-09-25 20:59 ` Michael Buesch
0 siblings, 0 replies; 24+ messages in thread
From: Michael Buesch @ 2008-09-25 20:59 UTC (permalink / raw)
To: Sergei Shtylyov
Cc: Aurelien Jarno, John W. Linville, Ralf Baechle, linux-mips
On Thursday 25 September 2008 16:39:42 Sergei Shtylyov wrote:
> Hello.
>
> Aurelien Jarno wrote:
>
> >>>This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
> >>>pcibios_plat_dev_init() for the BCM47xx platform.
>
> >>>It fixes the regression introduced by commit
> >>>aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
> >>>driver").
>
> >>>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> >>>Reviewed-by: Michael Buesch <mb@bu3sch.de>
> >>>Signed-off-by: John W. Linville <linville@tuxdriver.com>
>
> >> Thanks for addessing my nitpicking (which you could have ignored :-).
> >> I'm only seeing this patch posted on April 21st before yesterday (and
> >>receiving no comments) -- probably Aurilen hasn't been persevering
> >>enough for Ralf to merge it. I've been a victim of Ralf's
> >>"forgetfullness" as well, so I can sympathise. :-)
>
> > You probably forget messages like:
> > http://www.linux-mips.org/archives/linux-mips/2008-05/msg00300.html
> > http://www.linux-mips.org/archives/linux-mips/2008-06/msg00128.html
>
> Yes, I have overlooked these since they had different subject.
>
> > and the numerous IRC pings.
>
> I've been thru that before. :-)
And one private discussion and the bugzilla entry. ;)
That's why I'm going to submit it to akpm or John, is it's not applied
to the mips tree until October the 5th.
--
Greetings Michael.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 10:05 ` Sergei Shtylyov
2008-09-25 12:32 ` Aurelien Jarno
@ 2008-09-25 17:24 ` John W. Linville
2008-09-25 21:00 ` Michael Buesch
1 sibling, 1 reply; 24+ messages in thread
From: John W. Linville @ 2008-09-25 17:24 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Ralf Baechle, linux-mips, Michael Buesch, Aurelien Jarno
On Thu, Sep 25, 2008 at 02:05:12PM +0400, Sergei Shtylyov wrote:
> Hello.
>
> John W. Linville wrote:
>
>> From: Aurelien Jarno <aurelien@aurel32.net>
>>
>> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
>> pcibios_plat_dev_init() for the BCM47xx platform.
>>
>> It fixes the regression introduced by commit
>> aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
>> driver").
>>
>> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
>> Reviewed-by: Michael Buesch <mb@bu3sch.de>
>> Signed-off-by: John W. Linville <linville@tuxdriver.com>
>>
>
> Thanks for addessing my nitpicking (which you could have ignored :-).
> I'm only seeing this patch posted on April 21st before yesterday (and
> receiving no comments) -- probably Aurilen hasn't been persevering
> enough for Ralf to merge it. I've been a victim of Ralf's
> "forgetfullness" as well, so I can sympathise. :-)
Sergei, I'm sorry if I was rude to you.
Ralf, given the OpenWRT and SSB connection, I could probably merge
this series through my tree if you don't want to take it in yours
for some reason.
John
--
John W. Linville Linux should be at the core
linville@tuxdriver.com of your literate lifestyle.
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-25 17:24 ` John W. Linville
@ 2008-09-25 21:00 ` Michael Buesch
0 siblings, 0 replies; 24+ messages in thread
From: Michael Buesch @ 2008-09-25 21:00 UTC (permalink / raw)
To: John W. Linville
Cc: Sergei Shtylyov, Ralf Baechle, linux-mips, Aurelien Jarno
On Thursday 25 September 2008 19:24:30 John W. Linville wrote:
> On Thu, Sep 25, 2008 at 02:05:12PM +0400, Sergei Shtylyov wrote:
> > Hello.
> >
> > John W. Linville wrote:
> >
> >> From: Aurelien Jarno <aurelien@aurel32.net>
> >>
> >> This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
> >> pcibios_plat_dev_init() for the BCM47xx platform.
> >>
> >> It fixes the regression introduced by commit
> >> aab547ce0d1493d400b6468c521a0137cd8c1edf ("ssb: Add Gigabit Ethernet
> >> driver").
> >>
> >> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
> >> Reviewed-by: Michael Buesch <mb@bu3sch.de>
> >> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> >>
> >
> > Thanks for addessing my nitpicking (which you could have ignored :-).
> > I'm only seeing this patch posted on April 21st before yesterday (and
> > receiving no comments) -- probably Aurilen hasn't been persevering
> > enough for Ralf to merge it. I've been a victim of Ralf's
> > "forgetfullness" as well, so I can sympathise. :-)
>
> Sergei, I'm sorry if I was rude to you.
>
> Ralf, given the OpenWRT and SSB connection, I could probably merge
> this series through my tree if you don't want to take it in yours
> for some reason.
Yeah, the regression also made it through your tree, so it's probably
OK to merge the fix through it, too. Let's give 'em another week
and merge it through your tree if it's still not in the mips tree.
--
Greetings Michael.
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 22:14 ` Sergei Shtylyov
` (2 preceding siblings ...)
2008-09-25 0:18 ` John W. Linville
@ 2008-09-26 15:42 ` Ralf Baechle
3 siblings, 0 replies; 24+ messages in thread
From: Ralf Baechle @ 2008-09-26 15:42 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Aurelien Jarno, linux-mips, Michael Buesch
On Thu, Sep 25, 2008 at 02:14:22AM +0400, Sergei Shtylyov wrote:
>> + res = ssb_pcibios_map_irq(dev, slot, pin);
>> + if (res < 0) {
>> + printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
>> + dev->dev.bus_id);
>> + return 0;
>> + }
>> + /* IRQ-0 and IRQ-1 are software interrupts. */
>> + WARN_ON((res == 0) || (res == 1));
>>
>
> Unneeded ()...
My rule of thumb for the use of parenthesis is that the reader of a piece
of code should not have to know much about operator precendence, so the
occasional avoidable parenthesis if it serves readability.
Ralf
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 1/6 v2] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-24 19:19 ` [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code Aurelien Jarno
2008-09-24 21:17 ` Michael Buesch
2008-09-24 22:14 ` Sergei Shtylyov
@ 2008-09-26 18:23 ` Aurelien Jarno
2008-09-27 14:06 ` [PATCH 1/6 v3] " Aurelien Jarno
2 siblings, 1 reply; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-26 18:23 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Michael Buesch
Please find below the version 2 of this patch that addresses all he
comments. It removes the unneeded braces and brackets, and add __init
to pcibios_map_irq().
---
This patch, ported from OpenWRT SVN, defines pcibios_map_irq() and
pcibios_plat_dev_init() for the BCM47xx platform.
It fixes the regression introduced by commit
aab547ce0d1493d400b6468c521a0137cd8c1edf.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/pci/Makefile | 1 +
arch/mips/pci/pci-bcm47xx.c | 57 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 58 insertions(+), 0 deletions(-)
create mode 100644 arch/mips/pci/pci-bcm47xx.c
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 15e01ae..c8c32f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
+obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
#
# These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644
index 0000000..853a7e9
--- /dev/null
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2008 Michael Buesch <mb@bu3sch.de>
+ * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+ int res;
+
+ res = ssb_pcibios_map_irq(dev, slot, pin);
+ if (res < 0) {
+ printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+ dev->dev.bus_id);
+ return 0;
+ }
+ /* IRQ-0 and IRQ-1 are software interrupts. */
+ WARN_ON(res == 0 || res == 1);
+
+ return res;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+ int err;
+
+ err = ssb_pcibios_plat_dev_init(dev);
+ if (err)
+ printk(KERN_ALERT "PCI: Failed to init device %s\n",
+ pci_name(dev));
+
+ return err;
+}
+
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 1/6 v3] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-26 18:23 ` [PATCH 1/6 v2] " Aurelien Jarno
@ 2008-09-27 14:06 ` Aurelien Jarno
2008-09-27 14:35 ` Ralf Baechle
0 siblings, 1 reply; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-27 14:06 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Michael Buesch
Please find below the version 3 of this patch that addresses all he
comments. This new version moves all the code to pcibios_plat_dev_init()
from pcibios_map_irq() to support dynamic interrupt routing. This way
errors can be reported correctly.
---
This patch defines pcibios_map_irq() and pcibios_plat_dev_init() for
the BCM47xx platform.
It fixes the regression introduced by commit
aab547ce0d1493d400b6468c521a0137cd8c1edf.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/pci/Makefile | 1 +
arch/mips/pci/pci-bcm47xx.c | 60 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 61 insertions(+), 0 deletions(-)
create mode 100644 arch/mips/pci/pci-bcm47xx.c
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index 15e01ae..c8c32f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -15,6 +15,7 @@ obj-$(CONFIG_SOC_TX3927) += ops-tx3927.o
obj-$(CONFIG_PCI_VR41XX) += ops-vr41xx.o pci-vr41xx.o
obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
obj-$(CONFIG_PCI_TX4927) += ops-tx4927.o
+obj-$(CONFIG_BCM47XX) += pci-bcm47xx.o
#
# These are still pretty much in the old state, watch, go blind.
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
new file mode 100644
index 0000000..fe3ec84
--- /dev/null
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2008 Aurelien Jarno <aurelien@aurel32.net>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/types.h>
+#include <linux/pci.h>
+#include <linux/ssb/ssb.h>
+
+int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+{
+ return 0;
+}
+
+int pcibios_plat_dev_init(struct pci_dev *dev)
+{
+ int res;
+ u8 slot, pin;
+
+ res = ssb_pcibios_plat_dev_init(dev);
+ if (res < 0) {
+ printk(KERN_ALERT "PCI: Failed to init device %s\n",
+ pci_name(dev));
+ return res;
+ }
+
+ pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
+ slot = PCI_SLOT(dev->devfn);
+ res = ssb_pcibios_map_irq(dev, slot, pin);
+
+ /* IRQ-0 and IRQ-1 are software interrupts. */
+ if (res < 2) {
+ printk(KERN_ALERT "PCI: Failed to map IRQ of device %s\n",
+ pci_name(dev));
+ return res;
+ }
+
+ dev->irq = res;
+ return 0;
+}
+
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 1/6 v3] [MIPS] BCM47xx: Add platform specific PCI code
2008-09-27 14:06 ` [PATCH 1/6 v3] " Aurelien Jarno
@ 2008-09-27 14:35 ` Ralf Baechle
0 siblings, 0 replies; 24+ messages in thread
From: Ralf Baechle @ 2008-09-27 14:35 UTC (permalink / raw)
To: Aurelien Jarno; +Cc: linux-mips, Michael Buesch
On Sat, Sep 27, 2008 at 04:06:16PM +0200, Aurelien Jarno wrote:
> Please find below the version 3 of this patch that addresses all he
> comments. This new version moves all the code to pcibios_plat_dev_init()
> from pcibios_map_irq() to support dynamic interrupt routing. This way
> errors can be reported correctly.
This one looks good. Thanks, applied.
Ralf
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 2/6] [MIPS] WGT634U: Add machine detection message
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
2008-09-24 19:19 ` [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code Aurelien Jarno
@ 2008-09-24 19:20 ` Aurelien Jarno
2008-09-24 19:21 ` [PATCH 3/6] [MIPS] Remove references to BCM947XX Aurelien Jarno
` (3 subsequent siblings)
5 siblings, 0 replies; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-24 19:20 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
This adds a printk message when a WGT634U machine is detected.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/bcm47xx/wgt634u.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index d1d90c9..f9e309a 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -112,6 +112,9 @@ static int __init wgt634u_init(void)
((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
(et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore;
+
+ printk(KERN_INFO "WGT634U machine detected.\n");
+
wgt634u_flash_data.width = mcore->flash_buswidth;
wgt634u_flash_resource.start = mcore->flash_window;
wgt634u_flash_resource.end = mcore->flash_window
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 3/6] [MIPS] Remove references to BCM947XX
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
2008-09-24 19:19 ` [PATCH 1/6] [MIPS] BCM47xx: Add platform specific PCI code Aurelien Jarno
2008-09-24 19:20 ` [PATCH 2/6] [MIPS] WGT634U: Add machine detection message Aurelien Jarno
@ 2008-09-24 19:21 ` Aurelien Jarno
2008-09-24 19:22 ` [PATCH 4/6] [MIPS] BCM47xx: Use the new SSB GPIO API Aurelien Jarno
` (2 subsequent siblings)
5 siblings, 0 replies; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-24 19:21 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips, Florian Fainelli
This patch removes the remaining reference
to the BCM947xx development board codename.
Signed-off-by: Florian Fainelli <florian.fainelli@telecomint.eu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
include/asm-mips/mach-bcm47xx/war.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/asm-mips/mach-bcm47xx/war.h b/include/asm-mips/mach-bcm47xx/war.h
index 4a2b798..87cd465 100644
--- a/include/asm-mips/mach-bcm47xx/war.h
+++ b/include/asm-mips/mach-bcm47xx/war.h
@@ -5,8 +5,8 @@
*
* Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
*/
-#ifndef __ASM_MIPS_MACH_BCM947XX_WAR_H
-#define __ASM_MIPS_MACH_BCM947XX_WAR_H
+#ifndef __ASM_MIPS_MACH_BCM47XX_WAR_H
+#define __ASM_MIPS_MACH_BCM47XX_WAR_H
#define R4600_V1_INDEX_ICACHEOP_WAR 0
#define R4600_V1_HIT_CACHEOP_WAR 0
@@ -22,4 +22,4 @@
#define R10000_LLSC_WAR 0
#define MIPS34K_MISSED_ITLB_WAR 0
-#endif /* __ASM_MIPS_MACH_BCM947XX_WAR_H */
+#endif /* __ASM_MIPS_MACH_BCM47XX_WAR_H */
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 4/6] [MIPS] BCM47xx: Use the new SSB GPIO API
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
` (2 preceding siblings ...)
2008-09-24 19:21 ` [PATCH 3/6] [MIPS] Remove references to BCM947XX Aurelien Jarno
@ 2008-09-24 19:22 ` Aurelien Jarno
2008-09-24 19:23 ` [PATCH 5/6] [MIPS] Add WGT634U reset button support Aurelien Jarno
2008-09-24 19:23 ` [PATCH 6/6] [MIPS] Scan PCI busses when they are registered Aurelien Jarno
5 siblings, 0 replies; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-24 19:22 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
This patch simplifies the BCM47xx GPIO code by using the new SSB GPIO
API, which does a lot things that were implemented directly in the
BCM47xx code.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/Kconfig | 1 +
arch/mips/bcm47xx/gpio.c | 85 +++++++++++++--------------------
arch/mips/bcm47xx/setup.c | 5 +-
include/asm-mips/mach-bcm47xx/gpio.h | 41 ++++++++--------
4 files changed, 58 insertions(+), 74 deletions(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 49896a2..1503feb 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -52,6 +52,7 @@ config BCM47XX
select SSB
select SSB_DRIVER_MIPS
select SSB_DRIVER_EXTIF
+ select SSB_EMBEDDED
select SSB_PCICORE_HOSTMODE if PCI
select GENERIC_GPIO
select SYS_HAS_EARLY_PRINTK
diff --git a/arch/mips/bcm47xx/gpio.c b/arch/mips/bcm47xx/gpio.c
index f5a53ac..9b79880 100644
--- a/arch/mips/bcm47xx/gpio.c
+++ b/arch/mips/bcm47xx/gpio.c
@@ -12,68 +12,51 @@
#include <asm/mach-bcm47xx/bcm47xx.h>
#include <asm/mach-bcm47xx/gpio.h>
-int bcm47xx_gpio_to_irq(unsigned gpio)
+#if (BCM47XX_CHIPCO_GPIO_LINES > BCM47XX_EXTIF_GPIO_LINES)
+static DECLARE_BITMAP(gpio_in_use, BCM47XX_CHIPCO_GPIO_LINES);
+#else
+static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
+#endif
+
+int gpio_request(unsigned gpio, const char *tag)
{
- if (ssb_bcm47xx.chipco.dev)
- return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2;
- else if (ssb_bcm47xx.extif.dev)
- return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2;
- else
+ if (ssb_chipco_available(&ssb_bcm47xx.chipco) &&
+ ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
return -EINVAL;
-}
-EXPORT_SYMBOL_GPL(bcm47xx_gpio_to_irq);
-int bcm47xx_gpio_get_value(unsigned gpio)
-{
- if (ssb_bcm47xx.chipco.dev)
- return ssb_chipco_gpio_in(&ssb_bcm47xx.chipco, 1 << gpio);
- else if (ssb_bcm47xx.extif.dev)
- return ssb_extif_gpio_in(&ssb_bcm47xx.extif, 1 << gpio);
- else
- return 0;
-}
-EXPORT_SYMBOL_GPL(bcm47xx_gpio_get_value);
+ if (ssb_extif_available(&ssb_bcm47xx.extif) &&
+ ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
+ return -EINVAL;
-void bcm47xx_gpio_set_value(unsigned gpio, int value)
-{
- if (ssb_bcm47xx.chipco.dev)
- ssb_chipco_gpio_out(&ssb_bcm47xx.chipco,
- 1 << gpio,
- value ? 1 << gpio : 0);
- else if (ssb_bcm47xx.extif.dev)
- ssb_extif_gpio_out(&ssb_bcm47xx.extif,
- 1 << gpio,
- value ? 1 << gpio : 0);
-}
-EXPORT_SYMBOL_GPL(bcm47xx_gpio_set_value);
+ if (test_and_set_bit(gpio, gpio_in_use))
+ return -EBUSY;
-int bcm47xx_gpio_direction_input(unsigned gpio)
-{
- if (ssb_bcm47xx.chipco.dev && (gpio < BCM47XX_CHIPCO_GPIO_LINES))
- ssb_chipco_gpio_outen(&ssb_bcm47xx.chipco,
- 1 << gpio, 0);
- else if (ssb_bcm47xx.extif.dev && (gpio < BCM47XX_EXTIF_GPIO_LINES))
- ssb_extif_gpio_outen(&ssb_bcm47xx.extif,
- 1 << gpio, 0);
- else
- return -EINVAL;
return 0;
}
-EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_input);
+EXPORT_SYMBOL(gpio_request);
-int bcm47xx_gpio_direction_output(unsigned gpio, int value)
+void gpio_free(unsigned gpio)
{
- bcm47xx_gpio_set_value(gpio, value);
+ if (ssb_chipco_available(&ssb_bcm47xx.chipco) &&
+ ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
+ return;
+
+ if (ssb_extif_available(&ssb_bcm47xx.extif) &&
+ ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
+ return;
+
+ clear_bit(gpio, gpio_in_use);
+}
+EXPORT_SYMBOL(gpio_free);
- if (ssb_bcm47xx.chipco.dev && (gpio < BCM47XX_CHIPCO_GPIO_LINES))
- ssb_chipco_gpio_outen(&ssb_bcm47xx.chipco,
- 1 << gpio, 1 << gpio);
- else if (ssb_bcm47xx.extif.dev && (gpio < BCM47XX_EXTIF_GPIO_LINES))
- ssb_extif_gpio_outen(&ssb_bcm47xx.extif,
- 1 << gpio, 1 << gpio);
+int gpio_to_irq(unsigned gpio)
+{
+ if (ssb_chipco_available(&ssb_bcm47xx.chipco))
+ return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2;
+ else if (ssb_extif_available(&ssb_bcm47xx.extif))
+ return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2;
else
return -EINVAL;
- return 0;
}
-EXPORT_SYMBOL_GPL(bcm47xx_gpio_direction_output);
+EXPORT_SYMBOL_GPL(gpio_to_irq);
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index 8d36f18..2f580fa 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -27,6 +27,7 @@
#include <linux/types.h>
#include <linux/ssb/ssb.h>
+#include <linux/ssb/ssb_embedded.h>
#include <asm/bootinfo.h>
#include <asm/reboot.h>
#include <asm/time.h>
@@ -41,7 +42,7 @@ static void bcm47xx_machine_restart(char *command)
printk(KERN_ALERT "Please stand by while rebooting the system...\n");
local_irq_disable();
/* Set the watchdog timer to reset immediately */
- ssb_chipco_watchdog_timer_set(&ssb_bcm47xx.chipco, 1);
+ ssb_watchdog_timer_set(&ssb_bcm47xx, 1);
while (1)
cpu_relax();
}
@@ -50,7 +51,7 @@ static void bcm47xx_machine_halt(void)
{
/* Disable interrupts and watchdog and spin forever */
local_irq_disable();
- ssb_chipco_watchdog_timer_set(&ssb_bcm47xx.chipco, 0);
+ ssb_watchdog_timer_set(&ssb_bcm47xx, 0);
while (1)
cpu_relax();
}
diff --git a/include/asm-mips/mach-bcm47xx/gpio.h b/include/asm-mips/mach-bcm47xx/gpio.h
index cfc8f4d..d8ff4cd 100644
--- a/include/asm-mips/mach-bcm47xx/gpio.h
+++ b/include/asm-mips/mach-bcm47xx/gpio.h
@@ -9,47 +9,46 @@
#ifndef __BCM47XX_GPIO_H
#define __BCM47XX_GPIO_H
+#include <linux/ssb/ssb_embedded.h>
+#include <asm/mach-bcm47xx/bcm47xx.h>
+
#define BCM47XX_EXTIF_GPIO_LINES 5
#define BCM47XX_CHIPCO_GPIO_LINES 16
-extern int bcm47xx_gpio_to_irq(unsigned gpio);
-extern int bcm47xx_gpio_get_value(unsigned gpio);
-extern void bcm47xx_gpio_set_value(unsigned gpio, int value);
-extern int bcm47xx_gpio_direction_input(unsigned gpio);
-extern int bcm47xx_gpio_direction_output(unsigned gpio, int value);
-
-static inline int gpio_request(unsigned gpio, const char *label)
-{
- return 0;
-}
+extern int gpio_request(unsigned gpio, const char *label);
+extern void gpio_free(unsigned gpio);
+extern int gpio_to_irq(unsigned gpio);
-static inline void gpio_free(unsigned gpio)
+static inline int gpio_get_value(unsigned gpio)
{
+ return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio);
}
-static inline int gpio_to_irq(unsigned gpio)
+static inline void gpio_set_value(unsigned gpio, int value)
{
- return bcm47xx_gpio_to_irq(gpio);
+ ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0);
}
-static inline int gpio_get_value(unsigned gpio)
+static inline int gpio_direction_input(unsigned gpio)
{
- return bcm47xx_gpio_get_value(gpio);
+ return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0);
}
-static inline void gpio_set_value(unsigned gpio, int value)
+static inline int gpio_direction_output(unsigned gpio, int value)
{
- bcm47xx_gpio_set_value(gpio, value);
+ return ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio);
}
-static inline int gpio_direction_input(unsigned gpio)
+static int gpio_intmask(unsigned gpio, int value)
{
- return bcm47xx_gpio_direction_input(gpio);
+ return ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio,
+ value ? 1 << gpio : 0);
}
-static inline int gpio_direction_output(unsigned gpio, int value)
+static int gpio_polarity(unsigned gpio, int value)
{
- return bcm47xx_gpio_direction_output(gpio, value);
+ return ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio,
+ value ? 1 << gpio : 0);
}
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 5/6] [MIPS] Add WGT634U reset button support
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
` (3 preceding siblings ...)
2008-09-24 19:22 ` [PATCH 4/6] [MIPS] BCM47xx: Use the new SSB GPIO API Aurelien Jarno
@ 2008-09-24 19:23 ` Aurelien Jarno
2008-09-24 19:23 ` [PATCH 6/6] [MIPS] Scan PCI busses when they are registered Aurelien Jarno
5 siblings, 0 replies; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-24 19:23 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
This patch adds support for the reset button of WGT634U machine, using
GPIO interrupts. Based on a patch from Michel Lespinasse.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/bcm47xx/wgt634u.c | 37 +++++++++++++++++++++++++++++++++++++
1 files changed, 37 insertions(+), 0 deletions(-)
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index f9e309a..db1a72f 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -11,6 +11,9 @@
#include <linux/leds.h>
#include <linux/mtd/physmap.h>
#include <linux/ssb/ssb.h>
+#include <linux/interrupt.h>
+#include <linux/reboot.h>
+#include <asm/gpio.h>
#include <asm/mach-bcm47xx/bcm47xx.h>
/* GPIO definitions for the WGT634U */
@@ -99,6 +102,30 @@ static struct platform_device *wgt634u_devices[] __initdata = {
&wgt634u_gpio_leds,
};
+static irqreturn_t gpio_interrupt(int irq, void *ignored)
+{
+ int state;
+
+ /* Interrupts are shared, check if the current one is
+ a GPIO interrupt. */
+ if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco,
+ SSB_CHIPCO_IRQ_GPIO))
+ return IRQ_NONE;
+
+ state = gpio_get_value(WGT634U_GPIO_RESET);
+
+ /* Interrupt are level triggered, revert the interrupt polarity
+ to clear the interrupt. */
+ gpio_polarity(WGT634U_GPIO_RESET, state);
+
+ if (!state) {
+ printk(KERN_INFO "Reset button pressed");
+ ctrl_alt_del();
+ }
+
+ return IRQ_HANDLED;
+}
+
static int __init wgt634u_init(void)
{
/* There is no easy way to detect that we are running on a WGT634U
@@ -115,6 +142,16 @@ static int __init wgt634u_init(void)
printk(KERN_INFO "WGT634U machine detected.\n");
+ if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
+ gpio_interrupt, IRQF_SHARED,
+ "WGT634U GPIO", &ssb_bcm47xx.chipco)) {
+ gpio_direction_input(WGT634U_GPIO_RESET);
+ gpio_intmask(WGT634U_GPIO_RESET, 1);
+ ssb_chipco_irq_mask(&ssb_bcm47xx.chipco,
+ SSB_CHIPCO_IRQ_GPIO,
+ SSB_CHIPCO_IRQ_GPIO);
+ }
+
wgt634u_flash_data.width = mcore->flash_buswidth;
wgt634u_flash_resource.start = mcore->flash_window;
wgt634u_flash_resource.end = mcore->flash_window
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 6/6] [MIPS] Scan PCI busses when they are registered
2008-09-24 19:18 [PATCH 0/6] BCM47xx patches Aurelien Jarno
` (4 preceding siblings ...)
2008-09-24 19:23 ` [PATCH 5/6] [MIPS] Add WGT634U reset button support Aurelien Jarno
@ 2008-09-24 19:23 ` Aurelien Jarno
5 siblings, 0 replies; 24+ messages in thread
From: Aurelien Jarno @ 2008-09-24 19:23 UTC (permalink / raw)
To: Ralf Baechle; +Cc: linux-mips
The patch below changes register_pci_controller() such that controllers
being added after pcibios_init() has run are be scanned immediately.
This is needed for example by the BCM47xx PCI controller, which is
located on the SSB bus, which is now initialized after the PCI
subsystem.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
arch/mips/pci/pci.c | 80 +++++++++++++++++++++++++++++++++-----------------
1 files changed, 53 insertions(+), 27 deletions(-)
diff --git a/arch/mips/pci/pci.c b/arch/mips/pci/pci.c
index c7fe6ec..a377e9d 100644
--- a/arch/mips/pci/pci.c
+++ b/arch/mips/pci/pci.c
@@ -34,6 +34,8 @@ static struct pci_controller *hose_head, **hose_tail = &hose_head;
unsigned long PCIBIOS_MIN_IO = 0x0000;
unsigned long PCIBIOS_MIN_MEM = 0;
+static int pci_initialized;
+
/*
* We need to avoid collisions with `mirrored' VGA ports
* and other strange ISA hardware, so we always want the
@@ -74,6 +76,42 @@ pcibios_align_resource(void *data, struct resource *res,
res->start = start;
}
+static void __devinit pcibios_scanbus(struct pci_controller *hose)
+{
+ static int next_busno;
+ static int need_domain_info;
+ struct pci_bus *bus;
+
+ if (!hose->iommu)
+ PCI_DMA_BUS_IS_PHYS = 1;
+
+ if (hose->get_busno && pci_probe_only)
+ next_busno = (*hose->get_busno)();
+
+ bus = pci_scan_bus(next_busno, hose->pci_ops, hose);
+ hose->bus = bus;
+
+ need_domain_info = need_domain_info || hose->index;
+ hose->need_domain_info = need_domain_info;
+ if (bus) {
+ next_busno = bus->subordinate + 1;
+ /* Don't allow 8-bit bus number overflow inside the hose -
+ reserve some space for bridges. */
+ if (next_busno > 224) {
+ next_busno = 0;
+ need_domain_info = 1;
+ }
+
+ if (!pci_probe_only) {
+ pci_bus_size_bridges(bus);
+ pci_bus_assign_resources(bus);
+ pci_enable_bridges(bus);
+ }
+ }
+}
+
+static DEFINE_MUTEX(pci_scan_mutex);
+
void __devinit register_pci_controller(struct pci_controller *hose)
{
if (request_resource(&iomem_resource, hose->mem_resource) < 0)
@@ -93,6 +131,17 @@ void __devinit register_pci_controller(struct pci_controller *hose)
printk(KERN_WARNING
"registering PCI controller with io_map_base unset\n");
}
+
+ /*
+ * Scan the bus if it is register after the PCI subsystem
+ * initialization.
+ */
+ if (pci_initialized) {
+ mutex_lock(&pci_scan_mutex);
+ pcibios_scanbus(hose);
+ mutex_unlock(&pci_scan_mutex);
+ }
+
return;
out:
@@ -125,38 +174,15 @@ static u8 __init common_swizzle(struct pci_dev *dev, u8 *pinp)
static int __init pcibios_init(void)
{
struct pci_controller *hose;
- struct pci_bus *bus;
- int next_busno;
- int need_domain_info = 0;
/* Scan all of the recorded PCI controllers. */
- for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
-
- if (!hose->iommu)
- PCI_DMA_BUS_IS_PHYS = 1;
-
- if (hose->get_busno && pci_probe_only)
- next_busno = (*hose->get_busno)();
-
- bus = pci_scan_bus(next_busno, hose->pci_ops, hose);
- hose->bus = bus;
- need_domain_info = need_domain_info || hose->index;
- hose->need_domain_info = need_domain_info;
- if (bus) {
- next_busno = bus->subordinate + 1;
- /* Don't allow 8-bit bus number overflow inside the hose -
- reserve some space for bridges. */
- if (next_busno > 224) {
- next_busno = 0;
- need_domain_info = 1;
- }
- }
- }
+ for (hose = hose_head; hose; hose = hose->next)
+ pcibios_scanbus(hose);
- if (!pci_probe_only)
- pci_assign_unassigned_resources();
pci_fixup_irqs(common_swizzle, pcibios_map_irq);
+ pci_initialized = 1;
+
return 0;
}
--
1.5.6.5
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply related [flat|nested] 24+ messages in thread