aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/spi.h
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-04-29 16:33:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-06 15:14:54 -0400
commit2f01a1f58889fbfeb68b1bc1b52e4197f3333490 (patch)
tree949cf33c4e3dcdf7abcf95c9bda4d8372da04f97 /drivers/net/wireless/wl12xx/spi.h
parentd53d9e67b55f6a9fc3f836c5c392eb41ce5676f4 (diff)
wl12xx: add driver
wl12xx is a driver for TI wl1251 802.11 chipset designed for embedded devices, supporting both SDIO and SPI busses. Currently the driver supports only SPI. Adding support 1253 (the 5 GHz version) should be relatively easy. More information here: http://focus.ti.com/general/docs/wtbu/wtbuproductcontent.tsp?contentId=4711&navigationId=12494&templateId=6123 (Collapsed original sequence of pre-merge patches into single commit for initial merge. -- JWL) Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: Bob Copeland <me@bobcopeland.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/spi.h')
-rw-r--r--drivers/net/wireless/wl12xx/spi.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/drivers/net/wireless/wl12xx/spi.h b/drivers/net/wireless/wl12xx/spi.h
new file mode 100644
index 00000000000..fd3227e904a
--- /dev/null
+++ b/drivers/net/wireless/wl12xx/spi.h
@@ -0,0 +1,109 @@
1/*
2 * This file is part of wl12xx
3 *
4 * Copyright (c) 1998-2007 Texas Instruments Incorporated
5 * Copyright (C) 2008 Nokia Corporation
6 *
7 * Contact: Kalle Valo <kalle.valo@nokia.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef __WL12XX_SPI_H__
26#define __WL12XX_SPI_H__
27
28#include "cmd.h"
29#include "acx.h"
30#include "reg.h"
31
32#define HW_ACCESS_MEMORY_MAX_RANGE 0x1FFC0
33
34#define HW_ACCESS_PART0_SIZE_ADDR 0x1FFC0
35#define HW_ACCESS_PART0_START_ADDR 0x1FFC4
36#define HW_ACCESS_PART1_SIZE_ADDR 0x1FFC8
37#define HW_ACCESS_PART1_START_ADDR 0x1FFCC
38
39#define HW_ACCESS_REGISTER_SIZE 4
40
41#define HW_ACCESS_PRAM_MAX_RANGE 0x3c000
42
43#define WSPI_CMD_READ 0x40000000
44#define WSPI_CMD_WRITE 0x00000000
45#define WSPI_CMD_FIXED 0x20000000
46#define WSPI_CMD_BYTE_LENGTH 0x1FFE0000
47#define WSPI_CMD_BYTE_LENGTH_OFFSET 17
48#define WSPI_CMD_BYTE_ADDR 0x0001FFFF
49
50#define WSPI_INIT_CMD_CRC_LEN 5
51
52#define WSPI_INIT_CMD_START 0x00
53#define WSPI_INIT_CMD_TX 0x40
54/* the extra bypass bit is sampled by the TNET as '1' */
55#define WSPI_INIT_CMD_BYPASS_BIT 0x80
56#define WSPI_INIT_CMD_FIXEDBUSY_LEN 0x07
57#define WSPI_INIT_CMD_EN_FIXEDBUSY 0x80
58#define WSPI_INIT_CMD_DIS_FIXEDBUSY 0x00
59#define WSPI_INIT_CMD_IOD 0x40
60#define WSPI_INIT_CMD_IP 0x20
61#define WSPI_INIT_CMD_CS 0x10
62#define WSPI_INIT_CMD_WS 0x08
63#define WSPI_INIT_CMD_WSPI 0x01
64#define WSPI_INIT_CMD_END 0x01
65
66#define WSPI_INIT_CMD_LEN 8
67
68#define TNETWIF_READ_OFFSET_BYTES 8
69#define HW_ACCESS_WSPI_FIXED_BUSY_LEN \
70 ((TNETWIF_READ_OFFSET_BYTES - 4) / sizeof(u32))
71#define HW_ACCESS_WSPI_INIT_CMD_MASK 0
72
73
74/* Raw target IO, address is not translated */
75void wl12xx_spi_read(struct wl12xx *wl, int addr, void *buf, size_t len);
76void wl12xx_spi_write(struct wl12xx *wl, int addr, void *buf, size_t len);
77
78/* Memory target IO, address is tranlated to partition 0 */
79void wl12xx_spi_mem_read(struct wl12xx *wl, int addr, void *buf, size_t len);
80void wl12xx_spi_mem_write(struct wl12xx *wl, int addr, void *buf, size_t len);
81u32 wl12xx_mem_read32(struct wl12xx *wl, int addr);
82void wl12xx_mem_write32(struct wl12xx *wl, int addr, u32 val);
83
84/* Registers IO */
85u32 wl12xx_reg_read32(struct wl12xx *wl, int addr);
86void wl12xx_reg_write32(struct wl12xx *wl, int addr, u32 val);
87
88/* INIT and RESET words */
89void wl12xx_spi_reset(struct wl12xx *wl);
90void wl12xx_spi_init(struct wl12xx *wl);
91void wl12xx_set_partition(struct wl12xx *wl,
92 u32 part_start, u32 part_size,
93 u32 reg_start, u32 reg_size);
94
95static inline u32 wl12xx_read32(struct wl12xx *wl, int addr)
96{
97 u32 response;
98
99 wl12xx_spi_read(wl, addr, &response, sizeof(u32));
100
101 return response;
102}
103
104static inline void wl12xx_write32(struct wl12xx *wl, int addr, u32 val)
105{
106 wl12xx_spi_write(wl, addr, &val, sizeof(u32));
107}
108
109#endif /* __WL12XX_SPI_H__ */