Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501!

2008-10-24 Thread Jean-Christophe PLAGNIOL-VILLARD
On 11:11 Fri 01 Aug , Ryan CHEN wrote:
 Hi all,
 This patch is part 2 for [PATCH:Enable 2D Engine in SM501]. New macro 
 CONFIG_SM501_ENABLE_2DENGINE be included to specify codes what enable SM501 
 2D engine. The macro need be declared in config header file.
 Why does it need to enable 2D engine? The reason is most of framebuffer 
 contents need be moved in VRAM when screen scrolls up. The work be done by 
 software in current U-Boot for SM501. The patch is to enable 2D engine to do 
 it by hardware without CPU interference.  
 
 Signed-off-by: Ryan Chen [EMAIL PROTECTED]
Do you plan to send a rebase patch?

Best Regards,
J.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501 to hurry up fresh speed!

2008-08-01 Thread Wolfgang Denk
Dear Ryan,

in message [EMAIL PROTECTED] you wrote:
 Hi  Wolfgang,
 I have modified my patch. New macro CONFIG_SM501_ENABLE_2DENGINE be
 included to specify codes what enable SM501 2D engine. The macro need be
 declared in config header file.
 Why does it need to enable 2D engine? The reason is most of framebuffer
 contents need be moved in VRAM when screen scrolls up. The work be done by
 software in current U-Boot for SM501. The patch is to enable 2D engine to do
 it by hardware without CPU interference.  
 
 Signed-off-by: Ryan Chen [EMAIL PROTECTED]

Could you please use git-format-patch to create the patch, and
git-send-email to send it? This might avoid problems like the line
wrapping - see below.

Also, please spend a few seconds on thinking about which text you want
to see in the commit message. As submitted here, the whole text:

Hi  Wolfgang,
I have modified my patch. ...
...
Signed-off-by: Ryan Chen [EMAIL PROTECTED]

would make it into the commit message. I do not think that was your
intention. Comments about the patch etc. should go *below* the ---
line that gets inserted by git-format-patch.

Well, but the real problem with your poatch is here:
...
 +#define FIELD_SIZE(field)   (1 + FIELD_END(field) -
 FIELD_START(field))
^^^
 +#define FIELD_MASK(field)   (((1  (FIELD_SIZE(field)-1)) |
 ((1  (FIELD_SIZE(field)-1)) - 1))  FIELD_START(field))
^^^
 +#define FIELD_NORMALIZE(reg, field) (((reg)  FIELD_MASK(field)) 
 FIELD_START(field))
^^^
 +#define FIELD_DENORMALIZE(field, value) (((value)  FIELD_START(field)) 
 FIELD_MASK(field))
^^^
 +#define FIELD_INIT(reg, field, value)   FIELD_DENORMALIZE(reg ## _ ##
 field, \
^^^
 +  reg ## _ ## field
 ## _ ## value)
^^^
 +#define FIELD_INIT_VAL(reg, field, value) \
 +(FIELD_DENORMALIZE(reg ## _ ##
 field, value))
