[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200130124233.4006-2-l.stelmach@samsung.com>
Date: Thu, 30 Jan 2020 13:42:31 +0100
From: Łukasz Stelmach <l.stelmach@...sung.com>
To: linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-samsung-soc@...r.kernel.org
Cc: Łukasz Stelmach <l.stelmach@...sung.com>
Subject: [RFC PATCH 2/4] scripts: add get_console_base.pl
Read UART base address from dtb for compile time configuration.
Signed-off-by: Łukasz Stelmach <l.stelmach@...sung.com>
---
scripts/get_console_base.pl | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100755 scripts/get_console_base.pl
diff --git scripts/get_console_base.pl scripts/get_console_base.pl
new file mode 100755
index 000000000000..c707ee37a19f
--- /dev/null
+++ scripts/get_console_base.pl
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+use strict;
+use File::Basename;
+use File::Spec::Functions;
+
+my $DTB=$ARGV[0];
+die "$0: DTB file not found: $DTB" unless (-f $DTB);
+
+my $scripts_dir=dirname($0);
+my $fdtget=catfile($scripts_dir, 'dtc', 'fdtget');
+
+my $stdout_path=`$fdtget -ts "$DTB" /chosen stdout-path`;
+chomp $stdout_path;
+
+if ($stdout_path =~ m#([^/][^:]*)(?::.*)#) {
+ $stdout_path=`$fdtget -ts "$DTB" /aliases $1`;
+ chomp $stdout_path;
+}
+
+my $reg = `$fdtget -tx "$DTB" $stdout_path reg`;
+unless ($reg =~ m/^([[:xdigit:]]+)/) {
+ die "Base address not found";
+}
+$reg = $1;
+print "0x$reg\n";
--
2.20.1
Powered by blists - more mailing lists