Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751866AbbKIPPR (ORCPT ); Mon, 9 Nov 2015 10:15:17 -0500 Received: from smtp2-g21.free.fr ([212.27.42.2]:47111 "EHLO smtp2-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbbKIPPO (ORCPT ); Mon, 9 Nov 2015 10:15:14 -0500 Subject: Re: Grafting old platform drivers onto a new DT kernel To: Javier Martinez Canillas , Andrew Lunn Cc: LKML , Linux ARM , Marc Zyngier , Jason Cooper , Thomas Gleixner , Ulf Hansson References: <563B3749.50701@free.fr> <20151105151559.GA16666@lunn.ch> From: Mason Message-ID: <5640B877.4020108@free.fr> Date: Mon, 9 Nov 2015 16:15:03 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0 SeaMonkey/2.38 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2615 Lines: 75 On 05/11/2015 16:42, Javier Martinez Canillas wrote: > Hello, > > On Thu, Nov 5, 2015 at 12:15 PM, Andrew Lunn wrote: >>> Since I don't have time to rewrite the drivers at the moment, I'm wondering >>> if it's possible to "graft" old drivers (they're using the platform API, no >>> trace of DT support) onto my small base? >> >> Platform drivers are still usable with DT systems. We used that fact >> when converting platform based machines over to DT, one driver at a >> time. Look in the git history for kirkwood devices. e.g. somewhere >> around v3.7, arch/arm/mach-kirkwood. board-dt.c, and the various >> board-*.c files, and the DT files in the usual place. >> > > OMAP did the same and still some boards use platform data and manually > register platform devices from board code. Take a look to > arch/arm/mach-omap2/pdata-quirks.c to see how that is being done. Hello, I tried compiling an ancient SDHCI driver on a v4.2 system. It crashes all over init because several host->ops functions are required, but the old driver does not define them: .reset .set_clock .set_bus_width .set_uhs_signaling So I downgraded to an older v3.14 kernel, and that problem vanished. But I am having a problem with the IRQ setup. # cat /proc/interrupts CPU0 CPU1 18: 93 0 irq0 1 Level serial 55: 2832 0 irq0 38 Level 26000.ethernet 60: 0 0 irq0 43 Edge mmc0 211: 319 2603 GIC 29 Edge twd Ethernet is using IRQ 38, as specified in the DT. mmc0 is supposed to use IRQ 60. I see that the mmc0 has the index 60, so I must have messed up between the real irq (hwirq?) and the index Linux uses internally (virq?) static struct resource sdhci_resources[] = { { .start = TANGOX_SDIO0_BASE_ADDR, .end = TANGOX_SDIO0_BASE_ADDR + 0x1ff, .flags = IORESOURCE_MEM, }, { .start = 60, /* SDHCI0 IRQ */ .flags = IORESOURCE_IRQ, }, }; Both ethernet and sdhci driver call platform_get_irq(pdev, 0); but the eth driver is DT, so calls of_irq_get() while sdhci is legacy, so calls platform_get_resource() -- IIUC. How do I specify a "hwirq" instead of a "Linux index"? and where? Is this relevant? https://www.kernel.org/doc/Documentation/IRQ-domain.txt Should I use irq_linear_revmap() / irq_find_mapping() ? Regards. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/