^^^
 +#define FIELD_VAL_SET(x, r, f, v)   x = x  ~FIELD_MASK(r ## _ ## f) \
 +  | FIELD_DENORMALIZE(r ## _ ##
 f, r ## _ ## f ## _ ## v)
^^^

And so on - your mailer is wrapping long lines, thus corrupting the
patch. It's unusable as is.

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: [EMAIL PROTECTED]
There are always alternatives.
-- Spock, The Galileo Seven, stardate 2822.3

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501 to hurry up fresh speed!

2008-08-01 Thread Wolfgang Denk
In message [EMAIL PROTECTED] you wrote:
 Hi  Wolfgang,
 I have modified my patch. New macro CONFIG_SM501_ENABLE_2DENGINE be
 included to specify codes what enable SM501 2D engine. The macro need be
 declared in config header file.
 Why does it need to enable 2D engine? The reason is most of framebuffer
 contents need be moved in VRAM when screen scrolls up. The work be done by
 software in current U-Boot for SM501. The patch is to enable 2D engine to do
 it by hardware without CPU interference.  
 
 Signed-off-by: Ryan Chen [EMAIL PROTECTED]

Also note that there are coding style violations: trailing white
space, indentation/vertical alignment by spaces instead of TABs,
incorrect vertical alignment of switch / case.

Please fix these before you resubmit.

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: [EMAIL PROTECTED]
At least they're __EXPERIENCED incompetents

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501!

2008-08-01 Thread Wolfgang Denk
In message [EMAIL PROTECTED] you wrote:
 Hi all,
 This patch is part 2 for [PATCH:Enable 2D Engine in SM501]. New macro 
 CONFIG_SM501_ENABLE_2DENGINE be included to specify codes what enable SM501 
 2D engine. The macro need be declared in config header file.
 Why does it need to enable 2D engine? The reason is most of framebuffer 
 contents need be moved in VRAM when screen scrolls up. The work be done by 
 software in current U-Boot for SM501. The patch is to enable 2D engine to do 
 it by hardware without CPU in
 terference.  
 
 Signed-off-by: Ryan Chen [EMAIL PROTECTED]

Please rework the commit message, and use shorter lines (maximum some
70+ characters per line).

There are also some coding style violations: trailing white
space, indentation/vertical alignment by spaces instead of TABs,

...
 +
 +#define POWER_MODE0_CLOCK   0x44
 +#define POWER_MODE0_CLOCK_PLL3_P1XCLK
 31:31
 +#define POWER_MODE0_CLOCK_PLL3_P1XCLK_ENABLE 1
 +#define POWER_MODE0_CLOCK_PLL3_P1XCLK_DISABLE0
 +#define POWER_MODE0_CLOCK_PLL3   
 30:30
 +#define POWER_MODE0_CLOCK_PLL3_ENABLE
 1
 +#define POWER_MODE0_CLOCK_PLL3_DISABLE   
 0   
Corrupted alignment here?

 +#define POWER_MODE1_CLOCK   0x4C
 +#define POWER_MODE1_CLOCK_PLL3_P1XCLK
 31:31
 +#define POWER_MODE1_CLOCK_PLL3_P1XCLK_ENABLE 1
 +#define POWER_MODE1_CLOCK_PLL3_P1XCLK_DISABLE0
 +#define POWER_MODE1_CLOCK_PLL3   
 30:30
 +#define POWER_MODE1_CLOCK_PLL3_ENABLE
 1
 +#define POWER_MODE1_CLOCK_PLL3_DISABLE   
 0   

Ditto here?

 +// 2D registers.

C++ comments are not allowed.

 +#define DE_REGISTER_OFFSET   0x10
 +#define DE_SOURCE   0x00

Check alignment.

...and so on.

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: [EMAIL PROTECTED]
I read part of it all the way through.

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501 to hurry up fresh speed!

2008-07-31 Thread Ryan CHEN
+ DE_STATUS) ~ 0x1);
+   write32((DE_REGISTER_OFFSET + DE_WINDOW_DESTINATION_BASE), \
+   FIELD_VALUE(0, DE_WINDOW_DESTINATION_BASE, ADDRESS, 0));
+   write32((DE_REGISTER_OFFSET + DE_FOREGROUND), color);
+   write32((DE_REGISTER_OFFSET + DE_DESTINATION),  \
+   FIELD_SET(0, DE_DESTINATION, WRAP, DISABLE) | \
+   FIELD_VALUE(0, DE_DESTINATION, X, dst_x) | \
+   FIELD_VALUE(0, DE_DESTINATION, Y, dst_y));
+
+   write32((DE_REGISTER_OFFSET + DE_DIMENSION), \
+   FIELD_VALUE(0, DE_DIMENSION, X, dim_x + 1) | \
+   FIELD_VALUE(0, DE_DIMENSION, Y_ET, dim_y + 1));
+
+   write32((DE_REGISTER_OFFSET + DE_CONTROL), \
+   FIELD_SET  (0, DE_CONTROL, STATUS, START) | \
+   FIELD_SET  (0, DE_CONTROL, DIRECTION, LEFT_TO_RIGHT) | \
+   FIELD_SET  (0, DE_CONTROL, LAST_PIXEL, OFF) | \
+   FIELD_SET  (0, DE_CONTROL, COMMAND, RECTANGLE_FILL) | \
+   FIELD_SET  (0, DE_CONTROL, ROP_SELECT, ROP2) | \
+   FIELD_VALUE(0, DE_CONTROL, ROP, 0x0C));
+
+   i  = SM501_TIMEOUT;
+   while(((read32(DE_REGISTER_OFFSET + DE_STATUS)  0x1) == 0x0)  (i
!= 0)) {
+   udelay(1);
+   i--;
+   }
+   if(i == 0) {
+   printf(sm501_video_hw_rectfill Timeout!\n);
+   }
+   /* clear 2d interrupt */
+   write32((DE_REGISTER_OFFSET + DE_STATUS), read32(DE_REGISTER_OFFSET
+ DE_STATUS) ~ 0x1);
+}
+#endif/* CONFIG_SM501_ENABLE_2DENGINE*/
 #endif /* CONFIG_VIDEO_SM501 */ 


