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/Write Status Register */
26 #define READ_STATUS 0x000000
27 #define WRITE_STATUS 0x00000C
28 enum reg_status_type {
33 /* Read Index Register */
34 #define READ_INDEX 0x000004
36 /* Read Data Size Register */
37 #define READ_DATA_SIZE 0x000008
39 /* Write Index Register */
40 #define WRITE_INDEX 0x000010
42 /* Write Status/Read Data Size Register
43 * for network packet (less than 2048 bytes data)
45 #define WSTATUS_RSIZE 0x000014
46 #define WSTATUS_MASK 0x80 /* Write Status Register value */
47 #define RSIZE_MASK 0x7F /* Read Data Size Register value [10:4] */
49 /* ARM to SD interrupt Enable */
50 #define INT_ENABLE 0x000020
51 /* ARM to SD interrupt Pending */
52 #define INT_PENDING 0x000024
54 #define INT_GCR_B BIT(7)
55 #define INT_GCR_A BIT(6)
56 #define INT_WRITE_STATUS BIT(5)
57 #define INT_WRITE_INDEX BIT(4)
58 #define INT_WRITE_SIZE BIT(3)
59 #define INT_READ_STATUS BIT(2)
60 #define INT_READ_INDEX BIT(1)
61 #define INT_READ_SIZE BIT(0)
63 /* General Communication Register A */
64 #define GCR_A 0x000028
71 /* General Communication Register B */
72 #define GCR_B 0x00002C
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
89 * struct ks_sdio_card - SDIO device data.
91 * Structure is used as the &struct sdio_func private data.
93 * @func: Pointer to the SDIO function device.
94 * @priv: Pointer to the &struct net_device private data.
97 struct sdio_func *func;
98 struct ks_wlan_private *priv;
101 /* Tx Device struct */
102 #define TX_DEVICE_BUFF_SIZE 1024
105 * struct tx_device_buffer - Queue item for the tx queue.
106 * @sendp: Pointer to the send request data.
107 * @size: Size of @sendp data.
108 * @complete_handler: Function called once data write to device is complete.
109 * @arg1: First argument to @complete_handler.
110 * @arg2: Second argument to @complete_handler.
112 struct tx_device_buffer {
113 unsigned char *sendp;
115 void (*complete_handler)(struct ks_wlan_private *priv,
116 struct sk_buff *skb);
121 * struct tx_device - Tx buffer queue.
122 * @tx_device_buffer: Queue buffer.
123 * @qhead: Head of tx queue.
124 * @qtail: Tail of tx queue.
125 * @tx_dev_lock: Queue lock.
128 struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
131 spinlock_t tx_dev_lock; /* protect access to the queue */
134 /* Rx Device struct */
135 #define RX_DATA_SIZE (2 + 2 + 2347 + 1)
136 #define RX_DEVICE_BUFF_SIZE 32
139 * struct rx_device_buffer - Queue item for the rx queue.
141 * @size: Size of @data.
143 struct rx_device_buffer {
144 unsigned char data[RX_DATA_SIZE];
149 * struct rx_device - Rx buffer queue.
150 * @rx_device_buffer: Queue buffer.
151 * @qhead: Head of rx queue.
152 * @qtail: Tail of rx queue.
153 * @rx_dev_lock: Queue lock.
156 struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
159 spinlock_t rx_dev_lock; /* protect access to the queue */
162 #define ROM_FILE "/*(DEBLOBBED)*/"
164 #endif /* _KS7010_SDIO_H */