From: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
To: linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org
Cc: Martyn Welch <martyn.welch@ge.com>,
Manohar Vanga <manohar.vanga@gmail.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Igor Alekseev <igor.alekseev@itep.ru>,
Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Subject: [PATCHv2 04/16] vme: stop DMA transfer on interruption
Date: Thu, 28 May 2015 12:31:10 +0300 [thread overview]
Message-ID: <1432805482-24129-5-git-send-email-dmitry.kalinkin@gmail.com> (raw)
In-Reply-To: <1432805482-24129-1-git-send-email-dmitry.kalinkin@gmail.com>
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
---
drivers/vme/bridges/vme_ca91cx42.c | 17 ++++++++++++++---
drivers/vme/bridges/vme_tsi148.c | 15 +++++++++++++--
2 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/drivers/vme/bridges/vme_ca91cx42.c b/drivers/vme/bridges/vme_ca91cx42.c
index 18078ec..e9bd657 100644
--- a/drivers/vme/bridges/vme_ca91cx42.c
+++ b/drivers/vme/bridges/vme_ca91cx42.c
@@ -1192,7 +1192,7 @@ static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
{
struct vme_dma_resource *ctrlr;
struct ca91cx42_dma_entry *entry;
- int retval = 0;
+ int retval;
dma_addr_t bus_addr;
u32 val;
struct device *dev;
@@ -1245,8 +1245,18 @@ static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
iowrite32(val, bridge->base + DGCS);
- wait_event_interruptible(bridge->dma_queue,
- ca91cx42_dma_busy(ctrlr->parent));
+ retval = wait_event_interruptible(bridge->dma_queue,
+ ca91cx42_dma_busy(ctrlr->parent));
+
+ if (retval) {
+ val = ioread32(bridge->base + DGCS);
+ iowrite32(val | CA91CX42_DGCS_STOP_REQ, bridge->base + DGCS);
+ /* Wait for the operation to abort */
+ wait_event(bridge->dma_queue,
+ ca91cx42_dma_busy(ctrlr->parent));
+ retval = -EINTR;
+ goto exit;
+ }
/*
* Read status register, this register is valid until we kick off a
@@ -1261,6 +1271,7 @@ static int ca91cx42_dma_list_exec(struct vme_dma_list *list)
val = ioread32(bridge->base + DCTL);
}
+exit:
/* Remove list from running list */
mutex_lock(&ctrlr->mtx);
list_del(&list->list);
diff --git a/drivers/vme/bridges/vme_tsi148.c b/drivers/vme/bridges/vme_tsi148.c
index 6562348..fb1e7ad 100644
--- a/drivers/vme/bridges/vme_tsi148.c
+++ b/drivers/vme/bridges/vme_tsi148.c
@@ -1892,7 +1892,7 @@ static int tsi148_dma_busy(struct vme_bridge *tsi148_bridge, int channel)
static int tsi148_dma_list_exec(struct vme_dma_list *list)
{
struct vme_dma_resource *ctrlr;
- int channel, retval = 0;
+ int channel, retval;
struct tsi148_dma_entry *entry;
u32 bus_addr_high, bus_addr_low;
u32 val, dctlreg = 0;
@@ -1942,9 +1942,19 @@ static int tsi148_dma_list_exec(struct vme_dma_list *list)
iowrite32be(dctlreg | TSI148_LCSR_DCTL_DGO, bridge->base +
TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DCTL);
- wait_event_interruptible(bridge->dma_queue[channel],
+ retval = wait_event_interruptible(bridge->dma_queue[channel],
tsi148_dma_busy(ctrlr->parent, channel));
+ if (retval) {
+ iowrite32be(dctlreg | TSI148_LCSR_DCTL_ABT, bridge->base +
+ TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DCTL);
+ /* Wait for the operation to abort */
+ wait_event(bridge->dma_queue[channel],
+ tsi148_dma_busy(ctrlr->parent, channel));
+ retval = -EINTR;
+ goto exit;
+ }
+
/*
* Read status register, this register is valid until we kick off a
* new transfer.
@@ -1957,6 +1967,7 @@ static int tsi148_dma_list_exec(struct vme_dma_list *list)
retval = -EIO;
}
+exit:
/* Remove list from running list */
mutex_lock(&ctrlr->mtx);
list_del(&list->list);
--
1.8.3.1
next prev parent reply other threads:[~2015-05-28 9:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-28 9:31 [PATCHv2 00/16] vme DMA and user space driver improvements Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 01/16] Documentation: mention vme_master_mmap() in VME API Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 02/16] vme: tsi148: fix DMA lists longer that one item Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 03/16] vme: tsi148: fix first DMA item mapping Dmitry Kalinkin
2015-05-28 9:31 ` Dmitry Kalinkin [this message]
2015-05-28 9:31 ` [PATCHv2 05/16] staging: vme_user: refactor llseek to switch(){} Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 06/16] vme: check for A64 overflow in vme_check_window() Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 07/16] vme: export vme_check_window() Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 08/16] staging: vme_user: provide DMA functionality Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 09/16] vme: ca91cx42: return error code on DMA error Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 10/16] vme: ca91cx42: fix LM_CTL address mask Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 11/16] staging: vme_user: remove unused counters Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 12/16] staging: vme_user: remove forward declarations Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 13/16] staging: vme_user: remove open/release Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 14/16] staging: vme_user: remove buf_unalloc helper Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 15/16] vme: tsi148: depend on HAS_DMA for Kconfig Dmitry Kalinkin
2015-05-28 9:31 ` [PATCHv2 16/16] vme: provide uapi header Dmitry Kalinkin
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=1432805482-24129-5-git-send-email-dmitry.kalinkin@gmail.com \
--to=dmitry.kalinkin@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=igor.alekseev@itep.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=manohar.vanga@gmail.com \
--cc=martyn.welch@ge.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®