From patchwork Sat Jul 18 20:51:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 1331610 X-Patchwork-Delegate: chunkeey@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=q4oS9ZJx; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=hzyeVmjT; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B8Kwx5B7Vz9sR4 for ; Sun, 19 Jul 2020 06:54:25 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version: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=VaMxuMlGkWhnKxvoB9aZIHF6SvF5BNpQu8A2a6ZupRo=; b=q4oS9ZJx+U7B10tFvepG645nu ZSt6m4I21yb37G4OUGan6Vs/AHJ64R93IKCPC3mijJTNL4X6ZeOlwoAWipFvKfTzrnxw8OApV6Pk0 IQQOajjEwH4j1zRnSo8zD8GDv7987Xgcci5xXvQTHzMcrd+jd+SyBUjToGI1G1w//Fk062qavQVvV h9KPboDSurAjhDKSpjve6OGHLG1BdvvTZEX1rCTZAg447OSoiJqMoGIz3ee5FxlX/9Kdd7V0xYYti Te7cNEfmTV7jBUaI/uD32y2Fs0TrQkg5kbEXOtzKqRwLdGwFvvdFP/b+vYaERnVqUvu31Dtn7P2JM vZCJ42isw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwtpR-0002vn-Q2; Sat, 18 Jul 2020 20:53:05 +0000 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jwtpM-0002uI-Om for openwrt-devel@lists.openwrt.org; Sat, 18 Jul 2020 20:53:02 +0000 Received: by mail-pl1-x641.google.com with SMTP id l6so6884894plt.7 for ; Sat, 18 Jul 2020 13:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZlG3kvKE0tntYONJ1EDOc5hw3ZFPzqxk9Z5kuOb/cKc=; b=hzyeVmjTD759lbtCWiiw9Y1QKH/+zzEw0frkf/IYA+2Z2kYJ19PHv8NtpEqMYNooSc iSe8wAqXRXovMGvbpkG/uQ4jGEkAwthr6Ttqa35K+INBTzvz2fxac6yFmyh4YDhP85P5 SptfjumusFOv2UWo36Mmv5vgZNOhlFpRKwLarriH+G6e54of6VjEXvFSmNMgmkeM7Y9c FIJ01aCxvVI4oF2CU1yiw2oLkMnshkLbpyyss9TI9a77oOFT4hpAz2TPtTszktZTom/L t0jVvGB08KjCP7XyYOWf+VLrvz4ObJbAmb24ssSzDFiOFgfC9INBQOz+y4QjdzFky16L FDPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZlG3kvKE0tntYONJ1EDOc5hw3ZFPzqxk9Z5kuOb/cKc=; b=F4pWPD1Fvide4Da2hL8MJ8UmnJMu8/sXFm7ONT/kUUg6qh6+8e+Bw1+piR0N+YA3af ZAcASDl3nr55YroeSElePaj1bWQ3oFPxkA4sSz/iTcVLbtNxWjiEd1pLoyOtKaOVn2zv XomNCI66cd2a5vtx0mjKYTLETnuMlAVYgDpcoAreXgy+pF7o/ZWU4fwrP58BsMmf8MdS f80TBZVztHxhYkHvEjge/RsB2DFfGlXTLVn4P9zu4D23KJEhUv5avC7R01y+n0KolOUA WYPGjotM8rNMUFHcJhDVikgRnrd1bYYIYyWu58pbwkkFhrB7olHxPp5qvJif6QqCH7lG +j8Q== X-Gm-Message-State: AOAM533zL2InOl+jHxSBuIHj2VcIFfWnyZkIJBrHBnPd+sGYceEbYrOT QYfaygVHTK7ESs6EZhRwBmEZlX5tj3Q= X-Google-Smtp-Source: ABdhPJyChecZEgbyY+ad+So44l1VwXGawCzQ9n2cZLv+9YyycYivPiVJnKzlEBxnmNzTA7IQOExz7Q== X-Received: by 2002:a17:90a:266f:: with SMTP id l102mr15547967pje.144.1595105578670; Sat, 18 Jul 2020 13:52:58 -0700 (PDT) Received: from localhost ([2601:647:5800:8d47:9eef:d5ff:fefc:64ae]) by smtp.gmail.com with ESMTPSA id 144sm11667207pfb.31.2020.07.18.13.52.57 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 18 Jul 2020 13:52:58 -0700 (PDT) From: Brian Norris To: openwrt-devel@lists.openwrt.org Subject: [RFC PATCH 4/5] ipq40xx: add open-drain support to pinctrl-msm Date: Sat, 18 Jul 2020 20:51:47 +0000 Message-Id: <20200718205148.1743807-5-computersforpeace@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200718205148.1743807-1-computersforpeace@gmail.com> References: <20200718205148.1743807-1-computersforpeace@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200718_165300_877922_5F2F7288 X-CRM114-Status: GOOD ( 15.89 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:641 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [computersforpeace[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Brian Norris Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Submitted upstream. Shouldn't affect existing devices, but enables new device support. https://lore.kernel.org/linux-gpio/20200703080646.23233-1-computersforpeace@gmail.com/ Currently queued for-next: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next&id=13355ca35cd16f5024655ac06e228b3c199e52a9 Signed-off-by: Brian Norris --- .../090-pinctrl-msm-open-drain.patch | 90 +++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch diff --git a/target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch b/target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch new file mode 100644 index 000000000000..9bb05f32844a --- /dev/null +++ b/target/linux/ipq40xx/patches-5.4/090-pinctrl-msm-open-drain.patch @@ -0,0 +1,90 @@ +From 5b08c1d567ee8e6af94696b3e549997cbdb2bb80 Mon Sep 17 00:00:00 2001 +From: Jaiganesh Narayanan +Date: Thu, 1 Sep 2016 10:40:38 +0530 +Subject: [PATCH] pinctrl: qcom: ipq4019: add open drain support + +Signed-off-by: Jaiganesh Narayanan +[ Brian: adapted from from the Chromium OS kernel used on IPQ4019-based + WiFi APs. ] +Signed-off-by: Brian Norris +--- +https://lore.kernel.org/linux-gpio/20200703080646.23233-1-computersforpeace@gmail.com/ + + drivers/pinctrl/qcom/pinctrl-ipq4019.c | 1 + + drivers/pinctrl/qcom/pinctrl-msm.c | 13 +++++++++++++ + drivers/pinctrl/qcom/pinctrl-msm.h | 2 ++ + 3 files changed, 16 insertions(+) + +diff --git a/drivers/pinctrl/qcom/pinctrl-ipq4019.c b/drivers/pinctrl/qcom/pinctrl-ipq4019.c +index 8bdb5bd393d2..63915cb210ff 100644 +--- a/drivers/pinctrl/qcom/pinctrl-ipq4019.c ++++ b/drivers/pinctrl/qcom/pinctrl-ipq4019.c +@@ -254,6 +254,7 @@ DECLARE_QCA_GPIO_PINS(99); + .mux_bit = 2, \ + .pull_bit = 0, \ + .drv_bit = 6, \ ++ .od_bit = 12, \ + .oe_bit = 9, \ + .in_bit = 0, \ + .out_bit = 1, \ +diff --git a/drivers/pinctrl/qcom/pinctrl-msm.c b/drivers/pinctrl/qcom/pinctrl-msm.c +index 83b7d64bc4c1..dac0404dadf4 100644 +--- a/drivers/pinctrl/qcom/pinctrl-msm.c ++++ b/drivers/pinctrl/qcom/pinctrl-msm.c +@@ -233,6 +233,10 @@ static int msm_config_reg(struct msm_pinctrl *pctrl, + *bit = g->pull_bit; + *mask = 3; + break; ++ case PIN_CONFIG_DRIVE_OPEN_DRAIN: ++ *bit = g->od_bit; ++ *mask = 1; ++ break; + case PIN_CONFIG_DRIVE_STRENGTH: + *bit = g->drv_bit; + *mask = 7; +@@ -310,6 +314,12 @@ static int msm_config_group_get(struct pinctrl_dev *pctldev, + if (!arg) + return -EINVAL; + break; ++ case PIN_CONFIG_DRIVE_OPEN_DRAIN: ++ /* Pin is not open-drain */ ++ if (!arg) ++ return -EINVAL; ++ arg = 1; ++ break; + case PIN_CONFIG_DRIVE_STRENGTH: + arg = msm_regval_to_drive(arg); + break; +@@ -382,6 +392,9 @@ static int msm_config_group_set(struct pinctrl_dev *pctldev, + else + arg = MSM_PULL_UP; + break; ++ case PIN_CONFIG_DRIVE_OPEN_DRAIN: ++ arg = 1; ++ break; + case PIN_CONFIG_DRIVE_STRENGTH: + /* Check for invalid values */ + if (arg > 16 || arg < 2 || (arg % 2) != 0) +diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h +index 9452da18a78b..dc7f8c84744b 100644 +--- a/drivers/pinctrl/qcom/pinctrl-msm.h ++++ b/drivers/pinctrl/qcom/pinctrl-msm.h +@@ -38,6 +38,7 @@ struct msm_function { + * @mux_bit: Offset in @ctl_reg for the pinmux function selection. + * @pull_bit: Offset in @ctl_reg for the bias configuration. + * @drv_bit: Offset in @ctl_reg for the drive strength configuration. ++ * @od_bit: Offset in @ctl_reg for controlling open drain. + * @oe_bit: Offset in @ctl_reg for controlling output enable. + * @in_bit: Offset in @io_reg for the input bit value. + * @out_bit: Offset in @io_reg for the output bit value. +@@ -75,6 +76,7 @@ struct msm_pingroup { + unsigned pull_bit:5; + unsigned drv_bit:5; + ++ unsigned od_bit:5; + unsigned oe_bit:5; + unsigned in_bit:5; + unsigned out_bit:5; +-- +2.17.1 +