Best Regards,
Ryan Chen
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 30, 2008 4:10 PM
To: Ryan CHEN
Cc: u-boot-users@lists.sourceforge.net; Antonio Maria BORNEO
Subject: Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501 to hurry up
fresh speed!

In message [EMAIL PROTECTED] you wrote:
 Hi all,
 This patch is to enable 2D Engine in SM501 video chip to hurry up fresh
speed. It change some 2D Engine registers and could obviously fasten screen
scroll up. I think it's reasonable to do it for consumerism.

Your line is way too long.

What exactly is fresh speed? 

For consumerism ?


 commit 02e99b0a871f91fd3598024a2468a059971ef28d
 Parent: 699f05125509249072a0b865c8d35520d97cd501
 Author: Ryan Chen [EMAIL PROTECTED]
 Date:   Wed Jul 30 09:45:01 2008 -0400
 
 Signed-off-by: Ryan Chen [EMAIL PROTECTED]
 
   modified:   drivers/video/sm501.c

Please format your patches using git-format-patch and make sure to supply a
reasonable comit message.


Your patch adds a lot of code that may or may not be needed on some systems.
Please make it optional using a CONFIG_ option.


 diff --git a/drivers/video/sm501.c b/drivers/video/sm501.c old mode 
 100644 new mode 100755

Please do not set exec permissions on plain source files.

 index 23db02c..f20cf94
 --- a/drivers/video/sm501.c
 +++ b/drivers/video/sm501.c
 @@ -35,6 +35,7 @@
  
  #include video_fb.h
  #include sm501.h
 +#include asm/io.h

What is this needed for?

