Skip to contentSkip to conversation

ppc4xx: use CONFIG_PCI_BOOTDELAY instead of private implementation

PATCH New matthias.fuchs at esd.eu 2 participants 6 messages Oct 13, 2011 – Dec 1, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ppc4xx: use CONFIG_PCI_BOOTDELAY instead of private implementation

From: Matthias Fuchs <[email protected]>

This patch switches PMC440 board code to the CONFIG_PCI_BOOTDELAY option instead of using a private implemention. This relies on Anatolji's patch that moves the pcidelay handling behind pci_target_init.

---
 board/esd/pmc440/pmc440.c |   15 ---------------
 include/configs/PMC440.h  |    2 ++
 2 files changed, 2 insertions(+), 15 deletions(-)
board/esd/pmc440/pmc440.c +0 -15
index 5236f44..0d56064 100644
@@ -617,21 +617,6 @@ void pci_master_init(struct pci_controller *hose)
 
 static void wait_for_pci_ready(void)
 {
-	int i;
-	char *s = getenv("pcidelay");
-	/*
-	 * We have our own handling of the pcidelay variable.
-	 * Using CONFIG_PCI_BOOTDELAY enables pausing for host
-	 * and adapter devices. For adapter devices we do not
-	 * want this.
-	 */
-	if (s) {
-		int ms = simple_strtoul(s, NULL, 10);
-		printf("PCI:   Waiting for %d ms\n", ms);
-		for (i=0; i<ms; i++)
-			udelay(1000);
-	}
-
 	if (!(in_be32((void*)GPIO1_IR) & GPIO1_PPC_EREADY)) {
 		printf("PCI:   Waiting for EREADY (CTRL-C to skip) ... ");
 		while (1) {
include/configs/PMC440.h +2 -0
index bee74aa..ed47a87 100644
@@ -432,6 +432,8 @@
 #define CONFIG_SYS_PCI_MASTER_INIT
 #define CONFIG_SYS_PCI_BOARD_FIXUP_IRQ
 
+#define CONFIG_PCI_BOOTDELAY 0
+
 /* PCI identification */
 #define CONFIG_SYS_PCI_SUBSYS_VENDORID 0x12FE	/* PCI Vendor ID: esd gmbh      */
 #define CONFIG_SYS_PCI_SUBSYS_ID_NONMONARCH 0x0441	/* PCI Device ID: Non-Monarch */
Signature · 1 line
1.6.1
#1 lore raw

PATCH 2/3 ppc4xx: remove invalid access to PCI_BRDGOPT2 register

From: Matthias Fuchs <[email protected]>

This patch removes an invalid call to pci_write_config_dword to PCI_BRDGOPT2 register. This function must not be used from pci_target_init and is also at the wrong place. The correct call is done later in pci_target_init via pci_hose_write_config_dword.

---
 board/esd/pmc440/pmc440.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
board/esd/pmc440/pmc440.c +0 -2
index 0d56064..3713e37 100644
@@ -574,8 +574,6 @@ void pci_target_init(struct pci_controller *hose)
 	/* No error reporting */
 	pci_hose_write_config_word(hose, 0, PCI_ERREN, 0);
 
-	pci_write_config_dword(0, PCI_BRDGOPT2, 0x00000101);
-
 	if (!is_monarch()) {
 		/* Program the board's subsystem id/classcode */
 		pci_hose_write_config_word(hose, 0, PCI_SUBSYSTEM_ID,
Signature · 1 line
1.6.1
#2 lore raw

PATCH 3/3 ppc4xx: fix PMC440 painit command

From: Matthias Fuchs <[email protected]>

This patch fixes the PMC440 BSP command painit. The implementation was broken since the step to the new environment handling.

---
 board/esd/pmc440/cmd_pmc440.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
board/esd/pmc440/cmd_pmc440.c +15 -2
index 200d7ee..3bcf2b0 100644
@@ -342,7 +342,8 @@ U_BOOT_CMD(
 
 #if defined(CONFIG_PRAM)
 #include <environment.h>
-extern env_t *env_ptr;
+#include <search.h>
+#include <errno.h>
 
 int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
@@ -351,6 +352,10 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	u32 param;
 	ulong *lptr;
 
+	env_t *envp;
+	char *res;
+	int len;
+
 	v = getenv("pram");
 	if (v)
 		pram = simple_strtoul(v, NULL, 10);
@@ -384,7 +389,15 @@ int do_painit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 
 	/* env is first (4k aligned) */
 	nextbase -= ((CONFIG_ENV_SIZE + 4096 - 1) & ~(4096 - 1));
-	memcpy((void*)nextbase, env_ptr, CONFIG_ENV_SIZE);
+	envp = (env_t *)nextbase;
+	res = (char *)envp->data;
+	len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
+        if (len < 0) {
+                error("Cannot export environment: errno = %d\n", errno);
+                return 1;
+        }
+	envp->crc = crc32(0, envp->data, ENV_SIZE);
+
 	*(--lptr) = CONFIG_ENV_SIZE;     /* size */
 	*(--lptr) = base - nextbase;  /* offset | type=0 */
 
Signature · 1 line
1.6.1
#3 lore raw

PATCH 3/3 ppc4xx: fix PMC440 painit command

Hi Matthias,

Quoted 4 lines · On Thursday 13 October 2011 15:12:24 matthias.fuchs at esd.eu wrote:

From: Matthias Fuchs <[email protected]>

This patch fixes the PMC440 BSP command painit. The implementation was broken since the step to the new environment handling.

After applying this patch to the latest U-Boot version I get the following error:

[stefan at kubuntu u-boot-ppc4xx (master)]$ ./MAKEALL PMC440 Configuring for PMC440 board...
cmd_pmc440.c: In function 'do_painit':
cmd_pmc440.c:394: error: too few arguments to function 'hexport_r' make[1]: *** [cmd_pmc440.o] Error 1

Seems that the hexport_r() API has changed. Could you please take a look and resubmit.

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

#4 lore raw

PATCH 2/3 ppc4xx: remove invalid access to PCI_BRDGOPT2 register

In reply to matthias.fuchs at esd.eu
Quoted 6 lines · On Thursday 13 October 2011 15:12:23 matthias.fuchs at esd.eu wrote:

From: Matthias Fuchs <[email protected]>

This patch removes an invalid call to pci_write_config_dword to PCI_BRDGOPT2 register. This function must not be used from pci_target_init and is also at the wrong place. The correct call is done later in pci_target_init via pci_hose_write_config_dword.

Applied to u-boot-ppc4xx. 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

#5 lore raw

PATCH 1/3 ppc4xx: use CONFIG_PCI_BOOTDELAY instead of private implementation

In reply to matthias.fuchs at esd.eu
Quoted 5 lines · On Thursday 13 October 2011 15:12:22 matthias.fuchs at esd.eu wrote:

From: Matthias Fuchs <[email protected]>

This patch switches PMC440 board code to the CONFIG_PCI_BOOTDELAY option instead of using a private implemention. This relies on Anatolji's patch that moves the pcidelay handling behind pci_target_init.

Applied to u-boot-ppc4xx. 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