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: 19111 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DF71A246B8 for ; Wed, 14 Aug 2013 12:53:23 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id m1sf8059233ves.10 for ; Wed, 14 Aug 2013 05:53:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=Dp/IayxIfXclw1gNvodL9YlXcR4zINGVHUaYlxK3BnU=; b=YHxPLN6MOwfCBHtO/sYiWQwIwnadzwQ8xjs/+6oZgQ6o1npfUK7Q75yx74LvVHqZ77 724Y41ci4OsOPFVtTYrAtLOxCT2sL2M8oThmqRx3dTJOafms7vuGJpAU6mwgzJFpzpGt JQ9VArkPZxyldMrsJUzgsw+i12qvFSix2nbvzXf/mpDhEyhoyWk8vT0DgIqFt2vCHv/N N8AglYQXVoQpH+dhTYPpxK2FGCedqOV+2D3IEkDEfAHv7rSg3MjgQuH9Z0UJbaqR9doO mTSSF0HEWbW+XDvW5zqmG2nkMsBE3JH6J/aNX8rQoYzXCrDJEtybWi5eHs4ztfnTBqUN GGvA== X-Received: by 10.58.207.75 with SMTP id lu11mr2360227vec.20.1376484803595; Wed, 14 Aug 2013 05:53:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.130.196 with SMTP id og4ls3230524qeb.69.gmail; Wed, 14 Aug 2013 05:53:23 -0700 (PDT) X-Received: by 10.220.206.195 with SMTP id fv3mr9467662vcb.15.1376484803476; Wed, 14 Aug 2013 05:53:23 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id ae9si10968948vdc.93.2013.08.14.05.53.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 05:53:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id ha11so4019551vcb.7 for ; Wed, 14 Aug 2013 05:53:23 -0700 (PDT) X-Gm-Message-State: ALoCoQlXaBLkVcitlZiauQCwkRUjSEoGB7O4mT93ztZNElI76PlF+tKCXMqsYGs8Ixoi3cOSK3+V X-Received: by 10.52.103.101 with SMTP id fv5mr966185vdb.31.1376484803357; Wed, 14 Aug 2013 05:53:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp211088vcz; Wed, 14 Aug 2013 05:53:22 -0700 (PDT) X-Received: by 10.205.10.200 with SMTP id pb8mr7012538bkb.16.1376484802051; Wed, 14 Aug 2013 05:53:22 -0700 (PDT) Received: from mail-bk0-f41.google.com (mail-bk0-f41.google.com [209.85.214.41]) by mx.google.com with ESMTPS id cy5si1100206bkc.133.2013.08.14.05.53.21 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 14 Aug 2013 05:53:22 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.41 is neither permitted nor denied by best guess record for domain of andre.przywara@linaro.org) client-ip=209.85.214.41; Received: by mail-bk0-f41.google.com with SMTP id na10so2782907bkb.0 for ; Wed, 14 Aug 2013 05:53:21 -0700 (PDT) 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 Cc: linux-arm-kernel@lists.infradead.org, rob.herring@calxeda.com, patches@linaro.org, vinod.koul@intel.com, Andre Przywara 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-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: andre.przywara@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.176 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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__);