lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1420457437-17636-3-git-send-email-vgupta@synopsys.com>
Date:	Mon, 5 Jan 2015 17:00:36 +0530
From:	Vineet Gupta <Vineet.Gupta1@...opsys.com>
To:	<gregkh@...uxfoundation.org>
CC:	<linux-serial@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<robh@...nel.org>, <jslaby@...e.cz>,
	Vineet Gupta <Vineet.Gupta1@...opsys.com>,
	Arnd Bergmann <arnd@...db.de>
Subject: [PATCH v2 2/3] serial: 8250_early: prepare for dynamic BASE_BAUD

BASE_BAUD is pain in neck for multi-platform support as it hard codes at
build time the clk value for early uart.

Mitigate this by allowing arches/platforms to provide their own version
which can do dynamic setup based on DT values etc (see next patch for
usage)

This was needed for ARC SDP platforms based on 2 different FPGA flows, each
with a different UART clk value.

Signed-off-by: Vineet Gupta <vgupta@...opsys.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Jiri Slaby <jslaby@...e.cz>
Cc: linux-serial@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Cc: Rob Herring <robh@...nel.org>
Cc: Arnd Bergmann <arnd@...db.de>
---
 drivers/tty/serial/earlycon.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c
index 64fe25a4285c..bfd3537739e0 100644
--- a/drivers/tty/serial/earlycon.c
+++ b/drivers/tty/serial/earlycon.c
@@ -54,6 +54,15 @@ static void __iomem * __init earlycon_map(unsigned long paddr, size_t size)
 	return base;
 }
 
+unsigned int __weak __init earlycon_base_baud(char *options)
+{
+#ifdef BASE_BAUD
+	return BASE_BAUD;
+#else
+	return 1843200/16;	/* x86 early console */
+#endif
+}
+
 static int __init parse_options(struct earlycon_device *device,
 				char *options)
 {
@@ -87,7 +96,7 @@ static int __init parse_options(struct earlycon_device *device,
 		return -EINVAL;
 	}
 
-	port->uartclk = BASE_BAUD * 16;
+	port->uartclk = earlycon_base_baud(options) * 16;
 
 	options = strchr(options, ',');
 	if (options) {
@@ -156,7 +165,7 @@ int __init of_setup_earlycon(unsigned long addr,
 
 	port->iotype = UPIO_MEM;
 	port->mapbase = addr;
-	port->uartclk = BASE_BAUD * 16;
+	port->uartclk = earlycon_base_baud(NULL) * 16;
 	port->membase = earlycon_map(addr, SZ_4K);
 
 	early_console_dev.con->data = &early_console_dev;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