Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134225
b: refs/heads/master
c: 8cab758
h: refs/heads/master
i:
  134223: c97f204
v: v3
  • Loading branch information
Alina Friedrichsen authored and John W. Linville committed Jan 29, 2009
1 parent e795fb4 commit b067d76
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ae54c985cc7daa502da6e7eb3b223a30fbbf4cfb
refs/heads/master: 8cab7581dba90b0519e25784e08feb5dedde737f
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ath5k/ath5k.h
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,7 @@ extern void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter);
/* Beacon control functions */
extern u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah);
extern u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
extern void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
extern void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
extern void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
#if 0
Expand Down
11 changes: 9 additions & 2 deletions trunk/drivers/net/wireless/ath5k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,22 @@ static ssize_t write_file_tsf(struct file *file,
size_t count, loff_t *ppos)
{
struct ath5k_softc *sc = file->private_data;
char buf[20];
char buf[21];
unsigned long long tsf;

if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
if (copy_from_user(buf, userbuf, min(count, sizeof(buf) - 1)))
return -EFAULT;
buf[sizeof(buf) - 1] = '\0';

if (strncmp(buf, "reset", 5) == 0) {
ath5k_hw_reset_tsf(sc->ah);
printk(KERN_INFO "debugfs reset TSF\n");
} else {
tsf = simple_strtoul(buf, NULL, 0);
ath5k_hw_set_tsf64(sc->ah, tsf);
printk(KERN_INFO "debugfs set TSF to %#018llx\n", tsf);
}

return count;
}

Expand Down
17 changes: 17 additions & 0 deletions trunk/drivers/net/wireless/ath5k/pcu.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,23 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
return ath5k_hw_reg_read(ah, AR5K_TSF_L32) | (tsf << 32);
}

/**
* ath5k_hw_set_tsf64 - Set a new 64bit TSF
*
* @ah: The &struct ath5k_hw
* @tsf64: The new 64bit TSF
*
* Sets the new TSF
*/
void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64)
{
ATH5K_TRACE(ah->ah_sc);

ath5k_hw_reg_write(ah, 0x00000000, AR5K_TSF_L32);
ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff, AR5K_TSF_U32);
ath5k_hw_reg_write(ah, tsf64 & 0xffffffff, AR5K_TSF_L32);
}

/**
* ath5k_hw_reset_tsf - Force a TSF reset
*
Expand Down

0 comments on commit b067d76

Please sign in to comment.