From patchwork Thu Apr 26 15:29:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10366205 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C85260225 for ; Thu, 26 Apr 2018 15:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 06F2F290FD for ; Thu, 26 Apr 2018 15:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0359F290CC; Thu, 26 Apr 2018 15:30:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1B77C29186 for ; Thu, 26 Apr 2018 15:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=tfno2oSTJFihhT5PSKbwREnz2RwqCevHhsEkThCTxi0=; b=W8WbseFzSgaBybm87G2UNeFhEI g478f0qH4xHyGxDQ3DX3uwir6YNZNlrM2Ukz0Npp7pk2k9teYF6dJLyPXuwNTtFM8qdfzJqHFtN3P uSX9tMJVYIwvjshSmvisWNMK8keDOdUPQcYzGmPznwhcEKoGC0dSRJsQY/71zJ+wOSsE6+LZ64M3m cxU6xiSMCmZhJYMR6RkznQ3S5haN3D9L7ggQiDcBh2QzImlS68EP0ZxOUci5EjQrnymHw2cEHp6cE ETZR+kCPnzc5qCLTASuaFNrLe34ipfiCSqIGxMPjuI+qPS8xfpfTemOQO/CQuinoDUrP+RN/aPusO z5q/pfIg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBiqs-0000CI-38; Thu, 26 Apr 2018 15:30:30 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fBiqA-0007WW-KL for linux-arm-kernel@lists.infradead.org; Thu, 26 Apr 2018 15:29:48 +0000 Received: by mail-wm0-x243.google.com with SMTP id x12so18184wmc.0 for ; Thu, 26 Apr 2018 08:29:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WnQuJXVTSeMq7JNTlBOZGHl3KR8ySUXtb6WxGSGIr1I=; b=Z3Vk8S4xE8sq1lno+k/r1glD9zFaxplN9y09S22ZVCd9LG+a2m70pmmCitpdu54iiw vGqWb0P5EZhChQwoi0CSnd2MG7/YTEqXrUDjTcBstLnrhIKUwTsL5PtcJridPcedcaS3 D3bBkleBMF9m9KBt3KMjycI1kixzGWFWI33OwAqNJeJGRu5kkkZztncaClIYpq/qeTEV vv23plEnzT8DDrADJR+9XoV/Z8uVO7No6lX/zzWsdP+/+A2N3ljVotUCK6lD9xS6uBS+ GDxFjNh7Y5k2WjJwX5nNLAHvYrlhUGFynwUbz6euBbzm1t3Y6bPZfTH5L1sBoWCCesCv BUmg== 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; bh=WnQuJXVTSeMq7JNTlBOZGHl3KR8ySUXtb6WxGSGIr1I=; b=A54VI9TcqvnVUz+66Fk1fx3zRNhCTGB54zZv2ZNGSXczgun19rtGaIFVWGh/rZwUa9 UUVQL3oUZqTLJS9kthaMcQqjTIggqxJuErsScfjEkFY3hRTN9dokauzEGi0pOrn/d4BL QV21fRvMQXOep2KWKlOAbEd6vHPg2GwdOrSwUloXHvGz9w1+96vt39S+exl49L/xUOWY y2kPwMsvzGXJ3IIqsSTJ7QV2ree4Xw8cE00fViq3Is4EWdEbVILVnRzy33VHIQL/TPkU gLocdXfWVBJCxg3Xa/DwkGEnSU3xH5v/4SORIiuCXPeazs8EKRGraQ9I1p4SX6DOt6wj wsCQ== X-Gm-Message-State: ALQs6tB3JFdd2vtWed0p/NVixWKW/ppRM0oUdZ62N6SKtEmf6IeQ3ihg xn+NP0DGOdl/SFxaas1JokdlLw== X-Google-Smtp-Source: AIpwx49lUdv9rFxYtt8BWEIkmBcmwZ6QfG8YcGdOLhE4Bz20ITMR9aegchkisBIFVmbTwsentmgI9g== X-Received: by 10.28.220.193 with SMTP id t184mr20284815wmg.138.1524756579171; Thu, 26 Apr 2018 08:29:39 -0700 (PDT) Received: from brgl-bgdev.lan (LFbn-NIC-1-84-58.w2-15.abo.wanadoo.fr. [2.15.173.58]) by smtp.gmail.com with ESMTPSA id q2-v6sm2679355wrj.57.2018.04.26.08.29.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Apr 2018 08:29:38 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , David Lechner , Michael Turquette , Stephen Boyd , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Mark Rutland , Yoshinori Sato , Rich Felker , Frank Rowand , "Rafael J . Wysocki" , Jarkko Sakkinen , Dmitry Torokhov , Arend van Spriel , Heikki Krogerus , Michal Suchanek , Jan Kiszka , Andy Shevchenko , Marc Zyngier , Peter Rosin Subject: [PATCH RFC PoC 2/2] misc: implement a dummy early platform driver Date: Thu, 26 Apr 2018 17:29:20 +0200 Message-Id: <20180426152920.21569-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180426152920.21569-1-brgl@bgdev.pl> References: <20180426152920.21569-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180426_082946_704376_D827C76A X-CRM114-Status: GOOD ( 20.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Bartosz Golaszewski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Implement a very simple early platform driver. Its purpose is to show how such drivers can be registered and to emit a message when probed. It can be then added to the device tree or machine code to verify that the early platform devices work as expected. Signed-off-by: Bartosz Golaszewski --- drivers/misc/Kconfig | 8 +++++++ drivers/misc/Makefile | 1 + drivers/misc/dummy-early.c | 46 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 drivers/misc/dummy-early.c diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 5d713008749b..99cde8aefdb0 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -91,6 +91,14 @@ config DUMMY_IRQ The sole purpose of this module is to help with debugging of systems on which spurious IRQs would happen on disabled IRQ vector. +config DUMMY_EARLY + bool "Dummy early platform driver" + select EARLYDEV + default n + help + This module's only function is to register itself with the early + platform device framework and be probed early in the boot process. + config IBM_ASM tristate "Device driver for IBM RSA service processor" depends on X86 && PCI && INPUT diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 20be70c3f118..84ad0225eb14 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -11,6 +11,7 @@ obj-$(CONFIG_INTEL_MID_PTI) += pti.o obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o obj-$(CONFIG_DUMMY_IRQ) += dummy-irq.o +obj-$(CONFIG_DUMMY_EARLY) += dummy-early.o obj-$(CONFIG_ICS932S401) += ics932s401.o obj-$(CONFIG_LKDTM) += lkdtm/ obj-$(CONFIG_TIFM_CORE) += tifm_core.o diff --git a/drivers/misc/dummy-early.c b/drivers/misc/dummy-early.c new file mode 100644 index 000000000000..f00fb1fbd5fa --- /dev/null +++ b/drivers/misc/dummy-early.c @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) 2018 Texas Instruments + * + * Author: + * Bartosz Golaszewski + * + * Dummy testing driver whose only purpose is to be registered and probed + * using the early platform device mechanism. + */ + +#include +#include +#include +#include +#include + +static int dummy_early_probe(struct platform_device *pdev) +{ + if (earlydev_probing_early()) + dev_notice(&pdev->dev, "dummy-early driver probed early!\n"); + else + dev_notice(&pdev->dev, "dummy-early driver probed late!\n"); + + return 0; +} + +static const struct of_device_id dummy_early_of_match[] = { + { .compatible = "none,dummy-early", }, + { }, +}; + +static struct earlydev_driver dummy_early_driver = { + .plat_drv = { + .probe = dummy_early_probe, + .driver = { + .name = "dummy-early", + .of_match_table = dummy_early_of_match, + }, + } +}; +earlydev_platform_driver(dummy_early_driver); + +MODULE_AUTHOR("Bartosz Golaszewski "); +MODULE_DESCRIPTION("Dummy early platform device driver"); +MODULE_LICENSE("GPL v2");