From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Assmann Kai <Kai.Assmann@de.bosch.com>
Subject: [PATCH] ARM: zynq: get ps_clk_rate from dt
Date: Mon, 26 Jun 2023 12:37:46 +0200 [thread overview]
Message-ID: <20230626103756.983193-1-s.trumtrar@pengutronix.de> (raw)
From: "Assmann Kai (BEG/EMS1)" <Kai.Assmann@de.bosch.com>
This adds a barebox-specific binding to overwrite the PS clock
frequency.
Currently the ps_clk_rate is locked to 33.3MHz. Introduce a devicetree
property "ps-clock-frequency" that specifies this clock.
If the property is found, overwrite ps_clk_rate otherwise stay at the
default 33.3MHz
Signed-off-by: Assmann Kai (BEG/MSD-NE2) <Kai.Assmann@de.bosch.com>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
Notes:
changes since v1:
- reword commit message
- add binding rst
- change type of ps_clk_frequency
.../devicetree/bindings/clocks/xlnx,ps7-clkc.rst | 10 ++++++++++
drivers/clk/zynq/clkc.c | 4 +++-
2 files changed, 13 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/clocks/xlnx,ps7-clkc.rst
diff --git a/Documentation/devicetree/bindings/clocks/xlnx,ps7-clkc.rst b/Documentation/devicetree/bindings/clocks/xlnx,ps7-clkc.rst
new file mode 100644
index 0000000000..523b0cf56e
--- /dev/null
+++ b/Documentation/devicetree/bindings/clocks/xlnx,ps7-clkc.rst
@@ -0,0 +1,10 @@
+Xilinx PS7 clkc
+===============
+
+In addition to the upstream bindings, following properties are understood:
+
+Optional properties:
+
+- ``ps-clock-frequency`` : Overrides the ps clock frequency set by the driver.
+ Per default the clock is set to 33.3MHz. When this property is set, the frequency
+ is overwritten by the devicetree property.
diff --git a/drivers/clk/zynq/clkc.c b/drivers/clk/zynq/clkc.c
index 1219e25f7a..d6de583e32 100644
--- a/drivers/clk/zynq/clkc.c
+++ b/drivers/clk/zynq/clkc.c
@@ -368,7 +368,7 @@ static int zynq_clock_probe(struct device *dev)
{
struct resource *iores;
void __iomem *clk_base;
- unsigned long ps_clk_rate = 33333330;
+ u32 ps_clk_rate = 33333330;
resource_size_t slcr_offset = 0;
iores = dev_get_resource(dev, IORESOURCE_MEM, 0);
@@ -390,6 +390,8 @@ static int zynq_clock_probe(struct device *dev)
slcr_offset = parent_res->start;
}
+ of_property_read_u32(dev->device_node, "ps-clk-frequency", &ps_clk_rate);
+
iores = request_iomem_region(dev_name(dev), iores->start + slcr_offset,
iores->end + slcr_offset);
if (IS_ERR(iores))
--
2.41.0
next reply other threads:[~2023-06-26 10:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-26 10:37 Steffen Trumtrar [this message]
2023-07-04 9:10 ` Sascha Hauer
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=20230626103756.983193-1-s.trumtrar@pengutronix.de \
--to=s.trumtrar@pengutronix.de \
--cc=Kai.Assmann@de.bosch.com \
--cc=barebox@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