From patchwork Mon Jul 22 22:22:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2831611 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 E333BC0319 for ; Mon, 22 Jul 2013 22:22:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E68862026B for ; Mon, 22 Jul 2013 22:22:39 +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 9A3372022A for ; Mon, 22 Jul 2013 22:22:38 +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 1V1OV2-0003Mq-05; Mon, 22 Jul 2013 22:22:36 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1OUz-0008DZ-P6; Mon, 22 Jul 2013 22:22:33 +0000 Received: from mail-lb0-f181.google.com ([209.85.217.181]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V1OUw-0008Cw-Mo for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2013 22:22:31 +0000 Received: by mail-lb0-f181.google.com with SMTP id w10so5628839lbi.26 for ; Mon, 22 Jul 2013 15:22:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:organization:to:subject:date:user-agent:cc:references :in-reply-to:mime-version:content-type:content-transfer-encoding :message-id:x-gm-message-state; bh=mpMBA1XR+vFQv6g9J2Z3RTJirDzUDipn6n2gk2cst9c=; b=oXz0XVeRVOEyVdl/fQMGCcSI0uUm92qP3BCL6JpyZiaPbDJL8iQWOmvi/P0TpbzCbz G8X9VRB0oSkKjw/34Er47yzoeu08GAXq8eVZTF1RxQFBzbdktjuWBG+Fx35fOrKDQTDF mjj7g88BlY5mPB8vuaXvZnyuXfUytVcluBuMjOUXLK02FhSULSf2v0/928EaDB3xFBww FrtScwc0S+etpdbsAZ1MtYJ5GypbRp7zlE8GQPEu6XdrqXmyORh3jE6su76LBQtaX1pS XlcQ1Mf1EIkQbS+d/wwQgAoc5QbPqij4+JDstZv7UvueSt8le2e5EjGvd+H46IX6YBQV 9cSQ== X-Received: by 10.112.235.104 with SMTP id ul8mr13111496lbc.36.1374531727861; Mon, 22 Jul 2013 15:22:07 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-84-39.pppoe.mtu-net.ru. [91.76.84.39]) by mx.google.com with ESMTPSA id p10sm11906292lap.8.2013.07.22.15.22.06 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 22 Jul 2013 15:22:07 -0700 (PDT) From: Sergei Shtylyov Organization: Cogent Embedded To: horms@verge.net.au, linux-sh@vger.kernel.org Subject: [PATCH v2 1/2] ARM: shmobile: r8a7778: add HPB-DMAC support Date: Tue, 23 Jul 2013 02:22:04 +0400 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.i686.PAE; KDE/4.4.5; i686; ; ) References: <201307230218.01495.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201307230218.01495.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201307230222.04763.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQl9qzENqzwR5TOXiS0LscqhFcmYZroAmaNFoD9CVsVbSyHy45v2HZhYKEwoWxZyY6DXFp30 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130722_182231_054811_51797D3C X-CRM114-Status: GOOD ( 18.40 ) X-Spam-Score: -2.6 (--) Cc: linux@arm.linux.org.uk, max.filippov@cogentembedded.com, magnus.damm@gmail.com, linux-arm-kernel@lists.infradead.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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.6 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 From: Max Filippov Add HPB-DMAC platform device on R8A7778 SoC along with its slave and channel configurations. Signed-off-by: Max Filippov [Sergei: moved *enum* declaring HPB-DMAC slave IDs from now removed to , removed #include from setup-r8a7778.c, removed SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[] and hpb_dmae_channels[].] Signed-off-by: Sergei Shtylyov --- Changes in version 2: - moved *enum* declaring HPB-DMAC slave IDs from the separate header file to , removed #include from setup-r8a7778.c; - removed SSI-related *enum* values and SSI-related data from hpb_dmae_slaves[] and hpb_dmae_channels[]. arch/arm/mach-shmobile/include/mach/r8a7778.h | 8 ++ arch/arm/mach-shmobile/setup-r8a7778.c | 80 ++++++++++++++++++++++++++ 2 files changed, 88 insertions(+) Index: renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h =================================================================== --- renesas.orig/arch/arm/mach-shmobile/include/mach/r8a7778.h +++ renesas/arch/arm/mach-shmobile/include/mach/r8a7778.h @@ -1,6 +1,7 @@ /* * Copyright (C) 2013 Renesas Solutions Corp. * Copyright (C) 2013 Kuninori Morimoto + * Copyright (C) 2013 Cogent Embedded, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -23,6 +24,13 @@ #include #include +/* HPB-DMA slave IDs */ +enum { + HPBDMA_SLAVE_DUMMY, + HPBDMA_SLAVE_SDHI0_TX, + HPBDMA_SLAVE_SDHI0_RX, +}; + extern void r8a7778_add_standard_devices(void); extern void r8a7778_add_standard_devices_dt(void); extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata); Index: renesas/arch/arm/mach-shmobile/setup-r8a7778.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/setup-r8a7778.c +++ renesas/arch/arm/mach-shmobile/setup-r8a7778.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -333,6 +334,84 @@ void __init r8a7778_add_mmc_device(struc info, sizeof(*info)); } +/* HPB-DMA */ + +/* Asynchronous mode register (ASYNCMDR) bits */ +#define ASYNCMDR_ASMD22_MASK BIT(2) /* SDHI0 */ +#define ASYNCMDR_ASMD22_SINGLE BIT(2) /* SDHI0 */ +#define ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */ +#define ASYNCMDR_ASMD21_MASK BIT(1) /* SDHI0 */ +#define ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */ +#define ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */ + +static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = { + { + .id = HPBDMA_SLAVE_SDHI0_TX, + .addr = 0xffe4c000 + 0x30, + .dcr = DCR_SPDS_16BIT | DCR_DMDL | DCR_DPDS_16BIT, + .rstr = ASYNCRSTR_ASRST21 | ASYNCRSTR_ASRST22 | + ASYNCRSTR_ASRST23, + .mdr = ASYNCMDR_ASMD21_SINGLE, + .mdm = ASYNCMDR_ASMD21_MASK, + .port = 0x0D0C, + .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, + .dma_ch = 21, + }, { + .id = HPBDMA_SLAVE_SDHI0_RX, + .addr = 0xffe4c000 + 0x30, + .dcr = DCR_SMDL | DCR_SPDS_16BIT | DCR_DPDS_16BIT, + .rstr = ASYNCRSTR_ASRST21 | ASYNCRSTR_ASRST22 | + ASYNCRSTR_ASRST23, + .mdr = ASYNCMDR_ASMD22_SINGLE, + .mdm = ASYNCMDR_ASMD22_MASK, + .port = 0x0D0C, + .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE, + .dma_ch = 22, + }, +}; + +static const struct hpb_dmae_channel hpb_dmae_channels[] = { + /* ch. 21 SD0 */ + HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), + /* ch. 22 SD0 */ + HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), +}; + +static struct hpb_dmae_pdata dma_platform_data __initdata = { + .slaves = hpb_dmae_slaves, + .num_slaves = ARRAY_SIZE(hpb_dmae_slaves), + .channels = hpb_dmae_channels, + .num_channels = ARRAY_SIZE(hpb_dmae_channels), + .ts_shift = { + [XMIT_SZ_8BIT] = 0, + [XMIT_SZ_16BIT] = 1, + [XMIT_SZ_32BIT] = 2, + }, + .num_hw_channels = 39, +}; + +static struct resource hpb_dmae_resources[] __initdata = { + /* Channel registers */ + DEFINE_RES_MEM(0xffc08000, 0x1000), + /* Common registers */ + DEFINE_RES_MEM(0xffc09000, 0x170), + /* Asynchronous reset registers */ + DEFINE_RES_MEM(0xffc00300, 4), + /* Asynchronous mode registers */ + DEFINE_RES_MEM(0xffc00400, 4), + /* IRQ for DMA channels */ + DEFINE_RES_NAMED(gic_iid(0x7b), 5, NULL, IORESOURCE_IRQ), +}; + +static void __init r8a7778_register_hpb_dmae(void) +{ + platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1, + hpb_dmae_resources, + ARRAY_SIZE(hpb_dmae_resources), + &dma_platform_data, + sizeof(dma_platform_data)); +} + void __init r8a7778_add_standard_devices(void) { int i; @@ -355,6 +434,7 @@ void __init r8a7778_add_standard_devices r8a7778_register_tmu(0); r8a7778_register_tmu(1); + r8a7778_register_hpb_dmae(); } void __init r8a7778_init_late(void)