Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2013 11:51:18 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r259126 - head/sys/arm/ti
Message-ID:  <201312091151.rB9BpIOJ075339@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: loos
Date: Mon Dec  9 11:51:17 2013
New Revision: 259126
URL: http://svnweb.freebsd.org/changeset/base/259126

Log:
  Activate the device before attempt to access any of its registers.  Without
  this change we may end up with a panic (Fatal kernel mode data abort:
  'External Non-Linefetch Abort (S)') as described in
  http://e2e.ti.com/support/arm/sitara_arm/f/791/t/276862.aspx.
  
  It is now possible to bring up I2C1 and I2C2 on BBB.
  
  Approved by:	adrian (mentor)

Modified:
  head/sys/arm/ti/ti_i2c.c

Modified: head/sys/arm/ti/ti_i2c.c
==============================================================================
--- head/sys/arm/ti/ti_i2c.c	Mon Dec  9 11:33:45 2013	(r259125)
+++ head/sys/arm/ti/ti_i2c.c	Mon Dec  9 11:51:17 2013	(r259126)
@@ -1076,20 +1076,20 @@ ti_i2c_attach(device_t dev)
 		goto out;
 	}
 
-	/* XXXOMAP3: FIXME get proper revision here */
-	/* First read the version number of the I2C module */
-	sc->sc_rev = ti_i2c_read_2(sc, I2C_REG_REVNB_HI) & 0xff;
-
-	device_printf(dev, "I2C revision %d.%d\n", sc->sc_rev >> 4,
-	    sc->sc_rev & 0xf);
-
-	/* Activate the H/W */
+	/* First we _must_ activate the H/W */
 	err = ti_i2c_activate(dev);
 	if (err) {
 		device_printf(dev, "ti_i2c_activate failed\n");
 		goto out;
 	}
 
+	/* XXXOMAP3: FIXME get proper revision here */
+	/* Read the version number of the I2C module */
+	sc->sc_rev = ti_i2c_read_2(sc, I2C_REG_REVNB_HI) & 0xff;
+
+	device_printf(dev, "I2C revision %d.%d\n", sc->sc_rev >> 4,
+	    sc->sc_rev & 0xf);
+
 	/* activate the interrupt */
 	err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE,
 				NULL, ti_i2c_intr, sc, &sc->sc_irq_h);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201312091151.rB9BpIOJ075339>