public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Kim Phillips <kim.phillips@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/5] mpc83xx/pcie: make it compile with PCIE2 unconfigured
Date: Thu, 16 Sep 2010 18:54:53 -0500	[thread overview]
Message-ID: <20100916185453.cb967dd5.kim.phillips@freescale.com> (raw)
In-Reply-To: <1284496841-15353-1-git-send-email-yanok@emcraft.com>

On Tue, 14 Sep 2010 22:40:37 +0200
Ilya Yanok <yanok@emcraft.com> wrote:

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

> +#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
>  #define PCIE_MAX_BUSES 2
> +#else
> +#define PCIE_MAX_BUSES 1
> +#endif

Technically this should be an indirect function of MPC8308, but what's
the problem with leaving MAX_BUSES as 2 always?

> +	unsigned int *cfg_addr;
> +
> +	if (bus == 0) {
> +		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE1_CFG_BASE;
> +	} else {
> +#if defined(CONFIG_SYS_PCIE2_CFG_BASE) && defined(CONFIG_SYS_PCIE2_SIZE)
> +		cfg_addr = (unsigned int *)CONFIG_SYS_PCIE2_CFG_BASE;
> +#else
> +		printf("Second PCIE host controller not configured!\n");
> +		return;
> +#endif

let's reduce the new ifdefs introduced in the file down to one, and
still be able remove the 'if (bus)' clauses by adding a static pcie cfg
struct array[], to which this and code below it would directly
dereference with array[bus].  The single ifdef should protect the
second entry in the array.  The "second PCIE host controller not
configured" check can be made by comparing num_buses with ARRAY_SIZE
(array) in mpc83xx_pcie_init prior to calling mpc83xx_pcie_init_bus
with an illegal bus value.

Kim

  parent reply	other threads:[~2010-09-16 23:54 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           ` Kim Phillips [this message]
2010-09-17 21:35             ` [U-Boot] [PATCH 1/5] mpc83xx/pcie: make it compile with PCIE2 unconfigured Ilya Yanok
2010-09-17 21:41             ` Ilya Yanok
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=20100916185453.cb967dd5.kim.phillips@freescale.com \
    --to=kim.phillips@freescale.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox