linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Minghuan Lian <Minghuan.Lian@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>
Cc: Minghuan Lian <Minghuan.Lian@freescale.com>,
	linux-pci@vger.kernel.org, Zang Roy-R61911 <r61911@freescale.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Scott Wood <scottwood@freescale.com>
Subject: [PATCH 12/12][v3] pci: fsl: fix function check_pci_ctl_endpt_part
Date: Wed, 23 Oct 2013 18:41:34 +0800	[thread overview]
Message-ID: <1382524894-15164-12-git-send-email-Minghuan.Lian@freescale.com> (raw)
In-Reply-To: <1382524894-15164-1-git-send-email-Minghuan.Lian@freescale.com>

The new FSL PCI driver does not use cfg_addr of pci_controller,
we may directly access PCI CCSR using fsl_pci->regs.

Signed-off-by: Minghuan Lian <Minghuan.Lian@freescale.com>
---
change log:
v1-v3:
The new patch to fix function check_pci_ctl_endpt_part

Based on upstream master.
Based on the discussion of RFC version here
http://patchwork.ozlabs.org/patch/274487/

 arch/powerpc/sysdev/fsl_pci.h   | 5 -----
 drivers/iommu/fsl_pamu_domain.c | 6 ++++--
 include/linux/fsl/pci-common.h  | 1 +
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index ae4dbe2..3176eb2 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -16,11 +16,6 @@
 
 struct platform_device;
 
-
-/* FSL PCI controller BRR1 register */
-#define PCI_FSL_BRR1      0xbf8
-#define PCI_FSL_BRR1_VER 0xffff
-
 extern void fsl_pcibios_fixup_bus(struct pci_bus *bus);
 extern int mpc83xx_add_bridge(struct device_node *dev);
 u64 fsl_pci_immrbar_base(struct pci_controller *hose);
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c
index c857c30..dd7bc25 100644
--- a/drivers/iommu/fsl_pamu_domain.c
+++ b/drivers/iommu/fsl_pamu_domain.c
@@ -36,6 +36,7 @@
 
 #include <asm/pci-bridge.h>
 #include <sysdev/fsl_pci.h>
+#include <linux/fsl/pci-common.h>
 
 #include "fsl_pamu_domain.h"
 #include "pci.h"
@@ -908,10 +909,11 @@ static struct iommu_group *get_device_iommu_group(struct device *dev)
 static  bool check_pci_ctl_endpt_part(struct pci_controller *pci_ctl)
 {
 	u32 version;
+	struct fsl_pci *pci = fsl_arch_sys_to_pci(pci_ctl);
 
 	/* Check the PCI controller version number by readding BRR1 register */
-	version = in_be32(pci_ctl->cfg_addr + (PCI_FSL_BRR1 >> 2));
-	version &= PCI_FSL_BRR1_VER;
+	version = in_be32(&pci->regs->block_rev1);
+	version &= PCIE_IP_REV_MASK;
 	/* If PCI controller version is >= 0x204 we can partition endpoints*/
 	if (version >= 0x204)
 		return 1;
diff --git a/include/linux/fsl/pci-common.h b/include/linux/fsl/pci-common.h
index 84b0801..6112adf 100644
--- a/include/linux/fsl/pci-common.h
+++ b/include/linux/fsl/pci-common.h
@@ -18,6 +18,7 @@
 #define PCIE_LTSSM_L0	0x16		/* L0 state */
 #define PCIE_IP_REV_2_2		0x02080202 /* PCIE IP block version Rev2.2 */
 #define PCIE_IP_REV_3_0		0x02080300 /* PCIE IP block version Rev3.0 */
+#define PCIE_IP_REV_MASK	0xffff
 #define PIWAR_EN		0x80000000	/* Enable */
 #define PIWAR_PF		0x20000000	/* prefetch */
 #define PIWAR_TGI_LOCAL		0x00f00000	/* target - local memory */
-- 
1.8.1.2

  parent reply	other threads:[~2013-10-23 10:42 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-23 10:41 [PATCH 01/12][v3] pci: fsl: derive the common PCI driver to drivers/pci/host Minghuan Lian
2013-10-23 10:41 ` [PATCH 02/12][v3] pci: fsl: add structure fsl_pci Minghuan Lian
2013-10-24  4:11   ` Kumar Gala
2013-10-24  4:15     ` Zang Roy-R61911
2013-10-25  5:58     ` Lian Minghuan-b31939
2013-10-28 18:22       ` Scott Wood
2014-01-03 22:19   ` [02/12,v3] " Scott Wood
2014-01-06  6:10     ` Lian Minghuan-b31939
2014-01-07  8:33       ` Scott Wood
2014-01-22 23:38     ` Roy Zang
2013-10-23 10:41 ` [PATCH 03/12][v3] pci: fsl: add PCI indirect access support Minghuan Lian
2014-01-03 22:33   ` [03/12,v3] " Scott Wood
2014-01-06  5:36     ` Lian Minghuan-b31939
2014-01-07  7:13       ` Scott Wood
2013-10-23 10:41 ` [PATCH 04/12][v3] pci: fsl: add early " Minghuan Lian
2013-10-23 10:41 ` [PATCH 05/12][v3] pci: fsl: port PCI ATMU related code Minghuan Lian
2013-10-23 10:41 ` [PATCH 06/12][v3] pci: fsl: port PCI controller setup code Minghuan Lian
2013-10-23 10:41 ` [PATCH 07/12][v3] pci: fsl: port PCI platform driver Minghuan Lian
2013-10-23 10:41 ` [PATCH 08/12][v3] pci: fsl: add PowerPC PCI driver Minghuan Lian
2013-10-23 10:41 ` [PATCH 09/12][v3] pci: fsl: update PCI PM driver Minghuan Lian
2013-10-23 10:41 ` [PATCH 10/12][v3] pci: fsl: support function fsl_pci_assign_primary Minghuan Lian
2013-10-23 10:41 ` [PATCH 11/12][v3] pci: fsl: update PCI EDAC driver Minghuan Lian
2014-01-03 22:16   ` [11/12,v3] " Scott Wood
2014-01-06  3:57     ` Lian Minghuan-b31939
2013-10-23 10:41 ` Minghuan Lian [this message]
2013-11-25 23:01 ` [PATCH 01/12][v3] pci: fsl: derive the common PCI driver to drivers/pci/host Bjorn Helgaas
2014-01-03 22:37   ` Scott Wood

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=1382524894-15164-12-git-send-email-Minghuan.Lian@freescale.com \
    --to=minghuan.lian@freescale.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=r61911@freescale.com \
    --cc=scottwood@freescale.com \
    /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).