From patchwork Mon Mar 18 21:31:54 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2296041 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 013B640AFD for ; Mon, 18 Mar 2013 21:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932090Ab3CRVcT (ORCPT ); Mon, 18 Mar 2013 17:32:19 -0400 Received: from mail-ee0-f49.google.com ([74.125.83.49]:58041 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757049Ab3CRVcR (ORCPT ); Mon, 18 Mar 2013 17:32:17 -0400 Received: by mail-ee0-f49.google.com with SMTP id d41so2775334eek.8 for ; Mon, 18 Mar 2013 14:32:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=3KalLF5adq9ewf1OkqXMPAwwlrmDfSTV70zCdol+MnI=; b=HhlbYLXUUHW70kmtHjj2pMVeDrUSNebJFD7bheJjXAnZyFNkIZLnZ6bhOew2pnJB4a Tr+GMx8b+c75HEaHyCBIFpSyGie2T3CFXFAMUOFbThJyilN4Q1frTNmlSBpv7Bp/6cZk 65zuRoAOG70R6YqCpvoK6wHRYaYpvO0tmT0jA3e+2QTDBiGFrlL7ue3yTCE6K5WQxf+v FIE8BKpg4SlmF0jE+3M8bf+qiKGnpR+sqQgGYZ31noDvskAuHmXryJPgbzFUXrBIOBSx HSW9kUNZ7BTfqYwDYxQ4HnCSR6z6eOetJHedqwWJgHdeU6Sh5HOjcMsHbDz+QRe4iy40 CdgA== X-Received: by 10.14.220.135 with SMTP id o7mr53589468eep.3.1363642336124; Mon, 18 Mar 2013 14:32:16 -0700 (PDT) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPS id f47sm29540034eep.13.2013.03.18.14.32.14 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Mar 2013 14:32:15 -0700 (PDT) From: Tomasz Figa To: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, thomas.abraham@linaro.org, linus.walleij@linaro.org, Tomasz Figa Subject: [PATCH 5/6] pinctrl: samsung: Handle banks with two configuration registers Date: Mon, 18 Mar 2013 22:31:54 +0100 Message-Id: <1363642315-10331-6-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.8.1.5 In-Reply-To: <1363642315-10331-1-git-send-email-tomasz.figa@gmail.com> References: <1363642315-10331-1-git-send-email-tomasz.figa@gmail.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This patch adds support for banks that have more than one function configuration registers, e.g. some of the banks of S3C64xx SoCs. Signed-off-by: Tomasz Figa --- drivers/pinctrl/pinctrl-samsung.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/pinctrl/pinctrl-samsung.c b/drivers/pinctrl/pinctrl-samsung.c index 45a9939..b738b7b 100644 --- a/drivers/pinctrl/pinctrl-samsung.c +++ b/drivers/pinctrl/pinctrl-samsung.c @@ -303,6 +303,11 @@ static void samsung_pinmux_setup(struct pinctrl_dev *pctldev, unsigned selector, type = bank->type; mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1; shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC]; + if (shift >= 32) { + /* Some banks have two config registers */ + shift -= 32; + reg += 4; + } spin_lock_irqsave(&bank->slock, flags); @@ -356,6 +361,11 @@ static int samsung_pinmux_gpio_set_direction(struct pinctrl_dev *pctldev, mask = (1 << type->fld_width[PINCFG_TYPE_FUNC]) - 1; shift = pin_offset * type->fld_width[PINCFG_TYPE_FUNC]; + if (shift >= 32) { + /* Some banks have two config registers */ + shift -= 32; + reg += 4; + } spin_lock_irqsave(&bank->slock, flags);