From patchwork Fri Aug 30 12:37:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 2851963 Return-Path: X-Original-To: patchwork-linux-sh@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 71D559F313 for ; Fri, 30 Aug 2013 12:39:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBD7D203AD for ; Fri, 30 Aug 2013 12:39:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B4D6B2039D for ; Fri, 30 Aug 2013 12:39:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756039Ab3H3MjI (ORCPT ); Fri, 30 Aug 2013 08:39:08 -0400 Received: from mail-ea0-f172.google.com ([209.85.215.172]:44307 "EHLO mail-ea0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755991Ab3H3MjI (ORCPT ); Fri, 30 Aug 2013 08:39:08 -0400 Received: by mail-ea0-f172.google.com with SMTP id r16so902372ead.31 for ; Fri, 30 Aug 2013 05:39:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VC1nDvALD6tRqjwjCeiQAQfrUee1k07gN6ZGNr9SBTU=; b=LHBRp0yKsiCXRY2ShwkGZkjBcjINAmZBaV4ZDMq3BvW0B/fGLb9RSj2xwpLrczzaQE DXh3du5OrzmK5RdNvIBMpXRoWqKTDD0sdKF4eF0BgNjNLaZ0rnbWf7ePgmjlq1vXxZlg zYNCB3BN2cUDHmxUay64//fTd1FPfZ9RhH1omzDQJYftnRKYRioip+fcftdb0Oj60KIJ MMSKjwN0Mq2i0l8IS63Q8V5y7H3Nhu3lY/o6JZDeJuEuawM3Yd5xgJBKiYVcCAek0BT8 MgsH+ijhzkS+0s0QPWaWrL9WDWyOAPXB3hGanBVMoP84qScMkYc8nhXvf83jaCpDIYLx k02g== X-Received: by 10.14.177.199 with SMTP id d47mr12366852eem.14.1377866346816; Fri, 30 Aug 2013 05:39:06 -0700 (PDT) Received: from groucho.site ([109.201.152.242]) by mx.google.com with ESMTPSA id j7sm54444384eeo.15.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 30 Aug 2013 05:39:06 -0700 (PDT) From: Ulrich Hecht To: linux-sh@vger.kernel.org Cc: magnus.damm@gmail.com, Nguyen Viet Dung Subject: [RFC 05/10] ARM: shmobile: r8a7790: add I2C setup Date: Fri, 30 Aug 2013 14:37:39 +0200 Message-Id: <1377866264-21110-6-git-send-email-ulrich.hecht@gmail.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1377866264-21110-1-git-send-email-ulrich.hecht@gmail.com> References: <1377866264-21110-1-git-send-email-ulrich.hecht@gmail.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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: Nguyen Viet Dung This patch add setup for I2C bus. Signed-off-by: Nguyen Viet Dung --- arch/arm/mach-shmobile/include/mach/r8a7790.h | 3 +++ arch/arm/mach-shmobile/setup-r8a7790.c | 28 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h index 177a837..ad8b502 100644 --- a/arch/arm/mach-shmobile/include/mach/r8a7790.h +++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h @@ -1,7 +1,10 @@ #ifndef __ASM_R8A7790_H__ #define __ASM_R8A7790_H__ +#include + void r8a7790_add_standard_devices(void); +void r8a7790_add_i2c_device(int idx, struct i2c_rcar_platform_data *pdata); void r8a7790_add_dt_devices(void); void r8a7790_clock_init(void); void r8a7790_pinmux_init(void); diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c index e0d29a2..969fdf2 100644 --- a/arch/arm/mach-shmobile/setup-r8a7790.c +++ b/arch/arm/mach-shmobile/setup-r8a7790.c @@ -19,6 +19,7 @@ */ #include +#include #include #include #include @@ -196,6 +197,33 @@ void __init r8a7790_add_dt_devices(void) r8a7790_register_cmt(00); } +/* I2C */ +static struct resource rcar_i2c_res[] __initdata = { + /* I2C0 */ + DEFINE_RES_MEM(0xe6508000, 0x10000), + DEFINE_RES_IRQ(gic_spi(287)), + /* I2C1 */ + DEFINE_RES_MEM(0xe6518000, 0x10000), + DEFINE_RES_IRQ(gic_spi(288)), + /* I2C2 */ + DEFINE_RES_MEM(0xe6530000, 0x10000), + DEFINE_RES_IRQ(gic_spi(286)), + /* I2C3 */ + DEFINE_RES_MEM(0xe6540000, 0x10000), + DEFINE_RES_IRQ(gic_spi(290)), +}; + +void __init r8a7790_add_i2c_device(int idx, + struct i2c_rcar_platform_data *pdata) +{ + BUG_ON(idx < 0 || idx > 3); + + platform_device_register_resndata( + &platform_bus, "i2c-rcar", idx, + rcar_i2c_res + (2*idx), 2, + pdata, sizeof(*pdata)); +} + void __init r8a7790_add_standard_devices(void) { r8a7790_add_dt_devices();