From patchwork Mon Jun 3 15:51:11 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 17492 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D70FE238F2 for ; Mon, 3 Jun 2013 15:51:33 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f73sf5725657yha.3 for ; Mon, 03 Jun 2013 08:51:33 -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=SMuWBhMudZB5r4BQqa5V1Q+AJiFIu2EfBhbQco56/r4=; b=lT/jb+kCOWw7RLiGLQ3lczLT3on2XPpPztlW8++Ld0Ld5RnkYNGZ4ZFkD62O2wD1L3 lutXVHwgJ5KsGi6jH0+D2Q1Bg/EU9xaueB+RGPuq8gNrIaRV/66hCfZUvLKEt/msqs1o v881tObKGyzq5PUUjRVRr/5rGXBbe0iw57h0a9qTwpQ4HxA4JV3qfXoF3QfPtSPPT/gO cWfeNEdqXb5jCo1rV8GMF8wr9KcMrTs1EJ6apr0X6NypMOLKvpKYXNYuD+STOYI6TwyD SmKjPRDwu9hUmp8xd6ZQSF/O2La1gdHe5l5+5aeWIHWnody91z9yIvqwFxJdgbrwbV52 th5g== X-Received: by 10.224.200.202 with SMTP id ex10mr14245158qab.8.1370274693584; Mon, 03 Jun 2013 08:51:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.196 with SMTP id 4ls2050972qeg.96.gmail; Mon, 03 Jun 2013 08:51:33 -0700 (PDT) X-Received: by 10.220.48.201 with SMTP id s9mr2561615vcf.9.1370274693412; Mon, 03 Jun 2013 08:51:33 -0700 (PDT) Received: from mail-vc0-f181.google.com (mail-vc0-f181.google.com [209.85.220.181]) by mx.google.com with ESMTPS id zt2si34543046vdb.76.2013.06.03.08.51.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 08:51:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.181 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.181; Received: by mail-vc0-f181.google.com with SMTP id lf11so2782080vcb.12 for ; Mon, 03 Jun 2013 08:51:33 -0700 (PDT) X-Received: by 10.52.155.67 with SMTP id vu3mr14508190vdb.94.1370274693269; Mon, 03 Jun 2013 08:51:33 -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.221.10.206 with SMTP id pb14csp83944vcb; Mon, 3 Jun 2013 08:51:32 -0700 (PDT) X-Received: by 10.66.166.107 with SMTP id zf11mr25026811pab.166.1370274691451; Mon, 03 Jun 2013 08:51:31 -0700 (PDT) Received: from mail-pd0-f175.google.com (mail-pd0-f175.google.com [209.85.192.175]) by mx.google.com with ESMTPS id lb5si40170351pbc.120.2013.06.03.08.51.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 08:51:31 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.175 is neither permitted nor denied by best guess record for domain of pranavkumar@linaro.org) client-ip=209.85.192.175; Received: by mail-pd0-f175.google.com with SMTP id 5so2298972pdd.6 for ; Mon, 03 Jun 2013 08:51:31 -0700 (PDT) X-Received: by 10.68.0.66 with SMTP id 2mr24672517pbc.15.1370274690692; Mon, 03 Jun 2013 08:51:30 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id de14sm12030481pac.10.2013.06.03.08.51.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 03 Jun 2013 08:51:30 -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, linux-kernel@vger.kernel.org, Pranavkumar Sawargaonkar , Anup Patel Subject: [PATCH] arm64: Add support to pass earlyprintk argument via device tree Date: Mon, 3 Jun 2013 21:21:11 +0530 Message-Id: <1370274671-23812-1-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkRk/nBrLghpz08b+kREf4i/lbqpw4n/FTQguFM+nqOuPvRb0qxYsN6fQn4lRUm/SZlVd4Q X-Original-Sender: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.181 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 | 21 ++++++++++++++++++++- 2 files changed, 27 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..fb2d56f 100644 --- a/arch/arm64/kernel/setup.c +++ b/arch/arm64/kernel/setup.c @@ -60,6 +60,8 @@ EXPORT_SYMBOL(processor_id); unsigned int elf_hwcap __read_mostly; EXPORT_SYMBOL_GPL(elf_hwcap); +char *earlyprintk_dt_args; + static const char *cpu_name; static const char *machine_name; phys_addr_t __fdt_pointer __initdata; @@ -122,6 +124,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 +184,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 */