Date: Sun, 30 Nov 1997 15:30:23 +0100
From: Jes Sorensen <Jes.Sorensen@cern.ch>
To: linux-m68k@lists.linux-m68k.org
Subject: L68K: forwarded message from Alan Hourihane
Sender: owner-linux-m68k@phil.uni-sb.de

Hi

I have received the below patch for the 53c7xx driver from Alan
Hourihane, which should make the drivers work again in 2.1.64.

Its still the shoot first and ask afterwards approach (also know as
shoot down little blackbirds with stinger missiles approach), but could
someone try to apply this patch to 2.0.31-pre3 + my previous patches and
tell me if it makes the thing work?

Jes
------- start of forwarded message -------
From: Alan Hourihane <alanh@fairlite.demon.co.uk>
To: Jes Sorensen <Jes.Sorensen@cern.ch>
Subject: Linux 2.1.64 & 53c7xx driver
Date: Thu, 27 Nov 1997 23:29:29 +0000 (GMT)

Hi Jes...

I've finally got around to fixing the 53c7xx driver.

Two things.....

1. here's a patch against 2.1.64 to re-enable the working driver.
Obviously there are still too many flushes etc, but hey it's working.

2. If you don't add -fno-strength-reduce to the compilation process
in the CFLAGS in the arch/m68k/Makefile then the driver also fails. This
was removed somewhere between 2.1.35 and 2.1.64, but I don't know where.

I've tested this and it does work. Any questions, just ask.

Alan.

*** 53c7xx.c-2.1.64	Thu Nov 27 23:23:17 1997
--- 53c7xx.c	Thu Nov 27 23:23:49 1997
***************
*** 3728,3745 ****
  	return;
      }
  
-     cache_push(virt_to_bus(cmd->dsa), hostdata->dsa_len);
-     cache_push(virt_to_bus(ncrcurrent), sizeof(ncrcurrent));
- 
      /* 
       * If the NCR chip is in an idle state, start it running the scheduler
       * immediately.  Otherwise, signal the chip to jump to schedule as 
       * soon as it is idle.
       */
  
      if (hostdata->idle) {
  	hostdata->idle = 0;
  	hostdata->state = STATE_RUNNING;
  	NCR53c7x0_write32 (DSP_REG,  virt_to_bus ((void *)hostdata->schedule));
  	if (hostdata->options & OPTION_DEBUG_TRACE)
  	    NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl |
--- 3723,3743 ----
  	return;
      }
  
      /* 
       * If the NCR chip is in an idle state, start it running the scheduler
       * immediately.  Otherwise, signal the chip to jump to schedule as 
       * soon as it is idle.
       */
  
+ flush_cache_all();
+ cache_push(virt_to_bus(hostdata->script), flushsize);
+ cache_clear(virt_to_bus(hostdata->script), flushsize);
+ 
      if (hostdata->idle) {
  	hostdata->idle = 0;
  	hostdata->state = STATE_RUNNING;
+ 	flush_cache_all();
+ 	cache_clear(virt_to_bus(hostdata->script), flushsize);
  	NCR53c7x0_write32 (DSP_REG,  virt_to_bus ((void *)hostdata->schedule));
  	if (hostdata->options & OPTION_DEBUG_TRACE)
  	    NCR53c7x0_write8 (DCNTL_REG, hostdata->saved_dcntl |
***************
*** 4349,4354 ****
--- 4347,4354 ----
  #endif
  		
  		hostdata->state = STATE_RUNNING;
+ 		flush_cache_all();
+ 		cache_clear(virt_to_bus(hostdata->script), flushsize);
  		NCR53c7x0_write32 (DSP_REG, virt_to_bus(hostdata->dsp));
  		if (hostdata->options & OPTION_DEBUG_TRACE) {
  #ifdef CYCLIC_TRACE
***************
*** 4569,4574 ****
--- 4569,4578 ----
  	ACTION_ABORT_PRINT;
      const char *where = NULL;
  
+ flush_cache_all();
+ cache_push(virt_to_bus(hostdata->script), flushsize);
+ cache_clear(virt_to_bus(hostdata->script), flushsize);
+ 
      NCR53c7x0_local_setup(host);
  
      /*
***************
*** 4723,4728 ****
--- 4727,4737 ----
  	action = ACTION_ABORT_PRINT;
      }
  
+ flush_cache_all();
+ cache_push(virt_to_bus(hostdata->script), flushsize);
+ cache_clear(virt_to_bus(hostdata->script), flushsize);
+ 
+ 
      /* Flush DMA FIFO */
      if (!hostdata->dstat_valid) {
  	hostdata->dstat = NCR53c7x0_read8(DSTAT_REG);
***************
*** 4756,4762 ****
      }
  #endif
      
!     cache_push(virt_to_bus(hostdata->script), flushsize);
  }
  
  /*
--- 4765,4775 ----
      }
  #endif
      
! 
! flush_cache_all();
! cache_push(virt_to_bus(hostdata->script), flushsize);
! cache_clear(virt_to_bus(hostdata->script), flushsize);
! 
  }
  
  /*


------- end of forwarded message -------
