From: Qipeng Zha <qipeng.zha@intel.com>
To: linux-gpio@vger.kernel.org
Cc: linus.walleij@linaro.org, mika.westerberg@intel.com,
Qi Zheng <qi.zheng@intel.com>
Subject: [PATCH 1/3] pinctrl: Intel: add RX invertion config
Date: Sat, 12 Mar 2016 01:06:00 +0800 [thread overview]
Message-ID: <1457715962-108484-1-git-send-email-qipeng.zha@intel.com> (raw)
Some module need to enable RX invertion config on BXT platform.
Signed-off-by: Qi Zheng <qi.zheng@intel.com>
Signed-off-by: Qipeng Zha <qipeng.zha@intel.com>
---
drivers/pinctrl/intel/pinctrl-intel.c | 45 +++++++++++++++++++++++++++++++++++
drivers/pinctrl/intel/pinctrl-intel.h | 8 +++++++
2 files changed, 53 insertions(+)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 85536b4..ded5378 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -472,6 +472,14 @@ static int intel_config_get(struct pinctrl_dev *pctldev, unsigned pin,
break;
+ case PIN_CONF_INTEL_INV_RX:
+ value = intel_get_padcfg(pctrl, pin, PADCFG0);
+ if (value & PADCFG0_RXINV)
+ arg = 1;
+ else
+ arg = 0;
+ break;
+
default:
return -ENOTSUPP;
}
@@ -549,6 +557,38 @@ static int intel_config_set_pull(struct intel_pinctrl *pctrl, unsigned pin,
return ret;
}
+
+static int intel_config_set_misc(struct intel_pinctrl *pctrl, unsigned pin,
+ unsigned long config)
+{
+ unsigned param = pinconf_to_config_param(config);
+ unsigned arg = pinconf_to_config_argument(config);
+ void __iomem *padcfg0;
+ unsigned long flags;
+ int ret = 0;
+ u32 value;
+
+ spin_lock_irqsave(&pctrl->lock, flags);
+
+ padcfg0 = intel_get_padcfg(pctrl, pin, PADCFG0);
+ value = readl(padcfg0);
+
+ if (param == PIN_CONF_INTEL_INV_RX) {
+ if (arg)
+ value |= PADCFG0_RXINV;
+ else
+ value &= ~PADCFG0_RXINV;
+ } else
+ ret = -EINVAL;
+
+ if (!ret)
+ writel(value, padcfg0);
+
+ spin_unlock_irqrestore(&pctrl->lock, flags);
+
+ return ret;
+}
+
static int intel_config_set(struct pinctrl_dev *pctldev, unsigned pin,
unsigned long *configs, unsigned nconfigs)
{
@@ -567,6 +607,11 @@ static int intel_config_set(struct pinctrl_dev *pctldev, unsigned pin,
if (ret)
return ret;
break;
+ case PIN_CONF_INTEL_INV_RX:
+ ret = intel_config_set_misc(pctrl, pin, configs[i]);
+ if (ret)
+ return ret;
+ break;
default:
return -ENOTSUPP;
diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h
index b602157..51f9076 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.h
+++ b/drivers/pinctrl/intel/pinctrl-intel.h
@@ -18,6 +18,14 @@ struct platform_device;
struct device;
/**
+* customized pinconf configurations
+* @PIN_CONF_INTEL_INV_RX: this will invert the RX pad state before it is
+* sent to the GPIO-to-IOxAPIC, GPE/SCI, SMI, NMI logic or GPI_IS[n]
+* that is using it.
+*/
+#define PIN_CONF_INTEL_INV_RX (PIN_CONFIG_END + 1)
+
+/**
* struct intel_pingroup - Description about group of pins
* @name: Name of the groups
* @pins: All pins in this group
--
1.8.3.2
next reply other threads:[~2016-03-11 9:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-11 17:06 Qipeng Zha [this message]
2016-03-11 9:38 ` [PATCH 1/3] pinctrl: Intel: add RX invertion config Mika Westerberg
2016-03-14 1:10 ` Zheng, Qi
2016-03-14 8:50 ` Westerberg, Mika
2016-03-14 8:56 ` Zheng, Qi
2016-03-14 12:26 ` Linus Walleij
2016-03-15 2:17 ` Zheng, Qi
2016-03-16 12:27 ` Linus Walleij
2016-03-16 13:34 ` Daniel Vetter
[not found] ` <20160316133412.GN14170-dv86pmgwkMBes7Z6vYuT8azUEOm+Xw19@public.gmane.org>
2016-03-17 14:41 ` Linus Walleij
2016-03-17 15:14 ` [Intel-gfx] " Jani Nikula
2016-03-11 17:06 ` [PATCH 2/3] pinctrl:Intel: clear interrupt status for every IRQ setup Qipeng Zha
2016-03-11 9:45 ` Mika Westerberg
2016-03-14 1:24 ` Zheng, Qi
2016-03-14 8:44 ` Westerberg, Mika
2016-03-14 9:02 ` Zheng, Qi
2016-03-14 9:20 ` Westerberg, Mika
2016-03-14 12:40 ` Linus Walleij
2016-03-14 12:54 ` Westerberg, Mika
2016-03-14 13:00 ` Westerberg, Mika
2016-03-14 14:26 ` Westerberg, Mika
2016-03-15 5:17 ` Zheng, Qi
2016-03-11 17:06 ` [PATCH 3/3] pinctrl:Intel: make the high level interrupt working Qipeng Zha
2016-03-11 9:49 ` Mika Westerberg
2016-03-14 1:26 ` Zheng, Qi
2016-03-14 1:40 ` Zheng, Qi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1457715962-108484-1-git-send-email-qipeng.zha@intel.com \
--to=qipeng.zha@intel.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=mika.westerberg@intel.com \
--cc=qi.zheng@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).