Patchwork [v3,2/2] versatilepb: add i2c support

login
register
mail settings
Submitter Oskar Andero
Date April 10, 2012, 8:32 p.m.
Message ID <1334089947-24561-3-git-send-email-oskar.andero@gmail.com>
Download mbox | patch
Permalink /patch/151694/
State New
Headers show

Comments

Oskar Andero - April 10, 2012, 8:32 p.m.
Signed-off-by: Oskar Andero <oskar.andero@gmail.com>
---
 hw/versatilepb.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Paul Brook - April 11, 2012, 1:50 p.m.
In future I'd prefer if all patches had a description.  In this case I'd say 
what devices are being added.  Hint: it's more than just the I2C controller.

> Signed-off-by: Oskar Andero <oskar.andero@gmail.com>
Acked-by: Paul Brook <paul@codesourcery.com>

Patch

diff --git a/hw/versatilepb.c b/hw/versatilepb.c
index 25afb1e..d011554 100644
--- a/hw/versatilepb.c
+++ b/hw/versatilepb.c
@@ -13,6 +13,7 @@ 
 #include "net.h"
 #include "sysemu.h"
 #include "pci.h"
+#include "i2c.h"
 #include "boards.h"
 #include "blockdev.h"
 #include "exec-memory.h"
@@ -178,6 +179,7 @@  static void versatile_init(ram_addr_t ram_size,
     DeviceState *pl041;
     PCIBus *pci_bus;
     NICInfo *nd;
+    i2c_bus *i2c;
     int n;
     int done_smc = 0;
 
@@ -268,6 +270,10 @@  static void versatile_init(ram_addr_t ram_size,
     /* Add PL031 Real Time Clock. */
     sysbus_create_simple("pl031", 0x101e8000, pic[10]);
 
+    dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL);
+    i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
+    i2c_create_slave(i2c, "ds1338", 0x68);
+
     /* Add PL041 AACI Interface to the LM4549 codec */
     pl041 = qdev_create(NULL, "pl041");
     qdev_prop_set_uint32(pl041, "nc_fifo_depth", 512);