From patchwork Tue Feb 14 10:35:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Wu X-Patchwork-Id: 9571661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8603F60586 for ; Tue, 14 Feb 2017 10:35:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8BA5B2836B for ; Tue, 14 Feb 2017 10:35:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 806CB28391; Tue, 14 Feb 2017 10:35:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 45DAE28365 for ; Tue, 14 Feb 2017 10:35:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=QEW2s56LTPMB8p+jkbRfe11qpRLfmU6RiHaclRz3vGc=; b=Gcu7rCBMV+M/jpJd+VLRKJ6CPj 5gEQYElXbxwQktMlcaXff+ebMxybldkI4Z/4DzO8TMOYpPuj11QWoBP09A7req1ZQem726uNki56Z ZQZbQn8vKeZbGhhSlcyIc1AQnE1clzsEkM5o5sib/FWlh1PRqa2PsqM75EHQW7LXkb6oyS7osn1We NOhhsDZYXfokTFqQHMIX+G0yCZa87249aDqnMXo1p0mA957PgmEmDjLO5Ufvmy2/YjMnUVK5OTapz yJupo9mwi+kiJvMaY2TH9sm9WidnDBmgWknX1m6D7NTS1Dai8nBCaJyk8cJEZzdKtL/dBRbtYlFmU 6S/2Xhiw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cdaRo-0001GF-U6; Tue, 14 Feb 2017 10:35:00 +0000 Received: from lucky1.263xmail.com ([211.157.147.133]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cdaRg-00016w-5q for linux-rockchip@lists.infradead.org; Tue, 14 Feb 2017 10:34:56 +0000 Received: from david.wu?rock-chips.com (unknown [192.168.167.130]) by lucky1.263xmail.com (Postfix) with ESMTP id 6EE458F557; Tue, 14 Feb 2017 18:34:26 +0800 (CST) X-263anti-spam: X-MAIL-GRAY: 1 X-MAIL-DELIVERY: 0 Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 4A3B838B; Tue, 14 Feb 2017 18:34:27 +0800 (CST) X-RL-SENDER: david.wu@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: david.wu@rock-chips.com X-UNIQUE-TAG: <55468820553c3273f70dd9bd965ca8ec> X-ATTACHMENT-NUM: 0 X-SENDER: wdc@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 9947JRS24J; Tue, 14 Feb 2017 18:34:27 +0800 (CST) From: David Wu To: heiko@sntech.de, linus.walleij@linaro.org Subject: [PATCH v1 2/2] pinctrl: rockchip: Add input schmitt support for rk3328 Date: Tue, 14 Feb 2017 18:35:41 +0800 Message-Id: <1487068541-14120-3-git-send-email-david.wu@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1487068541-14120-1-git-send-email-david.wu@rock-chips.com> References: <1487068541-14120-1-git-send-email-david.wu@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170214_023452_534678_6B146A5B X-CRM114-Status: UNSURE ( 6.84 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: huangtao@rock-chips.com, linux-rockchip@lists.infradead.org, "david.wu" , linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: "david.wu" Signed-off-by: david.wu Reviewed-by: Heiko Stuebner --- drivers/pinctrl/pinctrl-rockchip.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/pinctrl/pinctrl-rockchip.c b/drivers/pinctrl/pinctrl-rockchip.c index 6a071b1..6206e1e 100644 --- a/drivers/pinctrl/pinctrl-rockchip.c +++ b/drivers/pinctrl/pinctrl-rockchip.c @@ -1358,6 +1358,26 @@ static int rockchip_set_pull(struct rockchip_pin_bank *bank, return ret; } +#define RK3328_SCHMITT_BITS_PER_PIN 1 +#define RK3328_SCHMITT_PINS_PER_REG 16 +#define RK3328_SCHMITT_BANK_STRIDE 8 +#define RK3328_SCHMITT_GRF_OFFSET 0x380 + +static void rk3328_calc_schmitt_reg_and_bit(struct rockchip_pin_bank *bank, + int pin_num, + struct regmap **regmap, + int *reg, u8 *bit) +{ + struct rockchip_pinctrl *info = bank->drvdata; + + *regmap = info->regmap_base; + *reg = RK3328_SCHMITT_GRF_OFFSET; + + *reg += bank->bank_num * RK3328_SCHMITT_BANK_STRIDE; + *reg += ((pin_num / RK3328_SCHMITT_PINS_PER_REG) * 4); + *bit = pin_num % RK3328_SCHMITT_PINS_PER_REG; +} + static int rockchip_get_schmitt(struct rockchip_pin_bank *bank, int pin_num) { struct rockchip_pinctrl *info = bank->drvdata; @@ -2857,6 +2877,7 @@ static int rockchip_pinctrl_probe(struct platform_device *pdev) .pull_calc_reg = rk3228_calc_pull_reg_and_bit, .drv_calc_reg = rk3228_calc_drv_reg_and_bit, .iomux_recalc = rk3328_recalc_mux, + .schmitt_calc_reg = rk3328_calc_schmitt_reg_and_bit, }; static struct rockchip_pin_bank rk3368_pin_banks[] = {