From patchwork Thu Feb 17 22:17:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 83490 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C32CEB7161 for ; Fri, 18 Feb 2011 09:17:42 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753137Ab1BQWRl (ORCPT ); Thu, 17 Feb 2011 17:17:41 -0500 Received: from pfepb.post.tele.dk ([195.41.46.236]:43463 "EHLO pfepb.post.tele.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753124Ab1BQWRl (ORCPT ); Thu, 17 Feb 2011 17:17:41 -0500 Received: from merkur.ravnborg.org (x1-6-30-46-9a-75-8a-52.k1039.webspeed.dk [93.167.48.205]) by pfepb.post.tele.dk (Postfix) with ESMTP id 4D7CBF84022; Thu, 17 Feb 2011 23:17:40 +0100 (CET) Date: Thu, 17 Feb 2011 23:17:40 +0100 From: Sam Ravnborg To: David Miller Cc: tglx@linutronix.de, sparclinux@vger.kernel.org Subject: Re: How do we allocate virtual floppy irq on sparc64 Message-ID: <20110217221740.GA25809@merkur.ravnborg.org> References: <20110217205747.GA25027@merkur.ravnborg.org> <20110217.130503.104054019.davem@davemloft.net> <20110217214731.GA25097@merkur.ravnborg.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110217214731.GA25097@merkur.ravnborg.org> User-Agent: Mutt/1.5.18 (2008-05-17) Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org > > So I will look up "SUNW,fdtwo" + "fd" to find the platform_device > for floppy. > And in that platform_device I can find the already allocated irq. Looks like this in patch format. Not tested yet as I still need to adapt irq_32.c... Sam --- To unsubscribe from this list: send the line "unsubscribe sparclinux" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/arch/sparc/include/asm/floppy_32.h +++ b/arch/sparc/include/asm/floppy_32.h @@ -303,6 +303,8 @@ static struct linux_prom_registers fd_regs[2]; static int sun_floppy_init(void) { + struct platform_device *op; + struct device_node *dp; char state[128]; phandle tnode, fd_node; int num_regs; @@ -310,7 +312,6 @@ static int sun_floppy_init(void) use_virtual_dma = 1; - FLOPPY_IRQ = 11; /* Forget it if we aren't on a machine that could possibly * ever have a floppy drive. */ @@ -349,6 +350,26 @@ static int sun_floppy_init(void) sun_fdc = (struct sun_flpy_controller *) of_ioremap(&r, 0, fd_regs[0].reg_size, "floppy"); + /* + * Look up irq in platform_device. + * We try "SUNW,fdtwo" and "fd" + */ + for_each_node_by_name(dp, "SUNW,fdtwo") { + op = of_find_device_by_node(dp); + if (op) + break; + } + if (!op) { + for_each_node_by_name(dp, "fd") { + op = of_find_device_by_node(dp); + if (op) + break; + } + } + if (!op) + goto no_sun_fdc; + + FLOPPY_IRQ = op->archdata.irqs[0]; + /* Last minute sanity check... */ if(sun_fdc->status_82072 == 0xff) { sun_fdc = NULL;