^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) NinjaSCSI I/O funtions
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) By: YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) This software may be used and distributed according to the terms of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) the GNU General Public License.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) /* $Id: nsp_io.h,v 1.3 2003/08/04 21:15:26 elca Exp $ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #ifndef __NSP_IO_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #define __NSP_IO_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) static inline void nsp_write(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) unsigned int index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) unsigned char val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static inline unsigned char nsp_read(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) unsigned int index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) static inline void nsp_index_write(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) unsigned char Value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) static inline unsigned char nsp_index_read(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) unsigned int Register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) /*******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) * Basic IO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) static inline void nsp_write(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) unsigned int index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) unsigned char val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) outb(val, (base + index));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) static inline unsigned char nsp_read(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) unsigned int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) return inb(base + index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) /**********************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) * Indexed IO
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) static inline unsigned char nsp_index_read(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) unsigned int Register)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) outb(Register, BaseAddr + INDEXREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) return inb(BaseAddr + DATAREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) static inline void nsp_index_write(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) unsigned char Value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) outb(Register, BaseAddr + INDEXREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) outb(Value, BaseAddr + DATAREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) /*********************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) * fifo func
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) /* read 8 bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) static inline void nsp_multi_read_1(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) insb(BaseAddr + Register, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) static inline void nsp_fifo8_read(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) /*nsp_dbg(NSP_DEBUG_DATA_IO, "buf=0x%p, count=0x%lx", buf, count);*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) nsp_multi_read_1(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) /*--------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) /* read 16 bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) static inline void nsp_multi_read_2(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) insw(BaseAddr + Register, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) static inline void nsp_fifo16_read(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) //nsp_dbg(NSP_DEBUG_DATA_IO, "buf=0x%p, count=0x%lx*2", buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) nsp_multi_read_2(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) /*--------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) /* read 32bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static inline void nsp_multi_read_4(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) insl(BaseAddr + Register, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static inline void nsp_fifo32_read(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) //nsp_dbg(NSP_DEBUG_DATA_IO, "buf=0x%p, count=0x%lx*4", buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) nsp_multi_read_4(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /*----------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) /* write 8bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static inline void nsp_multi_write_1(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) outsb(BaseAddr + Register, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) static inline void nsp_fifo8_write(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) nsp_multi_write_1(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /*---------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) /* write 16bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) static inline void nsp_multi_write_2(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) outsw(BaseAddr + Register, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static inline void nsp_fifo16_write(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) nsp_multi_write_2(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) /*---------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) /* write 32bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) static inline void nsp_multi_write_4(unsigned int BaseAddr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) outsl(BaseAddr + Register, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) static inline void nsp_fifo32_write(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) nsp_multi_write_4(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) /*====================================================================*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) static inline void nsp_mmio_write(unsigned long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) unsigned int index,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) unsigned char val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) unsigned char *ptr = (unsigned char *)(base + NSP_MMIO_OFFSET + index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) writeb(val, ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) static inline unsigned char nsp_mmio_read(unsigned long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) unsigned int index)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) unsigned char *ptr = (unsigned char *)(base + NSP_MMIO_OFFSET + index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) return readb(ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) /*-----------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline unsigned char nsp_mmio_index_read(unsigned long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) unsigned int reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) unsigned char *index_ptr = (unsigned char *)(base + NSP_MMIO_OFFSET + INDEXREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) unsigned char *data_ptr = (unsigned char *)(base + NSP_MMIO_OFFSET + DATAREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) writeb((unsigned char)reg, index_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) return readb(data_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) static inline void nsp_mmio_index_write(unsigned long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) unsigned int reg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) unsigned char val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) unsigned char *index_ptr = (unsigned char *)(base + NSP_MMIO_OFFSET + INDEXREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) unsigned char *data_ptr = (unsigned char *)(base + NSP_MMIO_OFFSET + DATAREG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) writeb((unsigned char)reg, index_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) writeb(val, data_ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) /* read 32bit FIFO */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static inline void nsp_mmio_multi_read_4(unsigned long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) unsigned long *ptr = (unsigned long *)(base + Register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) unsigned long *tmp = (unsigned long *)buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) //nsp_dbg(NSP_DEBUG_DATA_IO, "base 0x%0lx ptr 0x%p",base,ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) *tmp = readl(ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) //nsp_dbg(NSP_DEBUG_DATA_IO, "<%d,%p,%p,%lx>", i, ptr, tmp, *tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) tmp++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static inline void nsp_mmio_fifo32_read(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) //nsp_dbg(NSP_DEBUG_DATA_IO, "buf=0x%p, count=0x%lx*4", buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) nsp_mmio_multi_read_4(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) static inline void nsp_mmio_multi_write_4(unsigned long base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) unsigned int Register,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) unsigned long *ptr = (unsigned long *)(base + Register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) unsigned long *tmp = (unsigned long *)buf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) //nsp_dbg(NSP_DEBUG_DATA_IO, "base 0x%0lx ptr 0x%p",base,ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) for (i = 0; i < count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) writel(*tmp, ptr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) //nsp_dbg(NSP_DEBUG_DATA_IO, "<%d,%p,%p,%lx>", i, ptr, tmp, *tmp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) tmp++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) static inline void nsp_mmio_fifo32_write(unsigned int base,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) void *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) unsigned long count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) //nsp_dbg(NSP_DEBUG_DATA_IO, "buf=0x%p, count=0x%lx*4", buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) nsp_mmio_multi_write_4(base, FIFODATA, buf, count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) /* end */