Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
acx.c
Go to the documentation of this file.
1 /*
2  * This file is part of wl18xx
3  *
4  * Copyright (C) 2011 Texas Instruments Inc.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * version 2 as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18  * 02110-1301 USA
19  *
20  */
21 
22 #include "../wlcore/cmd.h"
23 #include "../wlcore/debug.h"
24 #include "../wlcore/acx.h"
25 
26 #include "acx.h"
27 
29  u32 sdio_blk_size, u32 extra_mem_blks,
30  u32 len_field_size)
31 {
32  struct wl18xx_acx_host_config_bitmap *bitmap_conf;
33  int ret;
34 
35  wl1271_debug(DEBUG_ACX, "acx cfg bitmap %d blk %d spare %d field %d",
36  host_cfg_bitmap, sdio_blk_size, extra_mem_blks,
37  len_field_size);
38 
39  bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL);
40  if (!bitmap_conf) {
41  ret = -ENOMEM;
42  goto out;
43  }
44 
45  bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap);
46  bitmap_conf->host_sdio_block_size = cpu_to_le32(sdio_blk_size);
47  bitmap_conf->extra_mem_blocks = cpu_to_le32(extra_mem_blks);
48  bitmap_conf->length_field_size = cpu_to_le32(len_field_size);
49 
51  bitmap_conf, sizeof(*bitmap_conf));
52  if (ret < 0) {
53  wl1271_warning("wl1271 bitmap config opt failed: %d", ret);
54  goto out;
55  }
56 
57 out:
58  kfree(bitmap_conf);
59 
60  return ret;
61 }
62 
64 {
65  struct wl18xx_acx_checksum_state *acx;
66  int ret;
67 
68  wl1271_debug(DEBUG_ACX, "acx checksum state");
69 
70  acx = kzalloc(sizeof(*acx), GFP_KERNEL);
71  if (!acx) {
72  ret = -ENOMEM;
73  goto out;
74  }
75 
77 
78  ret = wl1271_cmd_configure(wl, ACX_CHECKSUM_CONFIG, acx, sizeof(*acx));
79  if (ret < 0) {
80  wl1271_warning("failed to set Tx checksum state: %d", ret);
81  goto out;
82  }
83 
84 out:
85  kfree(acx);
86  return ret;
87 }
88 
90 {
91  struct wl18xx_acx_clear_statistics *acx;
92  int ret = 0;
93 
94  wl1271_debug(DEBUG_ACX, "acx clear statistics");
95 
96  acx = kzalloc(sizeof(*acx), GFP_KERNEL);
97  if (!acx) {
98  ret = -ENOMEM;
99  goto out;
100  }
101 
102  ret = wl1271_cmd_configure(wl, ACX_CLEAR_STATISTICS, acx, sizeof(*acx));
103  if (ret < 0) {
104  wl1271_warning("failed to clear firmware statistics: %d", ret);
105  goto out;
106  }
107 
108 out:
109  kfree(acx);
110  return ret;
111 }