stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Ian Abbott <abbotti@mev.co.uk>
Subject: [PATCH 3.10 04/23] staging: comedi: 8255_pci: initialize MITE data window
Date: Thu, 24 Apr 2014 14:48:34 -0700	[thread overview]
Message-ID: <20140424214826.466992548@linuxfoundation.org> (raw)
In-Reply-To: <20140424214825.933835556@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Ian Abbott <abbotti@mev.co.uk>

commit 268d1e799663b795cba15c64f5d29407786a9dd4 upstream.

According to National Instruments' PCI-DIO-96/PXI-6508/PCI-6503 User
Manual, the physical address in PCI BAR1 needs to be OR'ed with 0x80 and
written to register offset 0xC0 in the "MITE" registers (BAR0).  Do so
during initialization of the National Instruments boards handled by the
"8255_pci" driver.  The boards were previously handled by the
"ni_pcidio" driver, where the initialization was done by `mite_setup()`
in the "mite" module.  The "mite" module comes with too much extra
baggage for the "8255_pci" driver to deal with so use a local, simpler
initialization function.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/staging/comedi/drivers/8255_pci.c |   34 ++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

--- a/drivers/staging/comedi/drivers/8255_pci.c
+++ b/drivers/staging/comedi/drivers/8255_pci.c
@@ -59,6 +59,7 @@ Configuration Options: not applicable, u
 #include "../comedidev.h"
 
 #include "8255.h"
+#include "mite.h"
 
 enum pci_8255_boardid {
 	BOARD_ADLINK_PCI7224,
@@ -82,6 +83,7 @@ struct pci_8255_boardinfo {
 	const char *name;
 	int dio_badr;
 	int n_8255;
+	unsigned int has_mite:1;
 };
 
 static const struct pci_8255_boardinfo pci_8255_boards[] = {
@@ -129,36 +131,43 @@ static const struct pci_8255_boardinfo p
 		.name		= "ni_pci-dio-96",
 		.dio_badr	= 1,
 		.n_8255		= 4,
+		.has_mite	= 1,
 	},
 	[BOARD_NI_PCIDIO96B] = {
 		.name		= "ni_pci-dio-96b",
 		.dio_badr	= 1,
 		.n_8255		= 4,
+		.has_mite	= 1,
 	},
 	[BOARD_NI_PXI6508] = {
 		.name		= "ni_pxi-6508",
 		.dio_badr	= 1,
 		.n_8255		= 4,
+		.has_mite	= 1,
 	},
 	[BOARD_NI_PCI6503] = {
 		.name		= "ni_pci-6503",
 		.dio_badr	= 1,
 		.n_8255		= 1,
+		.has_mite	= 1,
 	},
 	[BOARD_NI_PCI6503B] = {
 		.name		= "ni_pci-6503b",
 		.dio_badr	= 1,
 		.n_8255		= 1,
+		.has_mite	= 1,
 	},
 	[BOARD_NI_PCI6503X] = {
 		.name		= "ni_pci-6503x",
 		.dio_badr	= 1,
 		.n_8255		= 1,
+		.has_mite	= 1,
 	},
 	[BOARD_NI_PXI_6503] = {
 		.name		= "ni_pxi-6503",
 		.dio_badr	= 1,
 		.n_8255		= 1,
+		.has_mite	= 1,
 	},
 };
 
@@ -166,6 +175,25 @@ struct pci_8255_private {
 	void __iomem *mmio_base;
 };
 
+static int pci_8255_mite_init(struct pci_dev *pcidev)
+{
+	void __iomem *mite_base;
+	u32 main_phys_addr;
+
+	/* ioremap the MITE registers (BAR 0) temporarily */
+	mite_base = pci_ioremap_bar(pcidev, 0);
+	if (!mite_base)
+		return -ENOMEM;
+
+	/* set data window to main registers (BAR 1) */
+	main_phys_addr = pci_resource_start(pcidev, 1);
+	writel(main_phys_addr | WENAB, mite_base + MITE_IODWBSR);
+
+	/* finished with MITE registers */
+	iounmap(mite_base);
+	return 0;
+}
+
 static int pci_8255_mmio(int dir, int port, int data, unsigned long iobase)
 {
 	void __iomem *mmio_base = (void __iomem *)iobase;
@@ -205,6 +233,12 @@ static int pci_8255_auto_attach(struct c
 	if (ret)
 		return ret;
 
+	if (board->has_mite) {
+		ret = pci_8255_mite_init(pcidev);
+		if (ret)
+			return ret;
+	}
+
 	is_mmio = (pci_resource_flags(pcidev, board->dio_badr) &
 		   IORESOURCE_MEM) != 0;
 	if (is_mmio) {



  parent reply	other threads:[~2014-04-24 21:48 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-24 21:48 [PATCH 3.10 00/23] 3.10.38-stable review Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 01/23] user namespace: fix incorrect memory barriers Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 02/23] Char: ipmi_bt_sm, fix infinite loop Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 03/23] x86: Adjust irq remapping quirk for older revisions of 5500/5520 chipsets Greg Kroah-Hartman
2014-04-24 21:48 ` Greg Kroah-Hartman [this message]
2014-04-24 21:48 ` [PATCH 3.10 05/23] tty: Set correct tty name in active sysfs attribute Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 07/23] Bluetooth: Fix removing Long Term Key Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 08/23] backing_dev: fix hung task on sync Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 09/23] bdi: avoid oops on device removal Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 10/23] Btrfs: skip submitting barrier for missing device Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 11/23] ext4: fix error return from ext4_ext_handle_uninitialized_extents() Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 12/23] ext4: fix partial cluster handling for bigalloc file systems Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 13/23] jffs2: Fix segmentation fault found in stress test Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 14/23] jffs2: Fix crash due to truncation of csize Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 15/23] jffs2: avoid soft-lockup in jffs2_reserve_space_gc() Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 16/23] jffs2: remove from wait queue after schedule() Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 17/23] sparc: PCI: Fix incorrect address calculation of PCI Bridge windows on Simba-bridges Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 18/23] Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 19/23] sparc32: fix build failure for arch_jump_label_transform Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 20/23] sparc64: dont treat 64-bit syscall return codes as 32-bit Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 21/23] sparc64: Make sure %pil interrupts are enabled during hypervisor yield Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 22/23] wait: fix reparent_leader() vs EXIT_DEAD->EXIT_ZOMBIE race Greg Kroah-Hartman
2014-04-24 21:48 ` [PATCH 3.10 23/23] exit: call disassociate_ctty() before exit_task_namespaces() Greg Kroah-Hartman
2014-04-25  0:18 ` [PATCH 3.10 00/23] 3.10.38-stable review Guenter Roeck
2014-04-25  1:49   ` Greg Kroah-Hartman
2014-04-25  2:02     ` Guenter Roeck
2014-04-25 17:03 ` Shuah Khan

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=20140424214826.466992548@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=abbotti@mev.co.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).