Commit 99a735b3 authored by Qipeng Zha's avatar Qipeng Zha Committed by Linus Walleij

pinctrl: intel: fix offset calculation issue of register PAD_OWN

The calculation equation of PAD_OWN register offset is not
correct for Broxton, verified this fix will get right
offset for Broxton.
Signed-off-by: default avatarQi Zheng <qi.zheng@intel.com>
Signed-off-by: default avatarQipeng Zha <qipeng.zha@intel.com>
Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 618a919b
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#define PADOWN_BITS 4 #define PADOWN_BITS 4
#define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS) #define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS)
#define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p)) #define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p))
#define PADOWN_GPP(p) ((p) / 8)
/* Offset from pad_regs */ /* Offset from pad_regs */
#define PADCFG0 0x000 #define PADCFG0 0x000
...@@ -139,7 +140,7 @@ static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl, unsigned pin, ...@@ -139,7 +140,7 @@ static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl, unsigned pin,
static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin) static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin)
{ {
const struct intel_community *community; const struct intel_community *community;
unsigned padno, gpp, gpp_offset, offset; unsigned padno, gpp, offset, group;
void __iomem *padown; void __iomem *padown;
community = intel_get_community(pctrl, pin); community = intel_get_community(pctrl, pin);
...@@ -149,9 +150,9 @@ static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin) ...@@ -149,9 +150,9 @@ static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin)
return true; return true;
padno = pin_to_padno(community, pin); padno = pin_to_padno(community, pin);
gpp = padno / NPADS_IN_GPP; group = padno / community->gpp_size;
gpp_offset = padno % NPADS_IN_GPP; gpp = PADOWN_GPP(padno % community->gpp_size);
offset = community->padown_offset + gpp * 16 + (gpp_offset / 8) * 4; offset = community->padown_offset + 0x10 * group + gpp * 4;
padown = community->regs + offset; padown = community->regs + offset;
return !(readl(padown) & PADOWN_MASK(padno)); return !(readl(padown) & PADOWN_MASK(padno));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment