public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] mpc83xx:fix pcie configuration space read/write
Date: Sat, 15 Jan 2011 19:11:53 +0300	[thread overview]
Message-ID: <4D31C749.2080306@mvista.com> (raw)
In-Reply-To: <000e01cbb4a6$75a52880$6401a8c0@LENOVOE5CA6843>

Hello.

On 15-01-2011 14:22, Baidu Boy wrote:

> This patch fix a problem for the pcie enumeration when the mpc83xx pcie controller is
> connected with switch or we use both of the two pcie controller.

> Signed-off-by: Baidu Boy <liucai.lfn@gmail.com>
[...]

> diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c
> index 46a706d..c59e482 100644
> --- a/arch/powerpc/cpu/mpc83xx/pcie.c
> +++ b/arch/powerpc/cpu/mpc83xx/pcie.c
> @@ -30,6 +30,20 @@ DECLARE_GLOBAL_DATA_PTR;
>
>   #define PCIE_MAX_BUSES 2
>
> +/*private struct for mpc83xx pcie hose*/
> +static struct mpc83xx_pcie_priv{

    Need space before { here.

> +	u8 index;
> +}pcie_priv[PCIE_MAX_BUSES] = {

    And after } here.

> @@ -52,7 +66,8 @@ static int mpc83xx_pcie_remap_cfg(struct pci_controller *hose, pci_dev_t dev)
>   {
>   	int bus = PCI_BUS(dev) - hose->first_busno;
>   	immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
> -	pex83xx_t *pex =&immr->pciexp[bus];
> +	struct mpc83xx_pcie_priv *pcie_priv = (struct mpc83xx_pcie_priv *)hose->priv_data;

    'priv_data' is of type 'void *', so the type cast is not needed.

> +	pex83xx_t *pex =&immr->pciexp[pcie_priv->index];
>   	struct pex_outbound_window *out_win =&pex->bridge.pex_outbound_win[0];
>   	u8 devfn = PCI_DEV(dev)<<  3 | PCI_FUNC(dev);
>   	u32 dev_base = bus<<  24 | devfn<<  16;
> @@ -142,6 +157,8 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
>
>   	hose->cfg_addr = (unsigned int *)mpc83xx_pcie_cfg_space[bus].base;
>
> +	hose->priv_data = (void *)&pcie_priv[bus];

    Likewise, there's no need to cast to 'void *' -- the cast is automatic.

WBR, Sergei

  reply	other threads:[~2011-01-15 16:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-15 11:22 [U-Boot] [PATCH] mpc83xx:fix pcie configuration space read/write Baidu Boy
2011-01-15 16:11 ` Sergei Shtylyov [this message]
2011-01-16  2:58   ` Baidu Boy
  -- strict thread matches above, loose matches on Subject: below --
2011-01-07 12:29 [U-Boot] [PATCH] mpc83xx: fix " Baidu Boy
2011-01-09 12:49 ` Sergei Shtylyov

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=4D31C749.2080306@mvista.com \
    --to=sshtylyov@mvista.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