From patchwork Thu Jun 12 09:42:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 4340201 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 922729F314 for ; Thu, 12 Jun 2014 09:40:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AA66520218 for ; Thu, 12 Jun 2014 09:40:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C92562025B for ; Thu, 12 Jun 2014 09:40:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932904AbaFLJku (ORCPT ); Thu, 12 Jun 2014 05:40:50 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:39302 "EHLO mail-pb0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932845AbaFLJku (ORCPT ); Thu, 12 Jun 2014 05:40:50 -0400 Received: by mail-pb0-f45.google.com with SMTP id um1so823476pbc.32 for ; Thu, 12 Jun 2014 02:40:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:in-reply-to:references:subject; bh=nakhOO3R85wyeVuE2jUEez19ZAk/3jeD2WMHBm1fBTI=; b=n8HJx/YQIbNcg85/T7D9G3RTxlLY0jTPa5qddTovFgQaJ0gRWv8aj5YP4Nu+cIBefF +3lh2PzY1pZRSrCiDnR8lYjvXRa2fCxn7jJIiGFNeWmP2zgEIzbCVZ2KhtzT0Z6jDCcl pWZSJb060z+b7RaO0BxXQR6ktNchnCi24Sx5um830IkgmJWRQQcs5PyTR7G8C7x/daFg k9prCQMUGuMqckXPjjWq4Nd99zWGvNrmoQkVVqM0qwEurtXVEDG43bGJ6ujLUZLqxZVo ck8F76+fIGu9XdFH1Ie1tGzS6VY5JJyErYYYcDoGKWN4ElTKdVHvM63MT7mvgs8XS+hT Q5xA== X-Received: by 10.66.121.168 with SMTP id ll8mr20156397pab.86.1402566049664; Thu, 12 Jun 2014 02:40:49 -0700 (PDT) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by mx.google.com with ESMTPSA id eh4sm79395772pbc.79.2014.06.12.02.40.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 12 Jun 2014 02:40:48 -0700 (PDT) From: Magnus Damm To: linux-sh@vger.kernel.org Cc: Magnus Damm , geert+renesas@glider.be Date: Thu, 12 Jun 2014 18:42:55 +0900 Message-Id: <20140612094255.4132.94956.sendpatchset@w520> In-Reply-To: <20140612094209.4132.78270.sendpatchset@w520> References: <20140612094209.4132.78270.sendpatchset@w520> Subject: [PATCH v2 06/07] ARM: shmobile: Koelsch SYS-DMAC prototype 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.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 From: Magnus Damm Prototype code to enable part of the SYS-DMAC on Koelsch. Written to exercise the SYS-DMAC - Not for upstream merge. Based on the following patch by Kuninori Morimoto-san: "Local: ARM: shmobile: r8a7791: add SYS-DMAC support" This patch enables SYS-DMAC0 (= Low), it doesn't support SYS-DMAC1 (= HI) today. Because, SYS-DMAC HI/Low interrupt mapping is not good match to SH-DMAC driver. Thanks to Morimoto-san for his sample code! Signed-off-by: Magnus Damm --- Changes since V1: - None arch/arm/mach-shmobile/board-koelsch-reference.c | 93 ++++++++++++++++++++++ 1 file changed, 93 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- 0001/arch/arm/mach-shmobile/board-koelsch-reference.c +++ work/arch/arm/mach-shmobile/board-koelsch-reference.c 2014-06-11 06:47:39.000000000 +0900 @@ -66,6 +66,98 @@ static const struct resource du_resource DEFINE_RES_IRQ(gic_spi(268)), }; +#include +#include + +/* Local DMA slave IDs */ +enum { + RCAR_DMA_SLAVE_KOELSCH_INVALID = 0, +}; + +#define DMAE_CHANNEL(a, b) \ +{ \ + .offset = (a) - 0x20, \ + .dmars = (a) - 0x20 + 0x40, \ + .chclr_bit = (b), \ + .chclr_offset = 0x80 - 0x20, \ +} + +/* Sys-DMAC */ +#define SYS_DMAC_SLAVE(_id, _bit, _addr, toffset, roffset, t, r) \ +{ \ + .slave_id = SYS_DMAC_SLAVE_## _id ##_TX, \ + .addr = _addr + toffset, \ + .chcr = CHCR_TX(XMIT_SZ_## _bit ##BIT), \ + .mid_rid = t, \ +}, { \ + .slave_id = SYS_DMAC_SLAVE_## _id ##_RX, \ + .addr = _addr + roffset, \ + .chcr = CHCR_RX(XMIT_SZ_## _bit ##BIT), \ + .mid_rid = r, \ +} + +static const struct sh_dmae_slave_config r8a7791_sys_dmac_slaves[] = { +}; + +static const struct sh_dmae_channel r8a7791_sys_dmac_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), +}; + +static struct sh_dmae_pdata r8a7791_sys_dmac_platform_data = { + .slave = r8a7791_sys_dmac_slaves, + .slave_num = ARRAY_SIZE(r8a7791_sys_dmac_slaves), + .channel = r8a7791_sys_dmac_channels, + .channel_num = ARRAY_SIZE(r8a7791_sys_dmac_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, + .fourty_bits_addr = 1, +}; + +static struct resource r8a7791_sys_dmac_resources[] = { + /* Channel registers and DMAOR for low */ + DEFINE_RES_MEM(0xe6700020, 0x8763 - 0x20), + DEFINE_RES_IRQ(gic_spi(197)), + DEFINE_RES_NAMED(gic_spi(200), 15, NULL, IORESOURCE_IRQ), + + /* + * HI is not supported + * since IRQ has strange mapping + */ +}; + +#define r8a7791_register_sys_dmac(id) \ + platform_device_register_resndata( \ + &platform_bus, "sh-dma-engine", 2 + id, \ + &r8a7791_sys_dmac_resources[id * 3], 3, \ + &r8a7791_sys_dmac_platform_data, \ + sizeof(r8a7791_sys_dmac_platform_data)) + +static void __init koelsch_add_dmac_prototype(void) +{ + r8a7791_register_sys_dmac(0); +} + static void __init koelsch_add_du_device(void) { struct platform_device_info info = { @@ -96,6 +188,7 @@ static void __init koelsch_add_standard_ { shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false); r8a7791_add_dt_devices(); + koelsch_add_dmac_prototype(); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); koelsch_add_du_device();