devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration
@ 2021-03-08  6:59 zhengxunli
  2021-03-08  7:07 ` Greg KH
  0 siblings, 1 reply; 6+ messages in thread
From: zhengxunli @ 2021-03-08  6:59 UTC (permalink / raw)
  To: shubhrajyoti.datta
  Cc: devel, devicetree, git, gregkh, linux-clk, miquel.raynal,
	mturquette, robh+dt, sboyd, shubhrajyoti.datta, juliensu, slwu


Hi Shubhrajyoti,

My name is Zhengxun and I am the engineer from Macronix. We are
using the platform PicoZed 7015/7030 SOM (System On Module),
which is based on Xilinx Zynq®-7000 All Programmable (AP) SoC to
verify our Flash dirver. Of course, we are also using your clock
wizard, our version seems to be v5.2, but something went wrong.

+static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long 
rate,
+ unsigned long parent_rate)
+{
+                int err;
+                u32 value;
+                unsigned long flags = 0;
+                struct clk_wzrd_divider *divider = 
to_clk_wzrd_divider(hw);
+                void __iomem *div_addr = divider->base + divider->offset;
+
+                if (divider->lock)
+                                spin_lock_irqsave(divider->lock, flags);
+                else
+                                __acquire(divider->lock);
+
+                value = DIV_ROUND_CLOSEST(parent_rate, rate);
+
+                /* Cap the value to max */
+                min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE);
+
+                /* Set divisor and clear phase offset */
+                writel(value, div_addr);
+                writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET);

Why phase always set to zero? We want to support DTR operation in
Flash driver. Can you add a set_phase function to adjust the phase?

+                /* Check status register */
+                err = readl_poll_timeout(divider->base + 
WZRD_DR_STATUS_REG_OFFSET,
+                                                                 value, 
value & WZRD_DR_LOCK_BIT_MASK,
+ WZRD_USEC_POLL, WZRD_TIMEOUT_POLL);
+                if (err)
+                                goto err_reconfig;
+
+                /* Initiate reconfiguration */
+                writel(WZRD_DR_BEGIN_DYNA_RECONF,
+                       divider->base + WZRD_DR_INIT_REG_OFFSET);
+
+                /* Check status register */
+                err = readl_poll_timeout(divider->base + 
WZRD_DR_STATUS_REG_OFFSET,
+                                                                 value, 
value & WZRD_DR_LOCK_BIT_MASK,
+ WZRD_USEC_POLL, WZRD_TIMEOUT_POLL);

According to pg015-clk-wiz.pdf, Clocking Wizard v5.2 and later, need to 
write
0x00000007 followed by 0x00000002 into Clock Configuration Register 23, to
consolidate the redundant bits that the IP has upgraded, right?

Can you compatible to v5.2?

+err_reconfig:
+                if (divider->lock)
+                                spin_unlock_irqrestore(divider->lock, 
flags);
+                else
+                                __release(divider->lock);
+                return err;
+}

Thanks,
Zhengxun


CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information 
and/or personal data, which is protected by applicable laws. Please be 
reminded that duplication, disclosure, distribution, or use of this e-mail 
(and/or its attachments) or any part thereof is prohibited. If you receive 
this e-mail in error, please notify us immediately and delete this mail as 
well as its attachment(s) from your system. In addition, please be 
informed that collection, processing, and/or use of personal data is 
prohibited unless expressly permitted by personal data protection laws. 
Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================



============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================


^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration
@ 2021-03-15  7:07 Zhengxun Li
  2021-03-15  8:32 ` Shubhrajyoti Datta
  2021-03-18  5:41 ` Shubhrajyoti Datta
  0 siblings, 2 replies; 6+ messages in thread
From: Zhengxun Li @ 2021-03-15  7:07 UTC (permalink / raw)
  To: shubhrajyoti.datta
  Cc: devel, devicetree, git, gregkh, linux-clk, miquel.raynal,
	mturquette, robh+dt, sboyd, shubhrajyoti.datta, zhengxunli,
	juliensu, slwu

Hi Shubhrajyoti,

My name is Zhengxun and I am the engineer from Macronix. We are
using the platform PicoZed 7015/7030 SOM (System On Module),
which is based on Xilinx Zynq®-7000 All Programmable (AP) SoC to
verify our Flash driver. Of course, we are also using your clock
wizard, our version seems to be v5.2, but something went wrong.

+static int clk_wzrd_dynamic_reconfig(struct clk_hw *hw, unsigned long rate,
+ unsigned long parent_rate)
+{
+ int err;
+ u32 value;
+ unsigned long flags = 0;
+ struct clk_wzrd_divider *divider = to_clk_wzrd_divider(hw);
+ void __iomem *div_addr = divider->base + divider->offset;
+
+ if (divider->lock)
+ spin_lock_irqsave(divider->lock, flags);
+ else
+ __acquire(divider->lock);
+
+ value = DIV_ROUND_CLOSEST(parent_rate, rate);
+
+ /* Cap the value to max */
+ min_t(u32, value, WZRD_DR_MAX_INT_DIV_VALUE);
+
+ /* Set divisor and clear phase offset */
+ writel(value, div_addr);
+ writel(0x00, div_addr + WZRD_DR_DIV_TO_PHASE_OFFSET);

Why phase always set to zero? We want to support DTR operation in
Flash driver. Can you add a set_phase function to adjust the phase?

+ /* Check status register */
+ err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET,
+ value, value & WZRD_DR_LOCK_BIT_MASK,
+ WZRD_USEC_POLL, WZRD_TIMEOUT_POLL);
+ if (err)
+ goto err_reconfig;
+
+ /* Initiate reconfiguration */
+ writel(WZRD_DR_BEGIN_DYNA_RECONF,
+ divider->base + WZRD_DR_INIT_REG_OFFSET);
+
+ /* Check status register */
+ err = readl_poll_timeout(divider->base + WZRD_DR_STATUS_REG_OFFSET,
+ value, value & WZRD_DR_LOCK_BIT_MASK,
+ WZRD_USEC_POLL, WZRD_TIMEOUT_POLL);

According to pg015-clk-wiz.pdf, Clocking Wizard v5.2 and later, need to write
0x00000007 followed by 0x00000002 into Clock Configuration Register 23, to
consolidate the redundant bits that the IP has upgraded, right?

Can you compatible to v5.2?

Thanks,
Zhengxun

^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCH v10 0/9] clk: clocking-wizard: driver updates
@ 2021-02-24 13:10 Shubhrajyoti Datta
  2021-02-24 13:10 ` [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration Shubhrajyoti Datta
  0 siblings, 1 reply; 6+ messages in thread
From: Shubhrajyoti Datta @ 2021-02-24 13:10 UTC (permalink / raw)
  To: devicetree
  Cc: linux-clk, gregkh, robh+dt, sboyd, mturquette, shubhrajyoti.datta,
	git, miquel.raynal, devel, Shubhrajyoti Datta

In the thread [1] Greg suggested that we move the driver
to the clk from the staging.
Add patches to address the concerns regarding the fractional and
set rate support in the TODO.

The patch set does the following
- Trivial fixes for kernel doc.
- Move the driver to the clk folder
- Add capability to set rate.
- Add fractional support.
- Add support for configurable outputs.
- Make the output names unique so that multiple instances
do not crib.

Changes in the v3:
Added the cover-letter.
Add patches for rate setting and fractional support
Add patches for warning.
Remove the driver from staging as suggested

v4:
Reorder the patches.
Merge the CLK_IS_BASIC patch.
Add the yaml form of binding document

v5:
Fix a mismerge

v6:
Fix the yaml warning
use poll timedout

v7:
Binding doc updates
Use common divisor function.

v8:
Fix Robs comments

v9:
Fix device tree warnings

v10:
Reorder the patches
Update the speed grade description.

[1] https://spinics.net/lists/linux-driver-devel/msg117326.html

Shubhrajyoti Datta (9):
  staging: clocking-wizard: Fix kernel-doc warning
  staging: clocking-wizard: Rename speed-grade to xlnx,speed-grade
  staging: clocking-wizard: Update the fixed factor divisors
  staging: clocking-wizard: Allow changing of parent rate for single
    output
  staging: clocking-wizard: Add support for dynamic reconfiguration
  staging: clocking-wizard: Add support for fractional support
  staging: clocking-wizard: Remove the hardcoding of the clock outputs
  dt-bindings: add documentation of xilinx clocking wizard
  clk: clock-wizard: Add the clockwizard to clk directory

 .../bindings/clock/xlnx,clocking-wizard.yaml       |  72 +++
 drivers/clk/Kconfig                                |   9 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-xlnx-clock-wizard.c                | 636 +++++++++++++++++++++
 drivers/staging/Kconfig                            |   2 -
 drivers/staging/Makefile                           |   1 -
 drivers/staging/clocking-wizard/Kconfig            |  10 -
 drivers/staging/clocking-wizard/Makefile           |   2 -
 drivers/staging/clocking-wizard/TODO               |  12 -
 .../clocking-wizard/clk-xlnx-clock-wizard.c        | 333 -----------
 drivers/staging/clocking-wizard/dt-binding.txt     |  30 -
 11 files changed, 718 insertions(+), 390 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/xlnx,clocking-wizard.yaml
 create mode 100644 drivers/clk/clk-xlnx-clock-wizard.c
 delete mode 100644 drivers/staging/clocking-wizard/Kconfig
 delete mode 100644 drivers/staging/clocking-wizard/Makefile
 delete mode 100644 drivers/staging/clocking-wizard/TODO
 delete mode 100644 drivers/staging/clocking-wizard/clk-xlnx-clock-wizard.c
 delete mode 100644 drivers/staging/clocking-wizard/dt-binding.txt

-- 
2.1.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-03-18  5:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-08  6:59 [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration zhengxunli
2021-03-08  7:07 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2021-03-15  7:07 Zhengxun Li
2021-03-15  8:32 ` Shubhrajyoti Datta
2021-03-18  5:41 ` Shubhrajyoti Datta
2021-02-24 13:10 [PATCH v10 0/9] clk: clocking-wizard: driver updates Shubhrajyoti Datta
2021-02-24 13:10 ` [PATCH v10 5/9] staging: clocking-wizard: Add support for dynamic reconfiguration Shubhrajyoti Datta

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).