Received: by 10.192.165.148 with SMTP id m20csp2282603imm; Thu, 26 Apr 2018 08:32:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+4OKNVP/mp0vyEomK4L+ZQs0sncZKGgdTWq3XqD0UW68cufRbqyMa6NtzqxGBZd04lxBDw X-Received: by 10.99.39.135 with SMTP id n129mr27922004pgn.167.1524756733095; Thu, 26 Apr 2018 08:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524756733; cv=none; d=google.com; s=arc-20160816; b=beTVs9wSFMGynYVH9WU3mFoaMXQca2CdU7S6NV7dRnJTo5z5zNV8Z8kEc53CKp7AE6 6InESI9tObgZkOUcOdNvOyMeHkF1GCuSKOYup2+5U8p48EbLrJeRbmrllIvV0qqj/ibd FQymMakVwHxwq46PbNkTuuPhE2T+4ljNNkyNMx53z1pzETjrJtbzIC+Az7kT0B/atEnS jz2lZ/Z78UDEjuYSHBXYoU+xBu4p59mznshxhMC4SPitWw+lrtB9qzwtOZEuEXQ3xVgN pwwS5xsGnvSNcvisZB6pZkpdTHQI5VMJ9jyqo439L1guhN/b7luN3397uwezFqJmk3Wl sxFw== 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:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=WnQuJXVTSeMq7JNTlBOZGHl3KR8ySUXtb6WxGSGIr1I=; b=slpUDaY4wuEA6qQH5cQ6yle74xf/MTK/d7bSyC0ncxr36Ne3TwnpArO4tNCpjyNJZA 8RiRshjtjgyauzxzcDoCe1NICkzJ/uBYYJC9LCzwRYErhsymyjRbRXnN+yOnx360N6+w HyJ/nHYYQKPiYwkDvSiHCjissp6Tgefg7q9TGm8xUNrZtBdeJH6XFXuIhiXFbMW1d+CR I18EfInb4ApdXI8cLq8VdB4n1RwP4UAMFzCb770b5DCoCNrK7czV1XmypMcI/VDsvYta kn5lKZpogOwGm90JKZ49gZW0QtEPvQPav9q6GfQbkBsgnFg/jTqFAy0jD8B6GwGESAGg I5Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Z3Vk8S4x; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si5889340pgs.396.2018.04.26.08.31.58; Thu, 26 Apr 2018 08:32:13 -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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Z3Vk8S4x; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756758AbeDZPae (ORCPT + 99 others); Thu, 26 Apr 2018 11:30:34 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34507 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755709AbeDZP3k (ORCPT ); Thu, 26 Apr 2018 11:29:40 -0400 Received: by mail-wm0-f67.google.com with SMTP id w2so8528wmw.1 for ; Thu, 26 Apr 2018 08:29:39 -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=f1FTZ49304RDbzJ2sZi1Wc+H1rbzL4Vb+5WGPGy8MJbAq7VZkw2Vfx6BA8NTZT65s0 /fvNOB5ARmd5FbRTi2+GubpHrV6ah807nOMYzDRh6vsf/zJsASJ285t5s5k2f911cTQA MpXn4jQa7bYserYlcJPaoIOoc1fdUEUOl3kX1EjyJPvg0PxlbOZFedGVAKZEMBGy9+qj 8VW1ni99aUSo/pPEaAMOpILjJoicjWEvh3v/T6n1mE/TnIfce7e6sAyEd4YEOsLp+Zao 4K0OAx/yNOd91WcWf6zhmeUyoeNmjI7Yl9Z+/+OipHIoyFH3aRC1JKPqRZJj7mCu467e j70w== X-Gm-Message-State: ALQs6tCC5HaL6XP2uhWM/3OKZz1F72ob5UZW4JeLdiLDPnZf7TzeeWC7 /8zeF5mHUsOCX8WfX8eMxFKTBQ== 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 Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Bartosz Golaszewski 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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"); -- 2.17.0