changed Makefile and profiles, added patches for kernel 2.6.24
[openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1073-glamo-cmdqueue-bandaid.patch.patch
1 From ce8eaeee7875e668be4c2888fa05a61a5af0dd98 Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Sun, 13 Apr 2008 07:23:59 +0100
4 Subject: [PATCH] glamo-cmdqueue-bandaid.patch
5  [ Stop kernel from hanging every once in a while during Glamo
6    initialization. ]
7
8 debug-glamo-fb-cmdqueue-wait-timeout.patch
9
10 From: warmcat <andy@warmcat.com>
11 ---
12  drivers/mfd/glamo/glamo-fb.c |   30 +++++++++++++++++++++++++++---
13  1 files changed, 27 insertions(+), 3 deletions(-)
14
15 diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
16 index 394a0ad..f0d7600 100644
17 --- a/drivers/mfd/glamo/glamo-fb.c
18 +++ b/drivers/mfd/glamo/glamo-fb.c
19 @@ -553,12 +553,20 @@ static inline int glamofb_cmdq_empty(struct glamofb_handle *gfb)
20  
21  void glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
22  {
23 +       int timeout = 2000;
24 +
25         dev_dbg(gfb->dev, "glamofb_cmd_mode(gfb=%p, on=%d)\n", gfb, on);
26         if (on) {
27                 dev_dbg(gfb->dev, "%s: waiting for cmdq empty: ",
28                         __FUNCTION__);
29 -               while (!glamofb_cmdq_empty(gfb))
30 +               while ((!glamofb_cmdq_empty(gfb)) && (timeout--))
31                         yield();
32 +               if (timeout < 0) {
33 +                       printk(KERN_ERR"*************"
34 +                                      "glamofb cmd_queue never got empty"
35 +                                      "*************\n");
36 +                       return;
37 +               }
38                 dev_dbg(gfb->dev, "empty!\n");
39  
40                 /* display the entire frame then switch to command */
41 @@ -568,8 +576,16 @@ void glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
42  
43                 /* wait until LCD is idle */
44                 dev_dbg(gfb->dev, "waiting for LCD idle: ");
45 -               while (!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12))
46 +               timeout = 2000;
47 +               while ((!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12)) &&
48 +                     (timeout--))
49                         yield();
50 +               if (timeout < 0) {
51 +                       printk(KERN_ERR"*************"
52 +                                      "glamofb lcd never idle"
53 +                                      "*************\n");
54 +                       return;
55 +               }
56                 dev_dbg(gfb->dev, "idle!\n");
57  
58                 msleep(90);
59 @@ -589,10 +605,18 @@ EXPORT_SYMBOL_GPL(glamofb_cmd_mode);
60  
61  int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val)
62  {
63 +       int timeout = 2000;
64 +
65         dev_dbg(gfb->dev, "%s: waiting for cmdq empty\n",
66                 __FUNCTION__);
67 -       while (!glamofb_cmdq_empty(gfb))
68 +       while ((!glamofb_cmdq_empty(gfb)) && (timeout--))
69                 yield();
70 +       if (timeout < 0) {
71 +               printk(KERN_ERR"*************"
72 +                               "glamofb cmd_queue never got empty"
73 +                               "*************\n");
74 +               return 1;
75 +       }
76         dev_dbg(gfb->dev, "idle, writing 0x%04x\n", val);
77  
78         reg_write(gfb, GLAMO_REG_LCD_COMMAND1, val);
79 -- 
80 1.5.6.5
81