All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ilya Yanok <yanok@emcraft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/5] mpc83xx/pcie: make it compile with PCIE2 unconfigured
Date: Fri, 17 Sep 2010 23:41:46 +0200	[thread overview]
Message-ID: <1284759710-13259-1-git-send-email-yanok@emcraft.com> (raw)
In-Reply-To: <20100916185453.cb967dd5.kim.phillips@freescale.com>

MPC8308 has only one PCIE host controller so we want it to compile
without CONFIG_SYS_PCIE2_CFG_{BASE,SIZE} defined.

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 arch/powerpc/cpu/mpc83xx/pcie.c |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c
index 77f8906..e70d19e 100644
--- a/arch/powerpc/cpu/mpc83xx/pcie.c
+++ b/arch/powerpc/cpu/mpc83xx/pcie.c
@@ -30,6 +30,22 @@ DECLARE_GLOBAL_DATA_PTR;
 
 #define PCIE_MAX_BUSES 2
 
+static struct {
+	u32 base;
+	u32 size;
+} mpc83xx_pcie_cfg_space[] = {
+	{
+		.base = CONFIG_SYS_PCIE1_CFG_BASE,
+		.size = CONFIG_SYS_PCIE1_CFG_SIZE,
+	},
+#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_CFG_SIZE)
+	{
+		.base = CONFIG_SYS_PCIE2_CFG_BASE,
+		.size = CONFIG_SYS_PCIE2_CFG_SIZE,
+	},
+#endif
+};
+
 #ifdef CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES
 
 static int mpc83xx_pcie_remap_cfg(struct pci_controller *hose, pci_dev_t dev)
@@ -124,10 +140,7 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 	hose->first_busno = pci_last_busno() + 1;
 	hose->last_busno = 0xff;
 
-	if (bus == 0)
-		hose->cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
-	else
-		hose->cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
+	hose->cfg_addr = mpc83xx_pcie_cfg_space[bus].base;
 
 	pci_set_ops(hose,
 			pcie_read_config_byte,
@@ -182,15 +195,9 @@ static void mpc83xx_pcie_init_bus(int bus, struct pci_region *reg)
 		PEX_CSB_OBCTRL_CFGWE);
 
 	out_win = &pex->bridge.pex_outbound_win[0];
-	if (bus) {
-		out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
-			CONFIG_SYS_PCIE2_CFG_SIZE);
-		out_le32(&out_win->bar, CONFIG_SYS_PCIE2_CFG_BASE);
-	} else {
-		out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
-			CONFIG_SYS_PCIE1_CFG_SIZE);
-		out_le32(&out_win->bar, CONFIG_SYS_PCIE1_CFG_BASE);
-	}
+	out_le32(&out_win->ar, PEX_OWAR_EN | PEX_OWAR_TYPE_CFG |
+			mpc83xx_pcie_cfg_space[bus].size);
+	out_le32(&out_win->bar, mpc83xx_pcie_cfg_space[bus].base);
 	out_le32(&out_win->tarl, 0);
 	out_le32(&out_win->tarh, 0);
 
@@ -312,6 +319,11 @@ void mpc83xx_pcie_init(int num_buses, struct pci_region **reg, int warmboot)
 	 */
 	udelay(warmboot ? 1000 : 100000);
 
+	if (num_buses > ARRAY_SIZE(mpc83xx_pcie_cfg_space)) {
+		printf("Second PCIE host contoller not configured!\n");
+		num_buses = ARRAY_SIZE(mpc83xx_pcie_cfg_space);
+	}
+
 	for (i = 0; i < num_buses; i++)
 		mpc83xx_pcie_init_bus(i, reg[i]);
 }
-- 
1.6.2.5

  parent reply	other threads:[~2010-09-17 21:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25 14:00 [U-Boot] [PATCH] mpc8308_p1m: support for MPC8308 P1M board Ilya Yanok
2010-09-06 10:32 ` [U-Boot] [PATCH][v2] " Ilya Yanok
2010-09-07 21:47   ` Scott Wood
2010-09-08 21:36     ` [U-Boot] [PATCH][v3] " Ilya Yanok
2010-09-14  1:12       ` Kim Phillips
2010-09-14 20:40         ` [U-Boot] [PATCH 1/5] mpc83xx/pcie: make it compile with PCIE2 unconfigured Ilya Yanok
2010-09-14 20:40           ` [U-Boot] [PATCH 2/5] mpc83xx: add support for setting PCIE clocks Ilya Yanok
2010-09-14 20:40             ` [U-Boot] [PATCH 3/5] mpc8308: add SICR{L,H} fields definitions Ilya Yanok
2010-09-14 20:40               ` [U-Boot] [PATCH 4/5] MPC8308RDB: various clean ups Ilya Yanok
2010-09-14 20:40                 ` [U-Boot] [PATCH 5/5] mpc8308_p1m: support for MPC8308 P1M board Ilya Yanok
2010-09-16 23:56                 ` [U-Boot] [PATCH 4/5] MPC8308RDB: various clean ups Kim Phillips
2010-09-16 23:54           ` [U-Boot] [PATCH 1/5] mpc83xx/pcie: make it compile with PCIE2 unconfigured Kim Phillips
2010-09-17 21:35             ` Ilya Yanok
2010-09-17 21:41             ` Ilya Yanok [this message]
2010-09-22 21:02               ` Kim Phillips
2010-09-17 21:41             ` [U-Boot] [PATCH 2/5] mpc83xx: add support for setting PCIE clocks Ilya Yanok
2010-09-17 21:41             ` [U-Boot] [PATCH 3/5] mpc8308: add SICR{L,H} fields definitions Ilya Yanok
2010-09-17 21:41             ` [U-Boot] [PATCH 4/5] MPC8308RDB: various clean ups Ilya Yanok
2010-09-17 21:41             ` [U-Boot] [PATCH 5/5] mpc8308_p1m: support for MPC8308 P1M board Ilya Yanok
2010-09-18 20:35         ` [U-Boot] [PATCH][v3] " Wolfgang Denk
2010-09-20 16:18           ` Scott Wood
2010-09-20 16:42             ` Wolfgang Denk
2010-09-20 23:56               ` Kim Phillips

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=1284759710-13259-1-git-send-email-yanok@emcraft.com \
    --to=yanok@emcraft.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.