From patchwork Fri Jun 21 23:28:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2764921 Return-Path: X-Original-To: patchwork-linux-arm@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 3DEC49F472 for ; Fri, 21 Jun 2013 23:29:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 424B1201A8 for ; Fri, 21 Jun 2013 23:29:58 +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 EBC34201A1 for ; Fri, 21 Jun 2013 23:29:55 +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 1UqAld-0005Fy-4x; Fri, 21 Jun 2013 23:29:21 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqAlO-00089M-Rq; Fri, 21 Jun 2013 23:29:06 +0000 Received: from mail-la0-x22a.google.com ([2a00:1450:4010:c03::22a]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UqAlM-00088a-2T for linux-arm-kernel@lists.infradead.org; Fri, 21 Jun 2013 23:29:05 +0000 Received: by mail-la0-f42.google.com with SMTP id eb20so7982352lab.29 for ; Fri, 21 Jun 2013 16:28:40 -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=NgJyrFXijOfG2czNslQi4vN749NOXZ775ceMsGBdK2I=; b=LJHi9CXGfw4J6f8n0LR3R5f+O6F+P64rgJwmJpf8urXk9lvtkvuVnqUcg/laKTxvrR MCtusTb/RxkGNEGruWNZbfzahuUxdRQAbugtudxR32uzfm7bg8g5Qwdli4cVumlMlryi boi4unNcM5/ir9RWdVBbIKkIzCXDanAqvc0a/XWb5r1GLF12oPHIXFxMhmjXFsRT5TB5 pTxDDZ7qZrD5fRCPqQXQdJaetvObBcpkyOO2xmknQ/FfI56l/g4w43VIVTKAStsDzXtA cr5yhoa91qvOjGWp4G4ITNTI6K9mLEMl5hG+5loSJDXCWBzyRQb/2qpHqfZtRgeDcVG7 bhfA== X-Received: by 10.112.125.199 with SMTP id ms7mr8534176lbb.29.1371857320340; Fri, 21 Jun 2013 16:28:40 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-149-228.pppoe.mtu-net.ru. [91.76.149.228]) by mx.google.com with ESMTPSA id p10sm2534558lap.8.2013.06.21.16.28.38 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 21 Jun 2013 16:28:39 -0700 (PDT) From: Sergei Shtylyov Organization: Cogent Embedded To: horms@verge.net.au, linux-sh@vger.kernel.org Subject: [PATCH v5 1/3] ARM: shmobile: r8a7778: add VIN support Date: Sat, 22 Jun 2013 03:28:46 +0400 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.i686.PAE; KDE/4.4.5; i686; ; ) References: <201306220326.46176.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201306220326.46176.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201306220328.47110.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQlxANoZQCu+daHe/0JXCHC8FktROwYevkNLobrVKaJ+UlK2Ap2eww1A1sSsUdlN8jNC77zC X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130621_192904_440526_251AE2CB X-CRM114-Status: GOOD ( 16.66 ) X-Spam-Score: -1.9 (-) Cc: linux@arm.linux.org.uk, vladimir.barinov@cogentembedded.com, magnus.damm@gmail.com, linux-arm-kernel@lists.infradead.org, matsu@igel.co.jp 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.7 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: Vladimir Barinov Add VIN clocks and platform devices on R8A7778 SoC; add function to register the VIN platform devices. Signed-off-by: Vladimir Barinov [Sergei: added 'id' parameter check to r8a7779_add_vin_device(), used '*pdata' in *sizeof* operator there, renamed some variables, annotated 'vin[01]_info' and vin[01]_resources[] as '__initdata'.] Signed-off-by: Sergei Shtylyov Acked-by: Kuninori Morimoto --- Changes since version 4: - resolved reject, refreshed the patch. Changes since version 3: - changed the VIN platform device names to be R8A7778 specific; - resolved reject in due to USB patch rework. Changes from version 2: - annotated 'vin[01]_info' and vin[01]_resources[] as '__initdata' since they're kmemdup()'ed while registering the platform devices anyway; - refreshed the patch. arch/arm/mach-shmobile/clock-r8a7778.c | 5 +++ arch/arm/mach-shmobile/include/mach/r8a7778.h | 3 ++ arch/arm/mach-shmobile/setup-r8a7778.c | 33 ++++++++++++++++++++++++++ 3 files changed, 41 insertions(+) Index: renesas/arch/arm/mach-shmobile/clock-r8a7778.c =================================================================== --- renesas.orig/arch/arm/mach-shmobile/clock-r8a7778.c +++ renesas/arch/arm/mach-shmobile/clock-r8a7778.c @@ -106,6 +106,7 @@ enum { MSTP331, MSTP323, MSTP322, MSTP321, MSTP114, + MSTP110, MSTP109, MSTP100, MSTP030, MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, @@ -119,6 +120,8 @@ static struct clk mstp_clks[MSTP_NR] = { [MSTP322] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 22, 0), /* SDHI1 */ [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */ [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */ + [MSTP110] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 10, 0), /* VIN0 */ + [MSTP109] = SH_CLK_MSTP32(&s_clk, MSTPCR1, 9, 0), /* VIN1 */ [MSTP100] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 0, 0), /* USB0/1 */ [MSTP030] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 30, 0), /* I2C0 */ [MSTP029] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 29, 0), /* I2C1 */ @@ -146,6 +149,8 @@ static struct clk_lookup lookups[] = { CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP321]), /* SDHI2 */ CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */ + CLKDEV_DEV_ID("r8a7778-vin.0", &mstp_clks[MSTP110]), /* VIN0 */ + CLKDEV_DEV_ID("r8a7778-vin.1", &mstp_clks[MSTP109]), /* VIN1 */ CLKDEV_DEV_ID("ehci-platform", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ CLKDEV_DEV_ID("ohci-platform", &mstp_clks[MSTP100]), /* USB OHCI port0/1 */ CLKDEV_DEV_ID("i2c-rcar.0", &mstp_clks[MSTP030]), /* I2C0 */ 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 @@ -22,6 +22,7 @@ #include #include #include +#include extern void r8a7778_add_standard_devices(void); extern void r8a7778_add_standard_devices_dt(void); @@ -29,6 +30,8 @@ extern void r8a7778_add_ether_device(str extern void r8a7778_add_i2c_device(int id); extern void r8a7778_add_hspi_device(int id); extern void r8a7778_add_mmc_device(struct sh_mmcif_plat_data *info); +extern void r8a7778_add_vin_device(int id, + struct rcar_vin_platform_data *pdata); extern void r8a7778_add_usb_phy_device(struct rcar_phy_platform_data *pdata); extern void r8a7778_init_late(void); 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 @@ -333,6 +333,39 @@ void __init r8a7778_add_mmc_device(struc info, sizeof(*info)); } +/* VIN */ +#define R8A7778_VIN(idx) \ +static struct resource vin##idx##_resources[] __initdata = { \ + DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \ + DEFINE_RES_IRQ(gic_iid(0x5a)), \ +}; \ + \ +static struct platform_device_info vin##idx##_info __initdata = { \ + .parent = &platform_bus, \ + .name = "r8a7778-vin", \ + .id = idx, \ + .res = vin##idx##_resources, \ + .num_res = ARRAY_SIZE(vin##idx##_resources), \ + .dma_mask = DMA_BIT_MASK(32), \ +} + +R8A7778_VIN(0); +R8A7778_VIN(1); + +static struct platform_device_info *vin_info_table[] __initdata = { + &vin0_info, + &vin1_info, +}; + +void __init r8a7778_add_vin_device(int id, struct rcar_vin_platform_data *pdata) +{ + BUG_ON(id < 0 || id > 1); + + vin_info_table[id]->data = pdata; + vin_info_table[id]->size_data = sizeof(*pdata); + platform_device_register_full(vin_info_table[id]); +} + void __init r8a7778_add_standard_devices(void) { int i;