Skip to contentSkip to conversation

Fix obvious mistake in pxa2xx i2s driver

PATCH Superseded Vasily Khoruzhick 2 participants 7 messages Feb 14, 2011 – Feb 20, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix obvious mistake in pxa2xx i2s driver

RST bit is (1 << 3) bit, not (1 << 2), fix condition that enables i2s if ENB is set and RST is not set.

---
 hw/pxa2xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pxa2xx.c +1 -1
index d966846..68b67ae 100644
@@ -1631,7 +1631,7 @@ static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
         }
         if (value & (1 << 4))				/* EFWR */
             printf("%s: Attempt to use special function\n", __FUNCTION__);
-        s->enable = ((value ^ 4) & 5) == 5;		/* ENB && !RST*/
+        s->enable = ((value ^ (1 << 3)) & 9) == 9;		/* ENB && !RST*/
         pxa2xx_i2s_update(s);
         break;
     case SACR1:
Signature · 1 line
1.7.4
#1 lore raw
Quoted 3 lines · On Monday 14 February 2011 18:59:10 Vasily Khoruzhick wrote:

RST bit is (1 << 3) bit, not (1 << 2), fix condition that enables i2s if ENB is set and RST is not set.

Ping

#2 lore raw
In reply to Vasily Khoruzhick
Quoted 13 lines · Vasily Khoruzhick

RST bit is (1 << 3) bit, not (1 << 2), fix condition that enables i2s if ENB is set and RST is not set.

---
 hw/pxa2xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pxa2xx.c +0 -0
index d966846..68b67ae 100644

hw/pxa2xx.c static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr, · line 1637

Quoted 8 lines
hw/pxa2xx.c +1 -1
@@ -1631,7 +1631,7 @@ static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
         }
         if (value & (1 << 4))				/* EFWR */
             printf("%s: Attempt to use special function\n", __FUNCTION__);
-        s->enable = ((value ^ 4) & 5) == 5;		/* ENB && !RST*/
+        s->enable = ((value ^ (1 << 3)) & 9) == 9;		/* ENB && !RST*/
         pxa2xx_i2s_update(s);
         break;
     case SACR1:

The fix looks fine, but the resulting code is probably over engineered... What about:

         s->enable = (value & 9) == 1;

?

Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#3 lore raw
Quoted 6 lines · On Sunday 20 February 2011 20:24:46 Aurelien Jarno wrote:

The fix looks fine, but the resulting code is probably over engineered... What about:

         s->enable = (value & 9) == 1;

?

Looks OK to me.

Regards
Vasily

#4 lore raw
Quoted 11 lines · Vasily Khoruzhick
Quoted 6 lines · On Sunday 20 February 2011 20:24:46 Aurelien Jarno wrote:

The fix looks fine, but the resulting code is probably over engineered... What about:

         s->enable = (value & 9) == 1;

?

Looks OK to me.

Can you please provide a new version with that code instead, I'll apply it.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net
#5 lore raw

PATCH v2 1/1 Fix obvious mistake in pxa2xx i2s driver

RST bit is (1 << 4) bit, not (1 << 3), fix condition that enables i2s if ENB is set and RST is not set.

---
v2: simplify expression

 hw/pxa2xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pxa2xx.c +1 -1
index d966846..6e41fc6 100644
@@ -1631,7 +1631,7 @@ static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
         }
         if (value & (1 << 4))				/* EFWR */
             printf("%s: Attempt to use special function\n", __FUNCTION__);
-        s->enable = ((value ^ 4) & 5) == 5;		/* ENB && !RST*/
+        s->enable = (value & 9) == 1;			/* ENB && !RST*/
         pxa2xx_i2s_update(s);
         break;
     case SACR1:
Signature · 1 line
1.7.4
#6 lore raw
Quoted 9 lines · Vasily Khoruzhick

RST bit is (1 << 4) bit, not (1 << 3), fix condition that enables i2s if ENB is set and RST is not set.

---
v2: simplify expression

 hw/pxa2xx.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Thanks, applied.

Quoted 17 lines
hw/pxa2xx.c +1 -1
index d966846..6e41fc6 100644
@@ -1631,7 +1631,7 @@ static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
         }
         if (value & (1 << 4))				/* EFWR */
             printf("%s: Attempt to use special function\n", __FUNCTION__);
-        s->enable = ((value ^ 4) & 5) == 5;		/* ENB && !RST*/
+        s->enable = (value & 9) == 1;			/* ENB && !RST*/
         pxa2xx_i2s_update(s);
         break;
     case SACR1:
Signature · 1 line
1.7.4
Signature · 2 lines
Aurelien Jarno                          GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net