From patchwork Tue Apr 2 16:38:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Hunter, Jon" X-Patchwork-Id: 2379311 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 5675A3FD8C for ; Tue, 2 Apr 2013 16:41:19 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UN4ES-0001Ad-Lg; Tue, 02 Apr 2013 16:38:48 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UN4EP-0001A5-Km for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2013 16:38:46 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r32GcUjt010562; Tue, 2 Apr 2013 11:38:30 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r32GcULR007789; Tue, 2 Apr 2013 11:38:30 -0500 Received: from [192.157.144.139] (192.157.144.139) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Tue, 2 Apr 2013 11:38:29 -0500 Message-ID: <515B0984.7050803@ti.com> Date: Tue, 2 Apr 2013 11:38:28 -0500 From: Jon Hunter User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: Christoph Fritz Subject: Re: [RFC][BUG] arm/dts: OMAP3: set #interrupt-cells to two References: <1364631689.3767.7.camel@mars> <1364834508.3939.74.camel@mars> <1364918124.5935.145.camel@mars> In-Reply-To: <1364918124.5935.145.camel@mars> X-Originating-IP: [192.157.144.139] X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130402_123845_769130_20C9AB83 X-CRM114-Status: GOOD ( 30.49 ) X-Spam-Score: -9.2 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -2.3 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Javier Martinez Canillas , Paul Walmsley , Russell King , =?UTF-8?B?QmVubw==?= =?UTF-8?B?w650IENvdXNzb24=?= , Tony Lindgren , "devicetree-discuss@lists.ozlabs.org" , Rajendra Nayak , "Hans J. Koch" , Santosh Shilimkar , Daniel Mack , "linux-omap@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On 04/02/2013 10:55 AM, Christoph Fritz wrote: > On Mon, 2013-04-01 at 22:05 +0200, Javier Martinez Canillas wrote: > >>> As a quick-fix (hack) I wrote directly to the registers in gpio_probe() >>> to enable GPIO banks. I now geht this: >>> >>>>> [ 0.214630] omap_gpio_probe, 1133, CM_CLKSEL_PER 0x48005040: 0x000000ff >>>>> [ 0.214660] omap_gpio_probe, 1136, CM_ICLKEN_PER 0x48005010: 0x0007ffff >>>>> [ 0.214660] omap_gpio_probe, 1139, CM_FCLKEN_PER 0x48005000: 0x0007ffff > > to be more specific on this point, this is the patch to enable the > gpio-clocks: > > -- > Subject: [PATCH] HACK: enable gpio-clocks in gpio-omap probe() > > Without this patch setting trigger value from #interrupt-cell two > (smsc911x) fails. > --- > drivers/gpio/gpio-omap.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c > index 159f5c5..720b2e6 100644 > --- a/drivers/gpio/gpio-omap.c > +++ b/drivers/gpio/gpio-omap.c > @@ -1098,6 +1098,7 @@ static int omap_gpio_probe(struct platform_device > *pdev) > struct resource *res; > struct gpio_bank *bank; > int ret = 0; > + void __iomem *tmp; > > match = of_match_device(of_match_ptr(omap_gpio_match), dev); > > @@ -1117,6 +1118,17 @@ static int omap_gpio_probe(struct platform_device > *pdev) > return -ENODEV; > } > > + // TRM: Table 3-242. PER_CM Register Summary > + tmp = ioremap(0x48005040, 4); //CM_CLKSEL_PER, GPT2 = sys clk > + writel(0xFF, tmp); > + iounmap(tmp); > + tmp = ioremap(0x48005010, 4); //CM_ICLKEN_PER, ICKen GPT2 > + writel(0x7FFFF, tmp); > + iounmap(tmp); > + tmp = ioremap(0x48005000, 4); //CM_FCLKEN_PER, GPIOX functional clock > is enabled > + writel(0x7FFFF, tmp); > + iounmap(tmp); > + > bank->irq = res->start; > bank->dev = dev; > bank->dbck_flag = pdata->dbck_flag; > > Is there a better way to do this? A better way to hack this and leave the gpio bank on always would be ... >>> And it works for me. _But_ when I do enable regulator twl4030 >>> (CONFIG_REGULATOR_TWL4030=y) in my config these registers get reset: >>> >>> [ 2.935455] smsc911x_open, 1537, CM_CLKSEL_PER 0x48005040: 0x000000ff >>> [ 2.942291] smsc911x_open, 1540, CM_ICLKEN_PER 0x48005010: 0x00040fff >>> [ 2.949066] smsc911x_open, 1543, CM_FCLKEN_PER 0x48005000: 0x00000000 >>> >>> And the IRQ source for the network chip (smsc911x) is disabled :-( > > CONFIG_REGULATOR_TWL4030=y disables the gpio-clocks. Why is that? Well your hack is completely by-passing pm-runtime and so pm-runtime does not know that someone has enabled the bank. Therefore, the next time pm_runtime_get() is called followed by a pm_runtime_put() for the gpio bank it will disable the bank. By removing the pm_runtime_put() at the end of probe should always keep the bank enabled. >>> Do you have any idea how to ("quick") fix this? >>> >> >> A quick hack is to call gpio_request() explicitly before calling to >> irq_set_type() is made. >> I've this patch just to make it work until we find a clean solution: >> >> diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c >> index 90c15ee..d594e1d 100644 >> --- a/arch/arm/mach-omap2/gpmc.c >> +++ b/arch/arm/mach-omap2/gpmc.c >> @@ -14,6 +14,7 @@ >> */ >> #undef DEBUG >> >> +#include >> #include >> #include >> #include >> @@ -1528,6 +1529,11 @@ static int gpmc_probe_dt(struct platform_device *pdev) >> return ret; >> } >> >> + ret = gpio_request_one(176, GPIOF_IN, "smsc911x irq"); >> + if (ret) { >> + pr_err("Failed to request IRQ GPIO%d\n", 176); >> + return ret; >> + } >> + >> for_each_node_by_name(child, "nand") { >> ret = gpmc_probe_nand_child(pdev, child); >> if (ret < 0) { >> >> This solves the issue of the non-initialized GPIO bank before that >> makes the kernel to hang. > > Here it does not. A printk shows that I'm not using gpmc at all. > So I added a gpmc node: > > + gpmc: gpmc@0x6E000000 { > + compatible = "ti,omap3430-gpmc"; > + ti,hwmods = "ti,gpmc"; This should just be ... + ti,hwmods = "gpmc"; > + reg = <0x6E000000 0x2000>; > + gpmc,num-cs = <8>; > + gpmc,num-waitpins = <2>; > + #address-cells = <2>; > + #size-cells = <1>; > + ranges = <0 0 0x0 0x3FFFFFFF>; > + > + }; > > But still, gpmc_probe_dt() isn't called. I maybe have to define some > child nodes but currently I do configure the gpmc in u-boot and try to > avoid kernel-gpmc-config. Not sure what patches you have, but the plan for DT is that the kernel configures the gpmc and is not dependent on the bootloader. Cheers Jon diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c index f1fbedb2..0fc75a2 100644 --- a/drivers/gpio/gpio-omap.c +++ b/drivers/gpio/gpio-omap.c @@ -1181,8 +1181,6 @@ static int omap_gpio_probe(struct platform_device *pdev) if (bank->loses_context) bank->get_context_loss_count = pdata->get_context_loss_count; - pm_runtime_put(bank->dev); - list_add_tail(&bank->node, &omap_gpio_list); return ret;