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: 17710 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ea0-f199.google.com (mail-ea0-f199.google.com [209.85.215.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4C23425DFB for ; Sun, 9 Jun 2013 22:34:45 +0000 (UTC) Received: by mail-ea0-f199.google.com with SMTP id q10sf3713676eaj.10 for ; Sun, 09 Jun 2013 15:34:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=a2v9BA7VPQTwrhx+lQfBOT+1vP5ZJdpJmBNQDAFXjME=; b=MamJ2O0rd03zgk6eJrW107pEhvnFMIhyrcABDMXbRFhvg3dpkvjxmpUNxe+8RNPqae eh9itrw4Sm0bDD5SN2P+B6XVgkUotiPQHIa+iqYeTZJY20xT4Y/5jTHY6DFzD5iKGFSU UGM2tgXMMcRFGZC6brpMU49cQsSVWgx30zf2xsTzzEY0p5R/A7L8ch/UgqAeepv3OsXO 4/O4Dl/wpjgj/Q5Vv6bz1362Fp+vo8aWdb9A/5Z7tIrakOXUejXhKxBAcURzaupsTGIZ Lu15lOHCCVic2CF6yg1NxJoq1gpQYdee/ucczVbL4nzKkkoFh6ARUKI0s7qXXNOWKQeO jhjg== X-Received: by 10.180.95.5 with SMTP id dg5mr2599309wib.6.1370817283933; Sun, 09 Jun 2013 15:34:43 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.180.39.197 with SMTP id r5ls674509wik.5.gmail; Sun, 09 Jun 2013 15:34:43 -0700 (PDT) X-Received: by 10.194.219.198 with SMTP id pq6mr4121177wjc.58.1370817283749; Sun, 09 Jun 2013 15:34:43 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id bo9si2802652wjc.23.2013.06.09.15.34.43 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Jun 2013 15:34:43 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id oz10so4271351veb.5 for ; Sun, 09 Jun 2013 15:34:42 -0700 (PDT) X-Received: by 10.52.53.36 with SMTP id y4mr3466552vdo.51.1370817282480; Sun, 09 Jun 2013 15:34:42 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp48941vcb; Sun, 9 Jun 2013 15:34:41 -0700 (PDT) X-Received: by 10.152.120.133 with SMTP id lc5mr3694554lab.76.1370817280772; Sun, 09 Jun 2013 15:34:40 -0700 (PDT) Received: from mail-la0-x22e.google.com (mail-la0-x22e.google.com [2a00:1450:4010:c03::22e]) by mx.google.com with ESMTPS id mx4si2686337lbc.155.2013.06.09.15.34.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 09 Jun 2013 15:34:40 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:4010:c03::22e is neither permitted nor denied by best guess record for domain of linus.walleij@linaro.org) client-ip=2a00:1450:4010:c03::22e; Received: by mail-la0-f46.google.com with SMTP id eg20so5180857lab.19 for ; Sun, 09 Jun 2013 15:34:39 -0700 (PDT) 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 Cc: Linus Walleij 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: ALoCoQmirJfnOsI0eI1/H5r1spCvQlJHldM392ArEnIs87CmKjvoiJ2LZStPeRRBkyuOhmrupR/s X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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