From patchwork Wed Jun 4 16:14:10 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Dooks X-Patchwork-Id: 4295451 Return-Path: X-Original-To: patchwork-linux-sh@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 32B33BEEA7 for ; Wed, 4 Jun 2014 16:14:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CC8720251 for ; Wed, 4 Jun 2014 16:14:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 486D620274 for ; Wed, 4 Jun 2014 16:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751596AbaFDQOd (ORCPT ); Wed, 4 Jun 2014 12:14:33 -0400 Received: from ducie-dc1.codethink.co.uk ([185.25.241.215]:56401 "EHLO ducie-dc1.codethink.co.uk" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751128AbaFDQOc (ORCPT ); Wed, 4 Jun 2014 12:14:32 -0400 Received: from localhost (localhost [127.0.0.1]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTP id 1E440466F7B; Wed, 4 Jun 2014 17:14:31 +0100 (BST) X-Virus-Scanned: Debian amavisd-new at ducie-dc1.codethink.co.uk Received: from ducie-dc1.codethink.co.uk ([127.0.0.1]) by localhost (ducie-dc1.codethink.co.uk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GiSr4ANDU6od; Wed, 4 Jun 2014 17:14:25 +0100 (BST) Received: from rainbowdash.ducie.codethink.co.uk (rainbowdash.dyn.ducie.codethink.co.uk [10.24.1.179]) by ducie-dc1.codethink.co.uk (Postfix) with ESMTPS id 15D0746703E; Wed, 4 Jun 2014 17:14:19 +0100 (BST) Received: from ben by rainbowdash.ducie.codethink.co.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1WsDpS-00086Q-Pu; Wed, 04 Jun 2014 17:14:18 +0100 From: Ben Dooks To: linux-sh@vger.kernel.org Cc: laurent.pinchart@ideasonboard.com, Ben Dooks Subject: [PATCH 3/8] shdma: fdt: update r8a73a4 code for re-use in shdma-of code Date: Wed, 4 Jun 2014 17:14:10 +0100 Message-Id: <1401898455-31064-4-git-send-email-ben.dooks@codethink.co.uk> X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: <1401898455-31064-1-git-send-email-ben.dooks@codethink.co.uk> References: <1401898455-31064-1-git-send-email-ben.dooks@codethink.co.uk> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 The shdma-r8a73a4 code contains useful constants in the shdam-arm.h file that could be re-used by shdma-of code for the generic arm template structure. Change the names to be specific to ARM to ensure the code can be included in shdma-of whilst avoiding the possibility it will clash with any other defines. Signed-off-by: Ben Dooks --- drivers/dma/sh/shdma-arm.h | 48 +++++++++++++++++++++--------------------- drivers/dma/sh/shdma-r8a73a4.c | 18 ++++++++-------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/drivers/dma/sh/shdma-arm.h b/drivers/dma/sh/shdma-arm.h index a2b8258..987ca21 100644 --- a/drivers/dma/sh/shdma-arm.h +++ b/drivers/dma/sh/shdma-arm.h @@ -15,37 +15,37 @@ /* Transmit sizes and respective CHCR register values */ enum { - XMIT_SZ_8BIT = 0, - XMIT_SZ_16BIT = 1, - XMIT_SZ_32BIT = 2, - XMIT_SZ_64BIT = 7, - XMIT_SZ_128BIT = 3, - XMIT_SZ_256BIT = 4, - XMIT_SZ_512BIT = 5, + SHDMA_ARM_SZ_8BIT = 0, + SHDMA_ARM_SZ_16BIT = 1, + SHDMA_ARM_SZ_32BIT = 2, + SHDMA_ARM_SZ_64BIT = 7, + SHDMA_ARM_SZ_128BIT = 3, + SHDMA_ARM_SZ_256BIT = 4, + SHDMA_ARM_SZ_512BIT = 5, }; /* log2(size / 8) - used to calculate number of transfers */ -#define SH_DMAE_TS_SHIFT { \ - [XMIT_SZ_8BIT] = 0, \ - [XMIT_SZ_16BIT] = 1, \ - [XMIT_SZ_32BIT] = 2, \ - [XMIT_SZ_64BIT] = 3, \ - [XMIT_SZ_128BIT] = 4, \ - [XMIT_SZ_256BIT] = 5, \ - [XMIT_SZ_512BIT] = 6, \ +#define SH_DMAE_ARM_TS_SHIFT { \ + [SHDMA_ARM_SZ_8BIT] = 0, \ + [SHDMA_ARM_SZ_16BIT] = 1, \ + [SHDMA_ARM_SZ_32BIT] = 2, \ + [SHDMA_ARM_SZ_64BIT] = 3, \ + [SHDMA_ARM_SZ_128BIT] = 4, \ + [SHDMA_ARM_SZ_256BIT] = 5, \ + [SHDMA_ARM_SZ_512BIT] = 6, \ } -#define TS_LOW_BIT 0x3 /* --xx */ -#define TS_HI_BIT 0xc /* xx-- */ +#define SHDMA_ARM_TS_LOW_BIT 0x3 /* --xx */ +#define SHDMA_ARM_TS_HI_BIT 0xc /* xx-- */ -#define TS_LOW_SHIFT (3) -#define TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */ +#define SHDMA_ARM_TS_LOW_SHIFT (3) +#define SHDMA_ARM_TS_HI_SHIFT (20 - 2) /* 2 bits for shifted low TS */ -#define TS_INDEX2VAL(i) \ - ((((i) & TS_LOW_BIT) << TS_LOW_SHIFT) |\ - (((i) & TS_HI_BIT) << TS_HI_SHIFT)) +#define SHDMA_ARM_TS_INDEX2VAL(i) \ + ((((i) & SHDMA_ARM_TS_LOW_BIT) << SHDMA_ARM_TS_LOW_SHIFT) |\ + (((i) & SHDMA_ARM_TS_HI_BIT) << SHDMA_ARM_TS_HI_SHIFT)) -#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL((xmit_sz))) -#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL((xmit_sz))) +#define CHCR_TX(xmit_sz) (DM_FIX | SM_INC | 0x800 | SHDMA_ARM_TS_INDEX2VAL((xmit_sz))) +#define CHCR_RX(xmit_sz) (DM_INC | SM_FIX | 0x800 | SHDMA_ARM_TS_INDEX2VAL((xmit_sz))) #endif diff --git a/drivers/dma/sh/shdma-r8a73a4.c b/drivers/dma/sh/shdma-r8a73a4.c index 4fb9997..c7fd2b2 100644 --- a/drivers/dma/sh/shdma-r8a73a4.c +++ b/drivers/dma/sh/shdma-r8a73a4.c @@ -11,20 +11,20 @@ #include "shdma-arm.h" -const unsigned int dma_ts_shift[] = SH_DMAE_TS_SHIFT; +const unsigned int dma_ts_shift[] = SH_DMAE_ARM_TS_SHIFT; static const struct sh_dmae_slave_config dma_slaves[] = { { - .chcr = CHCR_TX(XMIT_SZ_32BIT), + .chcr = CHCR_TX(SHDMA_ARM_SZ_32BIT), .mid_rid = 0xd1, /* MMC0 Tx */ }, { - .chcr = CHCR_RX(XMIT_SZ_32BIT), + .chcr = CHCR_RX(SHDMA_ARM_SZ_32BIT), .mid_rid = 0xd2, /* MMC0 Rx */ }, { - .chcr = CHCR_TX(XMIT_SZ_32BIT), + .chcr = CHCR_TX(SHDMA_ARM_SZ_32BIT), .mid_rid = 0xe1, /* MMC1 Tx */ }, { - .chcr = CHCR_RX(XMIT_SZ_32BIT), + .chcr = CHCR_RX(SHDMA_ARM_SZ_32BIT), .mid_rid = 0xe2, /* MMC1 Rx */ }, }; @@ -65,10 +65,10 @@ const struct sh_dmae_pdata r8a73a4_dma_pdata = { .slave_num = ARRAY_SIZE(dma_slaves), .channel = dma_channels, .channel_num = ARRAY_SIZE(dma_channels), - .ts_low_shift = TS_LOW_SHIFT, - .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT, - .ts_high_shift = TS_HI_SHIFT, - .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT, + .ts_low_shift = SHDMA_ARM_TS_LOW_SHIFT, + .ts_low_mask = SHDMA_ARM_TS_LOW_BIT << SHDMA_ARM_TS_LOW_SHIFT, + .ts_high_shift = SHDMA_ARM_TS_HI_SHIFT, + .ts_high_mask = SHDMA_ARM_TS_HI_BIT << SHDMA_ARM_TS_HI_SHIFT, .ts_shift = dma_ts_shift, .ts_shift_num = ARRAY_SIZE(dma_ts_shift), .dmaor_init = DMAOR_DME,