Received: by 10.192.165.148 with SMTP id m20csp3901039imm; Mon, 23 Apr 2018 14:40:21 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/yJQPo+oChNYNUEN1fgRlcXT5UxZiA2fx4ZRnH7ewEinUXdLZvqE4g2G64RTqTUr624LdU X-Received: by 2002:a17:902:a24:: with SMTP id 33-v6mr22527361plo.72.1524519621672; Mon, 23 Apr 2018 14:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524519621; cv=none; d=google.com; s=arc-20160816; b=dWUjlrNtwftHwuNAXP10+Nlo0kqsBeali47JgSNOlnNBnGAul9vJ99lOXr7oMDJmDJ bU+ZAFNhGmQnTtiF83Tk50Zta0LsxaxPZw8xI4jTuUH6PfAYWqapPT60SG41pxcGDRxe SET2HIlY4dxB1snMAXajQiMS9essGSQC32nQ6XwCvsuxFNl/ZqirkLwggH+jxPhyaYIf 04RTJmPbWFiJsaGiMJVexWqZB6BNoNYOQ2gG+vLVPhu4kx3z+s4NwbKY4uNcPOzCKmVX TdMW4rG8ju2dPa4PxcI4HyfNVJAOzKJCQKKGOJlvTmLo1Kg5LKmCNQSO6ySj/W+xrTfJ bD6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=SyLrgC94B/1G5YVLTKIDYltHaCdZkz3H4svXnzENLZY=; b=WsvWMrgYMQr6Mp9DgAQA9+ZczqQPn5XDAP6aGYsQkMVf+SWzenjb1iH+MVP6f6evPj x4Y9GhdovFQG0csM/k57LcadUSCyOZw5is9Shrf3Sbk7UIirN9VNSD/FZ8a43/4baL+h IVfHkwzPwLGYaGZpyRapgDJs8NVmjuNQ38p3ZcqmGa+RKRr5nYFPm2/ZsZEduvwizJ5a /rdlnMGq495/resacbJni4xrjv1Vh+wdpJkZ+pYiGAi5wsKTwjfgelgLoTcgPLldFzyi Th+jgDpuzgfzL/CeRexqGrvx7CH3Nsc5SM0kArIAmXg7itoUoYkDbnQIt5DXpnPpm77/ KKjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=D9VU2OL6; 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 94-v6si12331651ple.56.2018.04.23.14.40.07; Mon, 23 Apr 2018 14:40:21 -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=fail header.i=@lechnology.com header.s=default header.b=D9VU2OL6; 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 S932652AbeDWViu (ORCPT + 99 others); Mon, 23 Apr 2018 17:38:50 -0400 Received: from vern.gendns.com ([206.190.152.46]:51331 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932615AbeDWVif (ORCPT ); Mon, 23 Apr 2018 17:38:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SyLrgC94B/1G5YVLTKIDYltHaCdZkz3H4svXnzENLZY=; b=D9VU2OL6OLuVr1RUUkwJwGLD1H tW9KDROQLuJbIhIDfrWhMmNr3kUW+6MTcAflTm54FgD9g64t9ZvJUY7cph2VgvEC1XTIwf3dX91SU wDKmoFXBOuPPzEHwRikGTMI+RiZhdIb93V+N28iPVqTVUtx+BnWhZpfxZW5xzela0NO+ErQ+CZIgC N3SLjsLnFRVJXuqo96W4qI3kKckCjZUmtLLhJpSTuvk/4lH9zJvU/zwLOxJnpyp0pGgbSHPcRpDpP Jf2sNFAzTcugyEwmRB6Ny+SCNk83KiN1SnaU5lvYLcZzdqhxZONTnzSkdr0EyeUVnMvHzPl9wUWJx vTHxSkDw==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:41480 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89_1) (envelope-from ) id 1fAjAN-000il7-M5; Mon, 23 Apr 2018 17:38:31 -0400 Subject: Re: [RFC work-in-progress 0/7] of: platform: use early platform routines instead of OF_DECLARE To: Bartosz Golaszewski , Sekhar Nori Cc: Kevin Hilman , Michael Turquette , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski , Stephen Boyd References: <20180423183814.20615-1-brgl@bgdev.pl> From: David Lechner Message-ID: Date: Mon, 23 Apr 2018 16:38:30 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180423183814.20615-1-brgl@bgdev.pl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org FYI: It looks like the CC for Stephen and Arnd was messed up, so I fixed. On 04/23/2018 01:38 PM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Hi David, Sekhar, > > since platform devices are generally considered more desirable than > CLK_OF_DECLARE, TIMER_OF_DECLARE etc. and we need to figure out how to > handle the clocks that need to be initialized early in the boot > process on DaVinci, I thought that I could give the early_platform > mechanism a try. > > This API is only used on one architecture (sh) but seems to work just > fine on ARM. It allows to register early platform drivers and then > probe them early in the boot process. So far only machine code is > supported but with a bit of hacking I was able to probe a DT device. > > This is a very dirty and far-from-upstream proof of concept that allows > to probe the (so far dummy) davinci timer platform device during the > call to init_time (from machine_desc). > > The idea is to have a special compatible fallback string: "earlydev" > that similarily to "syscon" would be added to device nodes that need > early probing. Then we'd call the of_early_platform_populate() > function that would find all compatible nodes and populate them > long before all the "normal" nodes. FWIW, "earlydev" sounds like a driver implementation detail, so not something that should be included in the device tree. We only need this because Linux needs a clocksource early on, but that doesn't mean that all device tree users need to do the same. I'm sure it makes things easier for a proof of concept though. :-) > > This would allow us to make the davinci timer a normal platform device > and possibly also probe the psc and pll drivers earlier than we do now. > > The early platform API even allows us to check if we're being probed > early in probe() so we can possibly probe the driver twice if needed: > only doing the critical stuff first and then completing the process > later. > > If you think this is a good idea, I would like to continue on that > and eventually make it an alternative to OF_DECLARE macros. > > For a quick conversion of the davinci timer to a platform driver > I image we'd need to use platform data lookup that would be passed > to of_early_platform_populate(). On the surface, it certainly sounds like a good idea to me. Do we have access to struct device of the platform device when using this early platform device? I remember when I was working on the clock drivers, I tried registering a platform device in the init_time callback but the kernel crashed because kobj stuff was not initialized yet. I'm guessing that the early platform device somehow works around this.