From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [PATCH v2] serial: omap: Add support for optional wake-up Date: Thu, 24 Oct 2013 06:19:36 -0700 Message-ID: <20131024131935.GV15154@atomide.com> References: <20131022134947.GK15154@atomide.com> <20131024103300.6023FC4039D@trevor.secretlab.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mho-03-ewr.mailhop.org ([204.13.248.66]:64986 "EHLO mho-01-ewr.mailhop.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754544Ab3JXNTk (ORCPT ); Thu, 24 Oct 2013 09:19:40 -0400 Content-Disposition: inline In-Reply-To: <20131024103300.6023FC4039D@trevor.secretlab.ca> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: Grant Likely Cc: Greg Kroah-Hartman , Kevin Hilman , Linus Walleij , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Roger Quadros * Grant Likely [131024 03:33]: > On Tue, 22 Oct 2013 06:49:48 -0700, Tony Lindgren wrote: > > @@ -1572,11 +1603,23 @@ static int serial_omap_probe(struct platform_device *pdev) > > struct uart_omap_port *up; > > struct resource *mem, *irq; > > struct omap_uart_port_info *omap_up_info = dev_get_platdata(&pdev->dev); > > - int ret; > > + int ret, uartirq = 0, wakeirq = 0; > > > > + /* The optional wakeirq may be specified in the board dts file */ > > if (pdev->dev.of_node) { > > + uartirq = irq_of_parse_and_map(pdev->dev.of_node, 0); > > + if (!uartirq) > > + return -EPROBE_DEFER; > > + wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1); > > omap_up_info = of_get_uart_port_info(&pdev->dev); > > pdev->dev.platform_data = omap_up_info; > > + } else { > > + irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > > + if (!irq) { > > + dev_err(&pdev->dev, "no irq resource?\n"); > > + return -ENODEV; > > + } > > + uartirq = irq->start; > > Ugh. This is such a hack. platform_get_irq() should just work for DT and > non-DT. There is no way around it right now, but we need to get the code > in place to resolve IRQs late so that drivers don't need these special > cases. Yes it's pretty messed up. I wrote something about it in the "Getting rid of subsys_initcall usage?" thread at: http://www.mail-archive.com/linux-i2c@vger.kernel.org/msg13678.html And having zero populated in the struct resource as valid IRQ is not nice at all. Regards, Tony From mboxrd@z Thu Jan 1 00:00:00 1970 From: tony@atomide.com (Tony Lindgren) Date: Thu, 24 Oct 2013 06:19:36 -0700 Subject: [PATCH v2] serial: omap: Add support for optional wake-up In-Reply-To: <20131024103300.6023FC4039D@trevor.secretlab.ca> References: <20131022134947.GK15154@atomide.com> <20131024103300.6023FC4039D@trevor.secretlab.ca> Message-ID: <20131024131935.GV15154@atomide.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org * Grant Likely [131024 03:33]: > On Tue, 22 Oct 2013 06:49:48 -0700, Tony Lindgren wrote: > > @@ -1572,11 +1603,23 @@ static int serial_omap_probe(struct platform_device *pdev) > > struct uart_omap_port *up; > > struct resource *mem, *irq; > > struct omap_uart_port_info *omap_up_info = dev_get_platdata(&pdev->dev); > > - int ret; > > + int ret, uartirq = 0, wakeirq = 0; > > > > + /* The optional wakeirq may be specified in the board dts file */ > > if (pdev->dev.of_node) { > > + uartirq = irq_of_parse_and_map(pdev->dev.of_node, 0); > > + if (!uartirq) > > + return -EPROBE_DEFER; > > + wakeirq = irq_of_parse_and_map(pdev->dev.of_node, 1); > > omap_up_info = of_get_uart_port_info(&pdev->dev); > > pdev->dev.platform_data = omap_up_info; > > + } else { > > + irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); > > + if (!irq) { > > + dev_err(&pdev->dev, "no irq resource?\n"); > > + return -ENODEV; > > + } > > + uartirq = irq->start; > > Ugh. This is such a hack. platform_get_irq() should just work for DT and > non-DT. There is no way around it right now, but we need to get the code > in place to resolve IRQs late so that drivers don't need these special > cases. Yes it's pretty messed up. I wrote something about it in the "Getting rid of subsys_initcall usage?" thread at: http://www.mail-archive.com/linux-i2c at vger.kernel.org/msg13678.html And having zero populated in the struct resource as valid IRQ is not nice at all. Regards, Tony