qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 4/5] pxa2xx: fix SSSR TFN logic
@ 2010-09-04 14:17 Blue Swirl
  2010-09-04 15:30 ` andrzej zaborowski
  0 siblings, 1 reply; 3+ messages in thread
From: Blue Swirl @ 2010-09-04 14:17 UTC (permalink / raw)
  To: qemu-devel

Fix SSSR TFN logic: TX FIFO is never filled, so it is always in
underrun condition if SSP is enabled.

This also fixes a gcc warning with -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
 hw/pxa2xx.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index 3c06bf9..ec7fd68 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -636,6 +636,7 @@ static void pxa2xx_ssp_fifo_update(PXA2xxSSPState *s)
 {
     s->sssr &= ~(0xf << 12);	/* Clear RFL */
     s->sssr &= ~(0xf << 8);	/* Clear TFL */
+    s->sssr &= ~SSSR_TFS;
     s->sssr &= ~SSSR_TNF;
     if (s->enable) {
         s->sssr |= ((s->rx_level - 1) & 0xf) << 12;
@@ -643,14 +644,13 @@ static void pxa2xx_ssp_fifo_update(PXA2xxSSPState *s)
             s->sssr |= SSSR_RFS;
         else
             s->sssr &= ~SSSR_RFS;
-        if (0 <= SSCR1_TFT(s->sscr[1]))
-            s->sssr |= SSSR_TFS;
-        else
-            s->sssr &= ~SSSR_TFS;
         if (s->rx_level)
             s->sssr |= SSSR_RNE;
         else
             s->sssr &= ~SSSR_RNE;
+        /* TX FIFO is never filled, so it is always in underrun
+           condition if SSP is enabled */
+        s->sssr |= SSSR_TFS;
         s->sssr |= SSSR_TNF;
     }

-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] pxa2xx: fix SSSR TFN logic
  2010-09-04 14:17 [Qemu-devel] [PATCH 4/5] pxa2xx: fix SSSR TFN logic Blue Swirl
@ 2010-09-04 15:30 ` andrzej zaborowski
  2010-09-04 15:53   ` Blue Swirl
  0 siblings, 1 reply; 3+ messages in thread
From: andrzej zaborowski @ 2010-09-04 15:30 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

Hi,

On 4 September 2010 16:17, Blue Swirl <blauwirbel@gmail.com> wrote:
> Fix SSSR TFN logic: TX FIFO is never filled, so it is always in
> underrun condition if SSP is enabled.

As far as I see this doesn't make any change when the port is enabled?
 How does it fix the logic then?

Cheers

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] pxa2xx: fix SSSR TFN logic
  2010-09-04 15:30 ` andrzej zaborowski
@ 2010-09-04 15:53   ` Blue Swirl
  0 siblings, 0 replies; 3+ messages in thread
From: Blue Swirl @ 2010-09-04 15:53 UTC (permalink / raw)
  To: andrzej zaborowski; +Cc: qemu-devel

On Sat, Sep 4, 2010 at 3:30 PM, andrzej zaborowski <balrogg@gmail.com> wrote:
> Hi,
>
> On 4 September 2010 16:17, Blue Swirl <blauwirbel@gmail.com> wrote:
>> Fix SSSR TFN logic: TX FIFO is never filled, so it is always in
>> underrun condition if SSP is enabled.
>
> As far as I see this doesn't make any change when the port is enabled?
>  How does it fix the logic then?

Before, TFS flag was never cleared, so if the port was enabled and
then disabled the flag remained set. According to my reading of the
manual, this shouldn't be the case. As you noticed, the logic does not
change for the case where the port is enabled.

The previous check was always true. If you prefer, the patch could be
simplified to something like this:
-        if (0 <= SSCR1_TFT(s->sscr[1]))
-            s->sssr |= SSSR_TFS;
-        else
-            s->sssr &= ~SSSR_TFS;
+        /* TX FIFO is never filled, so it is always in underrun
+           condition if SSP is enabled */
+        s->sssr |= SSSR_TFS;

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-09-04 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-04 14:17 [Qemu-devel] [PATCH 4/5] pxa2xx: fix SSSR TFN logic Blue Swirl
2010-09-04 15:30 ` andrzej zaborowski
2010-09-04 15:53   ` Blue Swirl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).