From patchwork Sun Oct 29 13:48:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 117413 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp1528148qgn; Sun, 29 Oct 2017 06:50:33 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TOwkeg1UanPTrJGCVx2gyHYYdNfdnsfdS5v9NDsxpWA2MuayRAFsnnpOseLFfGAHMTQuJb X-Received: by 10.84.231.193 with SMTP id g1mr4802684pln.407.1509285033098; Sun, 29 Oct 2017 06:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509285033; cv=none; d=google.com; s=arc-20160816; b=xUOVKU1sl76dNArS4hUnwEiIHYTZPXnnQ4AveRQ6oJtWapNoPgJUKm1nWyVUfTkK7S Pvt+zJ+MOlnQPAkVTbeGkYqwVf6wUHpIAd0MOEYiEYnnoCBWD8cBGsT7VtYz8As9WPQZ pIN11lwYvWKa9txpMrcvBaUPMt9c1aCHL0Ivc73Q3KjTHXoIxcRitXDPYuf/UZYVi/nY 5o4p9j6RtBKo3AR8pwa4vh3UhaoIdBqbxfo3+epR9fsCDxjDa/Ni1Me9TRoNTokoyOlC pBisJjZ2z7SF8rrrEahT84rDA2slJL3rV8/CXELcTEl834VHo1Lh8svh3oDL+7Klj5to 9mMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=qExC51DxMnAxdbbNF0fp4tkv43l/K8F+RIKd1+tryYE=; b=LqhrcrBc5H6s9J8JkO0uWamA222RsYWmJUW+lRJhSN9mfj/ps/VEvHJgXxHKaI9aL/ DvvL3KHFK5tMRqSX0ukmcYe2AMJi8QhROo5aad7mkoehpErUBjtJBg8jfRLBWe/qqIbO wzcZNdVcK8wg+UTobdvDBN+z5SjHzmMalKXTYMXF2H78kfPSC2IjLnpW3SuBqkqe4Urz dIruuHc0YK5uLjp67geCBxlxcOZnw7+bs+UAecx+l0RNZIWEHOOCxKOL3KIrUQK2W9p4 1WDaNMaQ1jj8fNkStJwO1rHaR36Qy/ver/QJZqiXSl+Pq9HXvYBGg/ySKOQH9v4bPrW9 s34w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fzEzTDxx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 102si7329781pld.614.2017.10.29.06.50.32; Sun, 29 Oct 2017 06:50:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fzEzTDxx; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751958AbdJ2Nua (ORCPT + 27 others); Sun, 29 Oct 2017 09:50:30 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:49707 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751804AbdJ2Nte (ORCPT ); Sun, 29 Oct 2017 09:49:34 -0400 Received: by mail-pf0-f196.google.com with SMTP id i5so8667666pfe.6 for ; Sun, 29 Oct 2017 06:49:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=qExC51DxMnAxdbbNF0fp4tkv43l/K8F+RIKd1+tryYE=; b=fzEzTDxxz8dUqX/V5MyeXbK+/IMVGk/gXDs777Vd9MONlXwzzP5vR9Xkj/TfYElRN4 Y91HHJEGhR+ALxzuSs1wqshG0+VnGSSo4jCZFySqRyTMIiM2lKKEInt04A2y84qdv+NJ 0d5iESSv6M4i5n+rbqbQBASBhMan5/HL3roWs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=qExC51DxMnAxdbbNF0fp4tkv43l/K8F+RIKd1+tryYE=; b=N5BtaipFvA5BLacBPVz/FpnI8rNoQJdA/La+2v40RDPMktWP9xNoY7Ewsa7qSBDbxB GobYvB/qV4TylxZFWjaZ2PJ0LsCsaaJIS39PKC+rDx8kPvikLMg1OOBxe8CVPr3TYZX1 1WiblEW8+PX+gXjo6ovvMB3GwGdJGvECReMTbjpsRDUnELfLyT3iCyYmS+Gsng6nXXGO iP44jQe7XzYfATWy1GvT0S+u/qI/UCAJmGtvOOOmA3cblzqcBwq1IB0vnKlpc6w+ffFF 8YbK7rei4QsIcgSxbd5abtrNsSFXsMhItOiTb1RlIG4E2agsRYqO/GU4m/Jg1S7zgGmi V9Pg== X-Gm-Message-State: AMCzsaUMW7Sm3toivxX+wsvzlhgyvPXky20OEk8cln6uD8JMVgubaFPc 4nKrjqZTy3PcBIxAQ0XjXm8BeQ== X-Received: by 10.98.10.74 with SMTP id s71mr6052933pfi.336.1509284974166; Sun, 29 Oct 2017 06:49:34 -0700 (PDT) Received: from localhost ([122.167.161.211]) by smtp.gmail.com with ESMTPSA id k76sm26332647pfb.37.2017.10.29.06.49.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 29 Oct 2017 06:49:33 -0700 (PDT) From: Viresh Kumar To: Greg Kroah-Hartman Cc: Viresh Kumar , Vincent Guittot , Stephen Boyd , Rajendra Nayak , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, s.hauer@pengutronix.de, l.stach@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, nm@ti.com, xuwei5@hisilicon.com, robh+dt@kernel.org Subject: [PATCH V4 09/12] boot_constraint: Add earlycon helper Date: Sun, 29 Oct 2017 19:18:57 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.rc1.236.g92ea95045093 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Getting boot messages during initial kernel boot is a common problem, which (almost) everyone wants to solve. Considering that this would be required by multiple platforms, provide a helper to check if "earlycon" or "earlyprintk" boot arguments are passed to kernel or not. The platforms can use this helper to add serial constraints only if earlycon if required. Signed-off-by: Viresh Kumar --- drivers/boot_constraints/Makefile | 2 +- drivers/boot_constraints/serial.c | 28 ++++++++++++++++++++++++++++ include/linux/boot_constraint.h | 2 ++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 drivers/boot_constraints/serial.c -- 2.15.0.rc1.236.g92ea95045093 diff --git a/drivers/boot_constraints/Makefile b/drivers/boot_constraints/Makefile index a765094623a3..0d4f88bb767c 100644 --- a/drivers/boot_constraints/Makefile +++ b/drivers/boot_constraints/Makefile @@ -1,3 +1,3 @@ # Makefile for device boot constraints -obj-y := clk.o deferrable_dev.o core.o pm.o supply.o +obj-y := clk.o deferrable_dev.o core.o pm.o serial.o supply.o diff --git a/drivers/boot_constraints/serial.c b/drivers/boot_constraints/serial.c new file mode 100644 index 000000000000..d0d07d4aa6af --- /dev/null +++ b/drivers/boot_constraints/serial.c @@ -0,0 +1,28 @@ +/* + * This contains helpers related to serial boot constraints. + * + * Copyright (C) 2017 Linaro. + * Viresh Kumar + * + * This file is released under the GPLv2. + */ + +#include + +static bool earlycon_boot_constraints_enabled __initdata; + +bool __init boot_constraint_earlycon_enabled(void) +{ + return earlycon_boot_constraints_enabled; +} + +static int __init enable_earlycon_boot_constraints(char *str) +{ + earlycon_boot_constraints_enabled = true; + + return 0; +} +__setup_param("earlycon", boot_constraint_earlycon, + enable_earlycon_boot_constraints, 0); +__setup_param("earlyprintk", boot_constraint_earlyprintk, + enable_earlycon_boot_constraints, 0); diff --git a/include/linux/boot_constraint.h b/include/linux/boot_constraint.h index c110b36e490f..aeada69b87e6 100644 --- a/include/linux/boot_constraint.h +++ b/include/linux/boot_constraint.h @@ -10,6 +10,7 @@ #define _LINUX_BOOT_CONSTRAINT_H #include +#include #include struct device; @@ -58,6 +59,7 @@ int dev_boot_constraint_add(struct device *dev, void dev_boot_constraints_remove(struct device *dev); void dev_boot_constraint_add_deferrable_of(struct dev_boot_constraint_of *oconst, int count); +bool __init boot_constraint_earlycon_enabled(void); #else static inline int dev_boot_constraint_add(struct device *dev,