2 * Driver for KeyStream, KS7010 based SDIO cards.
4 * Copyright (C) 2006-2008 KeyStream Corp.
5 * Copyright (C) 2009 Renesas Technology Corp.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 #ifndef _KS7010_SDIO_H
12 #define _KS7010_SDIO_H
14 #ifdef DEVICE_ALIGNMENT
15 #undef DEVICE_ALIGNMENT
17 #define DEVICE_ALIGNMENT 32
19 /* SDIO KeyStream vendor and device */
20 #define SDIO_VENDOR_ID_KS_CODE_A 0x005b
21 #define SDIO_VENDOR_ID_KS_CODE_B 0x0023
22 /* Older sources suggest earlier versions were named 7910 or 79xx */
23 #define SDIO_DEVICE_ID_KS_7010 0x7910
25 /* Read Status Register */
26 #define READ_STATUS 0x000000
27 #define READ_STATUS_BUSY 0
28 #define READ_STATUS_IDLE 1
30 /* Read Index Register */
31 #define READ_INDEX 0x000004
33 /* Read Data Size Register */
34 #define READ_DATA_SIZE 0x000008
36 /* Write Status Register */
37 #define WRITE_STATUS 0x00000C
38 #define WRITE_STATUS_BUSY 0
39 #define WRITE_STATUS_IDLE 1
41 /* Write Index Register */
42 #define WRITE_INDEX 0x000010
44 /* Write Status/Read Data Size Register
45 * for network packet (less than 2048 bytes data)
47 #define WSTATUS_RSIZE 0x000014
48 #define WSTATUS_MASK 0x80 /* Write Status Register value */
49 #define RSIZE_MASK 0x7F /* Read Data Size Register value [10:4] */
51 /* ARM to SD interrupt Enable */
52 #define INT_ENABLE 0x000020
53 /* ARM to SD interrupt Pending */
54 #define INT_PENDING 0x000024
56 #define INT_GCR_B (1<<7)
57 #define INT_GCR_A (1<<6)
58 #define INT_WRITE_STATUS (1<<5)
59 #define INT_WRITE_INDEX (1<<4)
60 #define INT_WRITE_SIZE (1<<3)
61 #define INT_READ_STATUS (1<<2)
62 #define INT_READ_INDEX (1<<1)
63 #define INT_READ_SIZE (1<<0)
65 /* General Communication Register A */
66 #define GCR_A 0x000028
71 /* General Communication Register B */
72 #define GCR_B 0x00002C
73 #define GCR_B_ACTIVE 0
77 /* #define WAKEUP 0x008104 */
78 /* #define WAKEUP_REQ 0x00 */
79 #define WAKEUP 0x008018
80 #define WAKEUP_REQ 0x5a
82 /* AHB Data Window 0x010000-0x01FFFF */
83 #define DATA_WINDOW 0x010000
84 #define WINDOW_SIZE 64*1024
86 #define KS7010_IRAM_ADDRESS 0x06000000
92 struct ks_sdio_card *sdio_card;
93 struct completion ks7010_sdio_wait;
94 struct workqueue_struct *ks7010sdio_wq;
95 struct delayed_work rw_wq;
96 unsigned char *read_buf;
97 struct tasklet_struct rx_bh_task;
100 struct ks_sdio_packet {
101 struct ks_sdio_packet *next;
103 u8 buffer[0] __attribute__ ((aligned(4)));
106 struct ks_sdio_card {
107 struct sdio_func *func;
108 struct ks_wlan_private *priv;
112 /* Tx Device struct */
113 #define TX_DEVICE_BUFF_SIZE 1024
115 struct tx_device_buffer {
116 unsigned char *sendp; /* pointer of send req data */
118 void (*complete_handler) (void *arg1, void *arg2);
124 struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
125 unsigned int qhead; /* tx buffer queue first pointer */
126 unsigned int qtail; /* tx buffer queue last pointer */
127 spinlock_t tx_dev_lock;
130 /* Rx Device struct */
131 #define RX_DATA_SIZE (2 + 2 + 2347 + 1)
132 #define RX_DEVICE_BUFF_SIZE 32
134 struct rx_device_buffer {
135 unsigned char data[RX_DATA_SIZE];
140 struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
141 unsigned int qhead; /* rx buffer queue first pointer */
142 unsigned int qtail; /* rx buffer queue last pointer */
143 spinlock_t rx_dev_lock;
145 #define ROM_FILE "ks7010sd.rom"
146 #define KS_WLAN_DRIVER_VERSION_INFO "ks7010 sdio linux 007"
148 #endif /* _KS7010_SDIO_H */