From patchwork Thu Aug 22 21:23:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2848409 Return-Path: X-Original-To: patchwork-linux-media@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 B3123BF546 for ; Thu, 22 Aug 2013 21:23:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD87420566 for ; Thu, 22 Aug 2013 21:23:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B6072058A for ; Thu, 22 Aug 2013 21:23:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753429Ab3HVVXK (ORCPT ); Thu, 22 Aug 2013 17:23:10 -0400 Received: from mail-la0-f50.google.com ([209.85.215.50]:57459 "EHLO mail-la0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264Ab3HVVXJ (ORCPT ); Thu, 22 Aug 2013 17:23:09 -0400 Received: by mail-la0-f50.google.com with SMTP id ek20so1927529lab.37 for ; Thu, 22 Aug 2013 14:23:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:organization:to:subject:date:user-agent:cc :references:in-reply-to:mime-version:content-type :content-transfer-encoding:message-id; bh=VazDmo+QKJaDAq5NhYh8Xm9SducySm+00Hgbc2anElE=; b=Z2ZzE5i6JtDx4p4COUex9VkjGyg+AXTn9TLwYZuGLZY55H2PNu8LrQjCJm8p1LX/4b SvbnrgbgI/NgUjURlIuXbs8r1duutzSplnDJtyDV2mZh8n3Mn8Hd1FrXjxt94v8cNmRf irErl+AHoZ6iCNNy7I2XviyQ1nXBTsDjJCAZWhGqQCBo96LPKB5vTsSqe98BlDvwzYnI 4sDI2LvUV7cct7pjqSvva2MTos+Ry4qfGsXu7WWGfT2RHXktvlb4SXLQB1RxtWBIRv0M xiC1828aj3xw0/8UMtcNXHIiXc8EItZT/FTY3GosTEt7Hinlgjjqn8rLhhgE6cLk778U 028A== X-Gm-Message-State: ALoCoQkC/yyELEZQYtM7x1y7OmsLZIksckkGNSNxpJgsz6Is5XFkZ8wE8actj1gwF514irT1Ivg8 X-Received: by 10.152.22.198 with SMTP id g6mr12221791laf.5.1377206588001; Thu, 22 Aug 2013 14:23:08 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-84-46.pppoe.mtu-net.ru. [91.76.84.46]) by mx.google.com with ESMTPSA id i9sm5513455laa.3.1969.12.31.16.00.00 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 22 Aug 2013 14:23:07 -0700 (PDT) From: Sergei Shtylyov Organization: Cogent Embedded To: horms@verge.net.au, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org, m.chehab@samsung.com Subject: [PATCH v5 1/3] ARM: shmobile: r8a7779: add VIN support Date: Fri, 23 Aug 2013 01:23:13 +0400 User-Agent: KMail/1.13.5 (Linux/2.6.32.26-175.fc12.i686.PAE; KDE/4.4.5; i686; ; ) Cc: magnus.damm@gmail.com, linux@arm.linux.org.uk, vladimir.barinov@cogentembedded.com References: <201308230119.13783.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201308230119.13783.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201308230123.13876.sergei.shtylyov@cogentembedded.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-9.7 required=5.0 tests=BAYES_00, 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 From: Vladimir Barinov Add VIN clocks and platform devices for R8A7779 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[0-3]_resources [] and 'vin[0-3]_info' as '__initdata'.] Signed-off-by: Sergei Shtylyov --- Changes since version 4: - resolved reject. Changes since version 3: - changed the VIN platform device name to be R8A7779 specific; - used '*pdata' in *sizeof* operator in r8a7779_add_vin_device(); - resolved reject in due to USB patch rework. Changes since version 2: - annotated vin[0-3]_resources[] and 'vin[0-3]_info' as '__initdata' since they are kmemdup()'ed while registering the platform devices anyway; Changes since the original posting: - added 'id' parameter check to r8a7779_add_vin_device(). arch/arm/mach-shmobile/clock-r8a7779.c | 10 +++++++ arch/arm/mach-shmobile/include/mach/r8a7779.h | 3 ++ arch/arm/mach-shmobile/setup-r8a7779.c | 37 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: media_tree/arch/arm/mach-shmobile/clock-r8a7779.c =================================================================== --- media_tree.orig/arch/arm/mach-shmobile/clock-r8a7779.c +++ media_tree/arch/arm/mach-shmobile/clock-r8a7779.c @@ -112,7 +112,9 @@ static struct clk *main_clks[] = { }; enum { MSTP323, MSTP322, MSTP321, MSTP320, + MSTP120, MSTP116, MSTP115, MSTP114, + MSTP110, MSTP109, MSTP108, MSTP103, MSTP101, MSTP100, MSTP030, MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, @@ -125,9 +127,13 @@ static struct clk mstp_clks[MSTP_NR] = { [MSTP322] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 22, 0), /* SDHI1 */ [MSTP321] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 21, 0), /* SDHI2 */ [MSTP320] = SH_CLK_MSTP32(&clkp_clk, MSTPCR3, 20, 0), /* SDHI3 */ + [MSTP120] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 20, 0), /* VIN3 */ [MSTP116] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 16, 0), /* PCIe */ [MSTP115] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 15, 0), /* SATA */ [MSTP114] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 14, 0), /* Ether */ + [MSTP110] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 10, 0), /* VIN0 */ + [MSTP109] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 9, 0), /* VIN1 */ + [MSTP108] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 8, 0), /* VIN2 */ [MSTP103] = SH_CLK_MSTP32(&clks_clk, MSTPCR1, 3, 0), /* DU */ [MSTP101] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 1, 0), /* USB2 */ [MSTP100] = SH_CLK_MSTP32(&clkp_clk, MSTPCR1, 0, 0), /* USB0/1 */ @@ -162,10 +168,14 @@ static struct clk_lookup lookups[] = { CLKDEV_CON_ID("peripheral_clk", &clkp_clk), /* MSTP32 clocks */ + CLKDEV_DEV_ID("r8a7779-vin.3", &mstp_clks[MSTP120]), /* VIN3 */ CLKDEV_DEV_ID("rcar-pcie", &mstp_clks[MSTP116]), /* PCIe */ CLKDEV_DEV_ID("sata_rcar", &mstp_clks[MSTP115]), /* SATA */ CLKDEV_DEV_ID("fc600000.sata", &mstp_clks[MSTP115]), /* SATA w/DT */ CLKDEV_DEV_ID("r8a777x-ether", &mstp_clks[MSTP114]), /* Ether */ + CLKDEV_DEV_ID("r8a7779-vin.0", &mstp_clks[MSTP110]), /* VIN0 */ + CLKDEV_DEV_ID("r8a7779-vin.1", &mstp_clks[MSTP109]), /* VIN1 */ + CLKDEV_DEV_ID("r8a7779-vin.2", &mstp_clks[MSTP108]), /* VIN2 */ CLKDEV_DEV_ID("ehci-platform.1", &mstp_clks[MSTP101]), /* USB EHCI port2 */ CLKDEV_DEV_ID("ohci-platform.1", &mstp_clks[MSTP101]), /* USB OHCI port2 */ CLKDEV_DEV_ID("ehci-platform.0", &mstp_clks[MSTP100]), /* USB EHCI port0/1 */ Index: media_tree/arch/arm/mach-shmobile/include/mach/r8a7779.h =================================================================== --- media_tree.orig/arch/arm/mach-shmobile/include/mach/r8a7779.h +++ media_tree/arch/arm/mach-shmobile/include/mach/r8a7779.h @@ -5,6 +5,7 @@ #include #include #include +#include struct platform_device; @@ -35,6 +36,8 @@ extern void r8a7779_add_standard_devices extern void r8a7779_add_standard_devices_dt(void); extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata); extern void r8a7779_add_usb_phy_device(struct rcar_phy_platform_data *pdata); +extern void r8a7779_add_vin_device(int idx, + struct rcar_vin_platform_data *pdata); extern void r8a7779_init_late(void); extern void r8a7779_clock_init(void); extern void r8a7779_pinmux_init(void); Index: media_tree/arch/arm/mach-shmobile/setup-r8a7779.c =================================================================== --- media_tree.orig/arch/arm/mach-shmobile/setup-r8a7779.c +++ media_tree/arch/arm/mach-shmobile/setup-r8a7779.c @@ -559,6 +559,33 @@ static struct resource ether_resources[] }, }; +#define R8A7779_VIN(idx) \ +static struct resource vin##idx##_resources[] __initdata = { \ + DEFINE_RES_MEM(0xffc50000 + 0x1000 * (idx), 0x1000), \ + DEFINE_RES_IRQ(gic_iid(0x5f + (idx))), \ +}; \ + \ +static struct platform_device_info vin##idx##_info __initdata = { \ + .parent = &platform_bus, \ + .name = "r8a7779-vin", \ + .id = idx, \ + .res = vin##idx##_resources, \ + .num_res = ARRAY_SIZE(vin##idx##_resources), \ + .dma_mask = DMA_BIT_MASK(32), \ +} + +R8A7779_VIN(0); +R8A7779_VIN(1); +R8A7779_VIN(2); +R8A7779_VIN(3); + +static struct platform_device_info *vin_info_table[] __initdata = { + &vin0_info, + &vin1_info, + &vin2_info, + &vin3_info, +}; + static struct platform_device *r8a7779_devices_dt[] __initdata = { &scif0_device, &scif1_device, @@ -610,6 +637,16 @@ void __init r8a7779_add_usb_phy_device(s pdata, sizeof(*pdata)); } +void __init r8a7779_add_vin_device(int id, struct rcar_vin_platform_data *pdata) +{ + BUG_ON(id < 0 || id > 3); + + vin_info_table[id]->data = pdata; + vin_info_table[id]->size_data = sizeof(*pdata); + + platform_device_register_full(vin_info_table[id]); +} + /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */ void __init __weak r8a7779_register_twd(void) { }