summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-04-10 12:58:18 +0000
committerDave Airlie <airlied@linux.ie>2004-04-10 12:58:18 +0000
commit2b0292c73995a4892812fe632abdaf46c49279e0 (patch)
tree8e91f6c7fb25f4f4182efe2c0843cf07d6b408b4 /linux
parente375a3dc10eb8945e05577df8b40072dfffaba81 (diff)
update gamma_dma with patch from davej in 2.6
Diffstat (limited to 'linux')
-rw-r--r--linux/gamma_dma.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index 41592a5d..b0c2240b 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -45,9 +45,14 @@ static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address,
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
mb();
- while ( GAMMA_READ(GAMMA_INFIFOSPACE) < 2);
+ while ( GAMMA_READ(GAMMA_INFIFOSPACE) < 2)
+ cpu_relax();
+
GAMMA_WRITE(GAMMA_DMAADDRESS, address);
- while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4);
+
+ while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4)
+ cpu_relax();
+
GAMMA_WRITE(GAMMA_DMACOUNT, length / 4);
}
@@ -55,16 +60,18 @@ void gamma_dma_quiescent_single(drm_device_t *dev)
{
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
- while (GAMMA_READ(GAMMA_DMACOUNT));
+ while (GAMMA_READ(GAMMA_DMACOUNT))
+ cpu_relax();
- while (GAMMA_READ(GAMMA_INFIFOSPACE) < 2);
+ while (GAMMA_READ(GAMMA_INFIFOSPACE) < 2)
+ cpu_relax();
GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10);
GAMMA_WRITE(GAMMA_SYNC, 0);
do {
while (!GAMMA_READ(GAMMA_OUTFIFOWORDS))
- ;
+ cpu_relax();
} while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
}
@@ -72,9 +79,11 @@ void gamma_dma_quiescent_dual(drm_device_t *dev)
{
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
- while (GAMMA_READ(GAMMA_DMACOUNT));
+ while (GAMMA_READ(GAMMA_DMACOUNT))
+ cpu_relax();
- while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3);
+ while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
+ cpu_relax();
GAMMA_WRITE(GAMMA_BROADCASTMASK, 3);
GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10);
@@ -82,12 +91,14 @@ void gamma_dma_quiescent_dual(drm_device_t *dev)
/* Read from first MX */
do {
- while (!GAMMA_READ(GAMMA_OUTFIFOWORDS));
+ while (!GAMMA_READ(GAMMA_OUTFIFOWORDS))
+ cpu_relax();
} while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG);
/* Read from second MX */
do {
- while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000));
+ while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000))
+ cpu_relax();
} while (GAMMA_READ(GAMMA_OUTPUTFIFO + 0x10000) != GAMMA_SYNC_TAG);
}
@@ -95,14 +106,15 @@ void gamma_dma_ready(drm_device_t *dev)
{
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
- while (GAMMA_READ(GAMMA_DMACOUNT));
+ while (GAMMA_READ(GAMMA_DMACOUNT))
+ cpu_relax();
}
static inline int gamma_dma_is_ready(drm_device_t *dev)
{
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
- return(!GAMMA_READ(GAMMA_DMACOUNT));
+ return (!GAMMA_READ(GAMMA_DMACOUNT));
}
irqreturn_t gamma_irq_handler( DRM_IRQ_ARGS )
@@ -115,13 +127,16 @@ irqreturn_t gamma_irq_handler( DRM_IRQ_ARGS )
/* FIXME: should check whether we're actually interested in the interrupt? */
atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */
- while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3);
+ while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
+ cpu_relax();
+
GAMMA_WRITE(GAMMA_GDELAYTIMER, 0xc350/2); /* 0x05S */
GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS, 8);
GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001);
if (gamma_dma_is_ready(dev)) {
/* Free previous buffer */
- if (test_and_set_bit(0, &dev->dma_flag)) return IRQ_HANDLED;
+ if (test_and_set_bit(0, &dev->dma_flag))
+ return IRQ_HANDLED;
if (dma->this_buffer) {
gamma_free_buffer(dev, dma->this_buffer);
dma->this_buffer = NULL;
@@ -830,7 +845,8 @@ void DRM(driver_irq_preinstall)( drm_device_t *dev ) {
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
- while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2);
+ while(GAMMA_READ(GAMMA_INFIFOSPACE) < 2)
+ cpu_relax();
GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000004 );
GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 );
@@ -840,7 +856,8 @@ void DRM(driver_irq_postinstall)( drm_device_t *dev ) {
drm_gamma_private_t *dev_priv =
(drm_gamma_private_t *)dev->dev_private;
- while(GAMMA_READ(GAMMA_INFIFOSPACE) < 3);
+ while(GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
+ cpu_relax();
GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002001 );
GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000008 );
@@ -853,7 +870,8 @@ void DRM(driver_irq_uninstall)( drm_device_t *dev ) {
if (!dev_priv)
return;
- while(GAMMA_READ(GAMMA_INFIFOSPACE) < 3);
+ while(GAMMA_READ(GAMMA_INFIFOSPACE) < 3)
+ cpu_relax();
GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00000000 );
GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 );