-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wlcore/wl12xx: add hw_init operation
Move all the wl12xx-specific hw initialization procedures into a new hw_init op. Move some commands and ACX functions to wl12xx. Signed-off-by: Luciano Coelho <coelho@ti.com>
- Loading branch information
Luciano Coelho
committed
Apr 12, 2012
1 parent
f83985b
commit 9d68d1e
Showing
13 changed files
with
499 additions
and
405 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
wl12xx-objs = main.o | ||
wl12xx-objs = main.o cmd.o acx.o | ||
|
||
obj-$(CONFIG_WL12XX) += wl12xx.o |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* This file is part of wl12xx | ||
* | ||
* Copyright (C) 2008-2009 Nokia Corporation | ||
* Copyright (C) 2011 Texas Instruments Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#include "../wlcore/cmd.h" | ||
#include "../wlcore/debug.h" | ||
#include "../wlcore/acx.h" | ||
|
||
#include "acx.h" | ||
|
||
int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap) | ||
{ | ||
struct wl1271_acx_host_config_bitmap *bitmap_conf; | ||
int ret; | ||
|
||
bitmap_conf = kzalloc(sizeof(*bitmap_conf), GFP_KERNEL); | ||
if (!bitmap_conf) { | ||
ret = -ENOMEM; | ||
goto out; | ||
} | ||
|
||
bitmap_conf->host_cfg_bitmap = cpu_to_le32(host_cfg_bitmap); | ||
|
||
ret = wl1271_cmd_configure(wl, ACX_HOST_IF_CFG_BITMAP, | ||
bitmap_conf, sizeof(*bitmap_conf)); | ||
if (ret < 0) { | ||
wl1271_warning("wl1271 bitmap config opt failed: %d", ret); | ||
goto out; | ||
} | ||
|
||
out: | ||
kfree(bitmap_conf); | ||
|
||
return ret; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* This file is part of wl12xx | ||
* | ||
* Copyright (C) 1998-2009, 2011 Texas Instruments. All rights reserved. | ||
* Copyright (C) 2008-2010 Nokia Corporation | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#ifndef __WL12XX_ACX_H__ | ||
#define __WL12XX_ACX_H__ | ||
|
||
#include "../wlcore/wlcore.h" | ||
|
||
struct wl1271_acx_host_config_bitmap { | ||
struct acx_header header; | ||
|
||
__le32 host_cfg_bitmap; | ||
} __packed; | ||
|
||
int wl1271_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap); | ||
|
||
#endif /* __WL12XX_ACX_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,252 @@ | ||
/* | ||
* This file is part of wl12xx | ||
* | ||
* Copyright (C) 2009-2010 Nokia Corporation | ||
* Copyright (C) 2011 Texas Instruments Inc. | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* version 2 as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, but | ||
* WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA | ||
* | ||
*/ | ||
|
||
#include "../wlcore/cmd.h" | ||
#include "../wlcore/debug.h" | ||
|
||
#include "cmd.h" | ||
|
||
int wl1271_cmd_ext_radio_parms(struct wl1271 *wl) | ||
{ | ||
struct wl1271_ext_radio_parms_cmd *ext_radio_parms; | ||
struct conf_rf_settings *rf = &wl->conf.rf; | ||
int ret; | ||
|
||
if (!wl->nvs) | ||
return -ENODEV; | ||
|
||
ext_radio_parms = kzalloc(sizeof(*ext_radio_parms), GFP_KERNEL); | ||
if (!ext_radio_parms) | ||
return -ENOMEM; | ||
|
||
ext_radio_parms->test.id = TEST_CMD_INI_FILE_RF_EXTENDED_PARAM; | ||
|
||
memcpy(ext_radio_parms->tx_per_channel_power_compensation_2, | ||
rf->tx_per_channel_power_compensation_2, | ||
CONF_TX_PWR_COMPENSATION_LEN_2); | ||
memcpy(ext_radio_parms->tx_per_channel_power_compensation_5, | ||
rf->tx_per_channel_power_compensation_5, | ||
CONF_TX_PWR_COMPENSATION_LEN_5); | ||
|
||
wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_EXT_RADIO_PARAM: ", | ||
ext_radio_parms, sizeof(*ext_radio_parms)); | ||
|
||
ret = wl1271_cmd_test(wl, ext_radio_parms, sizeof(*ext_radio_parms), 0); | ||
if (ret < 0) | ||
wl1271_warning("TEST_CMD_INI_FILE_RF_EXTENDED_PARAM failed"); | ||
|
||
kfree(ext_radio_parms); | ||
return ret; | ||
} | ||
|
||
int wl1271_cmd_general_parms(struct wl1271 *wl) | ||
{ | ||
struct wl1271_general_parms_cmd *gen_parms; | ||
struct wl1271_ini_general_params *gp = | ||
&((struct wl1271_nvs_file *)wl->nvs)->general_params; | ||
bool answer = false; | ||
int ret; | ||
|
||
if (!wl->nvs) | ||
return -ENODEV; | ||
|
||
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
wl1271_warning("FEM index from INI out of bounds"); | ||
return -EINVAL; | ||
} | ||
|
||
gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | ||
if (!gen_parms) | ||
return -ENOMEM; | ||
|
||
gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | ||
|
||
memcpy(&gen_parms->general_params, gp, sizeof(*gp)); | ||
|
||
if (gp->tx_bip_fem_auto_detect) | ||
answer = true; | ||
|
||
/* Override the REF CLK from the NVS with the one from platform data */ | ||
gen_parms->general_params.ref_clock = wl->ref_clock; | ||
|
||
ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); | ||
if (ret < 0) { | ||
wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); | ||
goto out; | ||
} | ||
|
||
gp->tx_bip_fem_manufacturer = | ||
gen_parms->general_params.tx_bip_fem_manufacturer; | ||
|
||
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
wl1271_warning("FEM index from FW out of bounds"); | ||
ret = -EINVAL; | ||
goto out; | ||
} | ||
|
||
wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", | ||
answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); | ||
|
||
out: | ||
kfree(gen_parms); | ||
return ret; | ||
} | ||
|
||
int wl128x_cmd_general_parms(struct wl1271 *wl) | ||
{ | ||
struct wl128x_general_parms_cmd *gen_parms; | ||
struct wl128x_ini_general_params *gp = | ||
&((struct wl128x_nvs_file *)wl->nvs)->general_params; | ||
bool answer = false; | ||
int ret; | ||
|
||
if (!wl->nvs) | ||
return -ENODEV; | ||
|
||
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
wl1271_warning("FEM index from ini out of bounds"); | ||
return -EINVAL; | ||
} | ||
|
||
gen_parms = kzalloc(sizeof(*gen_parms), GFP_KERNEL); | ||
if (!gen_parms) | ||
return -ENOMEM; | ||
|
||
gen_parms->test.id = TEST_CMD_INI_FILE_GENERAL_PARAM; | ||
|
||
memcpy(&gen_parms->general_params, gp, sizeof(*gp)); | ||
|
||
if (gp->tx_bip_fem_auto_detect) | ||
answer = true; | ||
|
||
/* Replace REF and TCXO CLKs with the ones from platform data */ | ||
gen_parms->general_params.ref_clock = wl->ref_clock; | ||
gen_parms->general_params.tcxo_ref_clock = wl->tcxo_clock; | ||
|
||
ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); | ||
if (ret < 0) { | ||
wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); | ||
goto out; | ||
} | ||
|
||
gp->tx_bip_fem_manufacturer = | ||
gen_parms->general_params.tx_bip_fem_manufacturer; | ||
|
||
if (gp->tx_bip_fem_manufacturer >= WL1271_INI_FEM_MODULE_COUNT) { | ||
wl1271_warning("FEM index from FW out of bounds"); | ||
ret = -EINVAL; | ||
goto out; | ||
} | ||
|
||
wl1271_debug(DEBUG_CMD, "FEM autodetect: %s, manufacturer: %d\n", | ||
answer ? "auto" : "manual", gp->tx_bip_fem_manufacturer); | ||
|
||
out: | ||
kfree(gen_parms); | ||
return ret; | ||
} | ||
|
||
int wl1271_cmd_radio_parms(struct wl1271 *wl) | ||
{ | ||
struct wl1271_nvs_file *nvs = (struct wl1271_nvs_file *)wl->nvs; | ||
struct wl1271_radio_parms_cmd *radio_parms; | ||
struct wl1271_ini_general_params *gp = &nvs->general_params; | ||
int ret; | ||
|
||
if (!wl->nvs) | ||
return -ENODEV; | ||
|
||
radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | ||
if (!radio_parms) | ||
return -ENOMEM; | ||
|
||
radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | ||
|
||
/* 2.4GHz parameters */ | ||
memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | ||
sizeof(struct wl1271_ini_band_params_2)); | ||
memcpy(&radio_parms->dyn_params_2, | ||
&nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | ||
sizeof(struct wl1271_ini_fem_params_2)); | ||
|
||
/* 5GHz parameters */ | ||
memcpy(&radio_parms->static_params_5, | ||
&nvs->stat_radio_params_5, | ||
sizeof(struct wl1271_ini_band_params_5)); | ||
memcpy(&radio_parms->dyn_params_5, | ||
&nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | ||
sizeof(struct wl1271_ini_fem_params_5)); | ||
|
||
wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | ||
radio_parms, sizeof(*radio_parms)); | ||
|
||
ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | ||
if (ret < 0) | ||
wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); | ||
|
||
kfree(radio_parms); | ||
return ret; | ||
} | ||
|
||
int wl128x_cmd_radio_parms(struct wl1271 *wl) | ||
{ | ||
struct wl128x_nvs_file *nvs = (struct wl128x_nvs_file *)wl->nvs; | ||
struct wl128x_radio_parms_cmd *radio_parms; | ||
struct wl128x_ini_general_params *gp = &nvs->general_params; | ||
int ret; | ||
|
||
if (!wl->nvs) | ||
return -ENODEV; | ||
|
||
radio_parms = kzalloc(sizeof(*radio_parms), GFP_KERNEL); | ||
if (!radio_parms) | ||
return -ENOMEM; | ||
|
||
radio_parms->test.id = TEST_CMD_INI_FILE_RADIO_PARAM; | ||
|
||
/* 2.4GHz parameters */ | ||
memcpy(&radio_parms->static_params_2, &nvs->stat_radio_params_2, | ||
sizeof(struct wl128x_ini_band_params_2)); | ||
memcpy(&radio_parms->dyn_params_2, | ||
&nvs->dyn_radio_params_2[gp->tx_bip_fem_manufacturer].params, | ||
sizeof(struct wl128x_ini_fem_params_2)); | ||
|
||
/* 5GHz parameters */ | ||
memcpy(&radio_parms->static_params_5, | ||
&nvs->stat_radio_params_5, | ||
sizeof(struct wl128x_ini_band_params_5)); | ||
memcpy(&radio_parms->dyn_params_5, | ||
&nvs->dyn_radio_params_5[gp->tx_bip_fem_manufacturer].params, | ||
sizeof(struct wl128x_ini_fem_params_5)); | ||
|
||
radio_parms->fem_vendor_and_options = nvs->fem_vendor_and_options; | ||
|
||
wl1271_dump(DEBUG_CMD, "TEST_CMD_INI_FILE_RADIO_PARAM: ", | ||
radio_parms, sizeof(*radio_parms)); | ||
|
||
ret = wl1271_cmd_test(wl, radio_parms, sizeof(*radio_parms), 0); | ||
if (ret < 0) | ||
wl1271_warning("CMD_INI_FILE_RADIO_PARAM failed"); | ||
|
||
kfree(radio_parms); | ||
return ret; | ||
} |
Oops, something went wrong.