Skip to contentSkip to conversation

ARM Versatile I2C support

Qemu-devel New Benoit Canet 2 participants 4 messages Jun 3, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

These two patches implements the ARM Versatile I2C support. The first one extract the I2C bitbanging code from the musicpal board. The second implement the versatile I2C hardware.

Benoit

#1 lore raw

PATCH 1/2 Extract I2C bitbang GPIO code from musicpal.c

From: Benoit canet <[email protected]>

---
 Makefile.target  |    2 +-
 hw/bitbang_i2c.c |   99 ++++++++++++++++++++++++++++++++++++++
 hw/bitbang_i2c.h |   50 +++++++++++++++++++
 hw/musicpal.c    |  138 +++--------------------------------------------------
 4 files changed, 158 insertions(+), 131 deletions(-)
 create mode 100644 hw/bitbang_i2c.c
 create mode 100644 hw/bitbang_i2c.h
Makefile.target +1 -1
index 445d55f..d049a73 100644
@@ -670,7 +670,7 @@ OBJS+= omap2.o omap_dss.o soc_dma.o
 OBJS+= omap_sx1.o palm.o tsc210x.o
 OBJS+= nseries.o blizzard.o onenand.o vga.o cbus.o tusb6010.o usb-musb.o
 OBJS+= mst_fpga.o mainstone.o
-OBJS+= musicpal.o pflash_cfi02.o
+OBJS+= musicpal.o pflash_cfi02.o bitbang_i2c.o
 OBJS+= framebuffer.o
 OBJS+= syborg.o syborg_fb.o syborg_interrupt.o syborg_keyboard.o
 OBJS+= syborg_serial.o syborg_timer.o syborg_pointer.o syborg_rtc.o
hw/bitbang_i2c.c new file +99 -0

99 lines not on this page · raw message

hw/bitbang_i2c.h new file +50 -0

50 lines not on this page · raw message

hw/musicpal.c +8 -130

181 lines not on this page · raw message

Signature · 1 line
1.5.6.3
#2 lore raw

PATCH 2/2 Add ARM versatile I2C emulation

From: Benoit canet <[email protected]>

---
 Makefile.target    |    1 +
 hw/versatile_i2c.c |   88 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/versatile_i2c.h |   15 +++++++++
 hw/versatilepb.c   |    5 +++
 4 files changed, 109 insertions(+), 0 deletions(-)
 create mode 100644 hw/versatile_i2c.c
 create mode 100644 hw/versatile_i2c.h
Makefile.target +1 -0
index d049a73..fa7efed 100644
@@ -657,6 +657,7 @@ ifeq ($(TARGET_BASE_ARCH), arm)
 OBJS+= integratorcp.o versatilepb.o smc91c111.o arm_pic.o arm_timer.o
 OBJS+= arm_boot.o pl011.o pl031.o pl050.o pl080.o pl110.o pl181.o pl190.o
 OBJS+= versatile_pci.o
+OBJS+= versatile_i2c.o
 OBJS+= realview_gic.o realview.o arm_sysctl.o mpcore.o
 OBJS+= armv7m.o armv7m_nvic.o stellaris.o pl022.o stellaris_enet.o
 OBJS+= pl061.o
hw/versatile_i2c.c new file +88 -0

88 lines not on this page · raw message

hw/versatile_i2c.h new file +15 -0
new file mode 100644
index 0000000..41f8a01
@@ -0,0 +1,15 @@
+/*
+ * Arm versatile i2c interface
+ *
+ * Copyright (c) 2009 Benoît Canet
+ *      Benoît Canet <[email protected]>
+ *
+ * This code is licenced under the GPL.
+ */
+#ifndef I2C_VERSATILE_H
+#define I2C_VERSATILE_H
+#include "i2c.h"
+
+i2c_bus *versatile_i2c_init(uint32_t base);
+
+#endif
hw/versatilepb.c +5 -0
index 03cf4d8..4f924be 100644
@@ -9,6 +9,8 @@
 
 #include "sysbus.h"
 #include "arm-misc.h"
+#include "i2c.h"
+#include "versatile_i2c.h"
 #include "primecell.h"
 #include "devices.h"
 #include "net.h"
@@ -170,6 +172,7 @@ static void versatile_init(ram_addr_t ram_size,
     NICInfo *nd;
     int n;
     int done_smc = 0;
+    i2c_bus *i2c;
 
     if (!cpu_model)
         cpu_model = "arm926";
@@ -224,6 +227,8 @@ static void versatile_init(ram_addr_t ram_size,
         n--;
     }
 
+    i2c = versatile_i2c_init(0x10002000);
+
     sysbus_create_simple("pl011", 0x101f1000, pic[12]);
     sysbus_create_simple("pl011", 0x101f2000, pic[13]);
     sysbus_create_simple("pl011", 0x101f3000, pic[14]);
Signature · 1 line
1.5.6.3
#3 lore raw
In reply to Benoit Canet
Quoted 3 lines · Benoit Canet

These two patches implements the ARM Versatile I2C support. The first one extract the I2C bitbanging code from the musicpal board. The second implement the versatile I2C hardware.

Could you convert this to the new device API? I'm reluctant to add new devices using the old API.

Paul