From: Sean Anderson <seanga2@gmail.com>
To: Niklas Cassel <Niklas.Cassel@wdc.com>,
Rick Chen <rick@andestech.com>, Leo <ycliang@andestech.com>
Cc: "damien.lemoal@opensource.wdc.com"
<damien.lemoal@opensource.wdc.com>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Re: [PATCH 3/7] k210: dts: fix fpioa node
Date: Fri, 25 Feb 2022 00:14:57 -0500 [thread overview]
Message-ID: <83e88079-eda3-de58-5666-506f284e8061@gmail.com> (raw)
In-Reply-To: <20220215161611.1563067-4-Niklas.Cassel@wdc.com>
> Re: [PATCH 3/7] k210: dts: fix fpioa node
This is not really a fix so much as an alignment with what Linux does
On 2/15/22 11:16 AM, Niklas Cassel wrote:
> From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
>
> Linux kernel fpioa pinctrl driver expects the sysctl phandle and the
> power bit offset of the fpioa device to be specified as a single
> property "canaan,k210-sysctl-power".
> Replace the "canaan,k210-sysctl" and "canaan,k210-power-offset"
> properties with "canaan,k210-sysctl-power" to satisfy the Linux kernel
> requirements. This new property is parsed using the existing function
> dev_read_phandle_with_args().
>
> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
> arch/riscv/dts/k210.dtsi | 3 +--
> drivers/pinctrl/pinctrl-k210.c | 19 ++++++++++++++-----
> 2 files changed, 15 insertions(+), 7 deletions(-)
>
> diff --git a/arch/riscv/dts/k210.dtsi b/arch/riscv/dts/k210.dtsi
> index 5c88c8ea8e..cf5c2360fb 100644
> --- a/arch/riscv/dts/k210.dtsi
> +++ b/arch/riscv/dts/k210.dtsi
> @@ -378,8 +378,7 @@
> <&sysclk K210_CLK_APB0>;
> clock-names = "ref", "pclk";
> resets = <&sysrst K210_RST_FPIOA>;
> - canaan,k210-sysctl = <&sysctl>;
> - canaan,k210-power-offset = <K210_SYSCTL_POWER_SEL>;
> + canaan,k210-sysctl-power = <&sysctl K210_SYSCTL_POWER_SEL>;
> pinctrl-0 = <&fpioa_jtag>;
> pinctrl-names = "default";
> status = "disabled";
> diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c
> index bb5153c673..63084ae837 100644
> --- a/drivers/pinctrl/pinctrl-k210.c
> +++ b/drivers/pinctrl/pinctrl-k210.c
> @@ -679,6 +679,7 @@ static int k210_pc_probe(struct udevice *dev)
> {
> int ret, i, j;
> struct k210_pc_priv *priv = dev_get_priv(dev);
> + struct ofnode_phandle_args args;
>
> priv->fpioa = dev_read_addr_ptr(dev);
> if (!priv->fpioa)
> @@ -692,15 +693,23 @@ static int k210_pc_probe(struct udevice *dev)
> if (ret && ret != -ENOSYS && ret != -ENOTSUPP)
> goto err;
>
> - priv->sysctl = syscon_regmap_lookup_by_phandle(dev, "canaan,k210-sysctl");
> + ret = dev_read_phandle_with_args(dev, "canaan,k210-sysctl-power",
> + NULL, 1, 0, &args);
> + if (ret)
> + goto err;
> +
> + if (args.args_count != 1) {
> + ret = -EINVAL;
> + goto err;
> + }
> +
> + priv->sysctl = syscon_node_to_regmap(args.node);
> if (IS_ERR(priv->sysctl)) {
> - ret = -ENODEV;
> + ret = PTR_ERR(priv->sysctl);
> goto err;
> }
>
> - ret = dev_read_u32(dev, "canaan,k210-power-offset", &priv->power_offset);
> - if (ret)
> - goto err;
> + priv->power_offset = args.args[0];
>
> debug("%s: fpioa = %p sysctl = %p power offset = %x\n", __func__,
> priv->fpioa, (void *)priv->sysctl->ranges[0].start,
>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
next prev parent reply other threads:[~2022-02-25 5:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-15 16:16 [PATCH 0/7] canaan k210 SoC fixes Niklas Cassel
2022-02-15 16:16 ` [PATCH 1/7] k210: use the board vendor name rather than the marketing name Niklas Cassel
2022-02-25 5:12 ` Sean Anderson
2022-02-15 16:16 ` [PATCH 2/7] k210: dts: add missing power bus clocks Niklas Cassel
2022-02-25 5:13 ` Sean Anderson
2022-02-15 16:16 ` [PATCH 3/7] k210: dts: fix fpioa node Niklas Cassel
2022-02-25 5:14 ` Sean Anderson [this message]
2022-02-15 16:16 ` [PATCH 4/7] spi: dw: Force set K210 fifo length to 31 Niklas Cassel
2022-02-25 5:17 ` Sean Anderson
2022-02-15 16:16 ` [PATCH 5/7] spi: dw: Actually mask interrupts Niklas Cassel
2022-02-25 5:18 ` Sean Anderson
2022-02-15 16:16 ` [PATCH 6/7] pinctrl: k210: Fix loop in k210_pc_get_drive() Niklas Cassel
2022-02-25 5:15 ` Sean Anderson
2022-02-15 16:16 ` [PATCH 7/7] pinctrl: k210: Fix bias-pull-up Niklas Cassel
2022-02-25 5:15 ` Sean Anderson
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=83e88079-eda3-de58-5666-506f284e8061@gmail.com \
--to=seanga2@gmail.com \
--cc=Niklas.Cassel@wdc.com \
--cc=damien.lemoal@opensource.wdc.com \
--cc=rick@andestech.com \
--cc=u-boot@lists.denx.de \
--cc=ycliang@andestech.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