Skip to contentSkip to conversation

PPC: Some PCI generalization in the global_data structure.

PATCH New Matvejchikov Ilya 2 participants 4 messages Jul 13, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PPC: Some PCI generalization in the global_data structure.

The global_data structure has no well defined method of the PCI clocks and other PCI related variables declaration. This patch adds initial support for the generalized method based on CONFIG_PCI usage. At present it only affects when CONFIG_MPC8272 or CONFIG_MPC8272_FAMILY defined.

---
 include/asm-ppc/global_data.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/asm-ppc/global_data.h +5 -0
index c5ac658..ac3e719 100644
@@ -42,6 +42,11 @@ typedef	struct	global_data {
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
 	unsigned long	bus_clk;
+#ifdef CONFIG_PCI
+#if defined(CONFIG_MPC8272) || defined(CONFIG_MPC8272_FAMILY)
+	u32		pci_clk;
+#endif
+#endif
 #if defined(CONFIG_8xx)
 	unsigned long	brg_clk;
 #endif
Signature · 1 line
1.5.6.2
#1 lore raw

PATCH 1/1 PPC: Some PCI generalization in the global_data structure.

Quoted 16 lines · In message <[email protected]> you…

The global_data structure has no well defined method of the PCI clocks and other PCI related variables declaration. This patch adds initial support for the generalized method based on CONFIG_PCI usage. At present it only affects when CONFIG_MPC8272 or CONFIG_MPC8272_FAMILY defined.

---
 include/asm-ppc/global_data.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/asm-ppc/global_data.h +0 -0
index c5ac658..ac3e719 100644
@@ -42,6 +42,11 @@ typedef	struct	global_data {
 	unsigned long	baudrate;

include/asm-ppc/global_data.h typedef struct global_data { · line 52

Quoted 10 lines
include/asm-ppc/global_data.h +5 -0
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
 	unsigned long	bus_clk;
+#ifdef CONFIG_PCI
+#if defined(CONFIG_MPC8272) || defined(CONFIG_MPC8272_FAMILY)
+	u32		pci_clk;
+#endif
+#endif
 #if defined(CONFIG_8xx)
 	unsigned long	brg_clk;
 #endif

This makes no sense to me.

Please keep in mind that the global_data stuff is intended for, and only for, holding global information while we are still running from flash (i. e. before relocation) so that we have neiter a writabel data segment nor a valid bss segment.

PCI initialization always happens *after* relocation to RAM, therefore no PCI related variables are ever needed in the global_data structure.

Rejected.

Best regards,

Wolfgang Denk

Signature · 6 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
Celestial navigation is based on the premise that the  Earth  is  the
center  of  the  universe.  The  premise is wrong, but the navigation
works. An incorrect model can be a useful tool.   - Kelvin Throop III
#2 lore raw

PATCH 1/1 PPC: Some PCI generalization in the global_data structure.

Quoted 10 lines

This makes no sense to me.

Please keep in mind that the global_data stuff is intended for, and only for, holding global information while we are still running from flash (i. e. before relocation) so that we have neiter a writabel data segment nor a valid bss segment.

PCI initialization always happens *after* relocation to RAM, therefore no PCI related variables are ever needed in the global_data structure.

Yes, I know it. But I only meant pci_clk for some cpus and other PCI related things (pciexp1_clk, pciexp2_clk for MPC837x etc)... At this moment we have in the global_data such things as:

struct global_data {
...
#ifdef some_cpu1
u32 pci_clk;
...
#enif
...
#ifdef some_cpu2
unsigned long pci_clk;
...
#endif

#ifdef some_cpu3
u32 pci_clk;
...
#endif
}

Does it is right approach? What do I do to use pci_clk for the mpc8272? May be it is more correctly to use the next form of declaration:

struct global_data {
#ifdef CONFIG_PCI
u32 pci_clk;
#ifdef some_cpu1
/* cpu1 specific pci variables */
#endif
#endif

Thanks.

#3 lore raw

PATCH 1/1 PPC: Some PCI generalization in the global_data structure.

In reply to Matvejchikov Ilya
Quoted 4 lines · In message <[email protected]> you…

The global_data structure has no well defined method of the PCI clocks and other PCI related variables declaration. This patch adds initial support for the generalized method based on CONFIG_PCI usage. At present it only affects when CONFIG_MPC8272 or CONFIG_MPC8272_FAMILY defined.

Hm... I should have checked the code first before replying.

So we already have this in the current code. What a crap.

Kim, Grant, John, can you please try and prepare patches (for the next release, then) to get rid of PCI related information from gd_t ?

Hm... looking closer there is a lot of other stuff there which most probably does not belong there either: TSEC Clocks? PCIe Clocks? board_type? Please check and comment...

Quoted 10 lines
---
 include/asm-ppc/global_data.h |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
include/asm-ppc/global_data.h +0 -0
index c5ac658..ac3e719 100644

include/asm-ppc/global_data.h typedef struct global_data { · line 47

Quoted 6 lines
include/asm-ppc/global_data.h +3 -0
@@ -42,6 +42,11 @@ typedef	struct	global_data {
 	unsigned long	baudrate;
 	unsigned long	cpu_clk;	/* CPU clock in Hz! */
 	unsigned long	bus_clk;
+#ifdef CONFIG_PCI
+#if defined(CONFIG_MPC8272) || defined(CONFIG_MPC8272_FAMILY)
+	u32		pci_clk;

This looks kind of broken to me.

I think you should add this in the "if defined(CONFIG_CPM2)" branch and just make it depend on "ifdef CONFIG_PCI".

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
Use C++ to confuse your enemies; use C to produce stable code.