From patchwork Fri Apr 19 22:21:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2467281 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 622073FD8C for ; Fri, 19 Apr 2013 22:23:34 +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 1UTJhf-00065k-Mr; Fri, 19 Apr 2013 22:22:48 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTJhU-0007Tv-Ba; Fri, 19 Apr 2013 22:22:36 +0000 Received: from mail-la0-x232.google.com ([2a00:1450:4010:c03::232]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UTJhN-0007TB-0L for linux-arm-kernel@lists.infradead.org; Fri, 19 Apr 2013 22:22:30 +0000 Received: by mail-la0-f50.google.com with SMTP id el20so4015692lab.9 for ; Fri, 19 Apr 2013 15:22:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:to:subject:cc:from:organization:date:mime-version :content-type:content-transfer-encoding:message-id :x-gm-message-state; bh=lljQiix8T2WYAoJ91j0MfVgCrOhvMwcBfSr4UkG/VJY=; b=KHghEZPCm6zNeTKAuaqwx8UKUEqupN3ay98phh3GE5JwxQIUQnRvHvQzh8LaNeEWzj JU4JaMN5GZm/X9CoPlUZw+NlRvw8pfSriasjbBKQNbExEiUGi2cEKd4JbSXRTrtQp5yU I020SgBNVt21i8WtmDo4SjkGOpLQUmPexoZUQ1vJ4dcbupw9qhau+1uc19ebP6u85Dk7 AzyUBhq2YIK3V+V03zMvd/diLze+KEkKf5Yska/2sxo+UhIbTWqZH84U5OjXsh1HhLWr OCMGVlE0xMpxt3AP6ZWr1UaDyvqhVkIBRZ5UsIDe8SHn+ZGI9sWae/eQHxvaLXumGnMt H+HQ== X-Received: by 10.112.161.97 with SMTP id xr1mr9104088lbb.15.1366410146697; Fri, 19 Apr 2013 15:22:26 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-86-130.pppoe.mtu-net.ru. [91.79.86.130]) by mx.google.com with ESMTPS id rn10sm6519506lbb.16.2013.04.19.15.22.24 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 19 Apr 2013 15:22:25 -0700 (PDT) To: horms@verge.net.au, magnus.damm@gmail.com, linux@arm.linux.org.uk, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/1] ARM: shmobile: r8a7778: add I2C support From: Sergei Shtylyov Organization: Cogent Embedded Date: Sat, 20 Apr 2013 02:21:36 +0400 MIME-Version: 1.0 Message-Id: <201304200221.36928.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQnn3n+gwtU7uZfTfadOlAq0/LXAz/swj1Jopb8a8R4Da7/sZ6sDXnz2wNgEaoM/V2J39KLn X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130419_182229_240504_B3A6D329 X-CRM114-Status: GOOD ( 14.60 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: vladimir.barinov@cogentembedded.com 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 From: Vladimir Barinov Add I2C clocks and platform devices for R8A7778 SoC. Don't forget to also add the peripheral clock which the I2C driver uses. Signed-off-by: Vladimir Barinov [Sergei: changed the registration function to platform_device_register_simple(), regrouped MSTPxxx *enum* members, added the copyright.] Signed-off-by: Sergei Shtylyov Acked-by: Kuninori Morimoto --- Changes since the original posting: - regrouped MSTPxxx *enum* members; - resolved reject in the 'clock-r8a7778.c' file, refreshed the patch; - added an ACK from Kuninori Morimoto. arch/arm/mach-shmobile/clock-r8a7778.c | 14 +++++++++++++- arch/arm/mach-shmobile/setup-r8a7778.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) 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 @@ -3,6 +3,7 @@ * * Copyright (C) 2013 Renesas Solutions Corp. * Copyright (C) 2013 Kuninori Morimoto + * Copyright (C) 2013 Cogent Embedded, Inc. * * based on r8a7779 * @@ -106,7 +107,8 @@ enum { MSTP323, MSTP322, MSTP321, MSTP114, MSTP100, - MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, + MSTP030, MSTP029, + MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, MSTP016, MSTP015, MSTP_NR }; @@ -116,6 +118,10 @@ static struct clk mstp_clks[MSTP_NR] = { [MSTP321] = SH_CLK_MSTP32(&p_clk, MSTPCR3, 21, 0), /* SDHI2 */ [MSTP114] = SH_CLK_MSTP32(&p_clk, MSTPCR1, 14, 0), /* Ether */ [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 */ + [MSTP028] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 28, 0), /* I2C2 */ + [MSTP027] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 27, 0), /* I2C3 */ [MSTP026] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 26, 0), /* SCIF0 */ [MSTP025] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 25, 0), /* SCIF1 */ [MSTP024] = SH_CLK_MSTP32(&p_clk, MSTPCR0, 24, 0), /* SCIF2 */ @@ -127,6 +133,8 @@ static struct clk mstp_clks[MSTP_NR] = { }; static struct clk_lookup lookups[] = { + CLKDEV_CON_ID("peripheral_clk", &p_clk), + /* MSTP32 clocks */ CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP323]), /* SDHI0 */ CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP322]), /* SDHI1 */ @@ -134,6 +142,10 @@ static struct clk_lookup lookups[] = { CLKDEV_DEV_ID("sh-eth", &mstp_clks[MSTP114]), /* Ether */ 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 */ + CLKDEV_DEV_ID("i2c-rcar.1", &mstp_clks[MSTP029]), /* I2C1 */ + CLKDEV_DEV_ID("i2c-rcar.2", &mstp_clks[MSTP028]), /* I2C2 */ + CLKDEV_DEV_ID("i2c-rcar.3", &mstp_clks[MSTP027]), /* I2C3 */ CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP026]), /* SCIF0 */ CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP025]), /* SCIF1 */ CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP024]), /* SCIF2 */ 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 @@ -94,6 +94,33 @@ static struct sh_timer_config sh_tmu1_pl &sh_tmu##idx##_platform_data, \ sizeof(sh_tmu##idx##_platform_data)) +/* I2C */ +static struct resource i2c0_resources[] = { + DEFINE_RES_MEM(0xffc70000, 0x1000), + DEFINE_RES_IRQ(gic_iid(0x63)), +}; + +static struct resource i2c1_resources[] = { + DEFINE_RES_MEM(0xffc71000, 0x1000), + DEFINE_RES_IRQ(gic_iid(0x6e)), +}; + +static struct resource i2c2_resources[] = { + DEFINE_RES_MEM(0xffc72000, 0x1000), + DEFINE_RES_IRQ(gic_iid(0x6c)), +}; + +static struct resource i2c3_resources[] = { + DEFINE_RES_MEM(0xffc73000, 0x1000), + DEFINE_RES_IRQ(gic_iid(0x6d)), +}; + +#define r8a7778_register_i2c(idx) \ + platform_device_register_simple( \ + "i2c-rcar", idx, \ + i2c##idx##_resources, \ + ARRAY_SIZE(i2c##idx##_resources)) + /* USB PHY */ static struct resource usb_phy_resources[] = { DEFINE_RES_MEM(0xffe70800, 0x100), @@ -260,6 +287,11 @@ void __init r8a7778_add_standard_devices r8a7778_register_tmu(0); r8a7778_register_tmu(1); + + r8a7778_register_i2c(0); + r8a7778_register_i2c(1); + r8a7778_register_i2c(2); + r8a7778_register_i2c(3); } void __init r8a7778_init_late(void)