From: robherring2@gmail•com (Rob Herring)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v2] DMA: fix AMBA PL08x compilation issue with 64bit DMA address type
Date: Mon, 19 Aug 2013 08:26:13 -0500 [thread overview]
Message-ID: <52121CF5.1070905@gmail.com> (raw)
In-Reply-To: <1376907568-18689-1-git-send-email-andre.przywara@linaro.org>
On 08/19/2013 05:19 AM, Andre Przywara wrote:
> When dma_addr_t is 64 bits long, compilation of the AMBA PL08x DMA
> driver breaks due to a missing 64bit%8bit modulo operation.
> Looking more closely the divisor in these operations can only be
> 1, 2 or 4, so the full featured '%' modulo operation is overkill and
> can be replaced with simple bit masking.
>
> Change from v1:
> Replace open-coded function with existing IS_ALIGNED macro and use a
> macro around that to avoid a line becoming too long.
>
> Signed-off-by: Andre Przywara <andre.przywara@linaro•org>
Vinod,
Can I have your ack and take this thru arm-soc tree. I'm dependent on
this to select 64-bit dma_addr_t for highbank.
Rob
> ---
> drivers/dma/amba-pl08x.c | 14 ++++++++------
> 1 file changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
> index bce5fbf..bff41d4 100644
> --- a/drivers/dma/amba-pl08x.c
> +++ b/drivers/dma/amba-pl08x.c
> @@ -133,6 +133,8 @@ struct pl08x_bus_data {
> u8 buswidth;
> };
>
> +#define IS_BUS_ALIGNED(bus) IS_ALIGNED((bus)->addr, (bus)->buswidth)
> +
> /**
> * struct pl08x_phy_chan - holder for the physical channels
> * @id: physical index to this channel
> @@ -889,8 +891,8 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
> return 0;
> }
>
> - if ((bd.srcbus.addr % bd.srcbus.buswidth) ||
> - (bd.dstbus.addr % bd.dstbus.buswidth)) {
> + if (!IS_BUS_ALIGNED(&bd.srcbus) ||
> + !IS_BUS_ALIGNED(&bd.dstbus)) {
> dev_err(&pl08x->adev->dev,
> "%s src & dst address must be aligned to src"
> " & dst width if peripheral is flow controller",
> @@ -911,9 +913,9 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
> */
> if (bd.remainder < mbus->buswidth)
> early_bytes = bd.remainder;
> - else if ((mbus->addr) % (mbus->buswidth)) {
> - early_bytes = mbus->buswidth - (mbus->addr) %
> - (mbus->buswidth);
> + else if (!IS_BUS_ALIGNED(mbus)) {
> + early_bytes = mbus->buswidth -
> + (mbus->addr & (mbus->buswidth - 1));
> if ((bd.remainder - early_bytes) < mbus->buswidth)
> early_bytes = bd.remainder;
> }
> @@ -931,7 +933,7 @@ static int pl08x_fill_llis_for_desc(struct pl08x_driver_data *pl08x,
> * Master now aligned
> * - if slave is not then we must set its width down
> */
> - if (sbus->addr % sbus->buswidth) {
> + if (!IS_BUS_ALIGNED(sbus)) {
> dev_dbg(&pl08x->adev->dev,
> "%s set down bus width to one byte\n",
> __func__);
>
next prev parent reply other threads:[~2013-08-19 13:26 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-14 12:52 [PATCH 0/2] DMA: AMBA PL08x DMA driver fixes due to ARCH_DMA_ADDR_T_64BIT Andre Przywara
2013-08-14 12:52 ` [PATCH 1/2] DMA: fix AMBA PL08x driver issue with 64bit DMA address type Andre Przywara
2013-08-14 13:00 ` Russell King - ARM Linux
2013-08-14 19:13 ` Rob Herring
2013-08-15 21:07 ` Andre Przywara
2013-08-15 21:15 ` Russell King - ARM Linux
2013-08-19 10:19 ` [PATCH v2] DMA: fix AMBA PL08x compilation " Andre Przywara
2013-08-19 13:26 ` Rob Herring [this message]
2013-08-21 6:17 ` Vinod Koul
2013-08-21 21:01 ` [PATCH 1/2] DMA: fix AMBA PL08x driver " Linus Walleij
2013-08-21 21:22 ` Andre Przywara
2013-08-21 21:49 ` Matt Sealey
2013-08-14 12:52 ` [PATCH 2/2] DMA: fix printk warning in AMBA PL08x DMA driver Andre Przywara
2013-08-14 13:00 ` Russell King - ARM Linux
2013-08-14 13:00 ` [PATCH 0/2] DMA: AMBA PL08x DMA driver fixes due to ARCH_DMA_ADDR_T_64BIT Russell King - ARM Linux
2013-08-14 14:05 ` Rob Herring
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=52121CF5.1070905@gmail.com \
--to=robherring2@gmail$(echo .)com \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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