From patchwork Wed May 22 10:48:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 17085 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f71.google.com (mail-qa0-f71.google.com [209.85.216.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EF90E238FE for ; Wed, 22 May 2013 10:50:29 +0000 (UTC) Received: by mail-qa0-f71.google.com with SMTP id bv4sf2322907qab.2 for ; Wed, 22 May 2013 03:49:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=B9KYb6Q/Q7l9mPKEmiY7hAjdNBPUk4HRZ/begqSsYnw=; b=Y+NpGHcQyKgB9bkElgFaYlX72fBMMGColB8I07ryqfqn2SFE2IoeZuTaLYAvroG2vG 9aMRiETW5PUWjZhhZ0xZgd4IhQPg4HNgHWApb72zJdlxRW38PyoSqWev2VJGblFQ9Pmo LwUotk9glJjq4Oqw9BEbhAijmnxPPcLD3rghPRuL9ecNv0/H6Lb17kLxy5EFZhmVT/4j oG+Tm1gyCF72CymfDpKHz3Do1mm4W2F3GMN/i+wnF9a2XSLHNIqPdcBPfsaqn6eb06Di h8TJsAZXW50DiZHMNuRvkbh8JblqEyYS4A0SghbDN3E35x2SD0pvN/7oVgVE0UiMSotO a8sg== X-Received: by 10.224.53.198 with SMTP id n6mr408437qag.2.1369219777058; Wed, 22 May 2013 03:49:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.24.133 with SMTP id u5ls788285qef.3.gmail; Wed, 22 May 2013 03:49:36 -0700 (PDT) X-Received: by 10.52.89.207 with SMTP id bq15mr2165526vdb.110.1369219776870; Wed, 22 May 2013 03:49:36 -0700 (PDT) Received: from mail-vb0-x229.google.com (mail-vb0-x229.google.com [2607:f8b0:400c:c02::229]) by mx.google.com with ESMTPS id sc6si3356216vdc.138.2013.05.22.03.49.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 May 2013 03:49:36 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::229; Received: by mail-vb0-f41.google.com with SMTP id p14so1207526vbm.28 for ; Wed, 22 May 2013 03:49:36 -0700 (PDT) X-Received: by 10.220.246.8 with SMTP id lw8mr2577037vcb.8.1369219776652; Wed, 22 May 2013 03:49:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp175950vcs; Wed, 22 May 2013 03:49:36 -0700 (PDT) X-Received: by 10.68.225.197 with SMTP id rm5mr7249435pbc.137.1369219775552; Wed, 22 May 2013 03:49:35 -0700 (PDT) Received: from mail-da0-x234.google.com (mail-da0-x234.google.com [2607:f8b0:400e:c00::234]) by mx.google.com with ESMTPS id sk3si5495631pab.0.2013.05.22.03.49.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 May 2013 03:49:35 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c00::234 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=2607:f8b0:400e:c00::234; Received: by mail-da0-f52.google.com with SMTP id o9so1069111dan.39 for ; Wed, 22 May 2013 03:49:35 -0700 (PDT) X-Received: by 10.68.114.100 with SMTP id jf4mr7054608pbb.144.1369219775144; Wed, 22 May 2013 03:49:35 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id sv4sm7604551pab.10.2013.05.22.03.49.31 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 22 May 2013 03:49:34 -0700 (PDT) From: Pranavkumar Sawargaonkar To: linux-arm-kernel@lists.infradead.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, catalin.marinas@arm.com, will.deacon@arm.com, Pranavkumar Sawargaonkar , Anup Patel Subject: [RFC] arm64: Add support to pass earlyprintk argument via device tree Date: Wed, 22 May 2013 16:18:33 +0530 Message-Id: <1369219713-18590-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQmj4QP7knd0SVjYQpSb9nL+GoaU0HY8eVHjITpDhkRHrFLSn5CaG+xyy5tH8rzgc793dAm3 X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This patch adds support for defining and passing earlyprintk related information i.e. device and address information via device tree by adding it inside "chosen" node. This will help user to just specify "earlyprintk" from bootargs without actually knowing the address and device to enable earlyprintk. Mechanism: One can just append earlyprintk=device-type,address (same as we pass through command line) in "/chosen" node to notify kernel which is the earlyprintk device and what is its address. Backward Compatibility: This patch also allows existing method of specifying earlyprintk parameter via bootargs. Existing method i.e. passing via bootargs will still have precedence over device tree i.e. if one specifies earlyprintk=device-type,address in bootargs then kernel will use information from bootargs instead of device tree. If user just specifies earlyprintk (without =...) then kernel will look for device tree earlyprintk parameter. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- arch/arm64/kernel/early_printk.c | 7 +++++++ arch/arm64/kernel/setup.c | 22 +++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kernel/early_printk.c b/arch/arm64/kernel/early_printk.c index fbb6e18..4e6f845 100644 --- a/arch/arm64/kernel/early_printk.c +++ b/arch/arm64/kernel/early_printk.c @@ -29,6 +29,8 @@ static void __iomem *early_base; static void (*printch)(char ch); +extern char *earlyprintk_dt_args; + /* * PL011 single character TX. */ @@ -116,6 +118,11 @@ static int __init setup_early_printk(char *buf) phys_addr_t paddr = 0; if (!buf) { + /* Try to check if Device Tree has this argument or not ? */ + buf = earlyprintk_dt_args; + } + + if (!buf) { pr_warning("No earlyprintk arguments passed.\n"); return 0; } diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c index 6a9a532..94ce7a9 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -60,6 +60,9 @@ EXPORT_SYMBOL(processor_id); unsigned int elf_hwcap __read_mostly; EXPORT_SYMBOL_GPL(elf_hwcap); +char *earlyprintk_dt_args; +EXPORT_SYMBOL_GPL(earlyprintk_dt_args); + static const char *cpu_name; static const char *machine_name; phys_addr_t __fdt_pointer __initdata; @@ -122,6 +125,23 @@ static void __init setup_processor(void) elf_hwcap = 0; } +int __init early_init_dt_scan_chosen_arm64(unsigned long node, + const char *uname, + int depth, void *data) +{ + char *prop; + + /* Check if this is chosen node */ + if (early_init_dt_scan_chosen(node, uname, depth, data) == 0) + return 0; + + prop = of_get_flat_dt_prop(node, "earlyprintk", NULL); + if (prop) + earlyprintk_dt_args = prop; + + return 1; +} + static void __init setup_machine_fdt(phys_addr_t dt_phys) { struct boot_param_header *devtree; @@ -165,7 +185,7 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) pr_info("Machine: %s\n", machine_name); /* Retrieve various information from the /chosen node */ - of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); + of_scan_flat_dt(early_init_dt_scan_chosen_arm64, boot_command_line); /* Initialize {size,address}-cells info */ of_scan_flat_dt(early_init_dt_scan_root, NULL); /* Setup memory, calling early_init_dt_add_memory_arch */