From patchwork Tue Jul 23 10:49:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2831937 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 757B39F243 for ; Tue, 23 Jul 2013 10:54:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 74B3D201E1 for ; Tue, 23 Jul 2013 10:54:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7D88C201D5 for ; Tue, 23 Jul 2013 10:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756808Ab3GWKuu (ORCPT ); Tue, 23 Jul 2013 06:50:50 -0400 Received: from moutng.kundenserver.de ([212.227.17.10]:61607 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756634Ab3GWKuU (ORCPT ); Tue, 23 Jul 2013 06:50:20 -0400 Received: from axis700.grange (dslb-094-220-153-077.pools.arcor-ip.net [94.220.153.77]) by mrelayeu.kundenserver.de (node=mrbap1) with ESMTP (Nemesis) id 0MZfXq-1Ug393115S-00KurD; Tue, 23 Jul 2013 12:50:11 +0200 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id 7700440BB5; Tue, 23 Jul 2013 12:50:10 +0200 (CEST) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1V1aAU-0007E7-6z; Tue, 23 Jul 2013 12:50:10 +0200 From: Guennadi Liakhovetski To: linux-kernel@vger.kernel.org Cc: Magnus Damm , Simon Horman , Laurent Pinchart , Vinod Koul , linux-sh@vger.kernel.org, Sergei Shtylyov , Guennadi Liakhovetski Subject: [PATCH v4 03/15] DMA: shdma: add r8a73a4 DMAC data to the device ID table Date: Tue, 23 Jul 2013 12:49:57 +0200 Message-Id: <1374576609-27748-4-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1374576609-27748-1-git-send-email-g.liakhovetski@gmx.de> References: <1374576609-27748-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:KLTqQcqOPZTkrg5tPspunC8IJeBsy6js/rblAzmPXpA Bvf5rqVebZLx2j7AXqm7IePEXcrSWGktTNrT0zaKp4oEgQzsqh ovhPqoJOBBakbxaSVFh+75yinvvETJDyeAk9w49CLRGE73qhWs 5Rg19kt5UXdBxkgUW18MElpcgWBoZZUCBh/G7Ufxt5t9RnguYG 2Yw1NPTOchUp5ZliVW2hz+wDE/ZgTQANnm44JAmmZQ6V2e2iZZ sFCii/ND736i6AeJkVbm88E20U41A+jm5A9Rep92HgTCWQbgVW N0DBHkWXBCZTTwuBaxsMVz33KuLXflMTtlnPp+CmWMtr+PDFlw +YzePAu0TwhXqsneYMSgS6LZ3p4ZN4kX1aFCetEduG0SKEwX+m r45K4XtrHmkYQ== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 This configuration data will be re-used, when DMAC DT support is added to r8a73a4. Signed-off-by: Guennadi Liakhovetski --- v4: make struct sh_dmae_pdata r8a73a4_dma_pdata "const" drivers/dma/sh/Kconfig | 4 ++ drivers/dma/sh/Makefile | 1 + drivers/dma/sh/shdma-r8a73a4.c | 75 ++++++++++++++++++++++++++++++++++++++++ drivers/dma/sh/shdma.h | 7 ++++ drivers/dma/sh/shdmac.c | 1 + 5 files changed, 88 insertions(+), 0 deletions(-) create mode 100644 drivers/dma/sh/shdma-r8a73a4.c diff --git a/drivers/dma/sh/Kconfig b/drivers/dma/sh/Kconfig index 0ac3e94..6921ba2 100644 --- a/drivers/dma/sh/Kconfig +++ b/drivers/dma/sh/Kconfig @@ -23,6 +23,10 @@ config SUDMAC help Enable support for the Renesas SUDMAC controllers. +config SHDMA_R8A73A4 + def_bool y + depends on ARCH_R8A73A4 && SH_DMAE != n + config SHDMA_R8A7740 def_bool y depends on ARCH_R8A7740 && SH_DMAE != n diff --git a/drivers/dma/sh/Makefile b/drivers/dma/sh/Makefile index acdd3cb..8352bfb 100644 --- a/drivers/dma/sh/Makefile +++ b/drivers/dma/sh/Makefile @@ -1,6 +1,7 @@ obj-$(CONFIG_SH_DMAE_BASE) += shdma-base.o shdma-of.o obj-$(CONFIG_SH_DMAE) += shdma.o shdma-y := shdmac.o +shdma-$(CONFIG_SHDMA_R8A73A4) += shdma-r8a73a4.o shdma-$(CONFIG_SHDMA_R8A7740) += shdma-r8a7740.o shdma-objs := $(shdma-y) obj-$(CONFIG_SUDMAC) += sudmac.o diff --git a/drivers/dma/sh/shdma-r8a73a4.c b/drivers/dma/sh/shdma-r8a73a4.c new file mode 100644 index 0000000..9db9b4d --- /dev/null +++ b/drivers/dma/sh/shdma-r8a73a4.c @@ -0,0 +1,75 @@ +#include + +#include +#include + +static const struct sh_dmae_slave_config dma_slaves[] = { + { + .slave_id = SHDMA_SLAVE_MMCIF0_TX, + .addr = 0xee200034, + .chcr = CHCR_TX(XMIT_SZ_32BIT), + .mid_rid = 0xd1, + }, { + .slave_id = SHDMA_SLAVE_MMCIF0_RX, + .addr = 0xee200034, + .chcr = CHCR_RX(XMIT_SZ_32BIT), + .mid_rid = 0xd2, + }, { + .slave_id = SHDMA_SLAVE_MMCIF1_TX, + .addr = 0xee220034, + .chcr = CHCR_TX(XMIT_SZ_32BIT), + .mid_rid = 0xe1, + }, { + .slave_id = SHDMA_SLAVE_MMCIF1_RX, + .addr = 0xee220034, + .chcr = CHCR_RX(XMIT_SZ_32BIT), + .mid_rid = 0xe2, + }, +}; + +#define DMAE_CHANNEL(a, b) \ + { \ + .offset = (a) - 0x20, \ + .dmars = (a) - 0x20 + 0x40, \ + .chclr_bit = (b), \ + .chclr_offset = 0x80 - 0x20, \ + } + +static const struct sh_dmae_channel dma_channels[] = { + DMAE_CHANNEL(0x8000, 0), + DMAE_CHANNEL(0x8080, 1), + DMAE_CHANNEL(0x8100, 2), + DMAE_CHANNEL(0x8180, 3), + DMAE_CHANNEL(0x8200, 4), + DMAE_CHANNEL(0x8280, 5), + DMAE_CHANNEL(0x8300, 6), + DMAE_CHANNEL(0x8380, 7), + DMAE_CHANNEL(0x8400, 8), + DMAE_CHANNEL(0x8480, 9), + DMAE_CHANNEL(0x8500, 10), + DMAE_CHANNEL(0x8580, 11), + DMAE_CHANNEL(0x8600, 12), + DMAE_CHANNEL(0x8680, 13), + DMAE_CHANNEL(0x8700, 14), + DMAE_CHANNEL(0x8780, 15), + DMAE_CHANNEL(0x8800, 16), + DMAE_CHANNEL(0x8880, 17), + DMAE_CHANNEL(0x8900, 18), + DMAE_CHANNEL(0x8980, 19), +}; + +const struct sh_dmae_pdata r8a73a4_dma_pdata = { + .slave = dma_slaves, + .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_shift = dma_ts_shift, + .ts_shift_num = ARRAY_SIZE(dma_ts_shift), + .dmaor_init = DMAOR_DME, + .chclr_present = 1, + .chclr_bitwise = 1, +}; diff --git a/drivers/dma/sh/shdma.h b/drivers/dma/sh/shdma.h index b5fe545..82a83f8 100644 --- a/drivers/dma/sh/shdma.h +++ b/drivers/dma/sh/shdma.h @@ -61,6 +61,13 @@ struct sh_dmae_desc { #define to_sh_dev(chan) container_of(chan->shdma_chan.dma_chan.device,\ struct sh_dmae_device, shdma_dev.dma_dev) +#ifdef CONFIG_SHDMA_R8A73A4 +extern const struct sh_dmae_pdata r8a73a4_dma_pdata; +#define r8a73a4_shdma_devid &r8a73a4_dma_pdata +#else +#define r8a73a4_shdma_devid NULL +#endif + #ifdef CONFIG_SHDMA_R8A7740 extern const struct sh_dmae_pdata r8a7740_dma_pdata; #define r8a7740_shdma_devid &r8a7740_dma_pdata diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c index fe54cda..6546bf9 100644 --- a/drivers/dma/sh/shdmac.c +++ b/drivers/dma/sh/shdmac.c @@ -907,6 +907,7 @@ MODULE_DEVICE_TABLE(of, sh_dmae_of_match); const struct platform_device_id sh_dmae_id_table[] = { {.name = SH_DMAE_DRV_NAME,}, + {.name = "shdma-r8a73a4", .driver_data = (kernel_ulong_t)r8a73a4_shdma_devid,}, {.name = "shdma-r8a7740", .driver_data = (kernel_ulong_t)r8a7740_shdma_devid,}, {} };