From patchwork Wed Aug 14 12:52:08 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 2844468 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 736DABF546 for ; Wed, 14 Aug 2013 12:55:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4683C205BE for ; Wed, 14 Aug 2013 12:55:06 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6A6C2205BB for ; Wed, 14 Aug 2013 12:55:01 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9aal-000149-TN; Wed, 14 Aug 2013 12:54:24 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9aaT-0008Cj-DJ; Wed, 14 Aug 2013 12:54:05 +0000 Received: from mail-bk0-f42.google.com ([209.85.214.42]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V9aa7-000887-1P for linux-arm-kernel@lists.infradead.org; Wed, 14 Aug 2013 12:53:45 +0000 Received: by mail-bk0-f42.google.com with SMTP id my10so2782404bkb.15 for ; Wed, 14 Aug 2013 05:53:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Dp/IayxIfXclw1gNvodL9YlXcR4zINGVHUaYlxK3BnU=; b=k6NOv8X2688Scn5DQYCP8YD6kUJ3flYrsYBIODc+ft6L+IN+2XOYKeT9xBfnG/P5OV ozI8iFfYQZHd/SWg7edpJH4suSt409VEI/0LuE+DFSCzQVUTd9vVXJ2xNxV8JxlXMQz0 er8tKp7CxxFSI8fxDXkWfmEemWIJHKM4YCWwBuKl9gxabIhsLj1t65QycFdDvmy0IOjR 8X/sTjAbMViCMAxwGz8BTPv+IY2xP0ZVvoUG7Frrmv1skGZaBWXy6RDOjgSc96WOpU3+ MmESuQ8QNxhN5zcSR3XIECkwN/mOHXZB3aDQfaHkLGSgVVf/lVXqbJY3RQSUjP7mO14y MpkQ== X-Gm-Message-State: ALoCoQlbE1QY975WUQNRoMf4F5qVhHAptQDeFJiTAfsjH+zszV0reShrbg1no9gH/7aju71S2cRO X-Received: by 10.204.240.11 with SMTP id ky11mr6867981bkb.21.1376484801391; Wed, 14 Aug 2013 05:53:21 -0700 (PDT) Received: from slackpad.drs.calxeda.com (f053087239.adsl.alicedsl.de. [78.53.87.239]) by mx.google.com with ESMTPSA id kk2sm3437371bkb.10.2013.08.14.05.53.19 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 05:53:20 -0700 (PDT) From: Andre Przywara To: peter.pearse@arm.com, linus.walleij@linaro.org, linux@arm.linux.org.uk Subject: [PATCH 1/2] DMA: fix AMBA PL08x driver issue with 64bit DMA address type Date: Wed, 14 Aug 2013 14:52:08 +0200 Message-Id: <1376484729-11826-2-git-send-email-andre.przywara@linaro.org> X-Mailer: git-send-email 1.7.12.1 In-Reply-To: <1376484729-11826-1-git-send-email-andre.przywara@linaro.org> References: <1376484729-11826-1-git-send-email-andre.przywara@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130814_085343_255021_DF9360E9 X-CRM114-Status: GOOD ( 11.64 ) X-Spam-Score: -2.6 (--) Cc: vinod.koul@intel.com, Andre Przywara , rob.herring@calxeda.com, linux-arm-kernel@lists.infradead.org, patches@linaro.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In Rob's recent pull request the patch ARM: highbank: select ARCH_DMA_ADDR_T_64BIT for LPAE promotes dma_addr_t to 64bit, which breaks compilation of the AMBA PL08x DMA driver. GCC has no function for the 64bit/8bit modulo operation. Looking more closely the divisor can only be 1, 2 or 4, so the full featured '%' modulo operation is overkill and can be replaced by simple bit masking. Signed-off-by: Andre Przywara --- drivers/dma/amba-pl08x.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index 06fe45c..29e1cf9 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c @@ -286,6 +286,11 @@ static inline struct pl08x_txd *to_pl08x_txd(struct dma_async_tx_descriptor *tx) return container_of(tx, struct pl08x_txd, vd.tx); } +static int bus_addr_offset(struct pl08x_bus_data *bus) +{ + return bus->addr & (bus->buswidth - 1); +} + /* * Mux handling. * @@ -886,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 (bus_addr_offset(&bd.srcbus) || + bus_addr_offset(&bd.dstbus)) { dev_err(&pl08x->adev->dev, "%s src & dst address must be aligned to src" " & dst width if peripheral is flow controller", @@ -908,9 +913,8 @@ 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 (bus_addr_offset(mbus)) { + early_bytes = mbus->buswidth - bus_addr_offset(mbus); if ((bd.remainder - early_bytes) < mbus->buswidth) early_bytes = bd.remainder; } @@ -928,7 +932,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 (bus_addr_offset(sbus)) { dev_dbg(&pl08x->adev->dev, "%s set down bus width to one byte\n", __func__);