diff options
author | Ohad Ben-Cohen <ohad@wizery.com> | 2010-09-15 19:31:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-09-21 11:05:00 -0400 |
commit | 15cea99306ae14ce5f7c3d3989bcc17202e2b0be (patch) | |
tree | 4755cdb83ca470dfa44b02f6f34aa8fa1c3454c6 | |
parent | 09cecc340b3b4d9960b039c0f576548bbf857f5a (diff) |
wl1271: make ref_clock configurable by board
The wl1271 device is using a reference clock that may change
between board to board.
Make the ref_clock parameter configurable by board settings
instead of having a hard coded value in the sources.
Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_boot.c | 11 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_boot.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_sdio.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/wl12xx/wl1271_spi.c | 2 | ||||
-rw-r--r-- | include/linux/wl12xx.h | 1 |
6 files changed, 12 insertions, 5 deletions
diff --git a/drivers/net/wireless/wl12xx/wl1271.h b/drivers/net/wireless/wl12xx/wl1271.h index faa5925efe30..4134f4495b95 100644 --- a/drivers/net/wireless/wl12xx/wl1271.h +++ b/drivers/net/wireless/wl12xx/wl1271.h | |||
@@ -330,6 +330,7 @@ struct wl1271 { | |||
330 | 330 | ||
331 | void (*set_power)(bool enable); | 331 | void (*set_power)(bool enable); |
332 | int irq; | 332 | int irq; |
333 | int ref_clock; | ||
333 | 334 | ||
334 | spinlock_t wl_lock; | 335 | spinlock_t wl_lock; |
335 | 336 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.c b/drivers/net/wireless/wl12xx/wl1271_boot.c index f36430b0336d..fc21db810812 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.c +++ b/drivers/net/wireless/wl12xx/wl1271_boot.c | |||
@@ -457,17 +457,20 @@ int wl1271_boot(struct wl1271 *wl) | |||
457 | { | 457 | { |
458 | int ret = 0; | 458 | int ret = 0; |
459 | u32 tmp, clk, pause; | 459 | u32 tmp, clk, pause; |
460 | int ref_clock = wl->ref_clock; | ||
460 | 461 | ||
461 | wl1271_boot_hw_version(wl); | 462 | wl1271_boot_hw_version(wl); |
462 | 463 | ||
463 | if (REF_CLOCK == 0 || REF_CLOCK == 2 || REF_CLOCK == 4) | 464 | if (ref_clock == 0 || ref_clock == 2 || ref_clock == 4) |
464 | /* ref clk: 19.2/38.4/38.4-XTAL */ | 465 | /* ref clk: 19.2/38.4/38.4-XTAL */ |
465 | clk = 0x3; | 466 | clk = 0x3; |
466 | else if (REF_CLOCK == 1 || REF_CLOCK == 3) | 467 | else if (ref_clock == 1 || ref_clock == 3) |
467 | /* ref clk: 26/52 */ | 468 | /* ref clk: 26/52 */ |
468 | clk = 0x5; | 469 | clk = 0x5; |
470 | else | ||
471 | return -EINVAL; | ||
469 | 472 | ||
470 | if (REF_CLOCK != 0) { | 473 | if (ref_clock != 0) { |
471 | u16 val; | 474 | u16 val; |
472 | /* Set clock type (open drain) */ | 475 | /* Set clock type (open drain) */ |
473 | val = wl1271_top_reg_read(wl, OCP_REG_CLK_TYPE); | 476 | val = wl1271_top_reg_read(wl, OCP_REG_CLK_TYPE); |
@@ -516,7 +519,7 @@ int wl1271_boot(struct wl1271 *wl) | |||
516 | wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); | 519 | wl1271_debug(DEBUG_BOOT, "clk2 0x%x", clk); |
517 | 520 | ||
518 | /* 2 */ | 521 | /* 2 */ |
519 | clk |= (REF_CLOCK << 1) << 4; | 522 | clk |= (ref_clock << 1) << 4; |
520 | wl1271_write32(wl, DRPW_SCRATCH_START, clk); | 523 | wl1271_write32(wl, DRPW_SCRATCH_START, clk); |
521 | 524 | ||
522 | wl1271_set_partition(wl, &part_table[PART_WORK]); | 525 | wl1271_set_partition(wl, &part_table[PART_WORK]); |
diff --git a/drivers/net/wireless/wl12xx/wl1271_boot.h b/drivers/net/wireless/wl12xx/wl1271_boot.h index f829699d597e..f73b0b15a280 100644 --- a/drivers/net/wireless/wl12xx/wl1271_boot.h +++ b/drivers/net/wireless/wl12xx/wl1271_boot.h | |||
@@ -46,7 +46,6 @@ struct wl1271_static_data { | |||
46 | /* delay between retries */ | 46 | /* delay between retries */ |
47 | #define INIT_LOOP_DELAY 50 | 47 | #define INIT_LOOP_DELAY 50 |
48 | 48 | ||
49 | #define REF_CLOCK 2 | ||
50 | #define WU_COUNTER_PAUSE_VAL 0x3FF | 49 | #define WU_COUNTER_PAUSE_VAL 0x3FF |
51 | #define WELP_ARM_COMMAND_VAL 0x4 | 50 | #define WELP_ARM_COMMAND_VAL 0x4 |
52 | 51 | ||
diff --git a/drivers/net/wireless/wl12xx/wl1271_sdio.c b/drivers/net/wireless/wl12xx/wl1271_sdio.c index 987ecdc9406d..f2f04663627c 100644 --- a/drivers/net/wireless/wl12xx/wl1271_sdio.c +++ b/drivers/net/wireless/wl12xx/wl1271_sdio.c | |||
@@ -234,6 +234,7 @@ static int __devinit wl1271_probe(struct sdio_func *func, | |||
234 | } | 234 | } |
235 | 235 | ||
236 | wl->irq = wlan_data->irq; | 236 | wl->irq = wlan_data->irq; |
237 | wl->ref_clock = wlan_data->board_ref_clock; | ||
237 | 238 | ||
238 | ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl); | 239 | ret = request_irq(wl->irq, wl1271_irq, 0, DRIVER_NAME, wl); |
239 | if (ret < 0) { | 240 | if (ret < 0) { |
diff --git a/drivers/net/wireless/wl12xx/wl1271_spi.c b/drivers/net/wireless/wl12xx/wl1271_spi.c index de56d8d9ee66..ced0a9e2c7e1 100644 --- a/drivers/net/wireless/wl12xx/wl1271_spi.c +++ b/drivers/net/wireless/wl12xx/wl1271_spi.c | |||
@@ -372,6 +372,8 @@ static int __devinit wl1271_probe(struct spi_device *spi) | |||
372 | goto out_free; | 372 | goto out_free; |
373 | } | 373 | } |
374 | 374 | ||
375 | wl->ref_clock = pdata->board_ref_clock; | ||
376 | |||
375 | wl->irq = spi->irq; | 377 | wl->irq = spi->irq; |
376 | if (wl->irq < 0) { | 378 | if (wl->irq < 0) { |
377 | wl1271_error("irq missing in platform data"); | 379 | wl1271_error("irq missing in platform data"); |
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h index bd70563107fa..95deae3968f4 100644 --- a/include/linux/wl12xx.h +++ b/include/linux/wl12xx.h | |||
@@ -29,6 +29,7 @@ struct wl12xx_platform_data { | |||
29 | /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ | 29 | /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ |
30 | int irq; | 30 | int irq; |
31 | bool use_eeprom; | 31 | bool use_eeprom; |
32 | int board_ref_clock; | ||
32 | }; | 33 | }; |
33 | 34 | ||
34 | int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); | 35 | int wl12xx_set_platform_data(const struct wl12xx_platform_data *data); |