Skip to content

Commit 99a735b

Browse files
qipengzhalinusw
authored andcommitted
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: Qi Zheng <qi.zheng@intel.com> Signed-off-by: Qipeng Zha <qipeng.zha@intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
1 parent 618a919 commit 99a735b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/pinctrl/intel/pinctrl-intel.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#define PADOWN_BITS 4
3535
#define PADOWN_SHIFT(p) ((p) % 8 * PADOWN_BITS)
3636
#define PADOWN_MASK(p) (0xf << PADOWN_SHIFT(p))
37+
#define PADOWN_GPP(p) ((p) / 8)
3738

3839
/* Offset from pad_regs */
3940
#define PADCFG0 0x000
@@ -139,7 +140,7 @@ static void __iomem *intel_get_padcfg(struct intel_pinctrl *pctrl, unsigned pin,
139140
static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin)
140141
{
141142
const struct intel_community *community;
142-
unsigned padno, gpp, gpp_offset, offset;
143+
unsigned padno, gpp, offset, group;
143144
void __iomem *padown;
144145

145146
community = intel_get_community(pctrl, pin);
@@ -149,9 +150,9 @@ static bool intel_pad_owned_by_host(struct intel_pinctrl *pctrl, unsigned pin)
149150
return true;
150151

151152
padno = pin_to_padno(community, pin);
152-
gpp = padno / NPADS_IN_GPP;
153-
gpp_offset = padno % NPADS_IN_GPP;
154-
offset = community->padown_offset + gpp * 16 + (gpp_offset / 8) * 4;
153+
group = padno / community->gpp_size;
154+
gpp = PADOWN_GPP(padno % community->gpp_size);
155+
offset = community->padown_offset + 0x10 * group + gpp * 4;
155156
padown = community->regs + offset;
156157

157158
return !(readl(padown) & PADOWN_MASK(padno));

0 commit comments

Comments
 (0)