From patchwork Wed Dec 25 19:12:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentine Barshak X-Patchwork-Id: 3405641 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 A720FC0D4A for ; Wed, 25 Dec 2013 19:12:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC83E20125 for ; Wed, 25 Dec 2013 19:12:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0132C20136 for ; Wed, 25 Dec 2013 19:12:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752333Ab3LYTMS (ORCPT ); Wed, 25 Dec 2013 14:12:18 -0500 Received: from mail-la0-f51.google.com ([209.85.215.51]:59918 "EHLO mail-la0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752320Ab3LYTMS (ORCPT ); Wed, 25 Dec 2013 14:12:18 -0500 Received: by mail-la0-f51.google.com with SMTP id ec20so3349048lab.38 for ; Wed, 25 Dec 2013 11:12:16 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WJ/t4rtiQ0xAx7r56tpvy47ZJw1z5EzXZcgz+K8y6hg=; b=kWqp4ZaBeo+BaNKz91l52dXjSTL1kd1q3LLdZXIMwiYT5HKY1amXvt6FMewbUNa2Eq Hs4jST7vgylQxSAKZCfoOKMRzWt/lxcQYGXqPgBN8GYda0W9LEciuyfSvB673swFjdJL olKMFzSwoOOpg7Uikvfjre08ut9G4o6L+ApC+MHpV+qKR76fso8WHC0cDOZK6yZrZMDj 4fdHbT5+XTBR3Lwx3wK5gWXCpU1/vBpYtVtuQQaeubSl1n1SVUkumLLzMLfLryj42mOr xc1zA1V7T0mnRZw4+vSeQvUwCmCBCDefW2ZOTmfsHs4qoB62BRM9rJN0sJMvM2c9gRat DzhA== X-Gm-Message-State: ALoCoQlizeQZLZmKDjpwB7cyINtaRwwV1Tkj09PQPFAUdHuKXYxMhze5a+vUq5V0Y9r8lot8mkOX X-Received: by 10.152.8.131 with SMTP id r3mr2545laa.79.1387998736926; Wed, 25 Dec 2013 11:12:16 -0800 (PST) Received: from black.localnet ([93.100.122.208]) by mx.google.com with ESMTPSA id bl6sm16950046lbb.5.2013.12.25.11.12.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Dec 2013 11:12:16 -0800 (PST) From: Valentine Barshak To: linux-sh@vger.kernel.org Cc: Simon Horman , Magnus Damm , Kuninori Morimoto , Laurent Pinchart Subject: [PATCH 3/3] arm: shmobile: koelsch: Add I2C support Date: Wed, 25 Dec 2013 23:12:10 +0400 Message-Id: <1387998730-6012-4-git-send-email-valentine.barshak@cogentembedded.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1387998730-6012-1-git-send-email-valentine.barshak@cogentembedded.com> References: <1387998730-6012-1-git-send-email-valentine.barshak@cogentembedded.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.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, 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 This adds I2C[1245] busses support to Koelsch board. I2C[03] do not have any slave devices connected and are not used because of the following: * I2C0 pins are multiplexed with LBSC pins; * I2C3 pins are multiplexed with EtherMAC and VIN0 pins. Signed-off-by: Valentine Barshak --- arch/arm/mach-shmobile/board-koelsch.c | 46 ++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c index de7cc64..799825c 100644 --- a/arch/arm/mach-shmobile/board-koelsch.c +++ b/arch/arm/mach-shmobile/board-koelsch.c @@ -148,6 +148,38 @@ static const struct gpio_keys_platform_data koelsch_keys_pdata __initconst = { .nbuttons = ARRAY_SIZE(gpio_buttons), }; +/* I2C */ +static const struct resource i2c_resources[] __initconst = { + /* I2C0 */ + DEFINE_RES_MEM(0xE6508000, 0x40), + DEFINE_RES_IRQ(gic_spi(287)), + /* I2C1 */ + DEFINE_RES_MEM(0xE6518000, 0x40), + DEFINE_RES_IRQ(gic_spi(288)), + /* I2C2 */ + DEFINE_RES_MEM(0xE6530000, 0x40), + DEFINE_RES_IRQ(gic_spi(286)), + /* I2C3 */ + DEFINE_RES_MEM(0xE6540000, 0x40), + DEFINE_RES_IRQ(gic_spi(290)), + /* I2C4 */ + DEFINE_RES_MEM(0xE6520000, 0x40), + DEFINE_RES_IRQ(gic_spi(19)), + /* I2C5 */ + DEFINE_RES_MEM(0xE6528000, 0x40), + DEFINE_RES_IRQ(gic_spi(20)), +}; + +static void __init koelsch_add_i2c(unsigned idx) +{ + unsigned res_idx = idx * 2; + + BUG_ON(res_idx >= ARRAY_SIZE(i2c_resources)); + + platform_device_register_simple("i2c-rcar_gen2", idx, + i2c_resources + res_idx, 2); +} + static const struct pinctrl_map koelsch_pinctrl_map[] = { /* DU */ PIN_MAP_MUX_GROUP_DEFAULT("rcar-du-r8a7791", "pfc-r8a7791", @@ -171,6 +203,15 @@ static const struct pinctrl_map koelsch_pinctrl_map[] = { /* SCIF1 (CN20: DEBUG SERIAL1) */ PIN_MAP_MUX_GROUP_DEFAULT("sh-sci.7", "pfc-r8a7791", "scif1_data_d", "scif1"), + /* I2C1 */ + PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.1", "pfc-r8a7791", + "i2c1_e", "i2c1"), + /* I2C2 */ + PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.2", "pfc-r8a7791", + "i2c2", "i2c2"), + /* I2C4 */ + PIN_MAP_MUX_GROUP_DEFAULT("i2c-rcar_gen2.4", "pfc-r8a7791", + "i2c4_c", "i2c4"), }; static void __init koelsch_add_standard_devices(void) @@ -192,6 +233,11 @@ static void __init koelsch_add_standard_devices(void) sizeof(koelsch_keys_pdata)); koelsch_add_du_device(); + + koelsch_add_i2c(1); + koelsch_add_i2c(2); + koelsch_add_i2c(4); + koelsch_add_i2c(5); } /*