1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18#ifndef _ISL_38XX_H
19#define _ISL_38XX_H
20
21#include <asm/io.h>
22#include <asm/byteorder.h>
23
24#define ISL38XX_CB_RX_QSIZE 8
25#define ISL38XX_CB_TX_QSIZE 32
26
27
28#define ISL38XX_MAX_WDS_LINKS 8
29
30
31#define ISL38XX_PSM_ACTIVE_STATE 0
32#define ISL38XX_PSM_POWERSAVE_STATE 1
33
34
35#define ISL38XX_PCI_MEM_SIZE 0x02000
36#define ISL38XX_MEMORY_WINDOW_SIZE 0x01000
37#define ISL38XX_DEV_FIRMWARE_ADDRES 0x20000
38#define ISL38XX_WRITEIO_DELAY 10
39#define ISL38XX_RESET_DELAY 50
40#define ISL38XX_WAIT_CYCLE 10
41#define ISL38XX_MAX_WAIT_CYCLES 10
42
43
44#define ISL38XX_HARDWARE_REG 0x0000
45#define ISL38XX_CARDBUS_CIS 0x0800
46#define ISL38XX_DIRECT_MEM_WIN 0x1000
47
48
49#define ISL38XX_DEV_INT_REG 0x0000
50#define ISL38XX_INT_IDENT_REG 0x0010
51#define ISL38XX_INT_ACK_REG 0x0014
52#define ISL38XX_INT_EN_REG 0x0018
53#define ISL38XX_GEN_PURP_COM_REG_1 0x0020
54#define ISL38XX_GEN_PURP_COM_REG_2 0x0024
55#define ISL38XX_CTRL_BLK_BASE_REG ISL38XX_GEN_PURP_COM_REG_1
56#define ISL38XX_DIR_MEM_BASE_REG 0x0030
57#define ISL38XX_CTRL_STAT_REG 0x0078
58
59
60
61#define ISL38XX_PCI_POSTING_FLUSH ISL38XX_INT_EN_REG
62
63
64
65
66
67
68
69
70
71
72
73
74static inline void
75isl38xx_w32_flush(void __iomem *base, u32 val, unsigned long offset)
76{
77 writel(val, base + offset);
78 (void) readl(base + ISL38XX_PCI_POSTING_FLUSH);
79}
80
81
82#define ISL38XX_DEV_INT_RESET 0x0001
83#define ISL38XX_DEV_INT_UPDATE 0x0002
84#define ISL38XX_DEV_INT_WAKEUP 0x0008
85#define ISL38XX_DEV_INT_SLEEP 0x0010
86
87
88#define ISL38XX_INT_IDENT_UPDATE 0x0002
89#define ISL38XX_INT_IDENT_INIT 0x0004
90#define ISL38XX_INT_IDENT_WAKEUP 0x0008
91#define ISL38XX_INT_IDENT_SLEEP 0x0010
92#define ISL38XX_INT_SOURCES 0x001E
93
94
95
96
97
98
99#define ISL38XX_CTRL_STAT_SLEEPMODE 0x00000200
100#define ISL38XX_CTRL_STAT_CLKRUN 0x00800000
101#define ISL38XX_CTRL_STAT_RESET 0x10000000
102#define ISL38XX_CTRL_STAT_RAMBOOT 0x20000000
103#define ISL38XX_CTRL_STAT_STARTHALTED 0x40000000
104#define ISL38XX_CTRL_STAT_HOST_OVERRIDE 0x80000000
105
106
107#define ISL38XX_CB_RX_DATA_LQ 0
108#define ISL38XX_CB_TX_DATA_LQ 1
109#define ISL38XX_CB_RX_DATA_HQ 2
110#define ISL38XX_CB_TX_DATA_HQ 3
111#define ISL38XX_CB_RX_MGMTQ 4
112#define ISL38XX_CB_TX_MGMTQ 5
113#define ISL38XX_CB_QCOUNT 6
114#define ISL38XX_CB_MGMT_QSIZE 4
115#define ISL38XX_MIN_QTHRESHOLD 4
116
117
118#define MGMT_FRAME_SIZE 1500
119#define MGMT_TX_FRAME_COUNT 24
120#define MGMT_RX_FRAME_COUNT 24
121#define MGMT_FRAME_COUNT (MGMT_TX_FRAME_COUNT + MGMT_RX_FRAME_COUNT)
122#define CONTROL_BLOCK_SIZE 1024
123#define PSM_FRAME_SIZE 1536
124#define PSM_MINIMAL_STATION_COUNT 64
125#define PSM_FRAME_COUNT PSM_MINIMAL_STATION_COUNT
126#define PSM_BUFFER_SIZE PSM_FRAME_SIZE * PSM_FRAME_COUNT
127#define MAX_TRAP_RX_QUEUE 4
128#define HOST_MEM_BLOCK CONTROL_BLOCK_SIZE + PSM_BUFFER_SIZE
129
130
131#define FRAGMENT_FLAG_MF 0x0001
132#define MAX_FRAGMENT_SIZE 1536
133
134
135
136
137#define MAX_FRAGMENT_SIZE_RX 1600
138
139typedef struct {
140 __le32 address;
141 __le16 size;
142 __le16 flags;
143} isl38xx_fragment;
144
145struct isl38xx_cb {
146 __le32 driver_curr_frag[ISL38XX_CB_QCOUNT];
147 __le32 device_curr_frag[ISL38XX_CB_QCOUNT];
148 isl38xx_fragment rx_data_low[ISL38XX_CB_RX_QSIZE];
149 isl38xx_fragment tx_data_low[ISL38XX_CB_TX_QSIZE];
150 isl38xx_fragment rx_data_high[ISL38XX_CB_RX_QSIZE];
151 isl38xx_fragment tx_data_high[ISL38XX_CB_TX_QSIZE];
152 isl38xx_fragment rx_data_mgmt[ISL38XX_CB_MGMT_QSIZE];
153 isl38xx_fragment tx_data_mgmt[ISL38XX_CB_MGMT_QSIZE];
154};
155
156typedef struct isl38xx_cb isl38xx_control_block;
157
158
159int isl38xx_in_queue(isl38xx_control_block *cb, int queue);
160
161void isl38xx_disable_interrupts(void __iomem *);
162void isl38xx_enable_common_interrupts(void __iomem *);
163
164void isl38xx_handle_sleep_request(isl38xx_control_block *, int *,
165 void __iomem *);
166void isl38xx_handle_wakeup(isl38xx_control_block *, int *, void __iomem *);
167void isl38xx_trigger_device(int, void __iomem *);
168void isl38xx_interface_reset(void __iomem *, dma_addr_t);
169
170#endif
171