From patchwork Thu Jan 30 12:42:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Lukasz Stelmach X-Patchwork-Id: 213585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00E0DC33C9E for ; Thu, 30 Jan 2020 12:43:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BF76C206F0 for ; Thu, 30 Jan 2020 12:43:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="LQQDXpQL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726873AbgA3MnG (ORCPT ); Thu, 30 Jan 2020 07:43:06 -0500 Received: from mailout1.w1.samsung.com ([210.118.77.11]:35906 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726902AbgA3MnG (ORCPT ); Thu, 30 Jan 2020 07:43:06 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20200130124304euoutp014655d927031c34d310594582c7f3efd9~uqq5VhiZZ2932129321euoutp01y for ; Thu, 30 Jan 2020 12:43:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20200130124304euoutp014655d927031c34d310594582c7f3efd9~uqq5VhiZZ2932129321euoutp01y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1580388185; bh=+P8a2fdMyzXk8luowUxelFub/dwbU2MtPQ3w1czBqRM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LQQDXpQLxlZeHlKlKIUQOfpnitWnFxtv4FuQhRs4yOKat8O1xCJkULrYrnKEgXVNF gGMFhQ7nHsnjf0O+084c6Avp42JkkFgQb2TEPCgSap9IwkqHCBOosZH112WsdTHMKb iiR1w+whOMaHQERr8TPLu+X3qJmslcmTDi0GFyNE= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200130124304eucas1p2a579180e27d6d0ad2f7e0fbb5bb06c92~uqq5FRhGh2611426114eucas1p28; Thu, 30 Jan 2020 12:43:04 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 83.D9.61286.85FC23E5; Thu, 30 Jan 2020 12:43:04 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200130124304eucas1p2f3381b1009cd71cd292169d5f10265c1~uqq4krDLU1246012460eucas1p2L; Thu, 30 Jan 2020 12:43:04 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200130124304eusmtrp155ca62ca38ac1f64a26c76184b2bd44c~uqq4kIDIS2256122561eusmtrp1l; Thu, 30 Jan 2020 12:43:04 +0000 (GMT) X-AuditID: cbfec7f2-f0bff7000001ef66-93-5e32cf581f1b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id A4.3E.08375.85FC23E5; Thu, 30 Jan 2020 12:43:04 +0000 (GMT) Received: from localhost (unknown [106.120.51.46]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200130124303eusmtip2548f372b63f47f071fa7db90415c7968~uqq4Wy6ve1492314923eusmtip2V; Thu, 30 Jan 2020 12:43:03 +0000 (GMT) From: =?utf-8?q?=C5=81ukasz_Stelmach?= To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: =?utf-8?q?=C5=81ukasz_Stelmach?= Subject: [RFC PATCH 2/4] scripts: add get_console_base.pl Date: Thu, 30 Jan 2020 13:42:31 +0100 Message-Id: <20200130124233.4006-2-l.stelmach@samsung.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200130124233.4006-1-l.stelmach@samsung.com> MIME-Version: 1.0 Organization: Samsung R&D Institute Poland X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpgleLIzCtJLcpLzFFi42LZduzned2I80ZxBusmqlvcPLSC0WLT42us Fpd3zWGzmHF+H5MDi8fmJfUefVtWMXp83iQXwBzFZZOSmpNZllqkb5fAlbF3TnDBbY6KqxMu sTUwrmDvYuTkkBAwkdj2+wNjFyMXh5DACkaJZWs6mSGcL4wSv9+egHI+M0r8P9/KAtPStKuZ DSKxnFHi5vwWVgjnOVD/jh9sIFVsAo4S/UtPsILYIgLZEpM/fmECsZkF7CUmzvoPViMsYClx 5uxXoEM4OFgEVCV+nSsFCfMKWEkcPr4S6j55ifO968BsTgFriY+rf7NC1AhKnJz5BOwgfgEt iTVN11kgxstLNG+dzQzR284usW1KLoTtInGs5y4rhC0s8er4Fqj5MhKnJ/ewgJwgIVAvMXmS GcgrEgI9jBLb5vyAetha4s65X2wgNcwCmhLrd+lDlDtKTP6ZD2HySdx4KwhxAJ/EpG3TmSHC vBIdbUIQM1Qk1vXvgZonJdH7agXjBEalWUhemYXk/FkIqxYwMq9iFE8tLc5NTy02zEst1ytO zC0uzUvXS87P3cQITBen/x3/tIPx66WkQ4wCHIxKPLweZ4zihFgTy4orcw8xSnAwK4nwiroa xgnxpiRWV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RE+JpTgj0VCLuag4EQAXSO14pQIAAA== X-CMS-MailID: 20200130124304eucas1p2f3381b1009cd71cd292169d5f10265c1 X-Msg-Generator: CA X-RootMTR: 20200130124304eucas1p2f3381b1009cd71cd292169d5f10265c1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200130124304eucas1p2f3381b1009cd71cd292169d5f10265c1 References: <20200130123934.3900-1-l.stelmach@samsung.com> <20200130124233.4006-1-l.stelmach@samsung.com> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Read UART base address from dtb for compile time configuration. Signed-off-by: Ɓukasz Stelmach --- 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";