* [PATCH] ARM: zynq7000: make PS_CLK Kconfigurable
@ 2017-03-12 20:27 Alexander Kurz
2017-03-15 8:05 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kurz @ 2017-03-12 20:27 UTC (permalink / raw)
To: barebox; +Cc: Alexander Kurz
The main clock source on Zynq-7000 based boards (PS_CLK) is not uniform
for all boards, while typical boards are clocked with 33.3MHz, the
Z-7010 based Digilent Zybo board is clocked with 50MHz.
Since barebox is not yet OF aware for Zynq, make PS_CLK board dependent
via Kconfig.
Signed-off-by: Alexander Kurz <akurz@blala.de>
---
arch/arm/mach-zynq/Kconfig | 6 ++++++
arch/arm/mach-zynq/clk-zynq7000.c | 9 ++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-zynq/Kconfig b/arch/arm/mach-zynq/Kconfig
index d35bd41..ff2aedb 100644
--- a/arch/arm/mach-zynq/Kconfig
+++ b/arch/arm/mach-zynq/Kconfig
@@ -8,6 +8,12 @@ config ZYNQ_DEBUG_LL_UART_BASE
hex
default 0xe0001000 if MACH_ZEDBOARD
+config ZYNQ_PS_CLK
+ int
+ default 33333330 if MACH_ZEDBOARD
+ help
+ Select the external clock frequency provided to PS_CLK.
+
choice
prompt "Xilinx Zynq type board"
diff --git a/arch/arm/mach-zynq/clk-zynq7000.c b/arch/arm/mach-zynq/clk-zynq7000.c
index cd49d84..49e020b 100644
--- a/arch/arm/mach-zynq/clk-zynq7000.c
+++ b/arch/arm/mach-zynq/clk-zynq7000.c
@@ -29,6 +29,13 @@
#include <mach/zynq7000-regs.h>
#include <malloc.h>
+#ifndef CONFIG_ZYNQ_PS_CLK
+#warning define ZYNQ_PS_CLK for your board
+#define ZYNQ_PS_CLK 33333330
+#else
+#define ZYNQ_PS_CLK CONFIG_ZYNQ_PS_CLK
+#endif
+
enum zynq_clks {
dummy, ps_clk, arm_pll, ddr_pll, io_pll, uart_clk, uart0, uart1,
cpu_clk, cpu_6x4x, cpu_3x2x, cpu_2x, cpu_1x,
@@ -361,7 +368,7 @@ static int zynq_clock_probe(struct device_d *dev)
{
struct resource *iores;
void __iomem *slcr_base;
- unsigned long ps_clk_rate = 33333330;
+ unsigned long ps_clk_rate = ZYNQ_PS_CLK;
iores = dev_request_mem_resource(dev, 0);
if (IS_ERR(iores))
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ARM: zynq7000: make PS_CLK Kconfigurable
2017-03-12 20:27 [PATCH] ARM: zynq7000: make PS_CLK Kconfigurable Alexander Kurz
@ 2017-03-15 8:05 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2017-03-15 8:05 UTC (permalink / raw)
To: Alexander Kurz; +Cc: barebox
Hi ALexander,
On Sun, Mar 12, 2017 at 09:27:00PM +0100, Alexander Kurz wrote:
> The main clock source on Zynq-7000 based boards (PS_CLK) is not uniform
> for all boards, while typical boards are clocked with 33.3MHz, the
> Z-7010 based Digilent Zybo board is clocked with 50MHz.
> Since barebox is not yet OF aware for Zynq, make PS_CLK board dependent
> via Kconfig.
We shouldn't encode differences between boards in Kconfig.
One way around it would be to add platform_data to the clk device and
call zynq_init() (with an additional freq argument) from the board code rather
than directly from an initcall.
Creating a small zynq_set_ps_clk() which sets the clock and is to
be called by the board before the clock driver is initialized would be
simpler but also work.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-15 8:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-12 20:27 [PATCH] ARM: zynq7000: make PS_CLK Kconfigurable Alexander Kurz
2017-03-15 8:05 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox