[coreboot-gerrit] Patch set updated for coreboot: sconfig: Add 10bit addressing mode to i2c device type

Duncan Laurie (dlaurie@google.com) gerrit at coreboot.org
Thu May 12 23:29:03 CEST 2016


Duncan Laurie (dlaurie at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14788

-gerrit

commit e36cee3d9c0fdde36cbf07258126ef62b7448719
Author: Duncan Laurie <dlaurie at chromium.org>
Date:   Sat May 7 19:49:37 2016 -0700

    sconfig: Add 10bit addressing mode to i2c device type
    
    Use the second token for an i2c device entry in devicetree.cb to
    indicate if it should use 10-bit addressing or 7-bit.  The default if
    not provided is to use 7-bit addressing, but it can be changed to
    10-bit addressing with the ".1" suffix.  For example:
    
    chip drivers/i2c/generic
      device i2c 3a.1 on end
    end
    
    Change-Id: I1d81a7e154fbc040def4d99ad07966fac242a472
    Signed-off-by: Duncan Laurie <dlaurie at chromium.org>
---
 src/device/device_util.c  | 5 +++--
 src/include/device/path.h | 1 +
 util/sconfig/main.c       | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/device/device_util.c b/src/device/device_util.c
index 837dfb5..b538212 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -202,7 +202,7 @@ u32 dev_path_encode(device_t dev)
 		ret |= dev->path.pnp.port << 8 | dev->path.pnp.device;
 		break;
 	case DEVICE_PATH_I2C:
-		ret |= dev->bus->secondary << 8 | dev->path.pnp.device;
+		ret |= dev->path.i2c.mode_10bit << 8 | dev->path.i2c.device;
 		break;
 	case DEVICE_PATH_APIC:
 		ret |= dev->path.apic.apic_id;
@@ -334,7 +334,8 @@ int path_eq(struct device_path *path1, struct device_path *path2)
 			(path1->pnp.device == path2->pnp.device);
 		break;
 	case DEVICE_PATH_I2C:
-		equal = (path1->i2c.device == path2->i2c.device);
+		equal = (path1->i2c.device == path2->i2c.device) &&
+			(path1->i2c.mode_10bit == path2->i2c.mode_10bit);
 		break;
 	case DEVICE_PATH_APIC:
 		equal = (path1->apic.apic_id == path2->apic.apic_id);
diff --git a/src/include/device/path.h b/src/include/device/path.h
index ba7661d..8421a38 100644
--- a/src/include/device/path.h
+++ b/src/include/device/path.h
@@ -53,6 +53,7 @@ struct pnp_path
 struct i2c_path
 {
 	unsigned device;
+	unsigned mode_10bit;
 };
 
 struct apic_path
diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 53fb030..fea90f4 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -257,7 +257,7 @@ struct device *new_device(struct device *parent, struct device *busdev, const in
 		break;
 
 	case I2C:
-		new_d->path = ".type=DEVICE_PATH_I2C,{.i2c={ .device = 0x%x }}";
+		new_d->path = ".type=DEVICE_PATH_I2C,{.i2c={ .device = 0x%x, .mode_10bit = %d }}";
 		break;
 
 	case APIC:



More information about the coreboot-gerrit mailing list