Received: by 10.192.165.148 with SMTP id m20csp4404058imm; Tue, 24 Apr 2018 02:04:31 -0700 (PDT) X-Google-Smtp-Source: AIpwx4830HAcjJsZbb2fCreyJAbWK2uZCGWeBdEmmgh2NOrmNHGEMJ1a40Oz6dBhTKXC1y7ENsYd X-Received: by 10.167.131.203 with SMTP id j11mr23488059pfn.101.1524560671803; Tue, 24 Apr 2018 02:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524560671; cv=none; d=google.com; s=arc-20160816; b=H/lUTuxJc6s4rX91GPsZ4SM90edM9yR/M7NGG8+KbPQMjVl8WTZ7/+Wl+OPcog9aqX OyExvLVdxBbsWH0PqH5bszMBDhWdlG3u9dy68fciwVCPbiJATn4JS8zSxRJzztiZBFZK 1eGVWsq8lsg9AdRMcT7Oek2t+D9o2ICMiT06Mr5vz4exwL2WXavG/ZzzbJRMqHR8BF5D PZFp4PEr1cggjjcpGeX87Td1kuyoLFp5RVA/Zm1zf7zIWSKZ7iReXMZL4Wj336L2mue+ vqgclNURwlgPllyUxbJ96H5eJocH8gkn3UkAHjKWCVCdmDFthHBeTe3p6pN2h5nG0Six yv1w== 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=gR3a9Hc8vfK8irpTN0kOJ3zhsg41q8TVd5RJ1/9ROc8=; b=WC2jwvNzDg/+2yozrD0T7WI3Eo0MtesbTJxS9mQRTCXFJiamW/HEPaAw7SHCKMF95N Rdrxfz5AQXBi90F90cT6m7sA/dRlq0UQo+vKwsKau2qqtR0aeqs0Dygqkr949hfTR8Km tzApWs6COEBRHjB3+e30Z2NFWah78jrlg6/v6c97IG/wCbBcHum6hLAaYrwec6R9Jpk7 IlHYV14mAuYwDN/MvXKC0CSqTN3emsYlWV+ludNLHlJtgQl22+l0uLdl6ZDpdT+VDdgn zWgIVH1syhPTwotJ9T/VMleaLX5kjvPJvFupd106vkCtC2J6vmvPcju7ZcPGOYgPyC+6 JuGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=CivYBeN/; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3si11295160pgs.516.2018.04.24.02.04.17; Tue, 24 Apr 2018 02:04:31 -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=@ti.com header.s=ti-com-17Q1 header.b=CivYBeN/; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756620AbeDXITX (ORCPT + 99 others); Tue, 24 Apr 2018 04:19:23 -0400 Received: from fllnx210.ext.ti.com ([198.47.19.17]:54074 "EHLO fllnx210.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756228AbeDXITQ (ORCPT ); Tue, 24 Apr 2018 04:19:16 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx210.ext.ti.com (8.15.1/8.15.1) with ESMTP id w3O8I5O1002486; Tue, 24 Apr 2018 03:18:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1524557885; bh=yGex5TLGaku1PbytBd1GoJNaLs4gNXKWgMsJDK0IVyA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=CivYBeN/shLydBd38311XojwQml2ERZ+xdY0jEkdyhoVjECQfnGeY5Rq4KR+yfY3m o24WJtKyLhsjWG3HJUCoKAAe+jF6na2Z30zcnt7hjgq27A5n0OO/tjgJ1Vh5oaYj7k Wjf8S/pZ6FifAVdZmHc4nDbfbLMFwqaYiQx8ppiM= Received: from DLEE105.ent.ti.com (dlee105.ent.ti.com [157.170.170.35]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3O8I5Qj013315; Tue, 24 Apr 2018 03:18:05 -0500 Received: from DLEE115.ent.ti.com (157.170.170.26) by DLEE105.ent.ti.com (157.170.170.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Tue, 24 Apr 2018 03:18:05 -0500 Received: from dlep32.itg.ti.com (157.170.170.100) by DLEE115.ent.ti.com (157.170.170.26) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1466.3 via Frontend Transport; Tue, 24 Apr 2018 03:18:05 -0500 Received: from [172.24.190.172] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep32.itg.ti.com (8.14.3/8.13.8) with ESMTP id w3O8I0SS013245; Tue, 24 Apr 2018 03:18:01 -0500 Subject: Re: [RFC work-in-progress 0/7] of: platform: use early platform routines instead of OF_DECLARE To: Bartosz Golaszewski , David Lechner CC: Kevin Hilman , Michael Turquette , Arnd Bergmann , Greg Kroah-Hartman , Linux ARM , Linux Kernel Mailing List , Bartosz Golaszewski , Stephen Boyd References: <20180423183814.20615-1-brgl@bgdev.pl> From: Sekhar Nori Message-ID: <71b04060-b33c-d566-f5a5-aba506c96cdd@ti.com> Date: Tue, 24 Apr 2018 13:48:00 +0530 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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tuesday 24 April 2018 12:56 PM, Bartosz Golaszewski wrote: > 2018-04-23 23:38 GMT+02:00 David Lechner : >> FYI: It looks like the CC for Stephen and Arnd was messed up, so I >> fixed. >> > > Thanks! > >> 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. :-) >> > > We already have "syscon" which too is more an implementation detail > than HW description. I should have probably Cc'ed Rob Herring. I'll do > it with a more polished version I should have today. Yeah, we should check with DT maintainers here. Even if there is push back on this, I suppose we can make of_early_platform_populate() take a list of compatible strings whose DT nodes should be considered early platform devices? >>> 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. >> > > Yes, it seems we do. I was getting kobj stack dumps too when trying to > register a device using just platform_device_register() and it went > away as soon as I switched to early platform. I agree, it sounds like a good idea to use for clock and timer devices. Thanks for looking into this. Looking forward to the more polished version. Thanks, Sekhar