[U-Boot] [PATCH 8/8] serial_zynq: Migrate to Zynq clock framework

Michal Simek michal.simek at xilinx.com
Wed Jan 22 11:51:00 CET 2014


From: Soren Brinkmann <soren.brinkmann at xilinx.com>

Remove hard coded frequencies and use Zynq's clock framework to obtain
the UART clock frequency.

Signed-off-by: Soren Brinkmann <soren.brinkmann at xilinx.com>
Signed-off-by: Michal Simek <michal.simek at xilinx.com>
---

 drivers/serial/serial_zynq.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c
index 9a1ee00..22c6bf0 100644
--- a/drivers/serial/serial_zynq.c
+++ b/drivers/serial/serial_zynq.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <linux/compiler.h>
 #include <serial.h>
+#include <asm/arch/clk.h>
 #include <asm/arch/hardware.h>

 #define ZYNQ_UART_SR_TXFULL	0x00000010 /* TX FIFO full */
@@ -45,23 +46,13 @@ static struct uart_zynq *uart_zynq_ports[2] = {
 # define CONFIG_ZYNQ_SERIAL_BAUDRATE1	CONFIG_BAUDRATE
 #endif

-#if !defined(CONFIG_ZYNQ_SERIAL_CLOCK0)
-# define CONFIG_ZYNQ_SERIAL_CLOCK0	50000000
-#endif
-#if !defined(CONFIG_ZYNQ_SERIAL_CLOCK1)
-# define CONFIG_ZYNQ_SERIAL_CLOCK1	50000000
-#endif
-
 struct uart_zynq_params {
 	u32 baudrate;
-	u32 clock;
 };

 static struct uart_zynq_params uart_zynq_ports_param[2] = {
 	[0].baudrate = CONFIG_ZYNQ_SERIAL_BAUDRATE0,
-	[0].clock = CONFIG_ZYNQ_SERIAL_CLOCK0,
 	[1].baudrate = CONFIG_ZYNQ_SERIAL_BAUDRATE1,
-	[1].clock = CONFIG_ZYNQ_SERIAL_CLOCK1,
 };

 /* Set up the baud rate in gd struct */
@@ -71,7 +62,7 @@ static void uart_zynq_serial_setbrg(const int port)
 	unsigned int calc_bauderror, bdiv, bgen;
 	unsigned long calc_baud = 0;
 	unsigned long baud = uart_zynq_ports_param[port].baudrate;
-	unsigned long clock = uart_zynq_ports_param[port].clock;
+	unsigned long clock = get_uart_clk(port);
 	struct uart_zynq *regs = uart_zynq_ports[port];

 	/*                master clock
--
1.8.2.3

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140122/93d6bb0d/attachment.pgp>


More information about the U-Boot mailing list