From: Alexander Kochetkov <al.kochet@gmail.com>
To: Vinod Koul <vinod.koul@intel.com>,
Dan Williams <dan.j.williams@intel.com>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Caesar Wang <wxt@rock-chips.com>,
Doug Anderson <dianders@chromium.org>,
linux-rockchip@lists.infradead.org,
Heiko Stuebner <heiko@sntech.de>,
Alexander Kochetkov <al.kochet@gmail.com>
Subject: [PATCH 1/3 v2] dmaengine: pl330: cleanup quirk pass code
Date: Thu, 10 Mar 2016 13:57:34 +0300 [thread overview]
Message-ID: <1457607456-30458-1-git-send-email-al.kochet@gmail.com> (raw)
In-Reply-To: <1455798674-10186-1-git-send-email-al.kochet@gmail.com>
The patch partially revert changes introduced by 271e1b86e691
"dmaengine: pl330: add quirk for broken no flushp"
The patch add 'quirk' member to 'struct _xfer_spec' and
remove 'struct pl330_dmac *pl330' parameter from
many intermediate functions. The patch is intended to
hide 'struct pl330_dmac' implementation from Microcode
generation functions.
The patch is here to allow easy backporting following
patches to longterm linux 4.1.x.
Signed-off-by: Alexander Kochetkov <al.kochet@gmail.com>
Reviewed-by: Caesar Wang <wxt@rock-chips.com>
---
drivers/dma/pl330.c | 59 ++++++++++++++++++++++++---------------------------
1 file changed, 28 insertions(+), 31 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 372b435..4abbc71 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -534,6 +534,7 @@ struct dma_pl330_desc {
struct _xfer_spec {
u32 ccr;
struct dma_pl330_desc *desc;
+ int quirks;
};
static inline bool _queue_empty(struct pl330_thread *thrd)
@@ -1151,14 +1152,13 @@ static inline int _ldst_memtomem(unsigned dry_run, u8 buf[],
return off;
}
-static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run,
- u8 buf[], const struct _xfer_spec *pxs,
- int cyc)
+static inline int _ldst_devtomem(unsigned dry_run, u8 buf[],
+ const struct _xfer_spec *pxs, int cyc)
{
int off = 0;
enum pl330_cond cond;
- if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)
+ if (pxs->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)
cond = BURST;
else
cond = SINGLE;
@@ -1168,7 +1168,7 @@ static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run,
off += _emit_LDP(dry_run, &buf[off], cond, pxs->desc->peri);
off += _emit_ST(dry_run, &buf[off], ALWAYS);
- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP))
+ if (!(pxs->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP))
off += _emit_FLUSHP(dry_run, &buf[off],
pxs->desc->peri);
}
@@ -1176,14 +1176,13 @@ static inline int _ldst_devtomem(struct pl330_dmac *pl330, unsigned dry_run,
return off;
}
-static inline int _ldst_memtodev(struct pl330_dmac *pl330,
- unsigned dry_run, u8 buf[],
- const struct _xfer_spec *pxs, int cyc)
+static inline int _ldst_memtodev(unsigned dry_run, u8 buf[],
+ const struct _xfer_spec *pxs, int cyc)
{
int off = 0;
enum pl330_cond cond;
- if (pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)
+ if (pxs->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP)
cond = BURST;
else
cond = SINGLE;
@@ -1193,7 +1192,7 @@ static inline int _ldst_memtodev(struct pl330_dmac *pl330,
off += _emit_LD(dry_run, &buf[off], ALWAYS);
off += _emit_STP(dry_run, &buf[off], cond, pxs->desc->peri);
- if (!(pl330->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP))
+ if (!(pxs->quirks & PL330_QUIRK_BROKEN_NO_FLUSHP))
off += _emit_FLUSHP(dry_run, &buf[off],
pxs->desc->peri);
}
@@ -1201,17 +1200,17 @@ static inline int _ldst_memtodev(struct pl330_dmac *pl330,
return off;
}
-static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
+static int _bursts(unsigned dry_run, u8 buf[],
const struct _xfer_spec *pxs, int cyc)
{
int off = 0;
switch (pxs->desc->rqtype) {
case DMA_MEM_TO_DEV:
- off += _ldst_memtodev(pl330, dry_run, &buf[off], pxs, cyc);
+ off += _ldst_memtodev(dry_run, &buf[off], pxs, cyc);
break;
case DMA_DEV_TO_MEM:
- off += _ldst_devtomem(pl330, dry_run, &buf[off], pxs, cyc);
+ off += _ldst_devtomem(dry_run, &buf[off], pxs, cyc);
break;
case DMA_MEM_TO_MEM:
off += _ldst_memtomem(dry_run, &buf[off], pxs, cyc);
@@ -1225,7 +1224,7 @@ static int _bursts(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
}
/* Returns bytes consumed and updates bursts */
-static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
+static inline int _loop(unsigned dry_run, u8 buf[],
unsigned long *bursts, const struct _xfer_spec *pxs)
{
int cyc, cycmax, szlp, szlpend, szbrst, off;
@@ -1233,7 +1232,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
struct _arg_LPEND lpend;
if (*bursts == 1)
- return _bursts(pl330, dry_run, buf, pxs, 1);
+ return _bursts(dry_run, buf, pxs, 1);
/* Max iterations possible in DMALP is 256 */
if (*bursts >= 256*256) {
@@ -1251,7 +1250,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
}
szlp = _emit_LP(1, buf, 0, 0);
- szbrst = _bursts(pl330, 1, buf, pxs, 1);
+ szbrst = _bursts(1, buf, pxs, 1);
lpend.cond = ALWAYS;
lpend.forever = false;
@@ -1283,7 +1282,7 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
off += _emit_LP(dry_run, &buf[off], 1, lcnt1);
ljmp1 = off;
- off += _bursts(pl330, dry_run, &buf[off], pxs, cyc);
+ off += _bursts(dry_run, &buf[off], pxs, cyc);
lpend.cond = ALWAYS;
lpend.forever = false;
@@ -1306,9 +1305,8 @@ static inline int _loop(struct pl330_dmac *pl330, unsigned dry_run, u8 buf[],
return off;
}
-static inline int _setup_loops(struct pl330_dmac *pl330,
- unsigned dry_run, u8 buf[],
- const struct _xfer_spec *pxs)
+static inline int _setup_loops(unsigned dry_run, u8 buf[],
+ const struct _xfer_spec *pxs)
{
struct pl330_xfer *x = &pxs->desc->px;
u32 ccr = pxs->ccr;
@@ -1317,16 +1315,15 @@ static inline int _setup_loops(struct pl330_dmac *pl330,
while (bursts) {
c = bursts;
- off += _loop(pl330, dry_run, &buf[off], &c, pxs);
+ off += _loop(dry_run, &buf[off], &c, pxs);
bursts -= c;
}
return off;
}
-static inline int _setup_xfer(struct pl330_dmac *pl330,
- unsigned dry_run, u8 buf[],
- const struct _xfer_spec *pxs)
+static inline int _setup_xfer(unsigned dry_run, u8 buf[],
+ const struct _xfer_spec *pxs)
{
struct pl330_xfer *x = &pxs->desc->px;
int off = 0;
@@ -1337,7 +1334,7 @@ static inline int _setup_xfer(struct pl330_dmac *pl330,
off += _emit_MOV(dry_run, &buf[off], DAR, x->dst_addr);
/* Setup Loop(s) */
- off += _setup_loops(pl330, dry_run, &buf[off], pxs);
+ off += _setup_loops(dry_run, &buf[off], pxs);
return off;
}
@@ -1346,9 +1343,8 @@ static inline int _setup_xfer(struct pl330_dmac *pl330,
* A req is a sequence of one or more xfer units.
* Returns the number of bytes taken to setup the MC for the req.
*/
-static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run,
- struct pl330_thread *thrd, unsigned index,
- struct _xfer_spec *pxs)
+static int _setup_req(unsigned dry_run, struct pl330_thread *thrd,
+ unsigned index, struct _xfer_spec *pxs)
{
struct _pl330_req *req = &thrd->req[index];
struct pl330_xfer *x;
@@ -1365,7 +1361,7 @@ static int _setup_req(struct pl330_dmac *pl330, unsigned dry_run,
if (x->bytes % (BRST_SIZE(pxs->ccr) * BRST_LEN(pxs->ccr)))
return -EINVAL;
- off += _setup_xfer(pl330, dry_run, &buf[off], pxs);
+ off += _setup_xfer(dry_run, &buf[off], pxs);
/* DMASEV peripheral/event */
off += _emit_SEV(dry_run, &buf[off], thrd->ev);
@@ -1457,9 +1453,10 @@ static int pl330_submit_req(struct pl330_thread *thrd,
xs.ccr = ccr;
xs.desc = desc;
+ xs.quirks = pl330->quirks;
/* First dry run to check if req is acceptable */
- ret = _setup_req(pl330, 1, thrd, idx, &xs);
+ ret = _setup_req(1, thrd, idx, &xs);
if (ret < 0)
goto xfer_exit;
@@ -1473,7 +1470,7 @@ static int pl330_submit_req(struct pl330_thread *thrd,
/* Hook the request */
thrd->lstenq = idx;
thrd->req[idx].desc = desc;
- _setup_req(pl330, 0, thrd, idx, &xs);
+ _setup_req(0, thrd, idx, &xs);
ret = 0;
--
1.7.9.5
next prev parent reply other threads:[~2016-03-10 10:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-18 12:31 Cleanups and improvenments for pl330 Alexander Kochetkov
2016-02-18 12:31 ` [PATCH 1/4] dmaengine: pl330: cleanup quirk pass code Alexander Kochetkov
2016-02-18 12:31 ` [PATCH 2/4] dmaengine: pl330: cleanup brst_len usage Alexander Kochetkov
2016-02-18 12:31 ` [PATCH 3/4] dmaengine: pl330: don't emit code for one iteration loop Alexander Kochetkov
2016-02-18 12:31 ` [PATCH 4/4] dmaengine: pl330: make cyclic transfer free runnable Alexander Kochetkov
2016-03-08 3:03 ` Cleanups and improvenments for pl330 Vinod Koul
2016-03-10 10:57 ` Alexander Kochetkov [this message]
2016-03-10 10:57 ` [PATCH 2/3 v2] dmaengine: pl330: don't emit code for one iteration loop Alexander Kochetkov
2016-03-10 10:57 ` [PATCH 3/3 v2] dmaengine: pl330: make cyclic transfer free runnable Alexander Kochetkov
2016-03-10 11:02 ` Cleanups and improvenments for pl330 v3 Alexander Kochetkov
2016-03-10 11:02 ` [PATCH 1/3 v3] dmaengine: pl330: cleanup quirk pass code Alexander Kochetkov
2016-03-10 11:02 ` [PATCH 2/3 v3] dmaengine: pl330: don't emit code for one iteration loop Alexander Kochetkov
2016-03-10 11:02 ` [PATCH 3/3 v3] dmaengine: pl330: make cyclic transfer free runnable Alexander Kochetkov
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=1457607456-30458-1-git-send-email-al.kochet@gmail.com \
--to=al.kochet@gmail.com \
--cc=dan.j.williams@intel.com \
--cc=dianders@chromium.org \
--cc=dmaengine@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=vinod.koul@intel.com \
--cc=wxt@rock-chips.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;
as well as URLs for NNTP newsgroup(s).