Date: Wed, 21 Oct 2015 15:41:16 +0000 (UTC) From: Ian Lepore <ian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r289704 - in head/sys: arm/ti/am335x dev/ofw Message-ID: <201510211541.t9LFfGRS011957@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ian Date: Wed Oct 21 15:41:16 2015 New Revision: 289704 URL: https://svnweb.freebsd.org/changeset/base/289704 Log: Fix parsing of I2C addresses properties in fdt data. I2C address is represented in 7-bits format in DT files, but system expect it in 8-bit format. Also, fix two drivers that locally hack around this bug. Submitted by: Michal Meloun <meloun@miracle.cz> Modified: head/sys/arm/ti/am335x/am335x_pmic.c head/sys/arm/ti/am335x/tda19988.c head/sys/dev/ofw/ofw_iicbus.c Modified: head/sys/arm/ti/am335x/am335x_pmic.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_pmic.c Wed Oct 21 15:32:21 2015 (r289703) +++ head/sys/arm/ti/am335x/am335x_pmic.c Wed Oct 21 15:41:16 2015 (r289704) @@ -147,7 +147,7 @@ am335x_pmic_probe(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; /* Convert to 8-bit addressing */ - sc->sc_addr = iicbus_get_addr(dev) << 1; + sc->sc_addr = iicbus_get_addr(dev); device_set_desc(dev, "TI TPS65217 Power Management IC"); Modified: head/sys/arm/ti/am335x/tda19988.c ============================================================================== --- head/sys/arm/ti/am335x/tda19988.c Wed Oct 21 15:32:21 2015 (r289703) +++ head/sys/arm/ti/am335x/tda19988.c Wed Oct 21 15:41:16 2015 (r289704) @@ -731,7 +731,7 @@ tda19988_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; - sc->sc_addr = iicbus_get_addr(dev) << 1; + sc->sc_addr = iicbus_get_addr(dev); sc->sc_cec_addr = (0x34 << 1); /* hardcoded */ sc->sc_edid = malloc(EDID_LENGTH, M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_edid_len = EDID_LENGTH; Modified: head/sys/dev/ofw/ofw_iicbus.c ============================================================================== --- head/sys/dev/ofw/ofw_iicbus.c Wed Oct 21 15:32:21 2015 (r289703) +++ head/sys/dev/ofw/ofw_iicbus.c Wed Oct 21 15:41:16 2015 (r289704) @@ -147,7 +147,11 @@ ofw_iicbus_attach(device_t dev) M_NOWAIT | M_ZERO); if (dinfo == NULL) continue; - dinfo->opd_dinfo.addr = paddr; + /* + * OFW uses 7-bit I2C address format (see ePAPR), + * but system expect 8-bit. + */ + dinfo->opd_dinfo.addr = paddr << 1; if (ofw_bus_gen_setup_devinfo(&dinfo->opd_obdinfo, child) != 0) { free(dinfo, M_DEVBUF);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510211541.t9LFfGRS011957>