From patchwork Tue Aug 6 23:04:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2839714 Return-Path: X-Original-To: patchwork-linux-arm@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 C98899F479 for ; Tue, 6 Aug 2013 23:04:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DB5F62017A for ; Tue, 6 Aug 2013 23:04:57 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B580D2010E for ; Tue, 6 Aug 2013 23:04:56 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6qJA-0006Q9-T6; Tue, 06 Aug 2013 23:04:53 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6qJ8-0004wZ-BQ; Tue, 06 Aug 2013 23:04:50 +0000 Received: from mail-la0-f45.google.com ([209.85.215.45]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1V6qJ4-0004uC-6D for linux-arm-kernel@lists.infradead.org; Tue, 06 Aug 2013 23:04:46 +0000 Received: by mail-la0-f45.google.com with SMTP id fj20so745223lab.18 for ; Tue, 06 Aug 2013 16:04:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=moOHkdG+pDdlp0hoVWRr01PcUnPkaZ4dv5FBU0uLXxM=; b=cVOZiCP26OwDE4rFnBxNKrHe2IMMJO07yhmikaRuqgGSI3hu2ahicSW4rTiAGEYqPY zPUkr9Uslqd2L9Yy/qrTp5gZ/FgvTxPokPlsJNxNGFvciuaGow/jHeYtcW4+klZuMgcf UXXo202EHL/TIlt6XlvLUEGTJ85cRB6wMBBUY+xM8cT7XGRNcxRAm7OUvJjKx+2zDTuE CArFbaUBhp5cWHeaGooC0WimewqM3Z9PEJgOjFjVAlQCB/CSPe2uWvtvQFD3M9gl5o1w ogSoIgSZWaeeiXFI2ZdmdJN5O+uszKesNzltgbTllK/HByhnoyCaPKSR9LzuzhPqgdYV Niog== X-Gm-Message-State: ALoCoQmqCJF9UDn8ARbea9Crt/1g6Pzu66tk6nJ7PIDqYojsckbi8Y/UrWAbw3Wx5DF3gmh6i9Od X-Received: by 10.152.9.194 with SMTP id c2mr141687lab.83.1375830263416; Tue, 06 Aug 2013 16:04:23 -0700 (PDT) Received: from localhost.localdomain (c83-249-208-124.bredband.comhem.se. [83.249.208.124]) by mx.google.com with ESMTPSA id am8sm1617425lac.1.2013.08.06.16.04.21 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 06 Aug 2013 16:04:22 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: nomadik: switch to use the Nomadik I2C driver Date: Wed, 7 Aug 2013 01:04:12 +0200 Message-Id: <1375830252-27233-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130806_190446_381808_B5579E7C X-CRM114-Status: GOOD ( 12.95 ) X-Spam-Score: -2.6 (--) Cc: Linus Walleij X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Instead of using bit-banged I2C, let's use the actual I2C driver in the kernel. Since the I2C block may be communicating with things like the PMIC, we need to select it from the Kconfig just like the bit-banged adapter is selected today. The rest of the configuration for this driver can be done from the device tree. Signed-off-by: Linus Walleij --- arch/arm/boot/dts/ste-nomadik-stn8815.dtsi | 42 ++++++++++++++++++++++-------- arch/arm/mach-nomadik/Kconfig | 1 + 2 files changed, 32 insertions(+), 11 deletions(-) diff --git a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi index a3acfa7..9169d30 100644 --- a/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi +++ b/arch/arm/boot/dts/ste-nomadik-stn8815.dtsi @@ -140,18 +140,30 @@ }; }; i2c0 { + i2c0_default_mux: i2c0_mux { + i2c0_default_mux { + ste,function = "i2c0"; + ste,pins = "i2c0_a_1"; + }; + }; i2c0_default_mode: i2c0_default { i2c0_default_cfg { ste,pins = "GPIO62_D3", "GPIO63_D2"; - ste,input = <1>; + ste,input = <0>; }; }; }; i2c1 { + i2c1_default_mux: i2c1_mux { + i2c1_default_mux { + ste,function = "i2c1"; + ste,pins = "i2c1_a_1"; + }; + }; i2c1_default_mode: i2c1_default { i2c1_default_cfg { ste,pins = "GPIO53_L4", "GPIO54_L3"; - ste,input = <1>; + ste,input = <0>; }; }; }; @@ -159,7 +171,7 @@ i2c2_default_mode: i2c2_default { i2c2_default_cfg { ste,pins = "GPIO73_C21", "GPIO74_C20"; - ste,input = <1>; + ste,input = <0>; }; }; }; @@ -682,13 +694,17 @@ /* I2C0 connected to the STw4811 power management chip */ i2c0 { - compatible = "i2c-gpio"; - gpios = <&gpio1 31 0>, /* sda */ - <&gpio1 30 0>; /* scl */ + compatible = "st,nomadik-i2c", "arm,primecell"; + reg = <0x101f8000 0x1000>; + interrupt-parent = <&vica>; + interrupts = <20>; + clock-frequency = <100000>; #address-cells = <1>; #size-cells = <0>; + clocks = <&i2c0clk>, <&pclki2c0>; + clock-names = "mclk", "apb_pclk"; pinctrl-names = "default"; - pinctrl-0 = <&i2c0_default_mode>; + pinctrl-0 = <&i2c0_default_mux>, <&i2c0_default_mode>; stw4811@2d { compatible = "st,stw4811"; @@ -698,13 +714,17 @@ /* I2C1 connected to various sensors */ i2c1 { - compatible = "i2c-gpio"; - gpios = <&gpio1 22 0>, /* sda */ - <&gpio1 21 0>; /* scl */ + compatible = "st,nomadik-i2c", "arm,primecell"; + reg = <0x101f7000 0x1000>; + interrupt-parent = <&vica>; + interrupts = <21>; + clock-frequency = <100000>; #address-cells = <1>; #size-cells = <0>; + clocks = <&i2c1clk>, <&pclki2c1>; + clock-names = "mclk", "apb_pclk"; pinctrl-names = "default"; - pinctrl-0 = <&i2c1_default_mode>; + pinctrl-0 = <&i2c1_default_mux>, <&i2c1_default_mode>; camera@2d { compatible = "st,camera"; diff --git a/arch/arm/mach-nomadik/Kconfig b/arch/arm/mach-nomadik/Kconfig index 5981c3d..4d42da4 100644 --- a/arch/arm/mach-nomadik/Kconfig +++ b/arch/arm/mach-nomadik/Kconfig @@ -27,6 +27,7 @@ config MACH_NOMADIK_8815NHK select NOMADIK_8815 select I2C select I2C_ALGOBIT + select I2C_NOMADIK endmenu endif