From patchwork Tue Feb 4 18:48:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Valentine Barshak X-Patchwork-Id: 3578471 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 618FA9F2F5 for ; Tue, 4 Feb 2014 18:48:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5D7A12012E for ; Tue, 4 Feb 2014 18:48:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 772502016C for ; Tue, 4 Feb 2014 18:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754415AbaBDSsa (ORCPT ); Tue, 4 Feb 2014 13:48:30 -0500 Received: from mail-lb0-f180.google.com ([209.85.217.180]:46700 "EHLO mail-lb0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753502AbaBDSs3 (ORCPT ); Tue, 4 Feb 2014 13:48:29 -0500 Received: by mail-lb0-f180.google.com with SMTP id n15so6820995lbi.11 for ; Tue, 04 Feb 2014 10:48:28 -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=bfgPV2dW/C60p4SQsq+eFVeebOW7xDMv3XhXCdIsU5M=; b=irxKsf6QIojZtQNgEvgIcY0AW2Uzms53oX7v+iXLHfNiuwNQ2bNjIl0++mGiZGVZVb CuM7GaVwKQoK/vh2nVVsiPbYakCGdCEZ+gKM2Cd6DGT5RrGR0nais9SftRNMV1MHXHoY 0E/Yqr2O+Ao50Gidncn0Mfd3gD4qGEfE2qsaOC7eEt95rckVDfWYmKQXA+W/3U14HAwd VDCXMD9CURwJXYaJ3B/40Ja01Cvke/hdTLnw5ApHkRDRjxq6rTz8jhmRWsvFr0WE8S6o K4DCt1VouP6UlydS8iVP8ryDN6E/2obL7mG+lR2kyVRWu2RzrrFhGl6zgw4u6uKDbWjJ lQMg== X-Gm-Message-State: ALoCoQnugZ42x5cuQDEj121ZHC+SymgWYqPVRllPcSEmKAq0/2gApItWl0MskBP/VSnbCSxCxkjZ X-Received: by 10.112.88.233 with SMTP id bj9mr29521973lbb.10.1391539708348; Tue, 04 Feb 2014 10:48:28 -0800 (PST) Received: from black.localnet ([93.100.122.208]) by mx.google.com with ESMTPSA id 10sm23526813lan.5.2014.02.04.10.48.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Feb 2014 10:48:27 -0800 (PST) From: Valentine Barshak To: linux-sh@vger.kernel.org Cc: Simon Horman , Magnus Damm , Laurent Pinchart Subject: [PATCH V3 1/4] ARM: shmobile: koelsch: Add I2C support Date: Tue, 4 Feb 2014 22:48:20 +0400 Message-Id: <1391539703-5787-2-git-send-email-valentine.barshak@cogentembedded.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1391539703-5787-1-git-send-email-valentine.barshak@cogentembedded.com> References: <1391539703-5787-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(+) Changes in V2: * capitalized ARM in the subject; Changes in V3: * rebased on top of renesas-devel-v3.14-rc1-20140204 tag. diff --git a/arch/arm/mach-shmobile/board-koelsch.c b/arch/arm/mach-shmobile/board-koelsch.c index 2ab5c75..b9f638e 100644 --- a/arch/arm/mach-shmobile/board-koelsch.c +++ b/arch/arm/mach-shmobile/board-koelsch.c @@ -163,6 +163,38 @@ static const struct platform_device_info sata0_info __initconst = { .dma_mask = DMA_BIT_MASK(32), }; +/* 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", @@ -186,6 +218,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) @@ -209,6 +250,11 @@ static void __init koelsch_add_standard_devices(void) koelsch_add_du_device(); platform_device_register_full(&sata0_info); + + koelsch_add_i2c(1); + koelsch_add_i2c(2); + koelsch_add_i2c(4); + koelsch_add_i2c(5); } /*