From patchwork Fri Dec 27 11:27:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentine Barshak X-Patchwork-Id: 3411701 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 C254F9F374 for ; Fri, 27 Dec 2013 11:27:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DF6642015F for ; Fri, 27 Dec 2013 11:27:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D11382015D for ; Fri, 27 Dec 2013 11:27:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754437Ab3L0L1t (ORCPT ); Fri, 27 Dec 2013 06:27:49 -0500 Received: from mail-lb0-f179.google.com ([209.85.217.179]:47458 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754439Ab3L0L1r (ORCPT ); Fri, 27 Dec 2013 06:27:47 -0500 Received: by mail-lb0-f179.google.com with SMTP id w7so4114893lbi.24 for ; Fri, 27 Dec 2013 03:27:46 -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=ic3qs9hxd7K18F2VwCx4+2IgG4UEFouz7q33McUiSdA=; b=Nn2JcS+B4EVvuru71TbP9m/sCR47m7MoDhxR5vjwiPMWaxAwydRTLny+ZLNQTAsVMv dGBwqrGaGX2Iq3V5vWUTJH5w3HNg4X0J5BcKTukm7U+TaEfiFz++dRmbL/2XKVmxQBiu kTElQ0YQcH0LzVbCMX59uMroenrgpxXyh/gvWQtSGqui1uHuwoJU85/EdiMJt73idfDk BYBpUdzClgeAmauVUSXw6BliaS6ki7O8mtmF4wCFrTNzHm+kWXQEnCqEB+cfqz5zN/u4 IjLg8zOch1cj7kY67WaKGy+ZcAKobvYhOn4EO/Mym1mBKoI4wDegrF/COhX+0kxwImeE JUTA== X-Gm-Message-State: ALoCoQmFGG5oGnGDQy15KEwi+Qu2ti0VcEPlGcJcyuEakfWlQPLifX0N2LJ85iwOl/1OcNavESs+ X-Received: by 10.152.238.34 with SMTP id vh2mr3131440lac.50.1388143666598; Fri, 27 Dec 2013 03:27:46 -0800 (PST) Received: from black.localnet ([93.100.122.208]) by mx.google.com with ESMTPSA id h11sm20845396lbg.8.2013.12.27.03.27.45 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 Dec 2013 03:27:45 -0800 (PST) From: Valentine Barshak To: linux-sh@vger.kernel.org Cc: Simon Horman , Magnus Damm , Kuninori Morimoto , Laurent Pinchart Subject: [PATCH 3/3 V2] ARM: shmobile: koelsch: Add I2C support Date: Fri, 27 Dec 2013 15:27:39 +0400 Message-Id: <1388143659-8739-4-git-send-email-valentine.barshak@cogentembedded.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1388143659-8739-1-git-send-email-valentine.barshak@cogentembedded.com> References: <1388143659-8739-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. Changes in V2: * Capitalized ARM in the subject. 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); } /*