From owner-svn-src-all@FreeBSD.ORG Thu Feb 27 18:13:08 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 2B99B705; Thu, 27 Feb 2014 18:13:08 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0D98614F0; Thu, 27 Feb 2014 18:13:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s1RID73G097065; Thu, 27 Feb 2014 18:13:07 GMT (envelope-from br@svn.freebsd.org) Received: (from br@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s1RID7re097064; Thu, 27 Feb 2014 18:13:07 GMT (envelope-from br@svn.freebsd.org) Message-Id: <201402271813.s1RID7re097064@svn.freebsd.org> From: Ruslan Bukin Date: Thu, 27 Feb 2014 18:13:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r262568 - head/sys/arm/freescale/vybrid 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.17 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: Thu, 27 Feb 2014 18:13:08 -0000 Author: br Date: Thu Feb 27 18:13:07 2014 New Revision: 262568 URL: http://svnweb.freebsd.org/changeset/base/262568 Log: Do not setup interrupt handler (polling is used). Modified: head/sys/arm/freescale/vybrid/vf_i2c.c Modified: head/sys/arm/freescale/vybrid/vf_i2c.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_i2c.c Thu Feb 27 17:31:59 2014 (r262567) +++ head/sys/arm/freescale/vybrid/vf_i2c.c Thu Feb 27 18:13:07 2014 (r262568) @@ -104,11 +104,9 @@ struct i2c_softc { struct resource *res[2]; bus_space_tag_t bst; bus_space_handle_t bsh; - void *ih; device_t dev; device_t iicbus; struct mtx mutex; - int ibif; }; static struct resource_spec i2c_spec[] = { @@ -117,19 +115,6 @@ static struct resource_spec i2c_spec[] = { -1, 0 } }; -static void -i2c_intr(void *arg) -{ - struct i2c_softc *sc; - - sc = arg; - - if (READ1(sc, I2C_IBSR) & IBSR_IBIF) { - WRITE1(sc, I2C_IBSR, IBSR_IBIF); - sc->ibif = 1; - } -} - static int i2c_probe(device_t dev) { @@ -148,7 +133,6 @@ static int i2c_attach(device_t dev) { struct i2c_softc *sc; - int err; sc = device_get_softc(dev); sc->dev = dev; @@ -164,14 +148,6 @@ i2c_attach(device_t dev) sc->bst = rman_get_bustag(sc->res[0]); sc->bsh = rman_get_bushandle(sc->res[0]); - /* Setup interrupt handler */ - err = bus_setup_intr(dev, sc->res[1], INTR_TYPE_BIO | INTR_MPSAFE, - NULL, i2c_intr, sc, &sc->ih); - if (err) { - device_printf(dev, "Unable to alloc interrupt resource.\n"); - return (ENXIO); - } - WRITE1(sc, I2C_IBIC, IBIC_BIIE); sc->iicbus = device_add_child(dev, "iicbus", -1); @@ -194,8 +170,10 @@ wait_for_iif(struct i2c_softc *sc) retry = 1000; while (retry --) { - if (sc->ibif == 1) + if (READ1(sc, I2C_IBSR) & IBSR_IBIF) { + WRITE1(sc, I2C_IBSR, IBSR_IBIF); return (IIC_NOERR); + } DELAY(10); } @@ -227,8 +205,10 @@ wait_for_icf(struct i2c_softc *sc) retry = 1000; while (retry --) { if (READ1(sc, I2C_IBSR) & IBSR_TCF) { - if (sc->ibif == 1) + if (READ1(sc, I2C_IBSR) & IBSR_IBIF) { + WRITE1(sc, I2C_IBSR, IBSR_IBIF); return (IIC_NOERR); + } } DELAY(10); } @@ -265,8 +245,6 @@ i2c_repeated_start(device_t dev, u_char DELAY(10); - sc->ibif = 0; - /* Write target address - LSB is R/W bit */ WRITE1(sc, I2C_IBDR, slave); @@ -310,8 +288,6 @@ i2c_start(device_t dev, u_char slave, in reg |= (IBCR_TXRX); WRITE1(sc, I2C_IBCR, reg); - sc->ibif = 0; - /* Write target address - LSB is R/W bit */ WRITE1(sc, I2C_IBDR, slave); @@ -407,7 +383,6 @@ i2c_read(device_t dev, char *buf, int le WRITE1(sc, I2C_IBCR, IBCR_IBIE | IBCR_MSSL); /* dummy read */ - sc->ibif = 0; READ1(sc, I2C_IBDR); DELAY(1000); } @@ -430,7 +405,6 @@ i2c_read(device_t dev, char *buf, int le WRITE1(sc, I2C_IBCR, IBCR_IBIE | IBCR_NOACK); } - sc->ibif = 0; *buf++ = READ1(sc, I2C_IBDR); (*read)++; } @@ -453,7 +427,6 @@ i2c_write(device_t dev, const char *buf, mtx_lock(&sc->mutex); while (*sent < len) { - sc->ibif = 0; WRITE1(sc, I2C_IBDR, *buf++);