Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134226
b: refs/heads/master
c: 27abe06
h: refs/heads/master
v: v3
  • Loading branch information
Alina Friedrichsen authored and John W. Linville committed Jan 29, 2009
1 parent b067d76 commit e6467e3
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8cab7581dba90b0519e25784e08feb5dedde737f
refs/heads/master: 27abe060aa9d3410545ef663676c7183fc2512c6
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ath9k/ath9k.h
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask);
bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask);
void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId);
u64 ath9k_hw_gettsf64(struct ath_hal *ah);
void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64);
void ath9k_hw_reset_tsf(struct ath_hal *ah);
bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting);
bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us);
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/net/wireless/ath9k/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ struct ath9k_debug {
struct dentry *debugfs_phy;
struct dentry *debugfs_dma;
struct dentry *debugfs_interrupt;
struct dentry *debugfs_tsf;
struct ath_stats stats;
};

Expand Down
49 changes: 49 additions & 0 deletions trunk/drivers/net/wireless/ath9k/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,49 @@ static const struct file_operations fops_interrupt = {
.owner = THIS_MODULE
};


static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
char buf[100];
snprintf(buf, sizeof(buf), "0x%016llx\n",
(unsigned long long)ath9k_hw_gettsf64(sc->sc_ah));
return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
}

static ssize_t write_file_tsf(struct file *file,
const char __user *user_buf,
size_t count, loff_t *ppos)
{
struct ath_softc *sc = file->private_data;
char buf[21];
unsigned long long tsf;

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

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

return count;
}

static const struct file_operations fops_tsf = {
.read = read_file_tsf,
.write = write_file_tsf,
.open = ath9k_debugfs_open,
.owner = THIS_MODULE
};


int ath9k_init_debug(struct ath_softc *sc)
{
sc->sc_debug.debug_mask = ath9k_debug;
Expand All @@ -247,6 +290,11 @@ int ath9k_init_debug(struct ath_softc *sc)
if (!sc->sc_debug.debugfs_interrupt)
goto err;

sc->sc_debug.debugfs_tsf = debugfs_create_file("tsf", S_IRUGO,
sc->sc_debug.debugfs_phy, sc, &fops_tsf);
if (!sc->sc_debug.debugfs_tsf)
goto err;

return 0;
err:
ath9k_exit_debug(sc);
Expand All @@ -255,6 +303,7 @@ int ath9k_init_debug(struct ath_softc *sc)

void ath9k_exit_debug(struct ath_softc *sc)
{
debugfs_remove(sc->sc_debug.debugfs_tsf);
debugfs_remove(sc->sc_debug.debugfs_interrupt);
debugfs_remove(sc->sc_debug.debugfs_dma);
debugfs_remove(sc->sc_debug.debugfs_phy);
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/net/wireless/ath9k/hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -3755,6 +3755,13 @@ u64 ath9k_hw_gettsf64(struct ath_hal *ah)
return tsf;
}

void ath9k_hw_settsf64(struct ath_hal *ah, u64 tsf64)
{
REG_WRITE(ah, AR_TSF_L32, 0x00000000);
REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff);
REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff);
}

void ath9k_hw_reset_tsf(struct ath_hal *ah)
{
int count;
Expand Down

0 comments on commit e6467e3

Please sign in to comment.