From: Andrei Lalaev <andrey.lalaev@gmail.com>
To: jernej.skrabec@gmail.com
Cc: linus.walleij@linaro.org, mripard@kernel.org,
frank@allwinnertech.com, andre.przywara@arm.com, wens@csie.org,
samuel@sholland.org, linux-gpio@vger.kernel.org,
linux-sunxi@lists.linux.dev,
Andrei Lalaev <andrey.lalaev@gmail.com>
Subject: Re: [PATCH] pinctrl: sunxi: sunxi_pconf_set: use correct offset
Date: Wed, 15 Jun 2022 21:06:44 +0300 [thread overview]
Message-ID: <20220615180643.299586-1-andrey.lalaev@gmail.com> (raw)
In-Reply-To: <8939552.CDJkKcVGEf@kista>
Hi!
Jernej, sorry to have kept you waiting.
On Wed, May 26, 2022 at 11:52 PM Jernej Škrabec <jernej.skrabec@gmail.com> wrote:
> You didn't explain how issue manifests. How did you find it?
I noticed this problem when tried to pull-down a pin at kernel 5.3.11.
sunxi_pconf_set uses sunxi_pconf_reg to get offset and shift.
sunxi_pconf_reg uses the next functions to calculate register offset:
sunxi_dlevel_reg
sunxi_dlevel_offset
sunxi_pull_reg
sunxi_pull_offset
These functions calculate the offset relative to the pinctrl address.
Let's consider the sunxi_pconf_reg's output with the following arguments:
pin = 354 (PL2)
param = PIN_CONFIG_BIAS_PULL_UP
So the sunxi_pull_reg is called and it returns "0x1a8".
This value too high to be register offset :)
But with my patch:
pin_base = 352
pin = 354 - 352 = 2 (PL2)
param = PIN_CONFIG_BIAS_PULL_UP
And sunxi_pull_reg returns "0x1c" as expected.
According to the datasheet [1] (page 349) it's the PL_PULL register.
P.S. sunxi_pconf_get calculates the pin number in the same way (line 490).
---
[1] https://linux-sunxi.org/images/4/4b/Allwinner_H3_Datasheet_V1.2.pdf
Best regards,
Andrei Lalaev
next prev parent reply other threads:[~2022-06-15 18:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-25 19:04 [PATCH] pinctrl: sunxi: sunxi_pconf_set: use correct offset Andrei Lalaev
2022-05-26 20:52 ` Jernej Škrabec
2022-06-15 18:06 ` Andrei Lalaev [this message]
2022-06-15 13:17 ` Linus Walleij
2022-06-15 15:56 ` Jernej Škrabec
2022-06-17 4:32 ` Samuel Holland
2022-06-27 9:27 ` Linus Walleij
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=20220615180643.299586-1-andrey.lalaev@gmail.com \
--to=andrey.lalaev@gmail.com \
--cc=andre.przywara@arm.com \
--cc=frank@allwinnertech.com \
--cc=jernej.skrabec@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mripard@kernel.org \
--cc=samuel@sholland.org \
--cc=wens@csie.org \
/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).