From e95b61cfb0c7203964c1a3f163e16a65f04d87ec Mon Sep 17 00:00:00 2001
From: wdenk <wdenk>
Date: Mon, 4 Nov 2002 16:02:40 +0000
Subject: [PATCH] Patch by Guillaume Alexandre,, 04 Nov 2002: Improve PCI
 access on 32-bits Compact PCI bus

Adjust VFD initialization on TRAB

Cleanup RRvision video code
---
 CHANGELOG                    |  3 +++
 board/pcippc2/pcippc2.c      | 21 +++++++++++++++++++++
 board/pcippc2/pcippc2.h      |  2 ++
 board/pcippc2/pcippc2_fpga.h |  1 +
 board/trab/trab.c            | 18 ++++++++++--------
 common/cmd_vfd.c             |  2 +-
 cpu/mpc8xx/video.c           |  8 --------
 include/configs/trab.h       |  2 +-
 8 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 8cf309db18f..d6055f32d56 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
 Changes since for U-Boot 0.1.0:
 ======================================================================
 
+* Patch by Guillaume Alexandre,, 04 Nov 2002:
+  Improve PCI access on 32-bits Compact PCI bus
+
 * Fix mdelay() on TRAB - this was still the debugging version with
   seconds instead of ms.
 
diff --git a/board/pcippc2/pcippc2.c b/board/pcippc2/pcippc2.c
index e1b065b0ced..80ca40250c2 100644
--- a/board/pcippc2/pcippc2.c
+++ b/board/pcippc2/pcippc2.c
@@ -117,6 +117,8 @@ int misc_init_r (void)
 {
 	pcippc2_fpga_init ();
 
+	pcippc2_cpci3264_init ();
+
 #if defined(CONFIG_WATCHDOG)
 	pcippc2_wdt_init ();
 #endif
@@ -147,6 +149,25 @@ void doc_init (void)
 	doc_probe (pcippc2_fpga1_phys + HW_FPGA1_DOC);
 }
 
+void pcippc2_cpci3264_init (void)
+{
+  pci_dev_t		bdf = pci_find_device(FPGA_VENDOR_ID, FPGA_DEVICE_ID, 0);
+
+  if (bdf == -1)
+  {
+    puts("Unable to find FPGA !\n");
+    hang();
+  }
+
+	if((in32(pcippc2_fpga0_phys + HW_FPGA0_BOARD) & 0x01000000) == 0x01000000)
+	/* 32-bits Compact PCI bus - LSB bit */
+	{
+		iobarrier_rw();
+		out32(BRIDGE(CPCI, PCIDG), 0x40000000);	/* 32-bits bridge, Pipeline */
+		iobarrier_rw();
+	}
+}
+
 #if defined(CONFIG_WATCHDOG)
 
 void pcippc2_wdt_init (void)
diff --git a/board/pcippc2/pcippc2.h b/board/pcippc2/pcippc2.h
index 6e9e2ff05e7..3820bbec618 100644
--- a/board/pcippc2/pcippc2.h
+++ b/board/pcippc2/pcippc2.h
@@ -40,6 +40,8 @@ extern u32	pcippc2_sdram_size		(void);
 
 extern void 	pcippc2_fpga_init		(void);
 
+extern void 	pcippc2_cpci3264_init	(void);
+
 extern void 	cpc710_pci_init			(void);
 extern void	cpc710_pci_enable_timeout	(void);
 
diff --git a/board/pcippc2/pcippc2_fpga.h b/board/pcippc2/pcippc2_fpga.h
index b6206a451e4..850c3319731 100644
--- a/board/pcippc2/pcippc2_fpga.h
+++ b/board/pcippc2/pcippc2_fpga.h
@@ -28,6 +28,7 @@
 #define FPGA_DEVICE_ID			0x000d
 
 #define HW_FPGA0_INT			0x0000
+#define HW_FPGA0_BOARD		0x0060
 #define HW_FPGA0_UART1			0x0080
 #define HW_FPGA0_UART2			0x0100
 #define HW_FPGA0_RTC			0x2000
diff --git a/board/trab/trab.c b/board/trab/trab.c
index b4ab3293679..6a758b2398d 100644
--- a/board/trab/trab.c
+++ b/board/trab/trab.c
@@ -42,13 +42,13 @@ extern int do_mdm_init; /* defined in common/main.c */
  * is that timers are not available yet, so we use a manually timed
  * loop.
  */
-#define KBD_MDELAY	1000
-static void mdelay_no_timer (int msec)
+#define KBD_MDELAY	5000
+static void udelay_no_timer (int usec)
 {
 	DECLARE_GLOBAL_DATA_PTR;
 
 	int i;
-	int delay = msec * 3;
+	int delay = usec * 3;
 
 	for (i = 0; i < delay; i ++) gd->bd->bi_arch_number = 145;
 }
@@ -102,12 +102,12 @@ int board_init ()
 	gd->bd->bi_boot_params = 0x0c000100;
 
 #ifdef CONFIG_MODEM_SUPPORT
-	/* This stuff is needed to get interrupts on stop-position
-	 * contact events.
+	/* This stuff is needed by the CPLD to read keyboard data.
 	 * (Copied from the LCD initialization routine.)
 	 */
-	if (rLCDCON1 == 0)
-	{
+	if (rLCDCON1 == 0) {
+		extern void init_grid_ctrl(void);
+
 		rPCCON = (rPCCON & 0xFFFFFF00)| 0x000000AA;
 		rPDCON = (rPDCON & 0xFFFFFF03)| 0x000000A8;
 #if 0
@@ -118,9 +118,11 @@ int board_init ()
 		rLCDCON4 = 0x00000001;
 		rLCDCON5 = 0x00000440;
 		rLCDCON1 = 0x00000B75;
+
+		init_grid_ctrl();
 	}
 
-	mdelay_no_timer (KBD_MDELAY);
+	udelay_no_timer (KBD_MDELAY);
 
 	if (key_pressed()) {
 		disable_putc();	/* modem doesn't understand banner etc */
diff --git a/common/cmd_vfd.c b/common/cmd_vfd.c
index d2c63d6e9cd..49df56c9f04 100644
--- a/common/cmd_vfd.c
+++ b/common/cmd_vfd.c
@@ -72,7 +72,7 @@ int trab_vfd (ulong bitmap)
 			return 0;
 		case VFD_REMOTE_LOGO_BMPNR:
 			transfer_pic(1, &vfd_remote_logo_bitmap[0],
-				VFD_TEST_LOGO_HEIGHT, VFD_TEST_LOGO_WIDTH);
+				VFD_REMOTE_LOGO_HEIGHT, VFD_REMOTE_LOGO_WIDTH);
 			return 0;
 #endif
 		default:
diff --git a/cpu/mpc8xx/video.c b/cpu/mpc8xx/video.c
index 10ec6f779d8..9db69e1e195 100644
--- a/cpu/mpc8xx/video.c
+++ b/cpu/mpc8xx/video.c
@@ -835,14 +835,6 @@ static void video_ctrl_init (void *memptr)
 	{
 		volatile immap_t *immr = (immap_t *) CFG_IMMR;
 
-		debug ("[RRvision] PD3 -> clk output: ");
-		immr->im_ioport.iop_pdpar |=   0x1000 ;
-#if 0	/* This is supposed to be an output XXX XXX */
-		immr->im_ioport.iop_pddir |=   0x1000 ;
-#else
-		immr->im_ioport.iop_pddir &= ~(0x1000);
-#endif
-		udelay (1000);
 		debug ("PDPAR=%04X PDDIR=%04X PDDAT=%04X\n",
 			immr->im_ioport.iop_pdpar,
 			immr->im_ioport.iop_pddir,
diff --git a/include/configs/trab.h b/include/configs/trab.h
index 4472087e10a..b7a27c69231 100644
--- a/include/configs/trab.h
+++ b/include/configs/trab.h
@@ -135,7 +135,7 @@
 		"ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::off\0" \
 	"add_misc=setenv bootargs $(bootargs) console=ttyS0 panic=1\0" \
 	"load=tftp 0xC100000 /tftpboot/TRAB/u-boot.bin\0" \
-	"update=protect off 1:0-7;era 1:0-7;cp.b 0xc100000 0 $(filesize);" \
+	"update=protect off 1:0-8;era 1:0-8;cp.b 0xc100000 0 $(filesize);" \
 		"setenv filesize;saveenv\0" \
 	"loadfile=/tftpboot/TRAB/pImage\0" \
 	"loadaddr=c400000\0" \
-- 
GitLab