diff options
author | John W. Linville <linville@tuxdriver.com> | 2011-06-08 13:44:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-08 13:44:21 -0400 |
commit | c0c33addcba2ce753b4e2746db99feaae2f82a85 (patch) | |
tree | dab480183ac0e64bfe9250e1f294705d1a424c78 /include/linux | |
parent | ffbc03bc75b39c7bd412e7cc6d2185c11b0ffedd (diff) | |
parent | 931749bf78b969c54de9bbc67cf29b13a40bb73b (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/bcma/bcma.h | 25 | ||||
-rw-r--r-- | include/linux/bcma/bcma_driver_chipcommon.h | 1 | ||||
-rw-r--r-- | include/linux/cordic.h | 48 | ||||
-rw-r--r-- | include/linux/crc8.h | 101 |
4 files changed, 175 insertions, 0 deletions
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 08763e4e848f..6ff080eac0b2 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -6,6 +6,7 @@ | |||
6 | 6 | ||
7 | #include <linux/bcma/bcma_driver_chipcommon.h> | 7 | #include <linux/bcma/bcma_driver_chipcommon.h> |
8 | #include <linux/bcma/bcma_driver_pci.h> | 8 | #include <linux/bcma/bcma_driver_pci.h> |
9 | #include <linux/ssb/ssb.h> /* SPROM sharing */ | ||
9 | 10 | ||
10 | #include "bcma_regs.h" | 11 | #include "bcma_regs.h" |
11 | 12 | ||
@@ -31,6 +32,12 @@ struct bcma_host_ops { | |||
31 | void (*write8)(struct bcma_device *core, u16 offset, u8 value); | 32 | void (*write8)(struct bcma_device *core, u16 offset, u8 value); |
32 | void (*write16)(struct bcma_device *core, u16 offset, u16 value); | 33 | void (*write16)(struct bcma_device *core, u16 offset, u16 value); |
33 | void (*write32)(struct bcma_device *core, u16 offset, u32 value); | 34 | void (*write32)(struct bcma_device *core, u16 offset, u32 value); |
35 | #ifdef CONFIG_BCMA_BLOCKIO | ||
36 | void (*block_read)(struct bcma_device *core, void *buffer, | ||
37 | size_t count, u16 offset, u8 reg_width); | ||
38 | void (*block_write)(struct bcma_device *core, const void *buffer, | ||
39 | size_t count, u16 offset, u8 reg_width); | ||
40 | #endif | ||
34 | /* Agent ops */ | 41 | /* Agent ops */ |
35 | u32 (*aread32)(struct bcma_device *core, u16 offset); | 42 | u32 (*aread32)(struct bcma_device *core, u16 offset); |
36 | void (*awrite32)(struct bcma_device *core, u16 offset, u32 value); | 43 | void (*awrite32)(struct bcma_device *core, u16 offset, u32 value); |
@@ -117,6 +124,8 @@ struct bcma_device { | |||
117 | struct bcma_device_id id; | 124 | struct bcma_device_id id; |
118 | 125 | ||
119 | struct device dev; | 126 | struct device dev; |
127 | struct device *dma_dev; | ||
128 | unsigned int irq; | ||
120 | bool dev_registered; | 129 | bool dev_registered; |
121 | 130 | ||
122 | u8 core_index; | 131 | u8 core_index; |
@@ -179,6 +188,10 @@ struct bcma_bus { | |||
179 | 188 | ||
180 | struct bcma_drv_cc drv_cc; | 189 | struct bcma_drv_cc drv_cc; |
181 | struct bcma_drv_pci drv_pci; | 190 | struct bcma_drv_pci drv_pci; |
191 | |||
192 | /* We decided to share SPROM struct with SSB as long as we do not need | ||
193 | * any hacks for BCMA. This simplifies drivers code. */ | ||
194 | struct ssb_sprom sprom; | ||
182 | }; | 195 | }; |
183 | 196 | ||
184 | extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) | 197 | extern inline u32 bcma_read8(struct bcma_device *core, u16 offset) |
@@ -208,6 +221,18 @@ void bcma_write32(struct bcma_device *core, u16 offset, u32 value) | |||
208 | { | 221 | { |
209 | core->bus->ops->write32(core, offset, value); | 222 | core->bus->ops->write32(core, offset, value); |
210 | } | 223 | } |
224 | #ifdef CONFIG_BCMA_BLOCKIO | ||
225 | extern inline void bcma_block_read(struct bcma_device *core, void *buffer, | ||
226 | size_t count, u16 offset, u8 reg_width) | ||
227 | { | ||
228 | core->bus->ops->block_read(core, buffer, count, offset, reg_width); | ||
229 | } | ||
230 | extern inline void bcma_block_write(struct bcma_device *core, const void *buffer, | ||
231 | size_t count, u16 offset, u8 reg_width) | ||
232 | { | ||
233 | core->bus->ops->block_write(core, buffer, count, offset, reg_width); | ||
234 | } | ||
235 | #endif | ||
211 | extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) | 236 | extern inline u32 bcma_aread32(struct bcma_device *core, u16 offset) |
212 | { | 237 | { |
213 | return core->bus->ops->aread32(core, offset); | 238 | return core->bus->ops->aread32(core, offset); |
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 083c3b6cd5ce..9c5b69fc985a 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
@@ -244,6 +244,7 @@ | |||
244 | #define BCMA_CC_REGCTL_DATA 0x065C | 244 | #define BCMA_CC_REGCTL_DATA 0x065C |
245 | #define BCMA_CC_PLLCTL_ADDR 0x0660 | 245 | #define BCMA_CC_PLLCTL_ADDR 0x0660 |
246 | #define BCMA_CC_PLLCTL_DATA 0x0664 | 246 | #define BCMA_CC_PLLCTL_DATA 0x0664 |
247 | #define BCMA_CC_SPROM 0x0830 /* SPROM beginning */ | ||
247 | 248 | ||
248 | /* Data for the PMU, if available. | 249 | /* Data for the PMU, if available. |
249 | * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) | 250 | * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) |
diff --git a/include/linux/cordic.h b/include/linux/cordic.h new file mode 100644 index 000000000000..f932093e20c2 --- /dev/null +++ b/include/linux/cordic.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Broadcom Corporation | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | #ifndef __CORDIC_H_ | ||
17 | #define __CORDIC_H_ | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | |||
21 | /** | ||
22 | * struct cordic_iq - i/q coordinate. | ||
23 | * | ||
24 | * @i: real part of coordinate (in phase). | ||
25 | * @q: imaginary part of coordinate (quadrature). | ||
26 | */ | ||
27 | struct cordic_iq { | ||
28 | s32 i; | ||
29 | s32 q; | ||
30 | }; | ||
31 | |||
32 | /** | ||
33 | * cordic_calc_iq() - calculates the i/q coordinate for given angle. | ||
34 | * | ||
35 | * @theta: angle in degrees for which i/q coordinate is to be calculated. | ||
36 | * @coord: function output parameter holding the i/q coordinate. | ||
37 | * | ||
38 | * The function calculates the i/q coordinate for a given angle using | ||
39 | * cordic algorithm. The coordinate consists of a real (i) and an | ||
40 | * imaginary (q) part. The real part is essentially the cosine of the | ||
41 | * angle and the imaginary part is the sine of the angle. The returned | ||
42 | * values are scaled by 2^16 for precision. The range for theta is | ||
43 | * for -180 degrees to +180 degrees. Passed values outside this range are | ||
44 | * converted before doing the actual calculation. | ||
45 | */ | ||
46 | struct cordic_iq cordic_calc_iq(s32 theta); | ||
47 | |||
48 | #endif /* __CORDIC_H_ */ | ||
diff --git a/include/linux/crc8.h b/include/linux/crc8.h new file mode 100644 index 000000000000..13c8dabb0441 --- /dev/null +++ b/include/linux/crc8.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Broadcom Corporation | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | #ifndef __CRC8_H_ | ||
17 | #define __CRC8_H_ | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | |||
21 | /* see usage of this value in crc8() description */ | ||
22 | #define CRC8_INIT_VALUE 0xFF | ||
23 | |||
24 | /* | ||
25 | * Return value of crc8() indicating valid message+crc. This is true | ||
26 | * if a CRC is inverted before transmission. The CRC computed over the | ||
27 | * whole received bitstream is _table[x], where x is the bit pattern | ||
28 | * of the modification (almost always 0xff). | ||
29 | */ | ||
30 | #define CRC8_GOOD_VALUE(_table) (_table[0xFF]) | ||
31 | |||
32 | /* required table size for crc8 algorithm */ | ||
33 | #define CRC8_TABLE_SIZE 256 | ||
34 | |||
35 | /* helper macro assuring right table size is used */ | ||
36 | #define DECLARE_CRC8_TABLE(_table) \ | ||
37 | static u8 _table[CRC8_TABLE_SIZE] | ||
38 | |||
39 | /** | ||
40 | * crc8_populate_lsb - fill crc table for given polynomial in regular bit order. | ||
41 | * | ||
42 | * @table: table to be filled. | ||
43 | * @polynomial: polynomial for which table is to be filled. | ||
44 | * | ||
45 | * This function fills the provided table according the polynomial provided for | ||
46 | * regular bit order (lsb first). Polynomials in CRC algorithms are typically | ||
47 | * represented as shown below. | ||
48 | * | ||
49 | * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1 | ||
50 | * | ||
51 | * For lsb first direction x^7 maps to the lsb. So the polynomial is as below. | ||
52 | * | ||
53 | * - lsb first: poly = 10101011(1) = 0xAB | ||
54 | */ | ||
55 | void crc8_populate_lsb(u8 table[CRC8_TABLE_SIZE], u8 polynomial); | ||
56 | |||
57 | /** | ||
58 | * crc8_populate_msb - fill crc table for given polynomial in reverse bit order. | ||
59 | * | ||
60 | * @table: table to be filled. | ||
61 | * @polynomial: polynomial for which table is to be filled. | ||
62 | * | ||
63 | * This function fills the provided table according the polynomial provided for | ||
64 | * reverse bit order (msb first). Polynomials in CRC algorithms are typically | ||
65 | * represented as shown below. | ||
66 | * | ||
67 | * poly = x^8 + x^7 + x^6 + x^4 + x^2 + 1 | ||
68 | * | ||
69 | * For msb first direction x^7 maps to the msb. So the polynomial is as below. | ||
70 | * | ||
71 | * - msb first: poly = (1)11010101 = 0xD5 | ||
72 | */ | ||
73 | void crc8_populate_msb(u8 table[CRC8_TABLE_SIZE], u8 polynomial); | ||
74 | |||
75 | /** | ||
76 | * crc8() - calculate a crc8 over the given input data. | ||
77 | * | ||
78 | * @table: crc table used for calculation. | ||
79 | * @pdata: pointer to data buffer. | ||
80 | * @nbytes: number of bytes in data buffer. | ||
81 | * @crc: previous returned crc8 value. | ||
82 | * | ||
83 | * The CRC8 is calculated using the polynomial given in crc8_populate_msb() | ||
84 | * or crc8_populate_lsb(). | ||
85 | * | ||
86 | * The caller provides the initial value (either %CRC8_INIT_VALUE | ||
87 | * or the previous returned value) to allow for processing of | ||
88 | * discontiguous blocks of data. When generating the CRC the | ||
89 | * caller is responsible for complementing the final return value | ||
90 | * and inserting it into the byte stream. When validating a byte | ||
91 | * stream (including CRC8), a final return value of %CRC8_GOOD_VALUE | ||
92 | * indicates the byte stream data can be considered valid. | ||
93 | * | ||
94 | * Reference: | ||
95 | * "A Painless Guide to CRC Error Detection Algorithms", ver 3, Aug 1993 | ||
96 | * Williams, Ross N., ross<at>ross.net | ||
97 | * (see URL http://www.ross.net/crc/download/crc_v3.txt). | ||
98 | */ | ||
99 | u8 crc8(const u8 table[CRC8_TABLE_SIZE], u8 *pdata, size_t nbytes, u8 crc); | ||
100 | |||
101 | #endif /* __CRC8_H_ */ | ||