aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/53c700.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/53c700.h')
-rw-r--r--drivers/scsi/53c700.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/drivers/scsi/53c700.h b/drivers/scsi/53c700.h
index 362d78483d09..a8c83bb03630 100644
--- a/drivers/scsi/53c700.h
+++ b/drivers/scsi/53c700.h
@@ -238,21 +238,23 @@ struct NCR_700_Host_Parameters {
238#ifdef CONFIG_53C700_LE_ON_BE 238#ifdef CONFIG_53C700_LE_ON_BE
239#define bE (hostdata->force_le_on_be ? 0 : 3) 239#define bE (hostdata->force_le_on_be ? 0 : 3)
240#define bSWAP (hostdata->force_le_on_be) 240#define bSWAP (hostdata->force_le_on_be)
241/* This is terrible, but there's no raw version of ioread32. That means 241#define bEBus (!hostdata->force_le_on_be)
242 * that on a be board we swap twice (once in ioread32 and once again to
243 * get the value correct) */
244#define bS_to_io(x) ((hostdata->force_le_on_be) ? (x) : cpu_to_le32(x))
245#elif defined(__BIG_ENDIAN) 242#elif defined(__BIG_ENDIAN)
246#define bE 3 243#define bE 3
247#define bSWAP 0 244#define bSWAP 0
248#define bS_to_io(x) (x)
249#elif defined(__LITTLE_ENDIAN) 245#elif defined(__LITTLE_ENDIAN)
250#define bE 0 246#define bE 0
251#define bSWAP 0 247#define bSWAP 0
252#define bS_to_io(x) (x)
253#else 248#else
254#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?" 249#error "__BIG_ENDIAN or __LITTLE_ENDIAN must be defined, did you include byteorder.h?"
255#endif 250#endif
251#ifndef bEBus
252#ifdef CONFIG_53C700_BE_BUS
253#define bEBus 1
254#else
255#define bEBus 0
256#endif
257#endif
256#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x)) 258#define bS_to_cpu(x) (bSWAP ? le32_to_cpu(x) : (x))
257#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x)) 259#define bS_to_host(x) (bSWAP ? cpu_to_le32(x) : (x))
258 260
@@ -466,14 +468,15 @@ NCR_700_readl(struct Scsi_Host *host, __u32 reg)
466{ 468{
467 const struct NCR_700_Host_Parameters *hostdata 469 const struct NCR_700_Host_Parameters *hostdata
468 = (struct NCR_700_Host_Parameters *)host->hostdata[0]; 470 = (struct NCR_700_Host_Parameters *)host->hostdata[0];
469 __u32 value = ioread32(hostdata->base + reg); 471 __u32 value = bEBus ? ioread32be(hostdata->base + reg) :
472 ioread32(hostdata->base + reg);
470#if 1 473#if 1
471 /* sanity check the register */ 474 /* sanity check the register */
472 if((reg & 0x3) != 0) 475 if((reg & 0x3) != 0)
473 BUG(); 476 BUG();
474#endif 477#endif
475 478
476 return bS_to_io(value); 479 return value;
477} 480}
478 481
479static inline void 482static inline void
@@ -497,7 +500,8 @@ NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg)
497 BUG(); 500 BUG();
498#endif 501#endif
499 502
500 iowrite32(bS_to_io(value), hostdata->base + reg); 503 bEBus ? iowrite32be(value, hostdata->base + reg):
504 iowrite32(value, hostdata->base + reg);
501} 505}
502 506
503#endif 507#endif