Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-05-01 Thread Anatolij Gustschin
Dear Matthias,

On Thu, 22 Apr 2010 12:30:56 +0200
Matthias Weisser weiss...@arcor.de wrote:
...
 diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
 index d1f47c9..4769cdb 100644
 --- a/drivers/video/cfb_console.c
 +++ b/drivers/video/cfb_console.c
 @@ -153,6 +153,14 @@ CONFIG_VIDEO_HW_CURSOR:   - Uses the hardware cursor 
 capability of the
  #endif
  
  
 /*/
 +/* Defines for the MB86R0xGDC driver  */
 +/*/
 +#ifdef CONFIG_VIDEO_MB86R0xGDC
 +
 +#define VIDEO_FB_16BPP_WORD_SWAP
 +#endif

Please do not add VIDEO_FB_16BPP_WORD_SWAP #define here.
Add it into your include/configs/jadecpu.h file in the video
related section like other boards do. Thanks!

Best regards,
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-05-01 Thread Anatolij Gustschin
Dear Matthias,

On Thu, 22 Apr 2010 15:03:55 +0200
Matthias Weißer weiss...@arcor.de wrote:
...
  +/*
  + * Set a RGB color in the LUT
  + */
  +void video_set_lut(unsigned int index, unsigned char r,
  +  unsigned char g, unsigned char b)
  +{
  +
  +}
 
  Code seems to be missing?
 
 The driver doesn't support palletized color format at the moment but 
 removing this function leads to a linker error.
 
 Maybe we should add a config option to disable palletized color format 
 or add a weak function somewhere. Maybe Anatolij can comment on this 
 issue also.

I will send a patch adding weak default video_set_lut() to cfb_console
driver. You can remove empty function then.

Best regards,
Anatolij
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-04-28 Thread Matthias Weißer
Am 22.04.2010 14:41, schrieb Wolfgang Denk:
 Dear Matthias Weisser,

 In message1271932257-14618-3-git-send-email-weiss...@arcor.de  you wrote:
 This patch adds support for the display controller in
 the MB86R0x SoCs.

 Signed-off-by: Matthias Weisserweiss...@arcor.de
 ...
 +pGD-memSize = VIDEO_MEM_SIZE;
 +pGD-frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;

 Please pay attention to the global memory map requirements. PRAM might
 go first.

Can you please explain this a bit more in detail? I checked the source 
and README for CONFIG_PRAM and it seems to be reserving some space at 
the end of RAM. But I have only found reference to it in ppc and m68k code.

What would be the correct way to reserve some 2MB-4MB at the end of 
system RAM as a framebuffer for the integrated graphics device?

Thanks in advance

Matthias
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-04-28 Thread Wolfgang Denk
Dear Matthias,

in message 4bd7d5dd.6080...@arcor.de you wrote:

  +  pGD-memSize = VIDEO_MEM_SIZE;
  +  pGD-frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;
 
  Please pay attention to the global memory map requirements. PRAM might
  go first.
 
 Can you please explain this a bit more in detail? I checked the source 
 and README for CONFIG_PRAM and it seems to be reserving some space at 
 the end of RAM. But I have only found reference to it in ppc and m68k code.

Right. But there is a chance that the ARM implementation might be
reworked soon, and then it will follow the documented approach as
well, so better start correctly from the beginning so you don;t run
into conflicts soon.

 What would be the correct way to reserve some 2MB-4MB at the end of 
 system RAM as a framebuffer for the integrated graphics device?

See the PPC implementation for reference.

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: w...@denx.de
Shakespeare's Law of Prototyping: (Hamlet III, iv, 156-160)
O, throw away the worser part of it,
And live the purer with the other half.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-04-28 Thread Matthias Weißer
Am 28.04.2010 08:44, schrieb Wolfgang Denk:
 Dear Matthias,


 in message4bd7d5dd.6080...@arcor.de  you wrote:

 +  pGD-memSize = VIDEO_MEM_SIZE;
 +  pGD-frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;

 Please pay attention to the global memory map requirements. PRAM might
 go first.

 Can you please explain this a bit more in detail? I checked the source
 and README for CONFIG_PRAM and it seems to be reserving some space at
 the end of RAM. But I have only found reference to it in ppc and m68k code.

 Right. But there is a chance that the ARM implementation might be
 reworked soon, and then it will follow the documented approach as
 well, so better start correctly from the beginning so you don;t run
 into conflicts soon.

I totally agree with you, but...

 What would be the correct way to reserve some 2MB-4MB at the end of
 system RAM as a framebuffer for the integrated graphics device?

 See the PPC implementation for reference.

I had a look into the PPC code and its clear to me how it is done there. 
But I currently do not see how this can be done on ARM without a couple 
of changes to arch/arm/lib/board.c

Another question regarding the video driver:
I have seen some video drivers in driver/video/... and some are in 
arch/.../cpu/...

What would be the right place for mine? As it is integrated into the SoC 
I tend to put it in arch/arm/cpu/arm/arm926ejs/mb86r0x and not into 
drivers/video. On the other hand there is a imx31 related video driver 
in drivers/video.

