public inbox for linux-arch@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
To: linux-pci@atrey.karlin.mff.cuni.cz, linux-arch@vger.kernel.org
Cc: Russell King <rmk@arm.linux.org.uk>,
	linux-arm-kernel@lists.arm.linux.org.uk,
	Kyle McMartin <kyle@parisc-linux.org>,
	Matthew Wilcox <matthew@wil.cx>,
	Grant Grundler <grundler@parisc-linux.org>,
	linux-parisc@vger.kernel.org, Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	linuxppc-dev@ozlabs.org, Chris Zankel <chris@zankel.net>
Subject: [patch 5/6] PARISC: move PERR & SERR enables out of pcibios_enable_resources()
Date: Wed, 27 Feb 2008 17:04:42 -0700	[thread overview]
Message-ID: <20080228001053.209248743@ldl.fc.hp.com> (raw)
In-Reply-To: 20080228000437.880811124@ldl.fc.hp.com

[-- Attachment #1: parisc-pcibios_enable_resources --]
[-- Type: text/plain, Size: 2124 bytes --]

Move PERR and SERR enables from pcibios_enable_resources() to
platform_pci_enable_device() so the former matches other
architectures and can be shared.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>

Index: work6/arch/parisc/kernel/pci.c
===================================================================
--- work6.orig/arch/parisc/kernel/pci.c	2008-02-27 11:30:02.000000000 -0700
+++ work6/arch/parisc/kernel/pci.c	2008-02-27 11:38:11.000000000 -0700
@@ -281,9 +281,7 @@
  * A driver is enabling the device.  We make sure that all the appropriate
  * bits are set to allow the device to operate as the driver is expecting.
  * We enable the port IO and memory IO bits if the device has any BARs of
- * that type, and we enable the PERR and SERR bits unconditionally.
- * Drivers that do not need parity (eg graphics and possibly networking)
- * can clear these bits if they want.
+ * that type.
  */
 int pcibios_enable_resources(struct pci_dev *dev, int mask)
 {
@@ -305,8 +303,6 @@
 			cmd |= PCI_COMMAND_MEMORY;
 	}
 
-	cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
-
 #if 0
 	/* If bridge/bus controller has FBB enabled, child must too. */
 	if (dev->bus->bridge_ctl & PCI_BRIDGE_CTL_FAST_BACK)
@@ -317,9 +313,38 @@
 	return 0;
 }
 
+/*
+ * A driver is enabling the device.  We enable the PERR and SERR bits
+ * unconditionally.  Drivers that do not need parity (eg graphics and
+ * possibly networking) can clear these bits if they want.
+ */
+static int platform_pci_enable_device(struct pci_dev *dev)
+{
+	u16 cmd, old_cmd;
+	int idx;
+
+	pci_read_config_word(dev, PCI_COMMAND, &cmd);
+	old_cmd = cmd;
+
+	cmd |= (PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
+
+	if (cmd != old_cmd) {
+		dev_info(&dev->dev, "enabling SERR and PARITY (%04x -> %04x)\n",
+			old_cmd, cmd);
+		pci_write_config_word(dev, PCI_COMMAND, cmd);
+	}
+
+	return 0;
+}
+
 int pcibios_enable_device(struct pci_dev *dev, int mask)
 {
-	return pcibios_enable_resources(dev, mask);
+	int err;
+
+	if ((err = pcibios_enable_resources(dev, mask)) < 0)
+		return err;
+
+	return platform_pci_enable_device(dev);
 }
 
 /* PA-RISC specific */

-- 

  parent reply	other threads:[~2008-02-28  0:09 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-28  0:04 [patch 0/6] RFC: PCI: consolidate pcibios_enable_resources() implementations, v2 Bjorn Helgaas
2008-02-28  0:04 ` [patch 1/6] PCI: split pcibios_enable_resources() out of pcibios_enable_device() Bjorn Helgaas
2008-02-28  0:04 ` [patch 2/6] ppc: make pcibios_enable_device() use pcibios_enable_resources() Bjorn Helgaas
2008-02-28  0:04 ` [patch 3/6] xtensa: " Bjorn Helgaas
2008-02-28  0:04 ` [patch 4/6] ARM: move bridge enable out of pcibios_enable_resources() Bjorn Helgaas
2008-03-03 17:59   ` Jesse Barnes
2008-03-03 17:59     ` Jesse Barnes
2008-03-03 20:35     ` Benjamin Herrenschmidt
2008-03-03 20:35       ` Benjamin Herrenschmidt
2008-03-03 20:43       ` Jesse Barnes
2008-03-03 20:43         ` Jesse Barnes
2008-03-06 15:06   ` Russell King - ARM Linux
2008-03-06 15:06     ` Russell King - ARM Linux
     [not found]     ` <20080306150640.GL3283-f404yB8NqCZvn6HldHNs0ANdhmdF6hFW@public.gmane.org>
2008-03-06 15:42       ` Bjorn Helgaas
2008-03-06 15:42         ` Bjorn Helgaas
2008-02-28  0:04 ` Bjorn Helgaas [this message]
2008-02-28 17:31   ` [patch 5/6] PARISC: move PERR & SERR enables " Grant Grundler
2008-03-03 18:30     ` Jesse Barnes
2008-03-03 18:30       ` Jesse Barnes
2008-02-28 17:38   ` Kyle McMartin
2008-02-28  0:04 ` [patch 6/6] PCI: consolidate several pcibios_enable_resources() implementations Bjorn Helgaas
     [not found]   ` <20080228001053.404893334-e+Ta4ugHZmL3oGB3hsPCZA@public.gmane.org>
2008-03-03 18:45     ` Jesse Barnes
2008-03-03 18:45       ` Jesse Barnes
     [not found]       ` <200803031045.07054.jbarnes-Y1mF5jBUw70BENJcbMCuUQ@public.gmane.org>
2008-03-03 19:10         ` Bjorn Helgaas
2008-03-03 19:10           ` Bjorn Helgaas
     [not found] ` <20080228000437.880811124-e+Ta4ugHZmL3oGB3hsPCZA@public.gmane.org>
2008-03-03 19:44   ` [patch 0/6] RFC: PCI: consolidate pcibios_enable_resources() implementations, v2 Russell King
2008-03-03 19:44     ` Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080228001053.209248743@ldl.fc.hp.com \
    --to=bjorn.helgaas@hp.com \
    --cc=benh@kernel.crashing.org \
    --cc=chris@zankel.net \
    --cc=grundler@parisc-linux.org \
    --cc=kyle@parisc-linux.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=matthew@wil.cx \
    --cc=paulus@samba.org \
    --cc=rmk@arm.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox