From: Kalle Valo <kvalo@qca.qualcomm.com> To: <ath10k@lists.infradead.org> Cc: <linux-wireless@vger.kernel.org> Subject: [PATCH 4/7] ath10k: add ath10k_sdio_write() Date: Wed, 5 Apr 2017 10:07:08 +0300 [thread overview] Message-ID: <149137602808.4898.9375951462565501167.stgit@potku.adurom.net> (raw) In-Reply-To: <149137591893.4898.2318291094351440261.stgit@potku.adurom.net> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> --- drivers/net/wireless/ath/ath10k/sdio.c | 48 +++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index bbd8317de861..beb1749672f0 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -368,6 +368,34 @@ static int ath10k_sdio_read(struct ath10k *ar, u32 addr, void *buf, size_t len) return ret; } +static int ath10k_sdio_write(struct ath10k *ar, u32 addr, const void *buf, size_t len) +{ + struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + struct sdio_func *func = ar_sdio->func; + int ret; + + sdio_claim_host(func); + + /* For some reason toio() doesn't have const for the buffer, need + * an ugly hack to workaround that. + */ + ret = sdio_memcpy_toio(func, addr, (void *)buf, len); + if (ret) { + ath10k_warn(ar, "failed to write to address 0x%x: %d\n", + addr, ret); + goto out; + } + + ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio write addr 0x%x buf 0x%p len %zu\n", + addr, buf, len); + ath10k_dbg_dump(ar, ATH10K_DBG_SDIO_DUMP, NULL, "sdio write ", buf, len); + +out: + sdio_release_host(func); + + return ret; +} + /* HIF mbox functions */ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar, @@ -1131,9 +1159,7 @@ static int ath10k_sdio_bmi_exchange_msg(struct ath10k *ar, addr = ar_sdio->mbox_info.htc_addr; memcpy(ar_sdio->bmi_buf, req, req_len); - ret = ath10k_sdio_read_write_sync(ar, addr, ar_sdio->bmi_buf, - req_len, - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, addr, ar_sdio->bmi_buf, req_len); if (ret) { ath10k_warn(ar, "unable to send the bmi data to the device: %d\n", @@ -1361,10 +1387,8 @@ static int ath10k_sdio_hif_disable_intrs(struct ath10k *ar) mutex_lock(&irq_data->mtx); memset(regs, 0, sizeof(*regs)); - ret = ath10k_sdio_read_write_sync(ar, - MBOX_INT_STATUS_ENABLE_ADDRESS, - ®s->int_status_en, sizeof(*regs), - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, MBOX_INT_STATUS_ENABLE_ADDRESS, + ®s->int_status_en, sizeof(*regs)); if (ret) ath10k_warn(ar, "unable to disable sdio interrupts: %d\n", ret); @@ -1498,10 +1522,8 @@ static int ath10k_sdio_hif_enable_intrs(struct ath10k *ar) FIELD_PREP(MBOX_COUNTER_INT_STATUS_ENABLE_BIT_MASK, ATH10K_SDIO_TARGET_DEBUG_INTR_MASK); - ret = ath10k_sdio_read_write_sync(ar, - MBOX_INT_STATUS_ENABLE_ADDRESS, - ®s->int_status_en, sizeof(*regs), - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, MBOX_INT_STATUS_ENABLE_ADDRESS, + ®s->int_status_en, sizeof(*regs)); if (ret) ath10k_warn(ar, "failed to update mbox interrupt status register : %d\n", @@ -1596,9 +1618,7 @@ static int ath10k_sdio_hif_diag_write_mem(struct ath10k *ar, u32 address, int ret; /* set write data */ - ret = ath10k_sdio_read_write_sync(ar, MBOX_WINDOW_DATA_ADDRESS, - (u8 *)data, nbytes, - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, MBOX_WINDOW_DATA_ADDRESS, data, nbytes); if (ret) { ath10k_warn(ar, "failed to write 0x%p to mbox window data addrress: %d\n",
WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@qca.qualcomm.com> To: ath10k@lists.infradead.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH 4/7] ath10k: add ath10k_sdio_write() Date: Wed, 5 Apr 2017 10:07:08 +0300 [thread overview] Message-ID: <149137602808.4898.9375951462565501167.stgit@potku.adurom.net> (raw) In-Reply-To: <149137591893.4898.2318291094351440261.stgit@potku.adurom.net> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com> --- drivers/net/wireless/ath/ath10k/sdio.c | 48 +++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/sdio.c b/drivers/net/wireless/ath/ath10k/sdio.c index bbd8317de861..beb1749672f0 100644 --- a/drivers/net/wireless/ath/ath10k/sdio.c +++ b/drivers/net/wireless/ath/ath10k/sdio.c @@ -368,6 +368,34 @@ static int ath10k_sdio_read(struct ath10k *ar, u32 addr, void *buf, size_t len) return ret; } +static int ath10k_sdio_write(struct ath10k *ar, u32 addr, const void *buf, size_t len) +{ + struct ath10k_sdio *ar_sdio = ath10k_sdio_priv(ar); + struct sdio_func *func = ar_sdio->func; + int ret; + + sdio_claim_host(func); + + /* For some reason toio() doesn't have const for the buffer, need + * an ugly hack to workaround that. + */ + ret = sdio_memcpy_toio(func, addr, (void *)buf, len); + if (ret) { + ath10k_warn(ar, "failed to write to address 0x%x: %d\n", + addr, ret); + goto out; + } + + ath10k_dbg(ar, ATH10K_DBG_SDIO, "sdio write addr 0x%x buf 0x%p len %zu\n", + addr, buf, len); + ath10k_dbg_dump(ar, ATH10K_DBG_SDIO_DUMP, NULL, "sdio write ", buf, len); + +out: + sdio_release_host(func); + + return ret; +} + /* HIF mbox functions */ static int ath10k_sdio_mbox_rx_process_packet(struct ath10k *ar, @@ -1131,9 +1159,7 @@ static int ath10k_sdio_bmi_exchange_msg(struct ath10k *ar, addr = ar_sdio->mbox_info.htc_addr; memcpy(ar_sdio->bmi_buf, req, req_len); - ret = ath10k_sdio_read_write_sync(ar, addr, ar_sdio->bmi_buf, - req_len, - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, addr, ar_sdio->bmi_buf, req_len); if (ret) { ath10k_warn(ar, "unable to send the bmi data to the device: %d\n", @@ -1361,10 +1387,8 @@ static int ath10k_sdio_hif_disable_intrs(struct ath10k *ar) mutex_lock(&irq_data->mtx); memset(regs, 0, sizeof(*regs)); - ret = ath10k_sdio_read_write_sync(ar, - MBOX_INT_STATUS_ENABLE_ADDRESS, - ®s->int_status_en, sizeof(*regs), - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, MBOX_INT_STATUS_ENABLE_ADDRESS, + ®s->int_status_en, sizeof(*regs)); if (ret) ath10k_warn(ar, "unable to disable sdio interrupts: %d\n", ret); @@ -1498,10 +1522,8 @@ static int ath10k_sdio_hif_enable_intrs(struct ath10k *ar) FIELD_PREP(MBOX_COUNTER_INT_STATUS_ENABLE_BIT_MASK, ATH10K_SDIO_TARGET_DEBUG_INTR_MASK); - ret = ath10k_sdio_read_write_sync(ar, - MBOX_INT_STATUS_ENABLE_ADDRESS, - ®s->int_status_en, sizeof(*regs), - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, MBOX_INT_STATUS_ENABLE_ADDRESS, + ®s->int_status_en, sizeof(*regs)); if (ret) ath10k_warn(ar, "failed to update mbox interrupt status register : %d\n", @@ -1596,9 +1618,7 @@ static int ath10k_sdio_hif_diag_write_mem(struct ath10k *ar, u32 address, int ret; /* set write data */ - ret = ath10k_sdio_read_write_sync(ar, MBOX_WINDOW_DATA_ADDRESS, - (u8 *)data, nbytes, - HIF_WR_SYNC_BYTE_INC); + ret = ath10k_sdio_write(ar, MBOX_WINDOW_DATA_ADDRESS, data, nbytes); if (ret) { ath10k_warn(ar, "failed to write 0x%p to mbox window data addrress: %d\n", _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k
next prev parent reply other threads:[~2017-04-05 7:11 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-04-05 7:06 [PATCH 0/7] ath10k: remove ath10k_sdio_io() Kalle Valo 2017-04-05 7:06 ` Kalle Valo 2017-04-05 7:06 ` [PATCH 1/7] ath10k: add ath10k_sdio_write32/read32() Kalle Valo 2017-04-05 7:06 ` [PATCH 2/7] ath10k: add ath10k_sdio_writesb() Kalle Valo 2017-04-05 7:06 ` Kalle Valo 2017-04-05 7:06 ` [PATCH 3/7] ath10k: add ath10k_sdio_read() Kalle Valo 2017-04-05 7:06 ` Kalle Valo 2017-04-05 7:07 ` Kalle Valo [this message] 2017-04-05 7:07 ` [PATCH 4/7] ath10k: add ath10k_sdio_write() Kalle Valo 2017-04-05 7:07 ` [PATCH 5/7] ath10k: add ath10k_sdio_readsb() Kalle Valo 2017-04-05 7:07 ` Kalle Valo 2017-04-05 7:07 ` [PATCH 6/7] ath10k: convert __ath10k_sdio_write_async() to use ath10k_sdio_write() Kalle Valo 2017-04-05 7:07 ` Kalle Valo 2017-04-05 7:07 ` [PATCH 7/7] ath10k: remove unused sdio wrappers Kalle Valo 2017-04-05 7:07 ` Kalle Valo 2017-04-05 16:08 ` [PATCH 0/7] ath10k: remove ath10k_sdio_io() Erik Stromdahl 2017-04-05 16:08 ` Erik Stromdahl 2017-04-05 16:53 ` Kalle Valo 2017-04-05 16:53 ` Kalle Valo 2017-04-05 17:14 ` Erik Stromdahl 2017-04-05 17:14 ` Erik Stromdahl 2017-04-09 18:04 ` Erik Stromdahl 2017-04-09 18:04 ` Erik Stromdahl
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=149137602808.4898.9375951462565501167.stgit@potku.adurom.net \ --to=kvalo@qca.qualcomm.com \ --cc=ath10k@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.