From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751955AbdJ2Nua (ORCPT ); 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 X-Google-Smtp-Source: ABhQp+RXICV9p7yf9WDERyUynR/kZsdMHZJmVOYatTfMCyhjGCxT50c/qgLebOTQjamXPulQf6DCdw== 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 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 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, -- 2.15.0.rc1.236.g92ea95045093