[PATCH] MPC5200 - Make PCI work in 2.6 with the IceCube 5200

Subsystems: the rest

STALE7632d

2 messages, 2 authors, 2005-10-11 · open the first message on its own page

[PATCH] MPC5200 - Make PCI work in 2.6 with the IceCube 5200

From: Wolfgang Denk <hidden>
Date: 2005-10-10 19:37:25

Hello,

the following patch is against the current 2.6 kernel.org tree
(commit f96c3bbe91117402f13119ce9e609db9087ed58f):

As a prerequisite for a working system, the  following  two  poatches
are needed, too:

http://patchwork.ozlabs.org/linuxppc/patch?id=2018
http://patchwork.ozlabs.org/linuxppc/patch?id=2017



!-------------------------------------------------------------flip-

[patch] making PCI work in the MPC5200
Patch by Alessandro Rubini, 08 Oct 2005

Make PCI work in 2.6 with the IceCube 5200.

Without the memory barriers all PCI config reads returned 0xffffffff
(actually, there may be more mb() than needed). Using wmb(); was not
enough to be able to read configuration registers.

Signed-off by Alessandro Rubini [off-list ref]
Signed-off by Wolfgang Denk [off-list ref]

---
commit cdd7fdf10b3cbb7eb82cacc7ba5dba3553020f49
tree 97d045b44c87c00a4b3fe5bca57b479be87e68b6
parent 509b5c9fcbfe7fcae7d4f98946e4dc9794d68645
author Wolfgang Denk [off-list ref] Sat, 08 Oct 2005 22:41:53 +0200
committer Wolfgang Denk [off-list ref] Sat, 08 Oct 2005 22:41:53 +0200

 arch/ppc/syslib/mpc52xx_pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -39,6 +39,7 @@ mpc52xx_pci_read_config(struct pci_bus *
 		((bus->number - hose->bus_offset) << 16) |
 		(devfn << 8) |
 		(offset & 0xfc));
+	mb();
 
 	value = in_le32(hose->cfg_data);
 
@@ -70,6 +71,7 @@ mpc52xx_pci_write_config(struct pci_bus 
 		((bus->number - hose->bus_offset) << 16) |
 		(devfn << 8) |
 		(offset & 0xfc));
+	mb();
 
 	if (len != 4) {
 		value = in_le32(hose->cfg_data);
@@ -80,9 +82,11 @@ mpc52xx_pci_write_config(struct pci_bus 
 
 		value &= ~mask;
 		val = value | ((val << offset) & mask);
+		mb();
 	}
 
 	out_le32(hose->cfg_data, val);
+	mb();
 
 	out_be32(hose->cfg_addr, 0);
 



!-------------------------------------------------------------flip-



Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Experience is what causes a person to make new  mistakes  instead  of
old ones.

Re: [PATCH] MPC5200 - Make PCI work in 2.6 with the IceCube 5200

From: Sylvain Munaut <hidden>
Date: 2005-10-11 23:18:23

Hi Wolfgang,


Weird, I would have thought the usage of in_be out_be macro ensured
that. But after checking, they only include a isync instruction which
doesn't guarantee memory access will be done while mb() uses sync that
does guarantee that.

Any one can comment on that ? Wasn't the purpose of the in_be out_be to
ensure that ?



	Sylvain



Wolfgang Denk wrote:
Hello,

the following patch is against the current 2.6 kernel.org tree
(commit f96c3bbe91117402f13119ce9e609db9087ed58f):

As a prerequisite for a working system, the  following  two  poatches
are needed, too:

http://patchwork.ozlabs.org/linuxppc/patch?id=2018
http://patchwork.ozlabs.org/linuxppc/patch?id=2017
quoted hunk
!-------------------------------------------------------------flip-

[patch] making PCI work in the MPC5200
Patch by Alessandro Rubini, 08 Oct 2005

Make PCI work in 2.6 with the IceCube 5200.

Without the memory barriers all PCI config reads returned 0xffffffff
(actually, there may be more mb() than needed). Using wmb(); was not
enough to be able to read configuration registers.

Signed-off by Alessandro Rubini [off-list ref]
Signed-off by Wolfgang Denk [off-list ref]

---
commit cdd7fdf10b3cbb7eb82cacc7ba5dba3553020f49
tree 97d045b44c87c00a4b3fe5bca57b479be87e68b6
parent 509b5c9fcbfe7fcae7d4f98946e4dc9794d68645
author Wolfgang Denk [off-list ref] Sat, 08 Oct 2005 22:41:53 +0200
committer Wolfgang Denk [off-list ref] Sat, 08 Oct 2005 22:41:53 +0200

 arch/ppc/syslib/mpc52xx_pci.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -39,6 +39,7 @@ mpc52xx_pci_read_config(struct pci_bus *
 		((bus->number - hose->bus_offset) << 16) |
 		(devfn << 8) |
 		(offset & 0xfc));
+	mb();
 
 	value = in_le32(hose->cfg_data);
 
@@ -70,6 +71,7 @@ mpc52xx_pci_write_config(struct pci_bus 
 		((bus->number - hose->bus_offset) << 16) |
 		(devfn << 8) |
 		(offset & 0xfc));
+	mb();
 
 	if (len != 4) {
 		value = in_le32(hose->cfg_data);
@@ -80,9 +82,11 @@ mpc52xx_pci_write_config(struct pci_bus 
 
 		value &= ~mask;
 		val = value | ((val << offset) & mask);
+		mb();
 	}
 
 	out_le32(hose->cfg_data, val);
+	mb();
 
 	out_be32(hose->cfg_addr, 0);
 

!-------------------------------------------------------------flip-



Best regards,

Wolfgang Denk
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help