Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266577
b: refs/heads/master
c: addb44b
h: refs/heads/master
i:
  266575: 338e0e4
v: v3
  • Loading branch information
Kalle Valo committed Sep 2, 2011
1 parent 7745bd0 commit 6b35656
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 56 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: 939f1ccec80bd2dad5638de2a6819c66d4cb6f32
refs/heads/master: addb44be036dd5fc814be770ec4b90f08c820e76
6 changes: 3 additions & 3 deletions trunk/drivers/net/wireless/ath/ath6kl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,9 @@ enum htc_send_full_action ath6kl_tx_queue_full(struct htc_target *target,
struct htc_packet *packet);
void ath6kl_stop_txrx(struct ath6kl *ar);
void ath6kl_cleanup_amsdu_rxbufs(struct ath6kl *ar);
int ath6kl_access_datadiag(struct ath6kl *ar, u32 address,
u8 *data, u32 length, bool read);
int ath6kl_read_reg_diag(struct ath6kl *ar, u32 *address, u32 *data);
int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length);
int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value);
int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length);
void ath6kl_init_profile_info(struct ath6kl *ar);
void ath6kl_tx_data_cleanup(struct ath6kl *ar);
void ath6kl_stop_endpoint(struct net_device *dev, bool keep_profile,
Expand Down
16 changes: 6 additions & 10 deletions trunk/drivers/net/wireless/ath/ath6kl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,13 @@ static int ath6kl_set_host_app_area(struct ath6kl *ar)
address = ath6kl_get_hi_item_addr(ar, HI_ITEM(hi_app_host_interest));
address = TARG_VTOP(ar->target_type, address);

if (ath6kl_read_reg_diag(ar, &address, &data))
if (ath6kl_diag_read32(ar, address, &data))
return -EIO;

address = TARG_VTOP(ar->target_type, data);
host_app_area.wmi_protocol_ver = WMI_PROTOCOL_VERSION;
if (ath6kl_access_datadiag(ar, address,
(u8 *)&host_app_area,
sizeof(struct host_app_area), false))
if (ath6kl_diag_write(ar, address, (u8 *) &host_app_area,
sizeof(struct host_app_area)))
return -EIO;

return 0;
Expand Down Expand Up @@ -377,7 +376,7 @@ static void ath6kl_dump_target_assert_info(struct ath6kl *ar)
address = TARG_VTOP(ar->target_type, address);

/* read RAM location through diagnostic window */
status = ath6kl_read_reg_diag(ar, &address, &regdump_loc);
status = ath6kl_diag_read32(ar, address, &regdump_loc);

if (status || !regdump_loc) {
ath6kl_err("failed to get ptr to register dump area\n");
Expand All @@ -389,11 +388,8 @@ static void ath6kl_dump_target_assert_info(struct ath6kl *ar)
regdump_loc = TARG_VTOP(ar->target_type, regdump_loc);

/* fetch register dump data */
status = ath6kl_access_datadiag(ar,
regdump_loc,
(u8 *)&regdump_val[0],
REG_DUMP_COUNT_AR6003 * (sizeof(u32)),
true);
status = ath6kl_diag_read(ar, regdump_loc, (u8 *)&regdump_val[0],
REG_DUMP_COUNT_AR6003 * (sizeof(u32)));

if (status) {
ath6kl_err("failed to get register dump\n");
Expand Down
94 changes: 52 additions & 42 deletions trunk/drivers/net/wireless/ath/ath6kl/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,74 +229,84 @@ static int ath6kl_set_addrwin_reg(struct ath6kl *ar, u32 reg_addr, u32 addr)
}

/*
* Read from the ATH6KL through its diagnostic window. No cooperation from
* the Target is required for this.
* Read from the hardware through its diagnostic window. No cooperation
* from the firmware is required for this.
*/
int ath6kl_read_reg_diag(struct ath6kl *ar, u32 *address, u32 *data)
int ath6kl_diag_read32(struct ath6kl *ar, u32 address, u32 *value)
{
int status;
int ret;

/* set window register to start read cycle */
status = ath6kl_set_addrwin_reg(ar, WINDOW_READ_ADDR_ADDRESS,
*address);

if (status)
return status;
ret = ath6kl_set_addrwin_reg(ar, WINDOW_READ_ADDR_ADDRESS, address);
if (ret)
return ret;

/* read the data */
status = hif_read_write_sync(ar, WINDOW_DATA_ADDRESS, (u8 *)data,
sizeof(u32), HIF_RD_SYNC_BYTE_INC);
if (status) {
ath6kl_err("failed to read from window data addr\n");
return status;
ret = hif_read_write_sync(ar, WINDOW_DATA_ADDRESS, (u8 *) value,
sizeof(*value), HIF_RD_SYNC_BYTE_INC);
if (ret) {
ath6kl_warn("failed to read32 through diagnose window: %d\n",
ret);
return ret;
}

return status;
return 0;
}


/*
* Write to the ATH6KL through its diagnostic window. No cooperation from
* the Target is required for this.
*/
static int ath6kl_write_reg_diag(struct ath6kl *ar, u32 *address, u32 *data)
static int ath6kl_diag_write32(struct ath6kl *ar, u32 address, u32 value)
{
int status;
int ret;

/* set write data */
status = hif_read_write_sync(ar, WINDOW_DATA_ADDRESS, (u8 *)data,
sizeof(u32), HIF_WR_SYNC_BYTE_INC);
if (status) {
ath6kl_err("failed to write 0x%x to window data addr\n", *data);
return status;
ret = hif_read_write_sync(ar, WINDOW_DATA_ADDRESS, (u8 *) &value,
sizeof(value), HIF_WR_SYNC_BYTE_INC);
if (ret) {
ath6kl_err("failed to write 0x%x during diagnose window to 0x%d\n",
address, value);
return ret;
}

/* set window register, which starts the write cycle */
return ath6kl_set_addrwin_reg(ar, WINDOW_WRITE_ADDR_ADDRESS,
*address);
address);
}

int ath6kl_access_datadiag(struct ath6kl *ar, u32 address,
u8 *data, u32 length, bool read)
int ath6kl_diag_read(struct ath6kl *ar, u32 address, void *data, u32 length)
{
u32 count;
int status = 0;
u32 count, *buf = data;
int ret;

for (count = 0; count < length; count += 4, address += 4) {
if (read) {
status = ath6kl_read_reg_diag(ar, &address,
(u32 *) &data[count]);
if (status)
break;
} else {
status = ath6kl_write_reg_diag(ar, &address,
(u32 *) &data[count]);
if (status)
break;
}
if (WARN_ON(length % 4))
return -EINVAL;

for (count = 0; count < length / 4; count++, address += 4) {
ret = ath6kl_diag_read32(ar, address, &buf[count]);
if (ret)
return ret;
}

return status;
return 0;
}

int ath6kl_diag_write(struct ath6kl *ar, u32 address, void *data, u32 length)
{
u32 count, *buf = data;
int ret;

if (WARN_ON(length % 4))
return -EINVAL;

for (count = 0; count < length / 4; count++, address += 4) {
ret = ath6kl_diag_write32(ar, address, buf[count]);
if (ret)
return ret;
}

return 0;
}

/* FIXME: move to a better place, target.h? */
Expand Down Expand Up @@ -328,7 +338,7 @@ static void ath6kl_reset_device(struct ath6kl *ar, u32 target_type,
break;
}

status = ath6kl_write_reg_diag(ar, &address, &data);
status = ath6kl_diag_write32(ar, address, data);

if (status)
ath6kl_err("failed to reset target\n");
Expand Down

0 comments on commit 6b35656

Please sign in to comment.