From patchwork Tue Sep 10 11:39:52 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 2865411 Return-Path: X-Original-To: patchwork-linux-sh@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 06A3DBF43F for ; Tue, 10 Sep 2013 11:40:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3F13320328 for ; Tue, 10 Sep 2013 11:40:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF13520214 for ; Tue, 10 Sep 2013 11:40:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751396Ab3IJLk2 (ORCPT ); Tue, 10 Sep 2013 07:40:28 -0400 Received: from mail-we0-f176.google.com ([74.125.82.176]:45150 "EHLO mail-we0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751348Ab3IJLk2 (ORCPT ); Tue, 10 Sep 2013 07:40:28 -0400 Received: by mail-we0-f176.google.com with SMTP id u56so6458888wes.35 for ; Tue, 10 Sep 2013 04:40:27 -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=DVnHiVBvMpbaGT0QfmE64MKN64z1jRvbmLVXEpXVqkM=; b=IfwVXb76k938i5H3ofxht4yhu/ONkak3sedL7cN/VxoCXCx+xdDIgc4QaX593QEVUB OrL1PO8slCKHZVNCdiLgs18fIQMM3yreHmSqodWfedQ/p+VYpM3b+weEIVFgs+vtrIge ymtHaS6E+F5g32b6UpEBVVZmg5GGSIFTB7NlZ8kSrormQRCB7kNpqKZCxi0tLlglyLNo W4sEt3+YfJNO1Ex+kG7q1X0TVA/juKk1UhTGW4P87NLOKZlREWQZhk+gCQLYL8Okz2KO 4dq3O3SW/AadZ6bS9ixtR3q3kJbtiJLy2EL69o/vr4OYleIClxm9dupNjF/e+BUJG71y puPQ== X-Received: by 10.194.178.166 with SMTP id cz6mr1229762wjc.53.1378813227068; Tue, 10 Sep 2013 04:40:27 -0700 (PDT) Received: from groucho.site ([109.201.154.159]) by mx.google.com with ESMTPSA id b13sm2930036wic.9.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 04:40:26 -0700 (PDT) From: Ulrich Hecht To: linux-sh@vger.kernel.org, horms@verge.net.au, magnus.damm@gmail.com Cc: laurent.pinchart@ideasonboard.com, sergei.shtylyov@cogentembedded.com, Ulrich Hecht , Nguyen Viet Dung Subject: [PATCH 1/3] ARM: shmobile: r8a7790: lager: i2c support Date: Tue, 10 Sep 2013 13:39:52 +0200 Message-Id: <1378813194-19493-2-git-send-email-ulrich.hecht@gmail.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1378813194-19493-1-git-send-email-ulrich.hecht@gmail.com> References: <1378813194-19493-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=-7.4 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 Enables the four i2c busses on the Lager board. Signed-off-by: Nguyen Viet Dung Signed-off-by: Ulrich Hecht --- arch/arm/mach-shmobile/board-lager.c | 60 ++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c index bb39d5f..097af8e 100644 --- a/arch/arm/mach-shmobile/board-lager.c +++ b/arch/arm/mach-shmobile/board-lager.c @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include #include @@ -171,6 +173,11 @@ static const struct pinctrl_map lager_pinctrl_map[] = { "du_sync_1", "du"), PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7790", "pfc-r8a7790", "du_clk_out_0", "du"), + /* I2C */ + PIN_MAP_MUX_GROUP_DEFAULT("rcar-i2c.1", "pfc-r8a7790", + "i2c1", "i2c1"), + PIN_MAP_MUX_GROUP_DEFAULT("rcar-i2c.2", "pfc-r8a7790", + "i2c2", "i2c2"), /* SCIF0 (CN19: DEBUG SERIAL0) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.6", "pfc-r8a7790", "scif0_data", "scif0"), @@ -193,6 +200,48 @@ static const struct pinctrl_map lager_pinctrl_map[] = { "intc_irq0", "intc"), }; +static struct i2c_board_info i2c2_devices[] = { + /* ak4643 at 0x12: no driver */ + { + I2C_BOARD_INFO("adv7180", 0x20), + }, + { + I2C_BOARD_INFO("adv7511", 0x39), + }, + /* adv7612 at 0x4c: no driver */ +}; + +/* I2C */ +static struct i2c_rcar_platform_data i2c_pdata = { + .bus_speed = 100000, +}; + +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)), +}; + +static void __init lager_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_h2", idx, + rcar_i2c_res + (2*idx), 2, + pdata, sizeof(*pdata)); +} + static void __init lager_add_standard_devices(void) { r8a7790_clock_init(); @@ -220,6 +269,17 @@ static void __init lager_add_standard_devices(void) ðer_pdata, sizeof(ether_pdata)); lager_add_du_device(); + + lager_add_i2c_device(0, &i2c_pdata); + lager_add_i2c_device(1, &i2c_pdata); + lager_add_i2c_device(2, &i2c_pdata); + lager_add_i2c_device(3, &i2c_pdata); + + /* + * I2C channels 0 and 3 are wired to external connectors; channel 1 + * has only one device (da9063) for which no driver exists. + */ + i2c_register_board_info(2, i2c2_devices, ARRAY_SIZE(i2c2_devices)); } static const char * const lager_boards_compat_dt[] __initconst = {