3 * Driver for KeyStream, KS7010 based SDIO cards.
6 * $Id: ks7010_sdio.h 1019 2009-09-28 05:41:07Z sekine $
8 * Copyright (C) 2006-2008 KeyStream Corp.
9 * Copyright (C) 2009 Renesas Technology Corp.
11 * This program is free software; you can redistribute it and/or modify
12 * it undr the terms of the GNU General Public License version 2 as
13 * published by the Free Sotware Foundation.
15 #ifndef _KS7010_SDIO_H
16 #define _KS7010_SDIO_H
18 #ifdef DEVICE_ALIGNMENT
19 #undef DEVICE_ALIGNMENT
21 #define DEVICE_ALIGNMENT 32
23 /* SDIO KeyStream vendor and device */
24 #define SDIO_VENDOR_ID_KS_CODE_A 0x005b
25 #define SDIO_VENDOR_ID_KS_CODE_B 0x0023
26 #define SDIO_DEVICE_ID_KS_7010 0x7910
28 /* Read Status Register */
29 #define READ_STATUS 0x000000
30 #define READ_STATUS_BUSY 0
31 #define READ_STATUS_IDLE 1
33 /* Read Index Register */
34 #define READ_INDEX 0x000004
36 /* Read Data Size Register */
37 #define READ_DATA_SIZE 0x000008
39 /* Write Status Register */
40 #define WRITE_STATUS 0x00000C
41 #define WRITE_STATUS_BUSY 0
42 #define WRITE_STATUS_IDLE 1
44 /* Write Index Register */
45 #define WRITE_INDEX 0x000010
47 /* Write Status/Read Data Size Register
48 * for network packet (less than 2048 bytes data)
50 #define WSTATUS_RSIZE 0x000014
51 #define WSTATUS_MASK 0x80 /* Write Status Register value */
52 #define RSIZE_MASK 0x7F /* Read Data Size Register value [10:4] */
54 /* ARM to SD interrupt Enable */
55 #define INT_ENABLE 0x000020
56 /* ARM to SD interrupt Pending */
57 #define INT_PENDING 0x000024
59 #define INT_GCR_B (1<<7)
60 #define INT_GCR_A (1<<6)
61 #define INT_WRITE_STATUS (1<<5)
62 #define INT_WRITE_INDEX (1<<4)
63 #define INT_WRITE_SIZE (1<<3)
64 #define INT_READ_STATUS (1<<2)
65 #define INT_READ_INDEX (1<<1)
66 #define INT_READ_SIZE (1<<0)
68 /* General Communication Register A */
69 #define GCR_A 0x000028
74 /* General Communication Register B */
75 #define GCR_B 0x00002C
76 #define GCR_B_ACTIVE 0
80 /* #define WAKEUP 0x008104 */
81 /* #define WAKEUP_REQ 0x00 */
82 #define WAKEUP 0x008018
83 #define WAKEUP_REQ 0x5a
85 /* AHB Data Window 0x010000-0x01FFFF */
86 #define DATA_WINDOW 0x010000
87 #define WINDOW_SIZE 64*1024
89 #define KS7010_IRAM_ADDRESS 0x06000000
96 struct ks_sdio_card *sdio_card;
97 struct completion ks7010_sdio_wait;
98 struct workqueue_struct *ks7010sdio_wq;
99 struct workqueue_struct *ks7010sdio_init;
100 struct work_struct init_task;
101 struct delayed_work rw_wq;
102 unsigned char *read_buf;
103 struct tasklet_struct rx_bh_task;
106 struct ks_sdio_packet {
107 struct ks_sdio_packet *next;
109 u8 buffer[0] __attribute__((aligned(4)));
113 struct ks_sdio_card {
114 struct sdio_func *func;
115 struct ks_wlan_private *priv;
117 const char *firmware;
123 /* Tx Device struct */
124 #define TX_DEVICE_BUFF_SIZE 1024
126 struct tx_device_buffer {
127 unsigned char *sendp; /* pointer of send req data */
129 void (*complete_handler)(void *arg1, void *arg2);
135 struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE];
136 unsigned int qhead; /* tx buffer queue first pointer */
137 unsigned int qtail; /* tx buffer queue last pointer */
138 spinlock_t tx_dev_lock;
141 /* Rx Device struct */
142 #define RX_DATA_SIZE (2 + 2 + 2347 + 1)
143 #define RX_DEVICE_BUFF_SIZE 32
145 struct rx_device_buffer {
146 unsigned char data[RX_DATA_SIZE];
151 struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE];
152 unsigned int qhead; /* rx buffer queue first pointer */
153 unsigned int qtail; /* rx buffer queue last pointer */
154 spinlock_t rx_dev_lock;
156 #define ROM_FILE "ks7010sd.rom"
157 #define CFG_FILE "ks79xx.cfg"
158 #define KS_WLAN_DRIVER_VERSION_INFO "ks7010 sdio linux 007"
160 #endif /* _KS7010_SDIO_H */