From patchwork Thu Sep 25 12:21:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Heiko_St=C3=BCbner?= X-Patchwork-Id: 4974361 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7392F9F1D4 for ; Thu, 25 Sep 2014 12:22:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C7F7020295 for ; Thu, 25 Sep 2014 12:22:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1186720274 for ; Thu, 25 Sep 2014 12:22:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750821AbaIYMWF (ORCPT ); Thu, 25 Sep 2014 08:22:05 -0400 Received: from gloria.sntech.de ([95.129.55.99]:50860 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750774AbaIYMWE convert rfc822-to-8bit (ORCPT ); Thu, 25 Sep 2014 08:22:04 -0400 Received: from ip545477c2.speed.planet.nl ([84.84.119.194] helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XX83b-0000Zo-FA; Thu, 25 Sep 2014 14:21:59 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: Pankaj Dubey Cc: Joachim Eastwood , "linux-arm-kernel@lists.infradead.org" , linux-samsung-soc@vger.kernel.org, "linux-kernel@vger.kernel.org" , kgene.kim@samsung.com, Russell King - ARM Linux , Arnd Bergmann , naushad@samsung.com, b29396@freescale.com, tomasz.figa@gmail.com, joshi@samsung.com, thomas.ab@samsung.com, Li.Xiubo@freescale.com, vikas.sajjan@samsung.com, chow.kim@samsung.com, lee.jones@linaro.org, dianders@chromium.org Subject: Re: [PATCH v5] mfd: syscon: Decouple syscon interface from platform devices Date: Thu, 25 Sep 2014 14:21:52 +0200 Message-ID: <4389453.TP96FZcCbx@phil> User-Agent: KMail/4.11.5 (Linux/3.13-1-amd64; KDE/4.11.3; x86_64; ; ) In-Reply-To: <13449286.k3JCbR2ABy@phil> References: <1411360807-7750-1-git-send-email-pankaj.dubey@samsung.com> <13449286.k3JCbR2ABy@phil> MIME-Version: 1.0 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Am Mittwoch, 24. September 2014, 20:35:10 schrieb Heiko Stübner: > Hi Pankaj, Joachim, > > Am Dienstag, 23. September 2014, 20:12:50 schrieb Joachim Eastwood: > > On 22 September 2014 06:40, Pankaj Dubey wrote: > > > Currently a syscon entity can be only registered directly through a > > > platform device that binds to a dedicated syscon driver. However in > > > certain use cases it is desirable to make a device used with another > > > driver a syscon interface provider. > > > > > > For example, certain SoCs (e.g. Exynos) contain system controller > > > blocks which perform various functions such as power domain control, > > > CPU power management, low power mode control, but in addition contain > > > certain IP integration glue, such as various signal masks, > > > coprocessor power control, etc. In such case, there is a need to have > > > a dedicated driver for such system controller but also share registers > > > with other drivers. The latter is where the syscon interface is helpful. > > > > > > In case of DT based platforms, this patch decouples syscon object from > > > syscon platform driver, and allows to create syscon objects first time > > > when it is required by calling of syscon_regmap_lookup_by APIs and keep > > > a list of such syscon objects along with syscon provider device_nodes > > > and regmap handles. > > > > > > For non-DT based platforms, this patch keeps syscon platform driver > > > structure where is can be probed and such non-DT based drivers can use > > > syscon_regmap_lookup_by_pdev API and get access to regmap handles. > > > Once all users of "syscon_regmap_lookup_by_pdev" migrated to DT based, > > > we can completly remove platform driver of syscon, and keep only helper > > > functions to get regmap handles. > > > > > > Suggested-by: Arnd Bergmann > > > Suggested-by: Tomasz Figa > > > Tested-by: Vivek Gautam > > > Tested-by: Javier Martinez Canillas > > > Signed-off-by: Pankaj Dubey > > > > I wrote a clk driver using syscon and your patch. clk driver uses > > CLK_OF_DECLARE, btw. > > > > It works but I get a '(null): Failed to create debugfs directory' > > message in the boot log. > > > > Tested-by: Joachim Eastwood > > on Rockchip platforms this syscon support also helps quite a bit, as the > pll lock-status is sitting in an external syscon register, so setting target > pll-rates through assigned-clocks is not easily doable without it. > Therefore I'm very much looking forward to this. > > > Similar to Joachim I get an error about debugfs from regmap, which seems > to be caused by > name = dev_name(map->dev); > returning NULL in regmap_debugfs_init in regmap-debugfs.c for such an > "early" syscon. It looks like of_device_make_bus_id would be able to do the necessary steps to populate the dev_name seemingly correctly. With the diff below I now get a syscon that can init clocks and also a sane regmap debugfs init: /debug/regmap # ls -la total 0 drwxr-xr-x 5 0 0 0 Jan 1 1970 . drwx------ 19 0 0 0 Jan 1 1970 .. drwxr-xr-x 2 0 0 0 Jan 1 1970 0-001b drwxr-xr-x 2 0 0 0 Jan 1 1970 ff730000.power-management drwxr-xr-x 2 0 0 0 Jan 1 1970 ff770000.syscon But of course I don't know enough about device-internals to determine if this is an insane solution or not :-) Heiko --- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c index 8ebc1c6..3734434 100644 --- a/drivers/mfd/syscon.c +++ b/drivers/mfd/syscon.c @@ -73,6 +73,7 @@ static struct syscon *of_syscon_register(struct device_node *np) goto err_pdev; } pdev->dev.of_node = of_node_get(np); + of_device_make_bus_id(&pdev->dev); } regmap = devm_regmap_init_mmio(&pdev->dev, base, &syscon_regmap_config);