Skip to contentSkip to conversation

Ability to set reference clock as module parameter

PATCH In review Gery Kahn 2 participants 2 messages Oct 11, 2010

Subsystems (4)
lore
Share & tools
lore

Gery Kahn

author
#0 lore raw

PATCH v2 1/1 Ability to set reference clock as module parameter

v2 Cleaned changes from development

Option to set reference clock as module param, debugfs readonly permanent MAC address

---
 arch/arm/mach-omap2/board-zoom-peripherals.c |    2 +-
 drivers/net/wireless/wl12xx/wl1271.h         |    3 ++-
 drivers/net/wireless/wl12xx/wl1271_debugfs.c |    5 ++++-
 drivers/net/wireless/wl12xx/wl1271_main.c    |    3 +++
 drivers/net/wireless/wl12xx/wl1271_sdio.c    |    9 ++++++++-
 5 files changed, 18 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/board-zoom-peripherals.c +1 -1
index 287ffcb..d1a8870 100644
@@ -190,7 +190,7 @@ static struct platform_device omap_vwlan_device = {
 struct wl12xx_platform_data omap_zoom_wlan_data __initdata = {
 	.irq = OMAP_GPIO_IRQ(OMAP_ZOOM_WLAN_IRQ_GPIO),
 	/* ZOOM ref clock is 26 MHz */
-	.board_ref_clock = 1,
+	.board_ref_clock = WL12XX_REFCLOCK_26,
 };
 
 static struct omap2_hsmmc_info mmc[] __initdata = {
drivers/net/wireless/wl12xx/wl1271.h +1 -0
index 9b8ba82..bb94b95 100644
@@ -273,6 +273,7 @@ struct wl1271_debugfs {
 
 	struct dentry *retry_count;
 	struct dentry *excessive_retries;
+	struct dentry *ref_clk;
 	struct dentry *gpio_power;
 };
 
drivers/net/wireless/wl12xx/wl1271_debugfs.c +4 -1
index c239ef4..db67acc 100644
@@ -35,7 +35,6 @@
 #define WL1271_DEBUGFS_STATS_LIFETIME 1000
 
 /* debugfs macros idea from mac80211 */
-
 #define DEBUGFS_READONLY_FILE(name, buflen, fmt, value...)		\
 static ssize_t name## _read(struct file *file, char __user *userbuf,	\
 			    size_t count, loff_t *ppos)			\
@@ -219,6 +218,8 @@ DEBUGFS_FWSTATS_FILE(rxpipe, tx_xfr_host_int_trig_rx_data, 20, "%u");
 DEBUGFS_READONLY_FILE(retry_count, 20, "%u", wl->stats.retry_count);
 DEBUGFS_READONLY_FILE(excessive_retries, 20, "%u",
 		      wl->stats.excessive_retries);
+DEBUGFS_READONLY_FILE(ref_clk, 3, "%d", wl->ref_clock);
+
 
 static ssize_t tx_queue_len_read(struct file *file, char __user *userbuf,
 				 size_t count, loff_t *ppos)
@@ -390,6 +391,7 @@ static void wl1271_debugfs_delete_files(struct wl1271 *wl)
 	DEBUGFS_DEL(tx_queue_len);
 	DEBUGFS_DEL(retry_count);
 	DEBUGFS_DEL(excessive_retries);
+	DEBUGFS_DEL(ref_clk);
 
 	DEBUGFS_DEL(gpio_power);
 }
@@ -492,6 +494,7 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl)
 	DEBUGFS_ADD(tx_queue_len, wl->debugfs.rootdir);
 	DEBUGFS_ADD(retry_count, wl->debugfs.rootdir);
 	DEBUGFS_ADD(excessive_retries, wl->debugfs.rootdir);
+	DEBUGFS_ADD(ref_clk, wl->debugfs.rootdir);
 
 	DEBUGFS_ADD(gpio_power, wl->debugfs.rootdir);
 
drivers/net/wireless/wl12xx/wl1271_main.c +3 -0
index adcbffb..c1a111e 100644
@@ -946,6 +946,9 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
 
 	memcpy(wl->mac_addr, vif->addr, ETH_ALEN);
 
+	/* update MAC address in wiphy struct */
+	memcpy(wiphy->perm_addr, vif->addr, ETH_ALEN);
+
 	if (wl->state != WL1271_STATE_OFF) {
 		wl1271_error("cannot start because not in off state: %d",
 			     wl->state);
drivers/net/wireless/wl12xx/wl1271_sdio.c +8 -1
index e359cdd..697716e 100644
@@ -44,6 +44,10 @@
 #define SDIO_DEVICE_ID_TI_WL1271	0x4076
 #endif
 
+static int modparam_ref_clk;
+module_param_named(ref_clk, modparam_ref_clk, int, 0444);
+MODULE_PARM_DESC(ref_clk, "Set reference clock");
+
 static const struct sdio_device_id wl1271_devices[] = {
 	{ SDIO_DEVICE(SDIO_VENDOR_ID_TI, SDIO_DEVICE_ID_TI_WL1271) },
 	{}
@@ -237,7 +241,10 @@ static int __devinit wl1271_probe(struct sdio_func *func,
 	}
 
 	wl->irq = wlan_data->irq;
-	wl->ref_clock = wlan_data->board_ref_clock;
+	if (modparam_ref_clk)
+		wl->ref_clock =  modparam_ref_clk;
+	else
+		wl->ref_clock = wlan_data->board_ref_clock;
 
 	ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl);
 	if (ret < 0) {
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 7 lines · ext Gery Kahn

v2 Cleaned changes from development

Option to set reference clock as module param, debugfs readonly permanent MAC address

---

Linville already mentioned once, please *always* include "wl1271:" in front of the patch subject, so that we know what the patches are about.

Signature · 2 lines
Cheers,
Luca.