From owner-svn-src-head@FreeBSD.ORG Mon Mar 19 18:03:21 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0294B106564A; Mon, 19 Mar 2012 18:03:21 +0000 (UTC) (envelope-from andreast@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C84AB8FC16; Mon, 19 Mar 2012 18:03:20 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JI3KCa079765; Mon, 19 Mar 2012 18:03:20 GMT (envelope-from andreast@svn.freebsd.org) Received: (from andreast@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JI3Kfm079763; Mon, 19 Mar 2012 18:03:20 GMT (envelope-from andreast@svn.freebsd.org) Message-Id: <201203191803.q2JI3Kfm079763@svn.freebsd.org> From: Andreas Tobler Date: Mon, 19 Mar 2012 18:03:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233188 - head/sys/powerpc/powermac X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 18:03:21 -0000 Author: andreast Date: Mon Mar 19 18:03:20 2012 New Revision: 233188 URL: http://svn.freebsd.org/changeset/base/233188 Log: Provide a fix for certain PowerMacs where the U3 i2c lacks the interrupt info. Tested by: Robert Hish MFC after: 1 week Modified: head/sys/powerpc/powermac/uninorth.c Modified: head/sys/powerpc/powermac/uninorth.c ============================================================================== --- head/sys/powerpc/powermac/uninorth.c Mon Mar 19 17:14:12 2012 (r233187) +++ head/sys/powerpc/powermac/uninorth.c Mon Mar 19 18:03:20 2012 (r233188) @@ -262,9 +262,11 @@ unin_chip_attach(device_t dev) struct unin_chip_devinfo *dinfo; phandle_t root; phandle_t child; + phandle_t iparent; device_t cdev; char compat[32]; - u_int reg[3]; + char name[32]; + u_int irq, reg[3]; int error, i = 0; sc = device_get_softc(dev); @@ -315,6 +317,33 @@ unin_chip_attach(device_t dev) dinfo->udi_ninterrupts = 0; unin_chip_add_intr(child, dinfo); + /* + * Some Apple machines do have a bug in OF, they miss + * the interrupt entries on the U3 I2C node. That means they + * do not have an entry with number of interrupts nor the + * entry of the interrupt parent handle. + * We define an interrupt and hardwire it to the /u3/mpic + * handle. + */ + + if (OF_getprop(child, "name", name, sizeof(name)) <= 0) + device_printf(dev, "device has no name!\n"); + if (dinfo->udi_ninterrupts == 0 && + (strcmp(name, "i2c-bus") == 0 || + strcmp(name, "i2c") == 0)) { + if (OF_getprop(child, "interrupt-parent", &iparent, + sizeof(iparent)) <= 0) { + iparent = OF_finddevice("/u3/mpic"); + device_printf(dev, "Set /u3/mpic as iparent!\n"); + } + /* Add an interrupt number 0 to the parent. */ + irq = MAP_IRQ(iparent, 0); + resource_list_add(&dinfo->udi_resources, SYS_RES_IRQ, + dinfo->udi_ninterrupts, irq, irq, 1); + dinfo->udi_interrupts[dinfo->udi_ninterrupts] = irq; + dinfo->udi_ninterrupts++; + } + unin_chip_add_reg(child, dinfo); cdev = device_add_child(dev, NULL, -1);