From patchwork Wed Dec 11 15:39:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 3327081 Return-Path: X-Original-To: patchwork-linux-omap@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 3B0FA9F1F0 for ; Wed, 11 Dec 2013 15:39:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7CF25207F2 for ; Wed, 11 Dec 2013 15:39:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 29E85207EF for ; Wed, 11 Dec 2013 15:39:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475Ab3LKPjd (ORCPT ); Wed, 11 Dec 2013 10:39:33 -0500 Received: from mail-wi0-f169.google.com ([209.85.212.169]:58837 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351Ab3LKPjc (ORCPT ); Wed, 11 Dec 2013 10:39:32 -0500 Received: by mail-wi0-f169.google.com with SMTP id hn6so7053606wib.2 for ; Wed, 11 Dec 2013 07:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=0VfuQlOUM5KZmhX0n4Bw6R6EvNUdnZnYiwDkM1X8yOo=; b=HbOlI5o4UoxGAGGuq/hExKCyLu7Bhkuzzbh8knkyK3PAL0X5jmcTB2WlIXayljoobp vN3EyGxZB2lHzFQVgvmw+mOgDb2ZHQYjGaNWZ2+CMpRbc0BrV9lhg8k998ZDKd2zwjcF DHM6awucaM7vFoGaGZ5P+Hz/JJk8AJJnv625FsfpB3RPTQa+/qQWE/VEyLoO9hXFsZXV AAeCoVB2aRhZt5D1hGfTLaa0eQZShIpfCdNdWuxNIkJI9rCylnXR5ui7zNfQ5BvgpBzB DenBoy4XLxsQi+h5AT/lN6BNBc4eWxsyGDZbmN0PwA3oqnMeWhiwWAVKPdvmYyp4+Kx9 mALg== MIME-Version: 1.0 X-Received: by 10.194.172.105 with SMTP id bb9mr2062645wjc.45.1386776371776; Wed, 11 Dec 2013 07:39:31 -0800 (PST) Received: by 10.216.111.195 with HTTP; Wed, 11 Dec 2013 07:39:31 -0800 (PST) In-Reply-To: <52A8768C.5070103@st.com> References: <52A8768C.5070103@st.com> Date: Wed, 11 Dec 2013 09:39:31 -0600 Message-ID: Subject: Re: need help to configure IRQ on gpio 139 pandaboard using device tree From: "menon.nishanth@gmail.com" To: Denis CIOCCA Cc: "linux-omap@vger.kernel.org" Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 On Wed, Dec 11, 2013 at 8:28 AM, Denis CIOCCA wrote: > Hi everybody, > > I'm trying to configure an IRQ on pandaboard using device tree but I'm > not able to understand how I can do it. > I want to configure the the gpio_139 pin and without device tree my > command was: > > OMAP4_MUX(MCSPI1_SIMO, OMAP_MUX_MODE3 | OMAP_PIN_INPUT_PULLUP), > > I need to associate it to a i2c device, declared in this way: here is how you'd figure it out in dt world ;) - it might be a little simpler or harder depending on which end of the development world one is from... (gmail might be screwing up my formatting a little.. so apologies before hand. http://pastebin.mozilla.org/3755622 is a copy if you need one.. anyways, step 1: from trm, you get to know that the pin is part of "core" "SYSCTRL_PADCONF_CORE" as it states for register instance in the trm. step 2: you compute the offset step 3: you define the pinctrl dt node step 4: you'd provide the device using it reference - rather trivial ;) --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm/boot/dts/omap4-panda-es.dts b/arch/arm/boot/dts/omap4-panda-es.dts index 56c4354..8f8d36c 100644 --- a/arch/arm/boot/dts/omap4-panda-es.dts +++ b/arch/arm/boot/dts/omap4-panda-es.dts @@ -41,6 +41,25 @@ 0xb6 (PIN_OUTPUT | MUX_MODE3) /* gpio_110 */ >; }; + + lsm303d_pins: lsm303d_pins { + pinctrl-single,pins = < + /* + * Example for 4460 device: + * from arch/arm/boot/dts/omap4.dtsi: + * omap4_pmx_core: reg = <0x4a100040 + * the base address --> ^^ + * + * Now, the offset is computed as following: + * Download TRM: http://www.ti.com/lit/ug/swpu235aa/swpu235aa.pdf + * Searching in TRM for MCSPI1_SIMO (page 4145), you see: + * 32 bit register 0x4a100134, it is on the higher 16 bits + * 0x4a100134(SOMI) + 2 (SIMO) = 0x4a100136 + * offset hence is = 0x4a100136 - 0x4a100040 = 0xF6 + */ + 0xF6 (PIN_INPUT_PULLUP | MUX_MODE3) /* mcspi1_somi.gpio_139 */ + >; + }; }; &led_wkgpio_pins { @@ -62,3 +81,16 @@ gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>; }; }; +&i2c4 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c4_pins>; + + clock-frequency = <400000>; + + lsm303d@03 { + pinctrl-names = "default"; + pinctrl-0 = <&lsm303d_pins>; + compatible = "st,lsm303d"; + reg = <0x03>; + }; +};