Thanks for you patience
Matthias
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-04-22 Thread Matthias Weisser
This patch adds support for the display controller in
the MB86R0x SoCs.

Signed-off-by: Matthias Weisser weiss...@arcor.de
---
 drivers/video/Makefile  |1 +
 drivers/video/cfb_console.c |8 ++
 drivers/video/mb86r0xgdc.c  |  194 +++
 3 files changed, 203 insertions(+), 0 deletions(-)
 create mode 100644 drivers/video/mb86r0xgdc.c

diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index a5e339a..1a60ec6 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_S6E63D6) += s6e63d6.o
 COBJS-$(CONFIG_VIDEO_AMBA) += amba.o
 COBJS-$(CONFIG_VIDEO_CT69000) += ct69000.o
 COBJS-$(CONFIG_VIDEO_MB862xx) += mb862xx.o
+COBJS-$(CONFIG_VIDEO_MB86R0xGDC) += mb86r0xgdc.o
 COBJS-$(CONFIG_VIDEO_MX3) += mx3fb.o
 COBJS-$(CONFIG_VIDEO_SED13806) += sed13806.o
 COBJS-$(CONFIG_SED156X) += sed156x.o
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index d1f47c9..4769cdb 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -153,6 +153,14 @@ CONFIG_VIDEO_HW_CURSOR: - Uses the hardware cursor 
capability of the
 #endif
 
 /*/
+/* Defines for the MB86R0xGDC driver*/
+/*/
+#ifdef CONFIG_VIDEO_MB86R0xGDC
+
+#define VIDEO_FB_16BPP_WORD_SWAP
+#endif
+
+/*/
 /* Include video_fb.h after definitions of VIDEO_HW_RECTFILL etc*/
 /*/
 #include video_fb.h
diff --git a/drivers/video/mb86r0xgdc.c b/drivers/video/mb86r0xgdc.c
new file mode 100644
index 000..9022730
--- /dev/null
+++ b/drivers/video/mb86r0xgdc.c
@@ -0,0 +1,194 @@
+/*
+ * (C) Copyright 2010
+ * Matthias Weisser weiss...@arcor.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * mb86r0x.c - Graphic interface for Fujitsu MB86R0x integrated graphic
+ * controller. Derived from mb862xx.c
+ */
+
+#include common.h
+
+#include malloc.h
+#include mb862xx.h
+#include asm/io.h
+#include asm/arch/hardware.h
+#include video_fb.h
+#include videomodes.h
+
+/*
+ * 4MB (at the end of system RAM)
+ */
+#define VIDEO_MEM_SIZE 0x40
+
+/*
+ * Graphic Device
+ */
+static GraphicDevice mb86r0x;
+
+void *video_hw_init(void)
+{
+   GraphicDevice *pGD = mb86r0x;
+   struct ctfb_res_modes var_mode[2];
+   unsigned long *vid;
+   unsigned long div;
+   unsigned long dspBase[2];
+   char *penv;
+   int bpp;
+   int i, j;
+
+   memset(pGD, 0, sizeof(GraphicDevice));
+
+   dspBase[0] = MB86R0x_GDC_DISP0_PHYS_BASE;
+   dspBase[1] = MB86R0x_GDC_DISP1_PHYS_BASE;
+
+   pGD-frameAdrs = MB86R0x_GDC_PHYS_BASE;
+   pGD-gdfIndex = GDF_15BIT_555RGB;
+   pGD-gdfBytesPP = 2;
+
+   pGD-memSize = VIDEO_MEM_SIZE;
+   pGD-frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;
+   vid = (unsigned long *)pGD-frameAdrs;
+
+   for (i = 0; i  2; i++) {
+   char varName[32];
+   u32 dcm1, dcm2, dcm3;
+   u16 htp, hdp, hdb, hsp, vtr, vsp, vdp;
+   u8 hsw, vsw;
+   u32 l2m, l2em, l2oa0, l2da0, l2oa1, l2da1;
+   u16 l2dx, l2dy, l2wx, l2wy, l2ww, l2wh;
+
+   sprintf(varName, gs_dsp_%d_param, i);
+
+   penv = getenv(varName);
+   if (penv == NULL) {
+   penv = getenv(videomode);
+   if ((i == 1) || (penv == NULL))
+   continue;
+   }
+
+   bpp = 0;
+   bpp = video_get_params(var_mode[i], penv);
+
+   if (bpp == 0) {
+   var_mode[i].xres = 640;
+   var_mode[i].yres = 480;
+   var_mode[i].pixclock = 39721;   /* 25MHz */
+   var_mode[i].left_margin = 48;
+   var_mode[i].right_margin = 16;
+   var_mode[i].upper_margin = 33;
+   

Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-04-22 Thread Wolfgang Denk
Dear Matthias Weisser,

In message 1271932257-14618-3-git-send-email-weiss...@arcor.de you wrote:
 This patch adds support for the display controller in
 the MB86R0x SoCs.
 
 Signed-off-by: Matthias Weisser weiss...@arcor.de
...
 + pGD-memSize = VIDEO_MEM_SIZE;
 + pGD-frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;

Please pay attention to the global memory map requirements. PRAM might
go first.


 + writel(dcm1, dspBase[i] + GC_DCM1);
 + writel(dcm2, dspBase[i] + GC_DCM2);
 + writel(dcm3, dspBase[i] + GC_DCM3);
 +
 + writew(htp, dspBase[i] + GC_HTP);
 + writew(hdp, dspBase[i] + GC_HDP);
 + writew(hdb, dspBase[i] + GC_HDB);
 + writew(hsp, dspBase[i] + GC_HSP);
 + writeb(hsw, dspBase[i] + GC_HSW);
 +
 + writeb(vsw, dspBase[i] + GC_VSW);
 + writew(vtr, dspBase[i] + GC_VTR);
 + writew(vsp, dspBase[i] + GC_VSP);
 + writew(vdp, dspBase[i] + GC_VDP);
 +
 + writel(l2m, dspBase[i] + GC_L2M);
 + writel(l2em, dspBase[i] + GC_L2EM);
 + writel(l2oa0, dspBase[i] + GC_L2OA0);
 + writel(l2da0, dspBase[i] + GC_L2DA0);
 + writel(l2oa1, dspBase[i] + GC_L2OA1);
 + writel(l2da1, dspBase[i] + GC_L2DA1);
 + writew(l2dx, dspBase[i] + GC_L2DX);
 + writew(l2dy, dspBase[i] + GC_L2DY);
 + writew(l2wx, dspBase[i] + GC_L2WX);
 + writew(l2wy, dspBase[i] + GC_L2WY);
 + writew(l2ww, dspBase[i] + GC_L2WW);
 + writew(l2wh, dspBase[i] + GC_L2WH);
 +
 + writel(dcm1 | (1  18) | (1  31), dspBase[i] + GC_DCM1);

Please use a C struct instead.

 +/*
 + * Set a RGB color in the LUT
 + */
 +void video_set_lut(unsigned int index, unsigned char r,
 + unsigned char g, unsigned char b)
 +{
 +
 +}

Code seems to be missing?

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: w...@denx.de
The more we disagree, the more chance there is that at least  one  of
us is right.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] video: add support for display controller in MB86R0x SoCs

2010-04-22 Thread Matthias Weißer
Am 22.04.2010 14:41, schrieb Wolfgang Denk:
 Dear Matthias Weisser,

 In message1271932257-14618-3-git-send-email-weiss...@arcor.de  you wrote:
 This patch adds support for the display controller in
 the MB86R0x SoCs.

 Signed-off-by: Matthias Weisserweiss...@arcor.de
 ...
 +pGD-memSize = VIDEO_MEM_SIZE;
 +pGD-frameAdrs = PHYS_SDRAM + PHYS_SDRAM_SIZE - VIDEO_MEM_SIZE;

 Please pay attention to the global memory map requirements. PRAM might
 go first.


 +writel(dcm1, dspBase[i] + GC_DCM1);
 +writel(dcm2, dspBase[i] + GC_DCM2);
 +writel(dcm3, dspBase[i] + GC_DCM3);
 +
 +writew(htp, dspBase[i] + GC_HTP);
 +writew(hdp, dspBase[i] + GC_HDP);
 +writew(hdb, dspBase[i] + GC_HDB);
 +writew(hsp, dspBase[i] + GC_HSP);
 +writeb(hsw, dspBase[i] + GC_HSW);
 +
 +writeb(vsw, dspBase[i] + GC_VSW);
 +writew(vtr, dspBase[i] + GC_VTR);
 +writew(vsp, dspBase[i] + GC_VSP);
 +writew(vdp, dspBase[i] + GC_VDP);
 +
 +writel(l2m, dspBase[i] + GC_L2M);
 +writel(l2em, dspBase[i] + GC_L2EM);
 +writel(l2oa0, dspBase[i] + GC_L2OA0);
 +writel(l2da0, dspBase[i] + GC_L2DA0);
 +writel(l2oa1, dspBase[i] + GC_L2OA1);
 +writel(l2da1, dspBase[i] + GC_L2DA1);
 +writew(l2dx, dspBase[i] + GC_L2DX);
 +writew(l2dy, dspBase[i] + GC_L2DY);
 +writew(l2wx, dspBase[i] + GC_L2WX);
 +writew(l2wy, dspBase[i] + GC_L2WY);
 +writew(l2ww, dspBase[i] + GC_L2WW);
 +writew(l2wh, dspBase[i] + GC_L2WH);
 +
 +writel(dcm1 | (1  18) | (1  31), dspBase[i] + GC_DCM1);

 Please use a C struct instead.

This driver is mainly copied from mb862xx (sharing the header as offsets 
are the same) and that was the approach used there. I will add the 
structures and use them.

 +/*
 + * Set a RGB color in the LUT
 + */
 +void video_set_lut(unsigned int index, unsigned char r,
 +unsigned char g, unsigned char b)
 +{
 +
 +}

 Code seems to be missing?

The driver doesn't support palletized color format at the moment but 
removing this function leads to a linker error.

Maybe we should add a config option to disable palletized color format 
or add a weak function somewhere. Maybe Anatolij can comment on this 
issue also.

Regards,
Matthias
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot