From patchwork Thu Feb 7 16:27:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 14678 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 7D07C2425E for ; Thu, 7 Feb 2013 16:28:02 +0000 (UTC) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by fiordland.canonical.com (Postfix) with ESMTP id 31967A18D2B for ; Thu, 7 Feb 2013 16:28:02 +0000 (UTC) Received: by mail-vc0-f170.google.com with SMTP id p16so1757471vcq.29 for ; Thu, 07 Feb 2013 08:28:01 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:from:to:cc:subject:date:message-id:x-mailer :mime-version:content-type:x-gm-message-state; bh=l7kAZISMDd2X6UGecGg+XFtC/wU1NdCRUoDtHFJHkTA=; b=UwjrAgDcqGzdARIqYD2czbVyaTx878qXRDTy8THjQTE3/vYFcO4+XiqLMKG+32tSIj H89YVo+aJV6dfzC8BYZZvOjusemhKbtgeBdwLQpk1h7Gtdnbmg5UfD5GXbJdW2a9IcP8 2dE+NWZkytDH08XcpaQtNy6fL16ahkVtHBuzXiSeuSeWGlMrekh3fiKBL65mwUluFY4Z 03XygzLf0v1wg1ndx4CkEtkfgm2d321uEl+LKsnph0rk2N0hAoqussfkeD7Q/CoitrWj 9YNGZ4mkPUBrkBDEaCaZWMFBYHLormc/Pz2Z14FRXNEq4vzdol+0IuTVNcNL8TgLoDu4 bcUw== X-Received: by 10.58.232.226 with SMTP id tr2mr2408192vec.48.1360254478930; Thu, 07 Feb 2013 08:27:58 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.58.252.8 with SMTP id zo8csp99213vec; Thu, 7 Feb 2013 08:27:58 -0800 (PST) X-Received: by 10.14.2.196 with SMTP id 44mr5574430eef.25.1360254477745; Thu, 07 Feb 2013 08:27:57 -0800 (PST) Received: from eu1sys200aog111.obsmtp.com (eu1sys200aog111.obsmtp.com [207.126.144.131]) by mx.google.com with SMTP id w41si48474055een.202.2013.02.07.08.27.47 (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 07 Feb 2013 08:27:57 -0800 (PST) Received-SPF: neutral (google.com: 207.126.144.131 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) client-ip=207.126.144.131; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.131 is neither permitted nor denied by best guess record for domain of linus.walleij@stericsson.com) smtp.mail=linus.walleij@stericsson.com Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob111.postini.com ([207.126.147.11]) with SMTP ID DSNKURPWAMJmzI0xy6I6akajnOtYL2W3QvmZ@postini.com; Thu, 07 Feb 2013 16:27:57 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A3A8CAD; Thu, 7 Feb 2013 16:19:31 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A9CBD17E3; Thu, 7 Feb 2013 16:27:40 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id CABDF24C2F4; Thu, 7 Feb 2013 17:27:31 +0100 (CET) Received: from steludxu4075.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.3.83.0; Thu, 7 Feb 2013 17:27:39 +0100 From: Linus Walleij To: , Cc: Stephen Warren , Anmar Oueja , Linus Walleij , Lee Jones Subject: [PATCH] pinctrl/abx500: adjust offset for get_mode() Date: Thu, 7 Feb 2013 17:27:37 +0100 Message-ID: <1360254457-17024-1-git-send-email-linus.walleij@stericsson.com> X-Mailer: git-send-email 1.7.11.3 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkFG06MOpCGg57za/KkZfiRFlKHF4XLbuqolkB5tctAAoE/Tmt4I3cB9p6XEXL4S51UiKTZ From: Linus Walleij The set_mode() and get_mode() functions in the abx500 were not mirrored, leading to the wrong GPIO control bits being read out. Cc: Lee Jones Reported-by: Patrice Chotard Signed-off-by: Linus Walleij --- drivers/pinctrl/pinctrl-abx500.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c index 17508b5..0b3aa1c 100644 --- a/drivers/pinctrl/pinctrl-abx500.c +++ b/drivers/pinctrl/pinctrl-abx500.c @@ -401,6 +401,8 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, bool alt_bit2; struct abx500_pinctrl *pct = pinctrl_dev_get_drvdata(pctldev); struct alternate_functions af = pct->soc->alternate_functions[gpio]; + /* on ABx5xx, there is no GPIO0, so adjust the offset */ + unsigned offset = gpio - 1; /* * if gpiosel_bit is set to unused, @@ -410,7 +412,7 @@ static u8 abx500_get_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip, return ABX500_DEFAULT; /* read GpioSelx register */ - abx500_gpio_get_bit(chip, AB8500_GPIO_SEL1_REG + (gpio / 8), + abx500_gpio_get_bit(chip, AB8500_GPIO_SEL1_REG + (offset / 8), af.gpiosel_bit, &bit_mode); mode = bit_mode;