* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
@ 2007-06-21 13:38 Matthias Fuchs
2007-06-21 21:14 ` Wolfgang Denk
0 siblings, 1 reply; 8+ messages in thread
From: Matthias Fuchs @ 2007-06-21 13:38 UTC (permalink / raw)
To: u-boot
ppc4xx: Add pci_pre_init() for 405 boards
This patch adds support for calling a plattform dependant
pci_pre_init() function for 405 boards. This can be used to
move the current pci_405gp_fixup_irq() function into the
board code.
This feature can be enabled by defining CFG_PCI_PRE_INIT.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
commit 9941716bc8ed06f12d60fbb4f02e4d07a2792097
tree e5ace7dda41c62e8b266e8a4dc3292a0d87b8b04
parent 3c908811a5e7098d476976eed54a4f8b0e80edc7
author Matthias Fuchs <matthias.fuchs@esd-electronics.com> Thu, 21 Jun 2007
14:42:46 +0200
committer Matthias Fuchs <matthias.fuchs@esd-electronics.com> Thu, 21 Jun 2007
14:42:46 +0200
cpu/ppc4xx/405gp_pci.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/cpu/ppc4xx/405gp_pci.c b/cpu/ppc4xx/405gp_pci.c
index 8bf03e1..b9538fa 100644
--- a/cpu/ppc4xx/405gp_pci.c
+++ b/cpu/ppc4xx/405gp_pci.c
@@ -191,6 +191,15 @@ void pci_405gp_init(struct pci_controlle
if (hose->pci_fb)
pciauto_region_init(hose->pci_fb);
+#if defined(CFG_PCI_PRE_INIT)
+ /* Let board change/modify hose & do initial checks */
+ if (pci_pre_init (hose) == 0) {
+ printf("PCI: Board-specific initialization failed.\n");
+ printf("PCI: Configuration aborted.\n");
+ return;
+ }
+#endif
+
pci_register_hose(hose);
/*--------------------------------------------------------------------------+
--
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs esd electronic system design gmbh
http://www.esd-electronics.com Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68 30165 Hannover, Germany
-----------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-21 13:38 [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards Matthias Fuchs
@ 2007-06-21 21:14 ` Wolfgang Denk
2007-06-22 6:04 ` Stefan Roese
0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2007-06-21 21:14 UTC (permalink / raw)
To: u-boot
In message <200706211538.27078.matthias.fuchs@esd-electronics.com> you wrote:
> ppc4xx: Add pci_pre_init() for 405 boards
>
> This patch adds support for calling a plattform dependant
> pci_pre_init() function for 405 boards. This can be used to
> move the current pci_405gp_fixup_irq() function into the
> board code.
I think we should stop using this method to provide for board
specific code. Please use a weak function instead. See archive for
earlier discussions of how to do that.
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
Children are natural mimics who act like their parents despite every
effort to teach them good manners.
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-21 21:14 ` Wolfgang Denk
@ 2007-06-22 6:04 ` Stefan Roese
2007-06-22 12:00 ` Matthias Fuchs
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Roese @ 2007-06-22 6:04 UTC (permalink / raw)
To: u-boot
On Thursday 21 June 2007, Wolfgang Denk wrote:
> > This patch adds support for calling a plattform dependant
> > pci_pre_init() function for 405 boards. This can be used to
> > move the current pci_405gp_fixup_irq() function into the
> > board code.
>
> I think we should stop using this method to provide for board
> specific code. Please use a weak function instead. See archive for
> earlier discussions of how to do that.
Yes, please.
Matthias just copied the already existing PPC440 example to the PPC405 code.
But we should really stop extending the define mess right now. So Matthias,
could you please implement this in the way Wolfgang descried? And if possible
cleanup the 440 part too so that we can get rid of the CFG_PCI_PRE_INIT
define completely?
Thanks.
Viele Gr??e,
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
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-22 6:04 ` Stefan Roese
@ 2007-06-22 12:00 ` Matthias Fuchs
2007-06-22 12:11 ` Stefan Roese
0 siblings, 1 reply; 8+ messages in thread
From: Matthias Fuchs @ 2007-06-22 12:00 UTC (permalink / raw)
To: u-boot
Hi Wolfgang and Stefan,
is this what you like? If this is ok for you I will submit a clean patch.
Matthias
diff --git a/cpu/ppc4xx/405gp_pci.c b/cpu/ppc4xx/405gp_pci.c
index 8bf03e1..2837929 100644
--- a/cpu/ppc4xx/405gp_pci.c
+++ b/cpu/ppc4xx/405gp_pci.c
@@ -77,11 +77,21 @@
#include <asm/processor.h>
#include <pci.h>
+#ifdef CONFIG_PCI
+
DECLARE_GLOBAL_DATA_PTR;
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
+/*
+ * Board-specific pci initialization
+ * Platform code can reimplement pci_pre_init() if needed
+ */
+int __pci_pre_init(struct pci_controller *hose)
+{
+ return 1;
+}
+int pci_pre_init(struct pci_controller *hose) __attribute__((weak, alias("__pci_pre_init")));
-#ifdef CONFIG_PCI
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
#if defined(CONFIG_PMC405)
ushort pmc405_pci_subsys_deviceid(void);
@@ -191,6 +201,13 @@ void pci_405gp_init(struct pci_controlle
if (hose->pci_fb)
pciauto_region_init(hose->pci_fb);
+ /* Let board change/modify hose & do initial checks */
+ if (pci_pre_init (hose) == 0) {
+ printf("PCI: Board-specific initialization failed.\n");
+ printf("PCI: Configuration aborted.\n");
+ return;
+ }
+
pci_register_hose(hose);
/*--------------------------------------------------------------------------+
@@ -416,14 +433,12 @@ void pci_init_board(void)
#endif
-#endif /* CONFIG_PCI */
-
#endif /* CONFIG_405GP */
/*-----------------------------------------------------------------------------+
* CONFIG_440
*-----------------------------------------------------------------------------*/
-#if defined(CONFIG_440) && defined(CONFIG_PCI)
+#if defined(CONFIG_440)
static struct pci_controller ppc440_hose = {0};
@@ -496,14 +511,12 @@ void pci_440_init (struct pci_controller
pci_setup_indirect(hose, PCIX0_CFGADR, PCIX0_CFGDATA);
-#if defined(CFG_PCI_PRE_INIT)
/* Let board change/modify hose & do initial checks */
if (pci_pre_init (hose) == 0) {
printf("PCI: Board-specific initialization failed.\n");
printf("PCI: Configuration aborted.\n");
return;
}
-#endif
pci_register_hose( hose );
@@ -575,4 +588,5 @@ void pci_init_board(void)
#endif
}
-#endif /* CONFIG_440 & CONFIG_PCI */
+#endif /* CONFIG_440 */
+#endif /* CONFIG_PCI */
On Friday 22 June 2007 08:04, Stefan Roese wrote:
> On Thursday 21 June 2007, Wolfgang Denk wrote:
> > > This patch adds support for calling a plattform dependant
> > > pci_pre_init() function for 405 boards. This can be used to
> > > move the current pci_405gp_fixup_irq() function into the
> > > board code.
> >
> > I think we should stop using this method to provide for board
> > specific code. Please use a weak function instead. See archive for
> > earlier discussions of how to do that.
>
> Yes, please.
>
> Matthias just copied the already existing PPC440 example to the PPC405
> code. But we should really stop extending the define mess right now. So
> Matthias, could you please implement this in the way Wolfgang descried? And
> if possible cleanup the 440 part too so that we can get rid of the
> CFG_PCI_PRE_INIT define completely?
>
> Thanks.
>
> Viele Gr??e,
> 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
> =====================================================================
--
-----------------------------------------------------------------------
Dipl.-Ing. Matthias Fuchs esd electronic system design gmbh
http://www.esd-electronics.com Vahrenwalder Str. 207
phone: +49-511-37298-0, fax: -68 30165 Hannover, Germany
-----------------------------------------------------------------------
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-22 12:00 ` Matthias Fuchs
@ 2007-06-22 12:11 ` Stefan Roese
2007-06-22 15:35 ` Matthias Fuchs
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Roese @ 2007-06-22 12:11 UTC (permalink / raw)
To: u-boot
Hi Matthias,
On Friday 22 June 2007, Matthias Fuchs wrote:
> is this what you like? If this is ok for you I will submit a clean patch.
Yes, look fine. Please submit.
Thanks.
Viele Gr??e,
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
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-22 12:11 ` Stefan Roese
@ 2007-06-22 15:35 ` Matthias Fuchs
2007-06-22 15:44 ` Stefan Roese
0 siblings, 1 reply; 8+ messages in thread
From: Matthias Fuchs @ 2007-06-22 15:35 UTC (permalink / raw)
To: u-boot
ppc4xx: Add pci_pre_init() for 405 boards
This patch adds support for calling a plattform dependant
pci_pre_init() function for 405 boards. This can be used to
move the current pci_405gp_fixup_irq() function into the
board code.
This patch also makes the CFG_PCI_PRE_INIT define obsolete.
A default function with 'weak' attribute is used when
a board specific pci_pre_init() is not implemented.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
commit 2b9a0d67dfed6c29c3e46ed5e1443cf044631bb2
tree 18d8afc439bd0ce099a16e32ba3544a4170b46a6
parent acd7872c4d968197e6269572cbc122690f7e85ee
author Matthias Fuchs <matthias.fuchs@esd-electronics.com> Fri, 22 Jun 2007
17:32:41 +0200
committer Matthias Fuchs <matthias.fuchs@esd-electronics.com> Fri, 22 Jun 2007
17:32:41 +0200
cpu/ppc4xx/405gp_pci.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/cpu/ppc4xx/405gp_pci.c b/cpu/ppc4xx/405gp_pci.c
index 8bf03e1..2837929 100644
--- a/cpu/ppc4xx/405gp_pci.c
+++ b/cpu/ppc4xx/405gp_pci.c
@@ -77,11 +77,21 @@
#include <asm/processor.h>
#include <pci.h>
+#ifdef CONFIG_PCI
+
DECLARE_GLOBAL_DATA_PTR;
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
+/*
+ * Board-specific pci initialization
+ * Platform code can reimplement pci_pre_init() if needed
+ */
+int __pci_pre_init(struct pci_controller *hose)
+{
+ return 1;
+}
+int pci_pre_init(struct pci_controller *hose) __attribute__((weak,
alias("__pci_pre_init")));
-#ifdef CONFIG_PCI
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
#if defined(CONFIG_PMC405)
ushort pmc405_pci_subsys_deviceid(void);
@@ -191,6 +201,13 @@ void pci_405gp_init(struct pci_controlle
if (hose->pci_fb)
pciauto_region_init(hose->pci_fb);
+ /* Let board change/modify hose & do initial checks */
+ if (pci_pre_init (hose) == 0) {
+ printf("PCI: Board-specific initialization failed.\n");
+ printf("PCI: Configuration aborted.\n");
+ return;
+ }
+
pci_register_hose(hose);
/*--------------------------------------------------------------------------+
@@ -416,14 +433,12 @@ void pci_init_board(void)
#endif
-#endif /* CONFIG_PCI */
-
#endif /* CONFIG_405GP */
/*-----------------------------------------------------------------------------+
* CONFIG_440
*-----------------------------------------------------------------------------*/
-#if defined(CONFIG_440) && defined(CONFIG_PCI)
+#if defined(CONFIG_440)
static struct pci_controller ppc440_hose = {0};
@@ -496,14 +511,12 @@ void pci_440_init (struct pci_controller
pci_setup_indirect(hose, PCIX0_CFGADR, PCIX0_CFGDATA);
-#if defined(CFG_PCI_PRE_INIT)
/* Let board change/modify hose & do initial checks */
if (pci_pre_init (hose) == 0) {
printf("PCI: Board-specific initialization failed.\n");
printf("PCI: Configuration aborted.\n");
return;
}
-#endif
pci_register_hose( hose );
@@ -575,4 +588,5 @@ void pci_init_board(void)
#endif
}
-#endif /* CONFIG_440 & CONFIG_PCI */
+#endif /* CONFIG_440 */
+#endif /* CONFIG_PCI */
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-22 15:35 ` Matthias Fuchs
@ 2007-06-22 15:44 ` Stefan Roese
2007-06-24 15:23 ` Matthias Fuchs
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Roese @ 2007-06-22 15:44 UTC (permalink / raw)
To: u-boot
Hi Matthias,
On Friday 22 June 2007, Matthias Fuchs wrote:
> ppc4xx: Add pci_pre_init() for 405 boards
Unfortunately line-wrapped. Please fix and send again.
Thanks.
Viele Gr??e,
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
=====================================================================
^ permalink raw reply [flat|nested] 8+ messages in thread
* [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards
2007-06-22 15:44 ` Stefan Roese
@ 2007-06-24 15:23 ` Matthias Fuchs
0 siblings, 0 replies; 8+ messages in thread
From: Matthias Fuchs @ 2007-06-24 15:23 UTC (permalink / raw)
To: u-boot
ppc4xx: Add pci_pre_init() for 405 boards
This patch adds support for calling a plattform dependant
pci_pre_init() function for 405 boards. This can be used to
move the current pci_405gp_fixup_irq() function into the
board code.
This patch also makes the CFG_PCI_PRE_INIT define obsolete.
A default function with 'weak' attribute is used when
a board specific pci_pre_init() is not implemented.
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
---
commit 2b9a0d67dfed6c29c3e46ed5e1443cf044631bb2
tree 18d8afc439bd0ce099a16e32ba3544a4170b46a6
parent acd7872c4d968197e6269572cbc122690f7e85ee
author Matthias Fuchs <matthias.fuchs@esd-electronics.com> Fri, 22 Jun 2007 17:32:41 +0200
committer Matthias Fuchs <matthias.fuchs@esd-electronics.com> Fri, 22 Jun 2007 17:32:41 +0200
cpu/ppc4xx/405gp_pci.c | 30 ++++++++++++++++++++++--------
1 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/cpu/ppc4xx/405gp_pci.c b/cpu/ppc4xx/405gp_pci.c
index 8bf03e1..2837929 100644
--- a/cpu/ppc4xx/405gp_pci.c
+++ b/cpu/ppc4xx/405gp_pci.c
@@ -77,11 +77,21 @@
#include <asm/processor.h>
#include <pci.h>
+#ifdef CONFIG_PCI
+
DECLARE_GLOBAL_DATA_PTR;
-#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
+/*
+ * Board-specific pci initialization
+ * Platform code can reimplement pci_pre_init() if needed
+ */
+int __pci_pre_init(struct pci_controller *hose)
+{
+ return 1;
+}
+int pci_pre_init(struct pci_controller *hose) __attribute__((weak, alias("__pci_pre_init")));
-#ifdef CONFIG_PCI
+#if defined(CONFIG_405GP) || defined(CONFIG_405EP)
#if defined(CONFIG_PMC405)
ushort pmc405_pci_subsys_deviceid(void);
@@ -191,6 +201,13 @@ void pci_405gp_init(struct pci_controlle
if (hose->pci_fb)
pciauto_region_init(hose->pci_fb);
+ /* Let board change/modify hose & do initial checks */
+ if (pci_pre_init (hose) == 0) {
+ printf("PCI: Board-specific initialization failed.\n");
+ printf("PCI: Configuration aborted.\n");
+ return;
+ }
+
pci_register_hose(hose);
/*--------------------------------------------------------------------------+
@@ -416,14 +433,12 @@ void pci_init_board(void)
#endif
-#endif /* CONFIG_PCI */
-
#endif /* CONFIG_405GP */
/*-----------------------------------------------------------------------------+
* CONFIG_440
*-----------------------------------------------------------------------------*/
-#if defined(CONFIG_440) && defined(CONFIG_PCI)
+#if defined(CONFIG_440)
static struct pci_controller ppc440_hose = {0};
@@ -496,14 +511,12 @@ void pci_440_init (struct pci_controller
pci_setup_indirect(hose, PCIX0_CFGADR, PCIX0_CFGDATA);
-#if defined(CFG_PCI_PRE_INIT)
/* Let board change/modify hose & do initial checks */
if (pci_pre_init (hose) == 0) {
printf("PCI: Board-specific initialization failed.\n");
printf("PCI: Configuration aborted.\n");
return;
}
-#endif
pci_register_hose( hose );
@@ -575,4 +588,5 @@ void pci_init_board(void)
#endif
}
-#endif /* CONFIG_440 & CONFIG_PCI */
+#endif /* CONFIG_440 */
+#endif /* CONFIG_PCI */
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-06-24 15:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-21 13:38 [U-Boot-Users] [PATCH] ppc4xx: Add pci_pre_init() for 405 boards Matthias Fuchs
2007-06-21 21:14 ` Wolfgang Denk
2007-06-22 6:04 ` Stefan Roese
2007-06-22 12:00 ` Matthias Fuchs
2007-06-22 12:11 ` Stefan Roese
2007-06-22 15:35 ` Matthias Fuchs
2007-06-22 15:44 ` Stefan Roese
2007-06-24 15:23 ` Matthias Fuchs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox