Patchwork [U-Boot,1/5] video: mb862xx: support Coral-PA controller

login
register
mail settings
Submitter Anatolij Gustschin
Date May 27, 2011, 2:08 p.m.
Message ID <1306505304-9593-2-git-send-email-agust@denx.de>
Download mbox | patch
Permalink /patch/97684/
State Accepted
Commit d7ffd27a6e52e33e59f0acdc0898bac3d3d91548
Delegated to: Anatolij Gustschin
Headers show

Comments

Anatolij Gustschin - May 27, 2011, 2:08 p.m.
Add detection of Coral-PA and configure Coral CCF an MMR parameters
using CONFIG_SYS_MB862xx_CCF and CONFIG_SYS_MB862xx_MMR macros.
Use CCF and MMR parameters for Coral-P Eval. Board if the appropriate
macros weren't defined.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
 drivers/video/mb862xx.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)
Anatolij Gustschin - July 4, 2011, 10:32 p.m.
On Fri, 27 May 2011 16:08:20 +0200
Anatolij Gustschin <agust@denx.de> wrote:

> Add detection of Coral-PA and configure Coral CCF an MMR parameters
> using CONFIG_SYS_MB862xx_CCF and CONFIG_SYS_MB862xx_MMR macros.
> Use CCF and MMR parameters for Coral-P Eval. Board if the appropriate
> macros weren't defined.
> 
> Signed-off-by: Anatolij Gustschin <agust@denx.de>
> ---
>  drivers/video/mb862xx.c |   32 +++++++++++++++++++++++++++-----
>  1 files changed, 27 insertions(+), 5 deletions(-)

applied to u-boot-video/master.

Anatolij

Patch

diff --git a/drivers/video/mb862xx.c b/drivers/video/mb862xx.c
index edf34aa..088365d 100644
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
@@ -189,10 +189,19 @@  static void de_init (void)
 }
 
 #if defined(CONFIG_VIDEO_CORALP)
+/* use CCF and MMR parameters for Coral-P Eval. Board as default */
+#ifndef CONFIG_SYS_MB862xx_CCF
+#define CONFIG_SYS_MB862xx_CCF	0x00090000
+#endif
+#ifndef CONFIG_SYS_MB862xx_MMR
+#define CONFIG_SYS_MB862xx_MMR	0x11d7fa13
+#endif
+
 unsigned int pci_video_init (void)
 {
 	GraphicDevice *dev = &mb862xx;
 	pci_dev_t devbusfn;
+	u16 device;
 
 	if ((devbusfn = pci_find_devices (supported, 0)) < 0) {
 		puts ("PCI video controller not found!\n");
@@ -212,10 +221,25 @@  unsigned int pci_video_init (void)
 
 	dev->pciBase = dev->frameAdrs;
 
-	/* Setup clocks and memory mode for Coral-P Eval. Board */
-	HOST_WR_REG (GC_CCF, 0x00090000);
+	puts("Coral-");
+
+	pci_read_config_word(devbusfn, PCI_DEVICE_ID, &device);
+	switch (device) {
+	case PCI_DEVICE_ID_CORAL_P:
+		puts("P\n");
+		break;
+	case PCI_DEVICE_ID_CORAL_PA:
+		puts("PA\n");
+		break;
+	default:
+		puts("Unknown\n");
+		return 0;
+	}
+
+	/* Setup clocks and memory mode for Coral-P(A) */
+	HOST_WR_REG(GC_CCF, CONFIG_SYS_MB862xx_CCF);
 	udelay (200);
-	HOST_WR_REG (GC_MMR, 0x11d7fa13);
+	HOST_WR_REG(GC_MMR, CONFIG_SYS_MB862xx_MMR);
 	udelay (100);
 	return dev->frameAdrs;
 }
@@ -235,8 +259,6 @@  unsigned int card_init (void)
 	if (!pci_video_init ())
 		return 0;
 
-	puts ("CoralP\n");
-
 	tmp = 0;
 	videomode = 0x310;
 	/* get video mode via environment */