From: "Łukasz Stelmach" <l.stelmach@samsung.com>
To: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Cc: "Łukasz Stelmach" <l.stelmach@samsung.com>
Subject: [RFC PATCH 2/4] scripts: add get_console_base.pl
Date: Thu, 30 Jan 2020 13:42:31 +0100 [thread overview]
Message-ID: <20200130124233.4006-2-l.stelmach@samsung.com> (raw)
In-Reply-To: <20200130124233.4006-1-l.stelmach@samsung.com>
Read UART base address from dtb for compile time configuration.
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.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
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-01-30 12:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200130124000eucas1p137943be0fe3e5e1eb45e705dc5c46431@eucas1p1.samsung.com>
2020-01-30 12:39 ` [RFC PATCH 0/4] boot/loader: Load kernel directly from firmware Łukasz Stelmach
[not found] ` <CGME20200130124251eucas1p2046004a71a1a9ff4274a6d1d96e2c260@eucas1p2.samsung.com>
2020-01-30 12:42 ` [RFC PATCH 1/4] scripts/dtc: update fdtget.c to upstream version v1.4.7-57-gf267e674d145 Łukasz Stelmach
[not found] ` <CGME20200130124304eucas1p2f3381b1009cd71cd292169d5f10265c1@eucas1p2.samsung.com>
2020-01-30 12:42 ` Łukasz Stelmach [this message]
[not found] ` <CGME20200130124314eucas1p11a244e77c9c5f583832832313ba93335@eucas1p1.samsung.com>
2020-01-30 12:42 ` [RFC PATCH 3/4] Add tools/hsinit Łukasz Stelmach
[not found] ` <CGME20200130124315eucas1p12d5380c44b68d08ae96849056303e175@eucas1p1.samsung.com>
2020-01-30 12:42 ` [RFC PATCH 4/4] boot/loader: Enable building bootloader replacement for Odroid XU4 Łukasz Stelmach
2020-01-30 12:47 ` [RFC PATCH 1/4] scripts/dtc: update fdtget.c to upstream version v1.4.7-57-gf267e674d145 Russell King - ARM Linux admin
[not found] ` <CGME20200130125530eucas1p282d9749764c3a5c21c85c829d372b650@eucas1p2.samsung.com>
2020-01-30 12:55 ` Łukasz Stelmach
2020-01-30 14:16 ` Rob Herring
[not found] ` <CGME20200206131712eucas1p15a5c38ac3dc6e05af318a9955a09e013@eucas1p1.samsung.com>
2020-02-06 13:17 ` Łukasz Stelmach
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=20200130124233.4006-2-l.stelmach@samsung.com \
--to=l.stelmach@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).