Received: by 10.192.165.148 with SMTP id m20csp669824imm; Fri, 27 Apr 2018 05:42:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpfp142FcyZgccmM+9NLF1+6yRK3Bw20t3hWFPgDPUZPGO6UJj3IGusUPOWCea7St1fnv33 X-Received: by 10.98.157.90 with SMTP id i87mr2156659pfd.190.1524832960442; Fri, 27 Apr 2018 05:42:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524832960; cv=none; d=google.com; s=arc-20160816; b=a/6/JN0JgR3SAobQqLv2w4oAa1W+b/HAEjd6s1Siov9gab8+z6w6zTII3ikVyWUB62 dYLjnb24L5iJHQqw/njuq+EJcElNWB4YIIpm1sPBAEQMD8iNL0nEDgsQt8LFSO6wul1l YJPcC/Vu7zmnm7NPYYESEpYgFb7G98LCOXyz/ACrtJj//T3CNTn4AB/Ewh5jrNB+trrg CuzgA1B44lYH5WZFuZLuynvybhh+vMM2gCg1xlptPZPUaJNYMWUp+CnRbb7BMl3EfD3U C8CwAtAU+R9BCZANlgNIkXI1+u3RImLEuHpKoKRq+C4j5tWAQtaud4zE4oiyva3wYhFR DkEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=AyVsQDJUwRFdnPduJmQsY4nz+Ewwpz/IgZUA6Hl+K3k=; b=u4ulwEkXQbt5ucC8MTOu9S2RBhueQiqdMvkXHMco5fHg1PYlQSUR79s+rwz+sifLzu HsyYKHnbVCwGTvuFZlUk31lZdWArlVUb4VWlG+CtyYeF1sDpqvt0d828EM9F23XMBQD8 kLf7JwFrBGdcW1+NeRnPLTmYj1VYZ+dF4bZdip2ElvV4GLQEl9JbdiwRv0mvLra4IjZH SsrY+nAF601ZFyMtI0GcYUfajvAje5Pj+yK5mbPCYHJ8v9EmRGR+jGntiDX2o5958Ct6 yjiTb65a9XGQ/6/o3WeWD/bDnUVz8VWnF/YN68Fy34pldHS9zT6a7vBybbbmvGWaLOo8 DgHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=iWaVlR/7; 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 x4-v6si1154619pgt.575.2018.04.27.05.42.18; Fri, 27 Apr 2018 05:42:40 -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=@gmail.com header.s=20161025 header.b=iWaVlR/7; 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 S1758237AbeD0Mki (ORCPT + 99 others); Fri, 27 Apr 2018 08:40:38 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:33474 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758117AbeD0Mkg (ORCPT ); Fri, 27 Apr 2018 08:40:36 -0400 Received: by mail-qt0-f194.google.com with SMTP id f16-v6so2013456qth.0; Fri, 27 Apr 2018 05:40:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=AyVsQDJUwRFdnPduJmQsY4nz+Ewwpz/IgZUA6Hl+K3k=; b=iWaVlR/7rkkU+fxNGrf5CzSS2YrCtlaZrR6tD1MAZnJ5yjroEJnw0Q2A5xmH3e5KZZ D8CGERY6ya0psJHFdz2E2mfXow5HX3Lu8Db+pkpvxMh7qptgbde9sT9cAFbbGc0VI6Nk qkNf6/KhbESUxn4aQ+QMrcERAbe/10lHki+XFbzCJ3amloPhP/K37L8IuBGdtHH5p6BG ClrUnaGYBlqQdKEHvr2WPhhwkRtor1OojUAMq4z6YJtpZvHHPRPZrL3z8P3qlrEJtbRq Y8G4efJnUtb2toKxq0eeXzBhIBh2CSyHtj9zhKKcL1J1+2pM/haQLbnTh5nTzcrPWR3Y 6pvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=AyVsQDJUwRFdnPduJmQsY4nz+Ewwpz/IgZUA6Hl+K3k=; b=TQXP4rEw/WJ6lANjR1u7SnvyTlpbA9ox0HA+t1M5Hm6KO0VuYTErRh5kWPcs0onCd/ zS/X27zpaxDnUZ3g/PkLl7qXIIcKZAu0n8opXcMdaOnS0DXBeMgwLy5AdE3XCjXwf73S wgTEn34AGU1N/FcK22m3Qm1VlcM9RR15FCGUfNDcj/eD/0FFMAMqs4UtvFPC2X5M7uHN V1H9Mv6kIdyVOy76a0lqcxlex9/T3C97NDZNQh4CUBzD28K+fUyyT0Clz0mfr5Z5S72s QulI+9pc23T6Qwdjl6Jo5sVGAdKZkcB8qNNo+EfY0dnZoQFk/x7FrKGsPBXCkkIyrsMf EcNA== X-Gm-Message-State: ALQs6tAMl4XIlcEbXpWTHNi4CO97V2v5WNR92gKRYg+AfI1VCKCVWybf Ugk8AFJ8LCLLgwJ5rrAEsVJQ8Ry0MqMRYGdSYcs= X-Received: by 2002:a0c:bd06:: with SMTP id m6-v6mr1767951qvg.156.1524832835251; Fri, 27 Apr 2018 05:40:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.185.3 with HTTP; Fri, 27 Apr 2018 05:40:34 -0700 (PDT) In-Reply-To: References: <20180426152920.21569-1-brgl@bgdev.pl> <20180426173151.GJ3094@brightrain.aerifal.cx> <6d1f9114-f1d1-961f-4f36-74adff059dc3@lechnology.com> From: Arnd Bergmann Date: Fri, 27 Apr 2018 14:40:34 +0200 X-Google-Sender-Auth: E7aKCnRSOm0jdjVWNGX7yN3MWvA Message-ID: Subject: Re: [PATCH RFC PoC 0/2] platform: different approach to early platform drivers To: Bartosz Golaszewski Cc: Bartosz Golaszewski , David Lechner , Rich Felker , Sekhar Nori , Kevin Hilman , Michael Turquette , Stephen Boyd , Greg Kroah-Hartman , Rob Herring , Mark Rutland , Yoshinori Sato , Frank Rowand , "Rafael J . Wysocki" , Jarkko Sakkinen , Dmitry Torokhov , Arend van Spriel , Heikki Krogerus , Michal Suchanek , Jan Kiszka , Andy Shevchenko , Marc Zyngier , Peter Rosin , Linux ARM , Linux Kernel Mailing List , DTML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 27, 2018 at 1:53 PM, Bartosz Golaszewski wrote: > 2018-04-27 12:18 GMT+02:00 Arnd Bergmann : >> On Fri, Apr 27, 2018 at 10:57 AM, Bartosz Golaszewski >> wrote: >>> 2018-04-27 9:52 GMT+02:00 Arnd Bergmann : >>>> On Fri, Apr 27, 2018 at 4:28 AM, David Lechner wrote: >>> My patch tries to address exactly the use cases we're facing - for >>> example by providing means to probe devices twice (early and late) and >>> to check the state we're at in order for users to be able to just do >>> the critical initialization early on and then continue with regular >>> stuff later. >> >> Maybe the problem is reusing the name and some of the code from >> an existing functionality that we've been trying to get rid of. >> > > I'm not reusing the name - in fact I set the prefix to earlydev_ > exactly in order to not confuse anyone. I'm also not reusing any code > in the second series. Ok. >> If what you want to do is completely different from the existing >> early_platform implementation, how about starting by moving that >> out of drivers/base/platform.c into something under arch/sh/ >> and renaming it to something with an sh_ prefix. >> > > Yes, this is a good idea, but what about the sh-specific drivers that > rely on it? Is including headers from arch/ in driver code still an > accepted practice? I think it's fine here, since we're just move it out of the way and there are only very few drivers using it: drivers/clocksource/sh_cmt.c:early_platform_init("earlytimer", &sh_cmt_device_driver); drivers/clocksource/sh_mtu2.c:early_platform_init("earlytimer", &sh_mtu2_device_driver); drivers/clocksource/sh_tmu.c:early_platform_init("earlytimer", &sh_tmu_device_driver); drivers/clocksource/timer-ti-dm.c:early_platform_init("earlytimer", &omap_dm_timer_driver); drivers/tty/serial/sh-sci.c:early_platform_init_buffer("earlyprintk", &sci_driver, For timer-ti-dm, it seems like a leftover from old times that can be removed. The other four are shared between arch/sh and arch/arm/mach-shmobile and already have some #ifdef to handle those two cases. >> Let's just leave the non-DT part out of it by making it sh specific. >> Then we can come up with improvements to the current >> platform_device handling for DT based platforms that you can >> use on DT-based davinci to replace what currently happens on >> board-file based davinci systems, without mixing up those >> two code paths too much in the base driver support. > > I don't see why we wouldn't want to unify these two cases. The best > solution to me seems having only one entry point into the driver code > - the probe() function stored in platform_driver - whether we're > probing it from DT, platform data, ACPI or early boot code. I'd rather keep those separate and would prefer not to have that many different ways of getting there instead. DT and board files can already share most of the code through the use of platform_device, especially when you start using device properties instead of platform_data, and the other two are rare corner cases and ideally left that way. The early boot code is always special and instead of making it easier to use, we should focus on using it as little as possible: every line of code that we call before even initializing timers and consoles means it gets harder to debug when something goes wrong. Arnd