Skip to contentSkip to conversation

pci: Divided pci code of the powerpc

PATCH New Nobuhiro Iwamatsu 6 participants 11 messages Aug 29, 2008 – Sep 25, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

A source code of pci is written mainly on powerpc. Macro uses a pci source code of powerpc because other architecture (ex. SuperH) doesn't work.

I made asm-ppc/pci.h and moved macro of pci.
Other archtecture need to make the following macro in asm-xxx/pci.h

 #define pci_phys_to_mem(dev, addr)  (addr)
 #define pci_mem_to_phys(dev, addr)  (addr)
 #define pci_phys_to_io(dev, addr)   (addr)
 #define pci_io_to_phys(dev, addr)   (addr)

Or have to make a function for pci address conversion. However, I want comment because I do not know the other architecture.

---
 include/asm-ppc/pci.h |   53 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/asm-sh/pci.h  |    5 ++++
 include/pci.h         |   22 +-------------------
 3 files changed, 59 insertions(+), 21 deletions(-)
 create mode 100644 include/asm-ppc/pci.h
include/asm-ppc/pci.h new file +53 -0
new file mode 100644
index 0000000..d5f8475
@@ -0,0 +1,53 @@
+/*
+ * (C) Copyright 2001 Sysgo Real-Time Solutions, GmbH <www.elinos.com>
+ * Andreas Heppel <[email protected]>
+ *
+ * (C) Copyright 2002
+ * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * aloong with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _ASM_PCI_H
+#define _ASM_PCI_H
+
+extern phys_addr_t pci_hose_bus_to_phys(struct pci_controller* hose,
+					unsigned long addr, unsigned long flags);
+extern unsigned long pci_hose_phys_to_bus(struct pci_controller* hose,
+					  phys_addr_t addr, unsigned long flags);
+
+#define pci_phys_to_bus(dev, addr, flags) \
+	pci_hose_phys_to_bus(pci_bus_to_hose(PCI_BUS(dev)), (addr), (flags))
+#define pci_bus_to_phys(dev, addr, flags) \
+	pci_hose_bus_to_phys(pci_bus_to_hose(PCI_BUS(dev)), (addr), (flags))
+
+#define pci_phys_to_mem(dev, addr)	pci_phys_to_bus((dev), (addr), PCI_REGION_MEM)
+#define pci_mem_to_phys(dev, addr)	pci_bus_to_phys((dev), (addr), PCI_REGION_MEM)
+#define pci_phys_to_io(dev, addr)	pci_phys_to_bus((dev), (addr), PCI_REGION_IO)
+#define pci_io_to_phys(dev, addr)	pci_bus_to_phys((dev), (addr), PCI_REGION_IO)
+
+#ifdef CONFIG_MPC824X
+extern void pci_mpc824x_init (struct pci_controller *hose);
+#endif
+
+#ifdef CONFIG_MPC85xx
+extern void pci_mpc85xx_init (struct pci_controller *hose);
+#endif
+
+#endif	/* _ASM_PCI_H */
include/asm-sh/pci.h +5 -0
index bc59491..1f24fb6 100644
@@ -44,4 +44,9 @@ int pci_sh4_read_config_dword(struct pci_controller *hose,
 int pci_sh4_write_config_dword(struct pci_controller *hose,
 		pci_dev_t dev, int offset, u32 value);
 
+#define pci_phys_to_mem(dev, addr)	(addr)
+#define pci_mem_to_phys(dev, addr)	(addr)
+#define pci_phys_to_io(dev, addr)	(addr)
+#define pci_io_to_phys(dev, addr)	(addr)
+
 #endif	/* _ASM_PCI_H_ */
include/pci.h +1 -21
index 1c8e216..9b61635 100644
@@ -432,21 +432,6 @@ extern __inline__ void pci_set_ops(struct pci_controller *hose,
 
 extern void pci_setup_indirect(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data);
 
-extern phys_addr_t pci_hose_bus_to_phys(struct pci_controller* hose,
-					unsigned long addr, unsigned long flags);
-extern unsigned long pci_hose_phys_to_bus(struct pci_controller* hose,
-					  phys_addr_t addr, unsigned long flags);
-
-#define pci_phys_to_bus(dev, addr, flags) \
-	pci_hose_phys_to_bus(pci_bus_to_hose(PCI_BUS(dev)), (addr), (flags))
-#define pci_bus_to_phys(dev, addr, flags) \
-	pci_hose_bus_to_phys(pci_bus_to_hose(PCI_BUS(dev)), (addr), (flags))
-
-#define pci_phys_to_mem(dev, addr)	pci_phys_to_bus((dev), (addr), PCI_REGION_MEM)
-#define pci_mem_to_phys(dev, addr)	pci_bus_to_phys((dev), (addr), PCI_REGION_MEM)
-#define pci_phys_to_io(dev, addr)	pci_phys_to_bus((dev), (addr), PCI_REGION_IO)
-#define pci_io_to_phys(dev, addr)	pci_bus_to_phys((dev), (addr), PCI_REGION_IO)
-
 extern int pci_hose_read_config_byte(struct pci_controller *hose,
 				     pci_dev_t dev, int where, u8 *val);
 extern int pci_hose_read_config_word(struct pci_controller *hose,
@@ -503,11 +488,6 @@ extern int pci_hose_config_device(struct pci_controller *hose,
 				  unsigned long mem,
 				  unsigned long command);
 
-#ifdef CONFIG_MPC824X
-extern void pci_mpc824x_init (struct pci_controller *hose);
-#endif
+#include <asm/pci.h>
 
-#ifdef CONFIG_MPC85xx
-extern void pci_mpc85xx_init (struct pci_controller *hose);
-#endif
 #endif	/* _PCI_H */
Signature · 1 line
1.5.5.1
#1 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Dear Nobuhiro Iwamatsu,

Quoted 6 lines · In message <[email protected]> you wrote:

A source code of pci is written mainly on powerpc. Macro uses a pci source code of powerpc because other architecture (ex. SuperH) doesn't work.

I made asm-ppc/pci.h and moved macro of pci.
Other archtecture need to make the following macro in asm-xxx/pci.h

Quoted 7 lines
 #define pci_phys_to_mem(dev, addr)  (addr)
 #define pci_mem_to_phys(dev, addr)  (addr)
 #define pci_phys_to_io(dev, addr)   (addr)
 #define pci_io_to_phys(dev, addr)   (addr)

Or have to make a function for pci address conversion. However, I want comment because I do not know the other architecture.

To me the patch looks OK, but I'm not an expert for al the affected architectures.

Hello everybody, please comment!!

Otherwise I will just apply the patch and then not listen to your complaints if it breaks anything.

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
History tends to exaggerate.
	-- Col. Green, "The Savage Curtain", stardate 5906.4
#2 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Hi, Wolfgang .

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Best regards,
Nobuhiro

2008/9/7 Wolfgang Denk <[email protected]>:

Quoted 41 lines

Dear Nobuhiro Iwamatsu,

Quoted 6 lines · In message <[email protected]> you wrote:

A source code of pci is written mainly on powerpc. Macro uses a pci source code of powerpc because other architecture (ex. SuperH) doesn't work.

I made asm-ppc/pci.h and moved macro of pci.
Other archtecture need to make the following macro in asm-xxx/pci.h

Quoted 7 lines
 #define pci_phys_to_mem(dev, addr)  (addr)
 #define pci_mem_to_phys(dev, addr)  (addr)
 #define pci_phys_to_io(dev, addr)   (addr)
 #define pci_io_to_phys(dev, addr)   (addr)

Or have to make a function for pci address conversion. However, I want comment because I do not know the other architecture.

To me the patch looks OK, but I'm not an expert for al the affected architectures.

Hello everybody, please comment!!

Otherwise I will just apply the patch and then not listen to your complaints if it breaks anything.

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de History tends to exaggerate.
-- Col. Green, "The Savage Curtain", stardate 5906.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Signature · 1 line
Nobuhiro Iwamatsu
#3 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Dear Wolfgang,

I'm doing some work on i386 at the moment and:
a) It seems PCI is already broken - see [PATCH 0/2] Update i386 code (sc520_cdp) (http://lists.denx.de/pipermail/u-boot/2008-September/040099.html)
b) The board I'm porting to doesn't use PCI
c) I don't have a sc520 board with PCI to test on

My vote would be to commit and fix up i386 later when someone needs PCI

Harsh, but true

Regards,

Graeme

Quoted 62 lines · Nobuhiro Iwamatsu

Hi, Wolfgang .

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Best regards,
Nobuhiro

2008/9/7 Wolfgang Denk <[email protected]>:

Quoted 30 lines

Dear Nobuhiro Iwamatsu,

Quoted 6 lines · In message <[email protected]> you wrote:

A source code of pci is written mainly on powerpc. Macro uses a pci source code of powerpc because other architecture (ex. SuperH) doesn't work.

I made asm-ppc/pci.h and moved macro of pci.
Other archtecture need to make the following macro in asm-xxx/pci.h

Quoted 7 lines
 #define pci_phys_to_mem(dev, addr)  (addr)
 #define pci_mem_to_phys(dev, addr)  (addr)
 #define pci_phys_to_io(dev, addr)   (addr)
 #define pci_io_to_phys(dev, addr)   (addr)

Or have to make a function for pci address conversion. However, I want comment because I do not know the other architecture.

To me the patch looks OK, but I'm not an expert for al the affected architectures.

Hello everybody, please comment!!

Otherwise I will just apply the patch and then not listen to your complaints if it breaks anything.

Best regards,

Wolfgang Denk

Quoted 11 lines

--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de History tends to exaggerate.
-- Col. Green, "The Savage Curtain", stardate 5906.4
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

--
Nobuhiro Iwamatsu
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

In reply to Nobuhiro Iwamatsu

Dear Stefan, Kim, Andy, Jon & Kumar,

in message <[email protected]>

Quoted 5 lines · Nobuhiro Iwamatsu

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Do I have your "go" (or at least no veto) to apply this patch?

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The universe is all a spin-off of the Big Bang.
#5 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Quoted 5 lines · Wolfgang Denk

Dear Stefan, Kim, Andy, Jon & Kumar,

in message <[email protected]>

Quoted 1 line · Nobuhiro Iwamatsu
Quoted 7 lines
Quoted 4 lines

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Do I have your "go" (or at least no veto) to apply this patch?

(forgot to reply all on this, already sent to the O.P.)

I think this is going to break some boards/archs. From the top of the u-boot tree, if you do

find . -type f -exec grep pci_register_hose {} /dev/null \;

it shows all the source files that are registering a PCI bus. A quick look shows there are MIPS, ARM, x86 in that list at least, that aren't addressed by this change.

#6 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Quoted 6 lines · Andrew Dyer
Quoted 5 lines · Wolfgang Denk

Dear Stefan, Kim, Andy, Jon & Kumar,

in message <[email protected]>

Quoted 1 line · Nobuhiro Iwamatsu
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Do I have your "go" (or at least no veto) to apply this patch?

If some of that code is powerpc-only, maybe we should move the code out of pci.c, too? pci_hose_phys_to_bus() appears to be... board/eltec/bab7xx/pci.c only, actually. The declaration was moved to asm/pci.h, but the implementation is in drivers/pci/pci.c.

Andy

#7 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Quoted 10 lines · Andy Fleming
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Do I have your "go" (or at least no veto) to apply this patch?

If some of that code is powerpc-only, maybe we should move the code out of pci.c, too? pci_hose_phys_to_bus() appears to be... board/eltec/bab7xx/pci.c only, actually.

That doesn't seem to be correct. In include/pci.h:

#define pci_phys_to_bus(dev, addr, flags) \
	pci_hose_phys_to_bus(pci_bus_to_hose(PCI_BUS(dev)), (addr), (flags))

and later:

#define pci_phys_to_mem(dev, addr) pci_phys_to_bus((dev), (addr), PCI_REGION_MEM)
#define pci_phys_to_io(dev, addr) pci_phys_to_bus((dev), (addr), PCI_REGION_IO)

So calling pci_phys_to_mem() or pci_phys_to_io() leads to a pci_hose_phys_to_bus() call in the end.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#8 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

In reply to Andrew Dyer
Quoted 9 lines · Andrew Dyer
Quoted 6 lines
Quoted 4 lines

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Do I have your "go" (or at least no veto) to apply this patch?

(forgot to reply all on this, already sent to the O.P.)

Quoted 8 lines

I think this is going to break some boards/archs. From the top of the u-boot tree, if you do

find . -type f -exec grep pci_register_hose {} /dev/null \;

it shows all the source files that are registering a PCI bus. A quick look shows there are MIPS, ARM, x86 in that list at least, that aren't addressed by this change.

That's correct. This patch moves the original defines to the PPC specific header and introduces new defines in the SH specific header. All other ARCH's will not compile anymore when they try to include PCI support.

So, NAK from me. An acceptable patch would be to move the original defines at least to all ARCH's already using PCI.

BTW: I fail to see what's really PPC specific about the pci code in question. Nobuhiro, could you please elaborate what's the problem here?

Thanks.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================

#9 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Hi, all.

2008/9/23 Stefan Roese <[email protected]>:

Quoted 15 lines · Andrew Dyer
Quoted 14 lines
Quoted 6 lines
Quoted 4 lines

I did a simple check.

Only powerpc and i386 and sh seem to use PCI. If powerpc does not have a problem, would you commit it?

Do I have your "go" (or at least no veto) to apply this patch?

(forgot to reply all on this, already sent to the O.P.)

I think this is going to break some boards/archs. From the top of the u-boot tree, if you do

find . -type f -exec grep pci_register_hose {} /dev/null \;

Quoted 7 lines
Quoted 3 lines

it shows all the source files that are registering a PCI bus. A quick look shows there are MIPS, ARM, x86 in that list at least, that aren't addressed by this change.

That's correct. This patch moves the original defines to the PPC specific header and introduces new defines in the SH specific header. All other ARCH's will not compile anymore when they try to include PCI support.

I understand that some macro of the PCI does not depend on only PPC as Andrew points it out.
I am thinking other countermeasure.

Quoted 6 lines

So, NAK from me. An acceptable patch would be to move the original defines at least to all ARCH's already using PCI.

BTW: I fail to see what's really PPC specific about the pci code in question. Nobuhiro, could you please elaborate what's the problem here?

I wanted to remove CPU and baords of specific code from from PCI network driver. CONFIG_E500, DB64360 and DB64460 CPU is PPC.
I thought that I could collect these with header files of PPC. Therefore I sent that patch in RFC.

Best regards,
Nobuhiro

Signature · 1 line
Nobuhiro Iwamatsu
#10 lore raw

PATCH 1/1 pci: Divided pci code of the powerpc

Quoted 5 lines · Nobuhiro Iwamatsu
Quoted 2 lines

BTW: I fail to see what's really PPC specific about the pci code in question. Nobuhiro, could you please elaborate what's the problem here?

I wanted to remove CPU and baords of specific code from from PCI network driver. CONFIG_E500, DB64360 and DB64460 CPU is PPC.

Now I understand. You are referring to code like this:

drivers/net/eepro100.c:

#if defined(CONFIG_E500) || defined(CONFIG_DB64360) || defined(CONFIG_DB64460) #define bus_to_phys(a) (a)
#define phys_to_bus(a) (a)
#else
#define bus_to_phys(a) pci_mem_to_phys((pci_dev_t)dev->priv, a) #define phys_to_bus(a) pci_phys_to_mem((pci_dev_t)dev->priv, a) #endif

Quoted 2 lines

I thought that I could collect these with header files of PPC. Therefore I sent that patch in RFC.

Yes, it definitely is a good idea to move those defines to platform/cpu headers.

Best regards,
Stefan

=====================================================================
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80 Email: office at denx.de
=====================================================================