From mboxrd@z Thu Jan 1 00:00:00 1970 From: arnd@arndb.de (Arnd Bergmann) Date: Thu, 1 Mar 2012 19:35:58 +0000 Subject: [PATCH 3/4] ARM: kirkwood: convert rtc-mv to fdt. In-Reply-To: <2c985a303f3b9b0cfcead25634b7e1db68d34ee3.1330625878.git.jason@lakedaemon.net> References: <2c985a303f3b9b0cfcead25634b7e1db68d34ee3.1330625878.git.jason@lakedaemon.net> Message-ID: <201203011935.58503.arnd@arndb.de> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Thursday 01 March 2012, Jason Cooper wrote: > The comment at mach-kirkwood/common.c:469, says this device is in every > kirkwood board. So, it is placed in kirkwood.dtsi. > > @@ -218,10 +220,15 @@ static int __devinit mv_rtc_probe(struct platform_device *pdev) > { > struct resource *res; > struct rtc_plat_data *pdata; > + struct device_node *np = pdev->dev.of_node; > resource_size_t size; > u32 rtc_time; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + > + if (np) > + of_address_to_resource(np, 0, res); > + > if (!res) > return -ENODEV; > > @@ -257,6 +264,8 @@ static int __devinit mv_rtc_probe(struct platform_device *pdev) > > pdata->irq = platform_get_irq(pdev, 0); > > + of_property_read_u32(np, "interrupts", &pdata->irq); > + > platform_set_drvdata(pdev, pdata); > > if (pdata->irq >= 0) { The two additions here don't seem necessary, the second one not even correct: Any interrupts and register properties automatically get turned into platform resources when the device is instatiated. The interrupt number should not be taken verbatim from the device tree because it is always local to the "interrupt-parent" node, so you would have to use irq_of_parse_and map rather than reading the property directly, but as I said you don't even need to do that for platform devices. Arnd From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnd Bergmann Subject: Re: [PATCH 3/4] ARM: kirkwood: convert rtc-mv to fdt. Date: Thu, 1 Mar 2012 19:35:58 +0000 Message-ID: <201203011935.58503.arnd@arndb.de> References: <2c985a303f3b9b0cfcead25634b7e1db68d34ee3.1330625878.git.jason@lakedaemon.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <2c985a303f3b9b0cfcead25634b7e1db68d34ee3.1330625878.git.jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Sender: devicetree-discuss-bounces+gldd-devicetree-discuss=m.gmane.org-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org To: Jason Cooper Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: devicetree@vger.kernel.org On Thursday 01 March 2012, Jason Cooper wrote: > The comment at mach-kirkwood/common.c:469, says this device is in every > kirkwood board. So, it is placed in kirkwood.dtsi. > > @@ -218,10 +220,15 @@ static int __devinit mv_rtc_probe(struct platform_device *pdev) > { > struct resource *res; > struct rtc_plat_data *pdata; > + struct device_node *np = pdev->dev.of_node; > resource_size_t size; > u32 rtc_time; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > + > + if (np) > + of_address_to_resource(np, 0, res); > + > if (!res) > return -ENODEV; > > @@ -257,6 +264,8 @@ static int __devinit mv_rtc_probe(struct platform_device *pdev) > > pdata->irq = platform_get_irq(pdev, 0); > > + of_property_read_u32(np, "interrupts", &pdata->irq); > + > platform_set_drvdata(pdev, pdata); > > if (pdata->irq >= 0) { The two additions here don't seem necessary, the second one not even correct: Any interrupts and register properties automatically get turned into platform resources when the device is instatiated. The interrupt number should not be taken verbatim from the device tree because it is always local to the "interrupt-parent" node, so you would have to use irq_of_parse_and map rather than reading the property directly, but as I said you don't even need to do that for platform devices. Arnd