Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp314484pxb; Thu, 19 Nov 2020 01:44:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyB8yb4usdaetJZwMMbcXrzefIucIGoDHtB26rtW51QDFiC1Ry3ePkjzCp2mJRK4p0TCFIj X-Received: by 2002:aa7:d3c3:: with SMTP id o3mr31098830edr.319.1605779059363; Thu, 19 Nov 2020 01:44:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605779059; cv=none; d=google.com; s=arc-20160816; b=lsWijLc/heJ/xaK7Bzb8KGzqzetv4M4M4KbfxQQ3EOzD+cgDeatSP4nVp3jpMdEbAI kI8+kVNTPBoZ0+h/NferOWyHl2T2pXmxo2sHvUsx99PwqVGqw9yNQyqEt5WZO8OJFys6 Nq44AH1yCD7MeCCJpx8lLDSJkw+IER//Tw49GlWTKkdCGsWhK0Uq2Dfe4nZsgYpahfAD 9kXsxrQdyeW17rdQ2ihpBYmhcXmJwwMLTnb5G+rjRNeN6onyI+jnuvhzBXiwysPvHAqP InbbW6WeBs2U2TdBqxlsGYFz7F51XrGRAOsEU0tPW6u8oMGRT5toeMxBAs7R1MqfD6zi hS9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=brzwdBiRg5GG4kfoSji7gHY0vphU0XyPvWjylt2E0hc=; b=ytA0Ey6N0TGc/D27u2j55+FL+FRwP4GxQBbID20yyHxM4gg+D0O0AsbwzfqFu9NPEz CukwyvY0TS3IotY5E+lrB2lSkJoCEqwOTC3EF7u2k49y9EU+7l2J2otnez8QaCn8BDeP e8KjShHDsw2zuNHLKiq5OxzHTX6YdQBhkeub4izo6F5diLPdpEEgDKwmIaBLuv37GYc7 /b1eICut2ltkhhCeGIs8wWiicv3LqoxSMut5eWp3LeAUnkNzHvWdocKl8KBfZnfuuQJe cshJHXavBZOlU8ZOfvM4rlAhcEYHGtPza9hyGqR1UYybiPdSDtoYRfdcyjnJn0i/efAE r4Xw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hp30si13306403ejc.505.2020.11.19.01.43.55; Thu, 19 Nov 2020 01:44:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726811AbgKSJmH convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 Nov 2020 04:42:07 -0500 Received: from mail-ed1-f68.google.com ([209.85.208.68]:32791 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726700AbgKSJmH (ORCPT ); Thu, 19 Nov 2020 04:42:07 -0500 Received: by mail-ed1-f68.google.com with SMTP id k4so5164658edl.0; Thu, 19 Nov 2020 01:42:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=3auPEnlipqCorigcU4BHjBL1ODSkT0upvIcBnwf2V8I=; b=Ltaa/tHJGpYIAD9TUO6XSrAhfNOlE1XcECAl/PBwFC3PM3GGfoYwMW3t3poQvAqpxC 8CSRVd0DhSixNun5AD7AyRuL1ednH8go/Ofwik+IpeD4KPYJ+mlC9xjeY41/CGBLgOwP gSWLfzWKh+sqiE/lRch2+vpO22dyNFk7HcUKL9r/Odt+qNvwc+2kqcWCKYwxNMQMTaXw h6hIYwbDy/NTnNGrwxP6KX3UZwNEL22KYEgilkfMt0sWnJbLdeY23/M9jV8xKknIwMd3 9aR1YMaiJDD/+VKf57OaqI5J+O3nH+OdzgMbd7ZtxlNM5001EiF4MotBZYfiRZCGqeKg AYaA== X-Gm-Message-State: AOAM532ir+7lywH5G7eXgM2wPtzS6lxmOOwElWrYqiuxvssNPXYjTeZ/ pVyb+Sv1w5MfXGgjIBSnOgY= X-Received: by 2002:a05:6402:370:: with SMTP id s16mr28723329edw.50.1605778924729; Thu, 19 Nov 2020 01:42:04 -0800 (PST) Received: from kozik-lap (adsl-84-226-167-205.adslplus.ch. [84.226.167.205]) by smtp.googlemail.com with ESMTPSA id s20sm14458997edw.26.2020.11.19.01.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 01:42:03 -0800 (PST) Date: Thu, 19 Nov 2020 10:42:01 +0100 From: Krzysztof Kozlowski To: Alice Guo Cc: "robh+dt@kernel.org" , "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , dl-linux-imx , Peng Fan , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Subject: Re: [EXT] Re: [PATCH v3 4/4] soc: imx8m: change to use platform driver Message-ID: <20201119094201.GA3841@kozik-lap> References: <20201113110409.13546-1-alice.guo@nxp.com> <20201113110409.13546-4-alice.guo@nxp.com> <20201114164128.GD14989@kozik-lap> <20201116161338.GB25108@kozik-lap> <20201118104226.GA23766@kozik-lap> <20201118141042.GA34654@kozik-lap> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 19, 2020 at 07:32:17AM +0000, Alice Guo wrote: > > > > -----Original Message----- > > From: Krzysztof Kozlowski > > Sent: 2020年11月18日 22:11 > > To: Alice Guo > > Cc: robh+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de; > > dl-linux-imx ; Peng Fan ; > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; > > linux-arm-kernel@lists.infradead.org > > Subject: Re: [EXT] Re: [PATCH v3 4/4] soc: imx8m: change to use platform driver > > > > Caution: EXT Email > > > > On Wed, Nov 18, 2020 at 02:07:41PM +0000, Alice Guo wrote: > > > > > > > > > > -----Original Message----- > > > > From: Krzysztof Kozlowski > > > > Sent: 2020年11月18日 18:42 > > > > To: Alice Guo > > > > Cc: robh+dt@kernel.org; shawnguo@kernel.org; s.hauer@pengutronix.de; > > > > dl-linux-imx ; Peng Fan ; > > > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; > > > > linux-arm-kernel@lists.infradead.org > > > > Subject: Re: [EXT] Re: [PATCH v3 4/4] soc: imx8m: change to use > > > > platform driver > > > > > > > > Caution: EXT Email > > > > > > > > On Wed, Nov 18, 2020 at 10:28:47AM +0000, Alice Guo wrote: > > > > > > > > > > > If it is properly explained and there is no other way then yes, > > > > > > you could. Here, for old DTBs, I would prefer to use > > > > > > of_platform_device_create() and bind to "soc" node (child of root). > > > > > > This way you would always have device and exactly one entry > > > > > > point for the probe. > > > > > > > > > > > > > > > > static struct platform_driver imx8_soc_init_driver = { > > > > > .probe = imx8_soc_init_probe, > > > > > .driver = { > > > > > .name = "soc@0", > > > > > }, > > > > > }; > > > > > Can I use "soc@0" to match this driver? It will not use > > > > > of_platform_device_create(). It will use of_find_property() to > > > > > determine whether and nvmem-cells can be used. If there is no > > > > > nvmem-cells, > > > > it will use the old way, which supports old DTBS. There is no need > > > > to add new compatible. > > > > > > > > No, the soc@0 is not a proper name for the driver. > > > > > > I have no good idea, please give suggestion. Should I still add new compatible? > > > Should I still keep device_initcall? If use > > > of_platform_device_create(), which node should I use? > > > > I mentioned my idea in the email before - of_platform_device_create() to bind > > to the soc node. This will have to be in the initcall, you don't have a choice to > > avoid it, since there was no compatible before. > > > > node = of_find_node_by_path("/soc@0"); > if (!node) > return -ENODEV; > > pdev = of_platform_device_create(node, "XXX", NULL); > if (!pdev) > return -ENODEV; > > Cannot use of_platform_device_create because "of_node_test_and_set_flag(np, OF_POPULATED)" returns true. > of_platform_device_create is used to create platform device, but soc@0 is created by common code. I don't know how > to bind to the soc node. The way I did in v3 seems not bad, it can work correctly and support old DTBs. Can I keep this way? Indeed, it would require some more hacks and actually might not work at all since bus device is already created. Keep the old way and fix other pointed out issues. Best regards, Krzysztof