From patchwork Wed Apr 17 18:44:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2455831 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 54D5D3FD8C for ; Wed, 17 Apr 2013 18:45:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966612Ab3DQSpv (ORCPT ); Wed, 17 Apr 2013 14:45:51 -0400 Received: from mail-la0-f51.google.com ([209.85.215.51]:61051 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966525Ab3DQSpv (ORCPT ); Wed, 17 Apr 2013 14:45:51 -0400 Received: by mail-la0-f51.google.com with SMTP id fo12so1811431lab.10 for ; Wed, 17 Apr 2013 11:45:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received: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=4lwSAZIIdEWqilT4xezM7gYGSwqwEsxtE8MV0FRq8YA=; b=cnsRT+s0MAchrCRCsfHOWIbURPIfAqc1BfbBU3Okmmmba6rVzSBtBJw1oJNphfp6YK rcLPsnECVW1SuxuB7JMV3XVdx7NQRVBUHg7p8lBd5UIxQYWxFO0dHZ+cF2vgNm8MF2Wu O1OJ3AguXqem8EKSOzBP8JUuCxzm+3FMHwUO+D8jOGXpfvQBNHagf4o4/PxPvsvQceEM Lnd2x6G/bQyxorw88yE79+GnJaPmnpYml5N4Ukwi1K6Y0QOTq64AwShILFc0dD8z0sNp W5dhNqpEuOXihpLGTDjI2a5+n8HcuOqFCaXpoZ4sfM7+7461+KoNRzxaS8LdozL0BWAA PtFg== X-Received: by 10.152.6.229 with SMTP id e5mr4158105laa.6.1366224347699; Wed, 17 Apr 2013 11:45:47 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-79-88-26.pppoe.mtu-net.ru. [91.79.88.26]) by mx.google.com with ESMTPS id or9sm3065193lbb.8.2013.04.17.11.45.45 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 17 Apr 2013 11:45:46 -0700 (PDT) From: Sergei Shtylyov Organization: Cogent Embedded To: horms@verge.net.au Subject: [PATCH 1/2] ARM: shmobile: r8a7778: add I2C support Date: Wed, 17 Apr 2013 22:44:58 +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, linux-sh@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <201304172242.27671.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201304172242.27671.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201304172244.59435.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQnqev98Qwn0PMurpLuDSxhALZf+2juemFl0WnNtnrUmaExxXSBv48I7oIQ+7uUsYP+aBNAG Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.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()] Signed-off-by: Sergei Shtylyov --- arch/arm/mach-shmobile/clock-r8a7778.c | 12 ++++++++++++ arch/arm/mach-shmobile/setup-r8a7778.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 44 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 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 * @@ -105,6 +106,7 @@ static struct clk *main_clks[] = { enum { MSTP114, MSTP100, + MSTP030, MSTP029, MSTP028, MSTP027, MSTP026, MSTP025, MSTP024, MSTP023, MSTP022, MSTP021, MSTP016, MSTP015, MSTP_NR }; @@ -112,6 +114,10 @@ enum { static struct clk mstp_clks[MSTP_NR] = { [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 */ @@ -123,10 +129,16 @@ 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-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), @@ -236,6 +263,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)