Patchwork [U-Boot] mpc83xx: pcie.c enumeration for mpc83xx/pcie.c

login
register
mail settings
Submitter Baidu Boy
Date Nov. 27, 2010, 10:31 a.m.
Message ID <AANLkTimM6hBxz__WJ1C8ei=7cwOHRvYOGMGByCuU++9y@mail.gmail.com>
Download mbox | patch
Permalink /patch/73272/
State Changes Requested
Headers show

Comments

Baidu Boy - Nov. 27, 2010, 10:31 a.m.
Signed-off-by: Baidu Boy <liucai.lfn@gmail.com>
---
 arch/powerpc/cpu/mpc83xx/pcie.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

 			ar |= PEX_OWAR_TYPE_MEM;
Wolfgang Denk - Nov. 27, 2010, 10:37 a.m.
Dear Baidu Boy,

In message <AANLkTimM6hBxz__WJ1C8ei=7cwOHRvYOGMGByCuU++9y@mail.gmail.com> you wrote:
> Signed-off-by: Baidu Boy <liucai.lfn@gmail.com>
> ---
>  arch/powerpc/cpu/mpc83xx/pcie.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)

Would you please explain what this paych is trying to do? Are you
fixing a bug (if so, how does it manifest and hoiw can we test that
your patch really fixes the bug), or are you adding a new feature?
(which one?)

On which board(s) has this patch been tested?

Best regards,

Wolfgang Denk
Baidu Boy - Nov. 27, 2010, 11:15 a.m.
Dear Wolfgang:

2010/11/27 Wolfgang Denk <wd@denx.de>:
> Would you please explain what this paych is trying to do? Are you
> fixing a bug (if so, how does it manifest and hoiw can we test that
> your patch really fixes the bug), or are you adding a new feature?
> (which one?)
>
> On which board(s) has this patch been tested?
>
> Best regards,
>

This patch is a bug fix for mpc83xx board.
I use the uboot-2010.09 to do the pcie enumeration for MPC8378E board,
and It failed. From the code we can see the reason is that:
in function
mpc83xx_pcie_register_hose(...,struct pci_region *reg...)
we pass the parameter reg which is a pointer to the pcie_regions_0[]
to this function.
but we changed this pointer in this function mpc83xx_pcie_register_hose().
---
	for (i = 0; i < 2; i++, reg++) {
...
}
---
And at the end of this function we call
mpc83xx_pcie_register_hose(bus, reg, reg16 >= PCI_LTSSM_L0) which use
the changed variable "reg".
I think this is the root cause.

Thanks!

Patch

diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c
index 1771c48..46a706d 100644
--- a/arch/powerpc/cpu/mpc83xx/pcie.c
+++ b/arch/powerpc/cpu/mpc83xx/pcie.c
@@ -201,18 +201,18 @@  static void mpc83xx_pcie_init_bus(int bus,
struct pci_region *reg)
 	out_le32(&out_win->tarl, 0);
 	out_le32(&out_win->tarh, 0);

-	for (i = 0; i < 2; i++, reg++) {
+	for (i = 0; i < 2; i++) {
 		u32 ar;

-		if (reg->size == 0)
+		if (reg[i].size == 0)
 			break;

 		out_win = &pex->bridge.pex_outbound_win[i + 1];
-		out_le32(&out_win->bar, reg->phys_start);
-		out_le32(&out_win->tarl, reg->bus_start);
+		out_le32(&out_win->bar, reg[i].phys_start);
+		out_le32(&out_win->tarl, reg[i].bus_start);
 		out_le32(&out_win->tarh, 0);
-		ar = PEX_OWAR_EN | (reg->size & PEX_OWAR_SIZE);
-		if (reg->flags & PCI_REGION_IO)
+		ar = PEX_OWAR_EN | (reg[i].size & PEX_OWAR_SIZE);
+		if (reg[i].flags & PCI_REGION_IO)
 			ar |= PEX_OWAR_TYPE_IO;
 		else