From 49d73826d0e1d9a6955fa3c1c5db4091f2dc0e8f Mon Sep 17 00:00:00 2001 From: Prasad Sodagudi Date: Wed, 6 Jun 2018 17:14:43 -0700 Subject: [PATCH] pinctrl: qcom: Add EGPIO feature support to pinctrl driver Island IO can be assigned to Apps TLMM dynamically if that island is not using the pin for any connectivity. Add support for enabling EGPIO feature if the pin can support it. EGPIO_PRESENT bit shows if EGPIO feature is present or not for particular pin. Once EGPIO_ENABLE bit is set the pin is now controlled by Apps TLMM. When pinctrl properties are getting initialized by device driver framework, pin functions select would call to msm_pinmux_set_mux function to select pin function and enable EGPIO. Change-Id: I64514904096286f2a5df351880cd56d753f0658f Signed-off-by: Prasad Sodagudi Signed-off-by: Rishabh Bhatnagar Signed-off-by: Elliot Berman --- drivers/pinctrl/qcom/pinctrl-lahaina.c | 2 ++ drivers/pinctrl/qcom/pinctrl-msm.c | 4 ++++ drivers/pinctrl/qcom/pinctrl-msm.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/pinctrl/qcom/pinctrl-lahaina.c b/drivers/pinctrl/qcom/pinctrl-lahaina.c index 417fee146be1..a2dbca9c6eba 100644 --- a/drivers/pinctrl/qcom/pinctrl-lahaina.c +++ b/drivers/pinctrl/qcom/pinctrl-lahaina.c @@ -45,6 +45,8 @@ .mux_bit = 2, \ .pull_bit = 0, \ .drv_bit = 6, \ + .egpio_enable = 12, \ + .egpio_present = 11, \ .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 bf6e77d5f0f0..e7edd341d025 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.c +++ b/drivers/pinctrl/qcom/pinctrl-msm.c @@ -180,6 +180,10 @@ static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev, val = msm_readl_ctl(pctrl, g); val &= ~mask; val |= i << g->mux_bit; + /* Check if egpio present and enable that feature */ + if (val & BIT(g->egpio_present)) + val |= BIT(g->egpio_enable); + msm_writel_ctl(val, pctrl, g); raw_spin_unlock_irqrestore(&pctrl->lock, flags); diff --git a/drivers/pinctrl/qcom/pinctrl-msm.h b/drivers/pinctrl/qcom/pinctrl-msm.h index 48569cda8471..e629a971a07b 100644 --- a/drivers/pinctrl/qcom/pinctrl-msm.h +++ b/drivers/pinctrl/qcom/pinctrl-msm.h @@ -75,6 +75,8 @@ struct msm_pingroup { unsigned pull_bit:5; unsigned drv_bit:5; + unsigned egpio_enable:5; + unsigned egpio_present:5; unsigned oe_bit:5; unsigned in_bit:5; unsigned out_bit:5;