From patchwork Sun Jun 9 22:34:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 2695301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id 026BE3FC23 for ; Sun, 9 Jun 2013 22:35:16 +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 1UloCf-00045E-VY; Sun, 09 Jun 2013 22:35:14 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UloCd-0005Dm-3h; Sun, 09 Jun 2013 22:35:11 +0000 Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UloCZ-0005DK-Fz for linux-arm-kernel@lists.infradead.org; Sun, 09 Jun 2013 22:35:08 +0000 Received: by mail-la0-f48.google.com with SMTP id lx15so4083152lab.7 for ; Sun, 09 Jun 2013 15:34:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=a2v9BA7VPQTwrhx+lQfBOT+1vP5ZJdpJmBNQDAFXjME=; b=DdU22B8jo2Ufgs07RnMAQJEH2QRENgI4XhNfllxC0FpSpAxa9L9XOXdfEF6S9JPOu2 pTojdhdRW3sbq2BKB3xZHNMTy6uup006gWsSPqWCT0EW4C599gTJZ5IHeqYEbQtT8Ft+ HDSFiS609kyz4bWEMFMBQyIeNw3q0AV9LNXCO9iJS+KHBU5DHfU59iSwlMvUaNcC1eNo zijrpyaSxs91gBOLXkogX6ZxcZl+udVnKo3n13Ta6b0/RcPs45CL1S8YVjj87iuB6+NV ZSXl4wjtVnRu+c0zM6BrZcQIqtngGKCUOSHZdd0oOY1EsLoOkMBZ+zDVKC6tlxBU7qI7 3tJA== X-Received: by 10.152.44.137 with SMTP id e9mr3588098lam.80.1370817279348; Sun, 09 Jun 2013 15:34:39 -0700 (PDT) Received: from localhost.localdomain (c83-249-209-231.bredband.comhem.se. [83.249.209.231]) by mx.google.com with ESMTPSA id v4sm3374138lag.8.2013.06.09.15.34.37 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 09 Jun 2013 15:34:38 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: nomadik: switch to use the Nomadik I2C driver Date: Mon, 10 Jun 2013 00:34:30 +0200 Message-Id: <1370817270-10116-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.8.1.4 X-Gm-Message-State: ALoCoQkzFLBN+yOYD5Kyq40EG4HmPY0EmUr1dfLiNJVkM6xCDaIYfOIdmPdFCboptzqvu8nexSlW X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130609_183507_709718_F4FC9BE4 X-CRM114-Status: GOOD ( 15.05 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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 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 --- This patch is based on the branch of Nomadik clocks making it possible to do all configuration of the I2C block from the device tree. --- 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 82970d7..0e543e0 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"; @@ -704,13 +720,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