linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>,
	linux-kernel@vger.kernel.org, jic23@kernel.org,
	linux-iio@vger.kernel.org, git@xilinx.com,
	michal.simek@xilinx.com, pmeerw@pmeerw.net,
	devicetree@vger.kernel.org
Cc: Manish Narani <manish.narani@xilinx.com>
Subject: Re: [PATCH v7 2/4] iio: adc: Add Xilinx AMS driver
Date: Mon, 25 Oct 2021 15:08:00 +0200	[thread overview]
Message-ID: <caaa19ef-131c-ad5c-1403-ff948de9f200@metafoo.de> (raw)
In-Reply-To: <20211019152048.28983-3-anand.ashok.dumbre@xilinx.com>

On 10/19/21 5:20 PM, Anand Ashok Dumbre wrote:
> +static int ams_init_device(struct ams *ams)
> +{
> +	u32 reg;
> +	int ret;
> +
> [...]
> +	if (ams->pl_base) {
> +		writel(AMS_PL_RESET_VALUE, ams->pl_base + AMS_VP_VN);
> +
> +		ret = readl_poll_timeout(ams->base + AMS_PL_CSTS, reg,
> +					 (reg & AMS_PL_CSTS_ACCESS_MASK) ==
> +					 AMS_PL_CSTS_ACCESS_MASK, 0,
> +					 AMS_INIT_TIMEOUT_US);

The PL_CSTS register indicates whether the PL monitor can be accessed 
through the AMS.

But here we access the reset register even before the check. In addition 
there is really no point in polling the register as the state will not 
change. If the PL can not be accessed this should just return. And only 
after verifying that the PL can be accessed should the reset be done.

> +		if (ret)
> +			return ret;
> +
> +		/* put sysmon in a default state */
> +		ams_pl_update_reg(ams, AMS_REG_CONFIG1, AMS_CONF1_SEQ_MASK,
> +				  AMS_CONF1_SEQ_DEFAULT);
> +	}
> +
> +	[...]
> +
> +	return 0;
> +}
> +
>
> +static int ams_probe(struct platform_device *pdev)
> +{
> [..]
> +
> +	ret = ams_init_device(ams);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failed to initialize AMS\n");
> +		return ret;
> +	}
> +
> +	ret = ams_parse_dt(indio_dev, pdev);
> +	if (ret) {
> +		dev_err(&pdev->dev, "failure in parsing DT\n");
> +		return ret;
> +	}
> +
These two need to be called the other way around. ams_init_device() 
wants to access the IO registers, but they are only mapped in 
ams_parse_dt().

  parent reply	other threads:[~2021-10-25 13:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-19 15:20 [PATCH v7 0/4] Add Xilinx AMS Driver Anand Ashok Dumbre
2021-10-19 15:20 ` [PATCH v7 1/4] arm64: zynqmp: DT: Add Xilinx AMS node Anand Ashok Dumbre
2021-10-19 15:20 ` [PATCH v7 2/4] iio: adc: Add Xilinx AMS driver Anand Ashok Dumbre
2021-10-21 11:06   ` Jonathan Cameron
2021-10-26 10:18     ` Anand Ashok Dumbre
2021-10-23 12:36   ` Lars-Peter Clausen
2021-10-27 20:35     ` Anand Ashok Dumbre
2021-10-24 14:27   ` kernel test robot
2021-10-25 10:10   ` Andy Shevchenko
2021-11-02 21:31     ` Anand Ashok Dumbre
2021-11-03 17:19       ` Jonathan Cameron
2021-10-25 13:08   ` Lars-Peter Clausen [this message]
2021-10-27  9:35     ` Anand Ashok Dumbre
2021-10-26  7:09   ` Lars-Peter Clausen
2021-10-27  9:04     ` Anand Ashok Dumbre
2021-10-19 15:20 ` [PATCH v7 3/4] dt-bindings: iio: adc: Add Xilinx AMS binding documentation Anand Ashok Dumbre
2021-10-27 17:00   ` Rob Herring
2021-10-19 15:20 ` [PATCH v7 4/4] MAINTAINERS: Add maintainer for xilinx-ams Anand Ashok Dumbre

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=caaa19ef-131c-ad5c-1403-ff948de9f200@metafoo.de \
    --to=lars@metafoo.de \
    --cc=anand.ashok.dumbre@xilinx.com \
    --cc=devicetree@vger.kernel.org \
    --cc=git@xilinx.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manish.narani@xilinx.com \
    --cc=michal.simek@xilinx.com \
    --cc=pmeerw@pmeerw.net \
    /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).