...
 +/* Program new power mode. */
 +static void setPower(unsigned long nGates, unsigned long Clock) {
 + unsigned long gate_reg, clock_reg;
 + unsigned long control_value;
 + u32 i;
 +
 + /*  Get current power mode. */
 + control_value = FIELD_GET(read32(POWER_MODE_CTRL),
 + POWER_MODE_CTRL,
 + MODE);
 +
 + switch (control_value)
 + {

Coding Style:

switch (control_value) {

 + switch (bpp)
 + {

Ditto...

 +#if defined CONFIG_MULTI_VIDEO_CARD
 +void *sm501_video_hw_init (void)
 +#else
  void *video_hw_init (void)
 +#endif

This seems to be an unrelated change that should be plit into a separate
patch.


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: [EMAIL PROTECTED] He 
had
quite a powerful intellect, but it  was  as  powerful  like  a locomotive,
and  ran on rails and was therefore almost impossible to
steer.  - Terry Pratchett, _Lords and Ladies_


-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users


[U-Boot-Users] [PATCH]:Enable 2D Engine in SM501!

2008-07-31 Thread Ryan CHEN
Hi all,
This patch is part 2 for [PATCH:Enable 2D Engine in SM501]. New macro 
CONFIG_SM501_ENABLE_2DENGINE be included to specify codes what enable SM501 
2D engine. The macro need be declared in config header file.
Why does it need to enable 2D engine? The reason is most of framebuffer 
contents need be moved in VRAM when screen scrolls up. The work be done by 
software in current U-Boot for SM501. The patch is to enable 2D engine to do it 
by hardware without CPU interference.  

Signed-off-by: Ryan Chen [EMAIL PROTECTED]

diff --git a/include/sm501.h b/include/sm501.h
index 3e71dbb..516776f 100644
--- a/include/sm501.h
+++ b/include/sm501.h
@@ -40,6 +40,2213 @@ typedef struct {
unsigned int Value;
 } SMI_REGS;
 +#ifdef CONFIG_SM501_ENABLE_2DENGINE
+/*
+ *
+ * Definitions for the System Configuration registers.
+ *
+ */
+
+#define SYSTEM_CTRL 0x00
+#define SYSTEM_CTRL_DPMS31:30
+#define SYSTEM_CTRL_DPMS_VPHP   0
+#define SYSTEM_CTRL_DPMS_VPHN   1
+#define SYSTEM_CTRL_DPMS_VNHP   2
+#define SYSTEM_CTRL_DPMS_VNHN   3
+#define SYSTEM_CTRL_PCI_BURST   29:29
+#define SYSTEM_CTRL_PCI_BURST_DISABLE   0
+#define SYSTEM_CTRL_PCI_BURST_ENABLE1
+#define SYSTEM_CTRL_CSC_STATUS  28:28
+#define SYSTEM_CTRL_CSC_STATUS_IDLE 0
+#define SYSTEM_CTRL_CSC_STATUS_BUSY 1
+#define SYSTEM_CTRL_PCI_MASTER  25:25
+#define SYSTEM_CTRL_PCI_MASTER_STOP 0
+#define SYSTEM_CTRL_PCI_MASTER_START1
+#define SYSTEM_CTRL_LATENCY_TIMER   24:24
+#define SYSTEM_CTRL_LATENCY_TIMER_ENABLE0
+#define SYSTEM_CTRL_LATENCY_TIMER_DISABLE   1
+#define SYSTEM_CTRL_PANEL_STATUS23:23
+#define SYSTEM_CTRL_PANEL_STATUS_CURRENT0
+#define SYSTEM_CTRL_PANEL_STATUS_PENDING1
+#define SYSTEM_CTRL_VIDEO_STATUS22:22
+#define SYSTEM_CTRL_VIDEO_STATUS_CURRENT0
+#define SYSTEM_CTRL_VIDEO_STATUS_PENDING1
+#define SYSTEM_CTRL_DE_FIFO 20:20
+#define SYSTEM_CTRL_DE_FIFO_NOT_EMPTY   0
+#define SYSTEM_CTRL_DE_FIFO_EMPTY   1
+#define SYSTEM_CTRL_DE_STATUS   19:19
+#define SYSTEM_CTRL_DE_STATUS_IDLE  0
+#define SYSTEM_CTRL_DE_STATUS_BUSY  1
+#define SYSTEM_CTRL_CRT_STATUS  17:17
+#define SYSTEM_CTRL_CRT_STATUS_CURRENT  0
+#define SYSTEM_CTRL_CRT_STATUS_PENDING  1
+#define SYSTEM_CTRL_ZVPORT  16:16
+#define SYSTEM_CTRL_ZVPORT_00
+#define SYSTEM_CTRL_ZVPORT_11
+#define SYSTEM_CTRL_PCI_BURST_READ  15:15
+#define SYSTEM_CTRL_PCI_BURST_READ_DISABLE  0
+#define SYSTEM_CTRL_PCI_BURST_READ_ENABLE   1
+#define SYSTEM_CTRL_DE_ABORT13:12
+#define SYSTEM_CTRL_DE_ABORT_NORMAL 0
+#define SYSTEM_CTRL_DE_ABORT_2D_ABORT   3
+#define SYSTEM_CTRL_PCI_SUBSYS_LOCK 11:11
+#define SYSTEM_CTRL_PCI_SUBSYS_LOCK_DISABLE 0
+#define SYSTEM_CTRL_PCI_SUBSYS_LOCK_ENABLE  1
+#define SYSTEM_CTRL_PCI_RETRY   7:7
+#define SYSTEM_CTRL_PCI_RETRY_ENABLE0
+#define SYSTEM_CTRL_PCI_RETRY_DISABLE   1
+#define SYSTEM_CTRL_PCI_CLOCK_RUN   6:6
+#define SYSTEM_CTRL_PCI_CLOCK_RUN_DISABLE   0
+#define SYSTEM_CTRL_PCI_CLOCK_RUN_ENABLE1
+#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE   5:4
+#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_1 0
+#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_2 1
+#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_4 2
+#define SYSTEM_CTRL_PCI_SLAVE_BURST_READ_SIZE_8 3
+#define SYSTEM_CTRL_CRT_TRISTATE2:2
+#define SYSTEM_CTRL_CRT_TRISTATE_DISABLE0
+#define SYSTEM_CTRL_CRT_TRISTATE_ENABLE 1
+#define SYSTEM_CTRL_INTMEM_TRISTATE 1:1
+#define SYSTEM_CTRL_INTMEM_TRISTATE_DISABLE 0
+#define SYSTEM_CTRL_INTMEM_TRISTATE_ENABLE  1
+#define SYSTEM_CTRL_PANEL_TRISTATE  0:0
+#define SYSTEM_CTRL_PANEL_TRISTATE_DISABLE  0
+#define SYSTEM_CTRL_PANEL_TRISTATE_ENABLE   1
+
+#define CURRENT_POWER_GATE  0x38
+#define CURRENT_POWER_GATE_AC97_I2S 18:18
+#define CURRENT_POWER_GATE_AC97_I2S_DISABLE 0
+#define CURRENT_POWER_GATE_AC97_I2S_ENABLE   

[U-Boot-Users] [PATCH]:Enable 2D Engine in SM501 to hurry up fresh speed!

2008-07-30 Thread Ryan CHEN
Hi all, 
This patch is to enable 2D Engine in SM501 video chip to hurry up fresh speed. 
It change some 2D Engine registers and could obviously fasten screen scroll up. 
I think it's reasonable to do it for consumerism.


commit 02e99b0a871f91fd3598024a2468a059971ef28d
Parent: 699f05125509249072a0b865c8d35520d97cd501
Author: Ryan Chen [EMAIL PROTECTED]
Date:   Wed Jul 30 09:45:01 2008 -0400

Signed-off-by: Ryan Chen [EMAIL PROTECTED]

modified:   drivers/video/sm501.c

diff --git a/drivers/video/sm501.c b/drivers/video/sm501.c
old mode 100644
new mode 100755
index 23db02c..f20cf94
--- a/drivers/video/sm501.c
+++ b/drivers/video/sm501.c
@@ -35,6 +35,7 @@
 
 #include video_fb.h
 #include sm501.h
+#include asm/io.h
 
 #define read8(ptrReg)\
 *(volatile unsigned char *)(sm501.isaBase + ptrReg)
@@ -54,6 +55,46 @@
 #define write32(ptrReg, value) \
 (*(volatile unsigned int *)(sm501.isaBase + ptrReg) = value)
 
+/* Register Macroes*/
+#define _F_START(f) (0 ? f)
+#define _F_END(f)   (1 ? f)
+#define _F_SIZE(f)  (1 + _F_END(f) - _F_START(f))
+#define _F_MASK(f)  (((1  _F_SIZE(f)) - 1)  _F_START(f))
+#define _F_NORMALIZE(v, f)  (((v)  _F_MASK(f))  _F_START(f))
+#define _F_DENORMALIZE(v, f)(((v)  _F_START(f))  _F_MASK(f))
+#define FIELD_GET(x, reg, field) \
+( \
+_F_NORMALIZE((x), reg ## _ ## field) \
+)
+#define FIELD_SET(x, reg, field, value) \
+( \
+(x  ~_F_MASK(reg ## _ ## field)) \
+| _F_DENORMALIZE(reg ## _ ## field ## _ ## value, reg ## _ ## field) \
+)
+#define FIELD_VALUE(x, reg, field, value) \
+( \
+(x  ~_F_MASK(reg ## _ ## field)) \
+| _F_DENORMALIZE(value, reg ## _ ## field) \
+)
+#define FIELD_CLEAR(reg, field) \
+( \
+~ _F_MASK(reg ## _ ## field) \
+)
+#define FIELD_START(field)  (0 ? field)
+#define FIELD_END(field)(1 ? field)
+#define FIELD_SIZE(field)   (1 + FIELD_END(field) - 
FIELD_START(field))
+#define FIELD_MASK(field)   (((1  (FIELD_SIZE(field)-1)) | ((1 
 (FIELD_SIZE(field)-1)) - 1))  FIELD_START(field))
+#define FIELD_NORMALIZE(reg, field) (((reg)  FIELD_MASK(field))  
FIELD_START(field))
+#define FIELD_DENORMALIZE(field, value) (((value)  FIELD_START(field))  
FIELD_MASK(field))
+#define FIELD_INIT(reg, field, value)   FIELD_DENORMALIZE(reg ## _ ## field, \
+  reg ## _ ## field ## 
_ ## value)
+#define FIELD_INIT_VAL(reg, field, value) \
+(FIELD_DENORMALIZE(reg ## _ ## field, 
value))
+#define FIELD_VAL_SET(x, r, f, v)   x = x  ~FIELD_MASK(r ## _ ## f) \
+  | FIELD_DENORMALIZE(r ## _ ## f, 
r ## _ ## f ## _ ## v)
+
+#define SM501_TIMEOUT  2   /* 20 ms */
+
 GraphicDevice sm501;
 
 /*-
@@ -77,11 +118,148 @@ static void SmiSetRegs (void)
}
 }
 
+static void set_current_gate(void)
+{
+   unsigned long value, gate;
+   /* change to mode0 */
+   value = read32(POWER_MODE_CTRL);
+   value = FIELD_SET(value, POWER_MODE_CTRL, MODE, MODE0);
+   write32(POWER_MODE_CTRL, value);
+
+   /* Don't forget to set up power mode0 gate properly. */
+   gate = read32(CURRENT_POWER_GATE);
+   gate = FIELD_SET(gate, CURRENT_POWER_GATE, 2D,  ENABLE);
+   write32(POWER_MODE0_GATE, gate);
+}
+
+/* Program new power mode. */
+static void setPower(unsigned long nGates, unsigned long Clock)
+{
+   unsigned long gate_reg, clock_reg;
+   unsigned long control_value;
+   u32 i;
+
+   /*  Get current power mode. */
+   control_value = FIELD_GET(read32(POWER_MODE_CTRL),
+   POWER_MODE_CTRL,
+   MODE);
+
+   switch (control_value)
+   {
+   case POWER_MODE_CTRL_MODE_MODE0:
+   /* Switch from mode 0 to mode 1.*/
+   gate_reg = POWER_MODE1_GATE;
+   clock_reg = POWER_MODE1_CLOCK;
+   control_value = FIELD_SET(control_value,
+   POWER_MODE_CTRL, MODE, MODE1);
+   break;
+
+   case POWER_MODE_CTRL_MODE_MODE1:
+   case POWER_MODE_CTRL_MODE_SLEEP:
+   /* Switch from mode 1 or sleep to mode 0.*/
+   gate_reg = POWER_MODE0_GATE;
+   clock_reg = POWER_MODE0_CLOCK;
+   control_value = FIELD_SET(control_value, POWER_MODE_CTRL, MODE, 
MODE0);
+   break;
+
+   default:
+   /* Invalid mode */
+   return;
+   }
+
+   /* Program new power mode. */
+   write32(gate_reg, nGates);
+   write32(clock_reg, Clock);
+   write32(POWER_MODE_CTRL, control_value);
+
+   /* When returning from sleep, wait until finished. */
+   i = SM501_TIMEOUT;
+   while ((FIELD_GET(read32(POWER_MODE_CTRL), POWER_MODE_CTRL, 

Re: [U-Boot-Users] [PATCH]:Enable 2D Engine in SM501 to hurry up fresh speed!

2008-07-30 Thread Wolfgang Denk
In message [EMAIL PROTECTED] you wrote:
 Hi all, 
 This patch is to enable 2D Engine in SM501 video chip to hurry up fresh 
 speed. It change some 2D Engine registers and could obviously fasten screen 
 scroll up. I think it's reasonable to do it for consumerism.

Your line is way too long.

What exactly is fresh speed? 

For consumerism ?


 commit 02e99b0a871f91fd3598024a2468a059971ef28d
 Parent: 699f05125509249072a0b865c8d35520d97cd501
 Author: Ryan Chen [EMAIL PROTECTED]
 Date:   Wed Jul 30 09:45:01 2008 -0400
 
 Signed-off-by: Ryan Chen [EMAIL PROTECTED]
 
   modified:   drivers/video/sm501.c

Please format your patches using git-format-patch and make sure to
supply a reasonable comit message.


Your patch adds a lot of code that may or may not be needed on some
systems. Please make it optional using a CONFIG_ option.


 diff --git a/drivers/video/sm501.c b/drivers/video/sm501.c
 old mode 100644
 new mode 100755

Please do not set exec permissions on plain source files.

 index 23db02c..f20cf94
 --- a/drivers/video/sm501.c
 +++ b/drivers/video/sm501.c
 @@ -35,6 +35,7 @@
  
  #include video_fb.h
  #include sm501.h
 +#include asm/io.h

What is this needed for?

...
 +/* Program new power mode. */
 +static void setPower(unsigned long nGates, unsigned long Clock)
 +{
 + unsigned long gate_reg, clock_reg;
 + unsigned long control_value;
 + u32 i;
 +
 + /*  Get current power mode. */
 + control_value = FIELD_GET(read32(POWER_MODE_CTRL),
 + POWER_MODE_CTRL,
 + MODE);
 +
 + switch (control_value)
 + {

Coding Style:

switch (control_value) {

 + switch (bpp)
 + {

Ditto...

 +#if defined CONFIG_MULTI_VIDEO_CARD
 +void *sm501_video_hw_init (void)
 +#else
  void *video_hw_init (void)
 +#endif

This seems to be an unrelated change that should be plit into a
separate patch.


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: [EMAIL PROTECTED]
He had quite a powerful intellect, but it  was  as  powerful  like  a
locomotive,  and  ran on rails and was therefore almost impossible to
steer.  - Terry Pratchett, _Lords and Ladies_

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
U-Boot-Users mailing list
U-Boot-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/u-boot-users