From owner-svn-src-all@freebsd.org Tue Apr 5 02:27:03 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21810B03BEA; Tue, 5 Apr 2016 02:27:03 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E30F1126E; Tue, 5 Apr 2016 02:27:02 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u352R26N011233; Tue, 5 Apr 2016 02:27:02 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u352R2PO011232; Tue, 5 Apr 2016 02:27:02 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201604050227.u352R2PO011232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 5 Apr 2016 02:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r297572 - head/sys/powerpc/mpc85xx X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 02:27:03 -0000 Author: jhibbits Date: Tue Apr 5 02:27:01 2016 New Revision: 297572 URL: https://svnweb.freebsd.org/changeset/base/297572 Log: Make i2c device child auto-probe work for MPC85xx and QorIQ SoCs. OFW i2c probing requires a new method ofw_bus_get_node(), and the bus device is assumed iichb. With these changes, i2c devices attached in fdt are probed and attached automagically. Modified: head/sys/powerpc/mpc85xx/i2c.c Modified: head/sys/powerpc/mpc85xx/i2c.c ============================================================================== --- head/sys/powerpc/mpc85xx/i2c.c Tue Apr 5 01:12:56 2016 (r297571) +++ head/sys/powerpc/mpc85xx/i2c.c Tue Apr 5 02:27:01 2016 (r297572) @@ -97,6 +97,7 @@ static int i2c_stop(device_t dev); static int i2c_reset(device_t dev, u_char speed, u_char addr, u_char *oldaddr); static int i2c_read(device_t dev, char *buf, int len, int *read, int last, int delay); static int i2c_write(device_t dev, const char *buf, int len, int *sent, int timeout); +static phandle_t i2c_get_node(device_t bus, device_t dev); static device_method_t i2c_methods[] = { DEVMETHOD(device_probe, i2c_probe), @@ -110,12 +111,13 @@ static device_method_t i2c_methods[] = { DEVMETHOD(iicbus_read, i2c_read), DEVMETHOD(iicbus_write, i2c_write), DEVMETHOD(iicbus_transfer, iicbus_transfer_gen), + DEVMETHOD(ofw_bus_get_node, i2c_get_node), { 0, 0 } }; static driver_t i2c_driver = { - "i2c", + "iichb", i2c_methods, sizeof(struct i2c_softc), }; @@ -425,3 +427,11 @@ i2c_write(device_t dev, const char *buf, return (IIC_NOERR); } + +static phandle_t +i2c_get_node(device_t bus, device_t dev) +{ + + /* Share controller node with iibus device. */ + return (ofw_bus_get_node(bus)); +}