From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/4] iio: adc: xilinx: limit pcap clock frequency value
Date: Sun, 29 Jul 2018 12:51:06 +0100 [thread overview]
Message-ID: <20180729125106.05692a44@archlinux> (raw)
In-Reply-To: <1532358123-23485-3-git-send-email-manish.narani@xilinx.com>
On Mon, 23 Jul 2018 20:32:01 +0530
Manish Narani <manish.narani@xilinx.com> wrote:
> This patch limits the xadc pcap clock frequency value to be less than
> 200MHz. This fixes the issue when zynq is booted at higher frequency
> values, pcap crosses the maximum limit of 200MHz(Fmax) as it is derived
> from IOPLL.
> If this limit is crossed it is required to alter the WEDGE and REDGE
> bits of XADC_CFG register to make timings better in the interface. So to
> avoid alteration of these bits every time, the pcap value should not
> cross the Fmax limit.
>
> Signed-off-by: Manish Narani <manish.narani@xilinx.com>
Applied, to the togreg branch of iio.git. If you want this backported
to stable, then request it once this patch is upstream. It may be
sometime given we've probably just missed the coming merge window.
If you do need it faster then let me know and I'll look at moving
it over to the branch of fixes during the RC phases.
Jonathan
> ---
> drivers/iio/adc/xilinx-xadc-core.c | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
> index 23395fc..0dd306d 100644
> --- a/drivers/iio/adc/xilinx-xadc-core.c
> +++ b/drivers/iio/adc/xilinx-xadc-core.c
> @@ -322,6 +322,7 @@ static irqreturn_t xadc_zynq_interrupt_handler(int irq, void *devid)
>
> #define XADC_ZYNQ_TCK_RATE_MAX 50000000
> #define XADC_ZYNQ_IGAP_DEFAULT 20
> +#define XADC_ZYNQ_PCAP_RATE_MAX 200000000
>
> static int xadc_zynq_setup(struct platform_device *pdev,
> struct iio_dev *indio_dev, int irq)
> @@ -332,6 +333,7 @@ static int xadc_zynq_setup(struct platform_device *pdev,
> unsigned int div;
> unsigned int igap;
> unsigned int tck_rate;
> + int ret;
>
> /* TODO: Figure out how to make igap and tck_rate configurable */
> igap = XADC_ZYNQ_IGAP_DEFAULT;
> @@ -343,6 +345,13 @@ static int xadc_zynq_setup(struct platform_device *pdev,
> if (!pcap_rate)
> return -EINVAL;
>
> + if (pcap_rate > XADC_ZYNQ_PCAP_RATE_MAX) {
> + ret = clk_set_rate(xadc->clk,
> + (unsigned long)XADC_ZYNQ_PCAP_RATE_MAX);
> + if (ret)
> + return ret;
> + }
> +
> if (tck_rate > pcap_rate / 2) {
> div = 2;
> } else {
> @@ -368,6 +377,12 @@ static int xadc_zynq_setup(struct platform_device *pdev,
> XADC_ZYNQ_CFG_REDGE | XADC_ZYNQ_CFG_WEDGE |
> tck_div | XADC_ZYNQ_CFG_IGAP(igap));
>
> + if (pcap_rate > XADC_ZYNQ_PCAP_RATE_MAX) {
> + ret = clk_set_rate(xadc->clk, pcap_rate);
> + if (ret)
> + return ret;
> + }
> +
> return 0;
> }
>
next prev parent reply other threads:[~2018-07-29 11:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-23 15:01 [PATCH v2 0/4] iio: adc: xilinx: XADC driver Enhancements and bug fixes Manish Narani
2018-07-23 15:02 ` [PATCH v2 1/4] iio: adc: xilinx: Check for return values in clk related functions Manish Narani
2018-07-29 11:48 ` Jonathan Cameron
2018-07-23 15:02 ` [PATCH v2 2/4] iio: adc: xilinx: limit pcap clock frequency value Manish Narani
2018-07-29 11:51 ` Jonathan Cameron [this message]
2018-07-30 10:13 ` Manish Narani
2018-07-23 15:02 ` [PATCH v2 3/4] iio: adc: xilinx: Remove platform_get_irq from xadc_remove function Manish Narani
2018-07-29 12:29 ` Jonathan Cameron
2018-07-23 15:02 ` [PATCH v2 4/4] iio: adc: xilinx: Move request_irq before enabling interrupts Manish Narani
2018-07-29 12:30 ` Jonathan Cameron
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=20180729125106.05692a44@archlinux \
--to=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.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).