summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2012-05-10 12:13:38 +0300
committerLuciano Coelho <coelho@ti.com>2012-06-05 15:55:53 +0300
commitd5b592764f5b21979f6260869bd96e69aa0536bb (patch)
treecc2814af3b3bfa769b4fea0232e9bbfde7e332d2
parenta9c130d522ddef8673728fa9738f4f3f8e61f9b9 (diff)
wl18xx: translate and write the board type to SCR_PAD2
The firmware uses the SCR_PAD2 register to read the board type passed from the driver. The values don't match the ones used in the mac and phy configuration, so we need to map them before writing. This commit adds a translation table that is used when writing the board type to SCR_PAD2. Signed-off-by: Luciano Coelho <coelho@ti.com> Signed-off-by: Arik Nemtsov <arik@wizery.com>
-rw-r--r--drivers/net/wireless/ti/wl18xx/main.c16
-rw-r--r--drivers/net/wireless/ti/wl18xx/reg.h9
2 files changed, 20 insertions, 5 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/main.c b/drivers/net/wireless/ti/wl18xx/main.c
index e5ebf4a14ba1..5214334c72c2 100644
--- a/drivers/net/wireless/ti/wl18xx/main.c
+++ b/drivers/net/wireless/ti/wl18xx/main.c
@@ -44,6 +44,12 @@
static char *ht_mode_param;
static char *board_type_param;
+static const u32 wl18xx_board_type_to_scrpad2[NUM_BOARD_TYPES] = {
+ [BOARD_TYPE_FPGA_18XX] = SCR_PAD2_BOARD_TYPE_FPGA,
+ [BOARD_TYPE_HDK_18XX] = SCR_PAD2_BOARD_TYPE_HDK,
+ [BOARD_TYPE_DVP_EVB_18XX] = SCR_PAD2_BOARD_TYPE_DVP_EVB,
+};
+
static const u8 wl18xx_rate_to_idx_2ghz[] = {
/* MCS rates are used only with 11n */
15, /* WL18XX_CONF_HW_RXTX_RATE_MCS15 */
@@ -584,11 +590,11 @@ out:
static void wl18xx_set_clk(struct wl1271 *wl)
{
- /*
- * TODO: this is hardcoded just for DVP/EVB, fix according to
- * new unified_drv.
- */
- wl1271_write32(wl, WL18XX_SCR_PAD2, 0xB3);
+ struct wl18xx_priv *priv = wl->priv;
+
+ /* write the translated board type to SCR_PAD2 */
+ wl1271_write32(wl, WL18XX_SCR_PAD2,
+ wl18xx_board_type_to_scrpad2[priv->board_type]);
wlcore_set_partition(wl, &wl->ptable[PART_TOP_PRCM_ELP_SOC]);
wl1271_write32(wl, 0x00A02360, 0xD0078);
diff --git a/drivers/net/wireless/ti/wl18xx/reg.h b/drivers/net/wireless/ti/wl18xx/reg.h
index 53987997f78f..e0170aeba05c 100644
--- a/drivers/net/wireless/ti/wl18xx/reg.h
+++ b/drivers/net/wireless/ti/wl18xx/reg.h
@@ -154,6 +154,15 @@ enum {
BOARD_TYPE_FPGA_18XX = 0,
BOARD_TYPE_HDK_18XX = 1,
BOARD_TYPE_DVP_EVB_18XX = 2,
+
+ NUM_BOARD_TYPES,
+};
+
+/* board type values used by the firmware in the SCR_PAD2 register */
+enum {
+ SCR_PAD2_BOARD_TYPE_FPGA = 0xB1,
+ SCR_PAD2_BOARD_TYPE_HDK = 0xB2,
+ SCR_PAD2_BOARD_TYPE_DVP_EVB = 0xB3,
};
struct wl18xx_mac_and_phy_params {