From patchwork Wed Sep 5 09:01:57 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 1406981 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F074FDF28C for ; Wed, 5 Sep 2012 09:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757440Ab2IEJBz (ORCPT ); Wed, 5 Sep 2012 05:01:55 -0400 Received: from na3sys009aog107.obsmtp.com ([74.125.149.197]:57607 "EHLO na3sys009aog107.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932489Ab2IEJBq (ORCPT ); Wed, 5 Sep 2012 05:01:46 -0400 Received: from mail-gh0-f174.google.com ([209.85.160.174]) (using TLSv1) by na3sys009aob107.postini.com ([74.125.148.12]) with SMTP ID DSNKUEcU+KGIWlmJNg79CI9z7KMzePr9ztRt@postini.com; Wed, 05 Sep 2012 02:01:46 PDT Received: by ghrr11 with SMTP id r11so33293ghr.19 for ; Wed, 05 Sep 2012 02:01:44 -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:in-reply-to:references :x-gm-message-state; bh=JlyTqrZqohjhgxFghLVhxVx9j2iOAsPvRRwqV2DbAqo=; b=RfYW8Ct3ZhGJlhqvqSJnyZmoUWzGW9KE00WH5sCQXhB5goiiLzB7MWC2hS9v5/7F23 PQ5g6tHVM1FLKUJogn+kap28TrfN0MBfg2v/Pm/Vm1DqFoXluVE6U3v1QZnn0Ke33sZg zXdMQuuVHyP0QaVeM5aVUYheLisHRI7MFBFnISGgcCM6u/hymgykb6OG/6j5zt7mlGnQ YFCkJFGqKehF5xwIznlACe+B+eOpUhB3yJ/bA44Jf/gqX9KUu6eJHQqDa4LYJAPSbukb vsJnGe2pXRAdQxOG0BEyrgoCHv+IPvzKWsiku+72p826Aj8LdZZX7s9SSABtKElhGslu CF0A== Received: by 10.236.154.2 with SMTP id g2mr21784675yhk.29.1346835704020; Wed, 05 Sep 2012 02:01:44 -0700 (PDT) Received: from barack.emea.dhcp.ti.com (dragon.ti.com. [192.94.94.33]) by mx.google.com with ESMTPS id h8sm1047114ank.9.2012.09.05.02.01.41 (version=SSLv3 cipher=OTHER); Wed, 05 Sep 2012 02:01:43 -0700 (PDT) From: Peter Ujfalusi To: Linus Walleij , Tony Lindgren Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH 1/2] pinctrl: pinctrl-single: Make sure we do not change bits outside of mask Date: Wed, 5 Sep 2012 12:01:57 +0300 Message-Id: <1346835718-21325-2-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.7.12 In-Reply-To: <1346835718-21325-1-git-send-email-peter.ujfalusi@ti.com> References: <1346835718-21325-1-git-send-email-peter.ujfalusi@ti.com> X-Gm-Message-State: ALoCoQnHafdHY9yqqrrwpA+2VPTJ04F+6wrti5UYwppjFKI7gzwI7bAe1D/slqHYvTlOzhHlrrVk Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Use the pcs->fmask to make sure that the value is not changing (setting) bits in areas where it should not. To avoid situations like this: pmx_dummy: pinmux@4a100040 { compatible = "pinctrl-single"; reg = <0x4a100040 0x0196>; #address-cells = <1>; #size-cells = <0>; pinctrl-single,register-width = <16>; pinctrl-single,function-mask = <0x00ff>; }; &pmx_dummy { pinctrl-names = "default"; pinctrl-0 = <&board_pins>; board_pins: pinmux_board_pins { pinctrl-single,pins = < 0x6c 0xf0f 0x6e 0x10f 0x70 0x23f 0x72 0xa5f >; }; }; Signed-off-by: Peter Ujfalusi Acked-by: Tony Lindgren --- drivers/pinctrl/pinctrl-single.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 76a4260..3508631 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -337,7 +337,7 @@ static int pcs_enable(struct pinctrl_dev *pctldev, unsigned fselector, vals = &func->vals[i]; val = pcs->read(vals->reg); val &= ~pcs->fmask; - val |= vals->val; + val |= (vals->val & pcs->fmask); pcs->write(val, vals->reg); }