Skip to contentSkip to conversation

i.MX: Add i.MX25 support through the 3DS evaluation board.

PATCH Superseded Jean-Christophe Dubois 2 participants 7 messages Jun 22, 2015 – Jun 24, 2015 Arm i.MX and Layerscape

v7 of 15 Superseded Latest is v15 →

lore
Share & tools
lore
#0 lore raw

v7 cover i.MX: Add i.MX25 support through the 3DS evaluation board.

This series of patches add the support for the i.MX25 processor through the Freescale 3DS evaluation board.

For now a limited set of devices are supported.
* GPT timers (from i.MX31)
* EPIT timers (from i.MX31)
* Serial ports (from i.MX31)
* Ethernet FEC port
* I2C controller

This was tested by:
* booting a minimal linux system
* booting the Xvisor hypervisor.

Jean-Christophe Dubois (4):
i.MX: Add FEC Ethernet Emulator.
i.MX: Add I2C contoller emulator
i.MX: Add i.MX25 3DS evaluation board support
i.MX: Add qtest support for I2C device emulator

 default-configs/arm-softmmu.mak |   3 +
 hw/arm/Makefile.objs            |   1 +
 hw/arm/imx25_3ds.c              | 273 +++++++++++++
 hw/i2c/Makefile.objs            |   1 +
 hw/i2c/imx_i2c.c                | 361 ++++++++++++++++++
 hw/i2c/imx_i2c_regs.h           |  63 +++
 hw/net/Makefile.objs            |   1 +
 hw/net/imx_fec.c                | 820 ++++++++++++++++++++++++++++++++++++++++
 include/hw/arm/imx.h            |   1 +
 tests/Makefile                  |   3 +
 tests/ds1338-test.c             |  75 ++++
 tests/libqos/i2c-imx.c          | 209 ++++++++++
 tests/libqos/i2c.h              |   3 +
 13 files changed, 1814 insertions(+)
 create mode 100644 hw/arm/imx25_3ds.c
 create mode 100644 hw/i2c/imx_i2c.c
 create mode 100644 hw/i2c/imx_i2c_regs.h
 create mode 100644 hw/net/imx_fec.c
 create mode 100644 tests/ds1338-test.c
 create mode 100644 tests/libqos/i2c-imx.c
Signature · 1 line
2.1.4
#1 lore raw

PATCH v7 1/4 i.MX: Add FEC Ethernet Emulator.

This is based on the mcf_fec.c FEC implementation for ColdFire.

* a generic phy was added (borrowed from lan9118).
* The buffer management is also modified as buffers are slightly different between coldfire and i.MX.

---

Changes since v1:
* none

Changes since v2:
* use QOM cast
* reworked debug printf
* use CamelCase for state type
* warn with qemu_log_mask(LOG_GUEST_ERROR) or qemu_log_mask(LOG_UNIMP)
* move to dma_memory_read/write API
* rework interrupt handling
* use qemu_flush_queued_packets() in rx_enable()

Changes since v3:
* use realise for device initialization
* More QOM cast
* reworked debug printf some more
* standardise GPL header
* use CamelCase for buffer descriptor type

Changes since v4:
* none

Changes since v5:
* replace hw_error() with qemu_log_mask(LOG_GUEST_ERROR, ...)
* remove reformating of imx.h header file.
* remove unnecessary spaces.

Changes since v6:
* port to new memory API

 default-configs/arm-softmmu.mak |   1 +
 hw/net/Makefile.objs            |   1 +
 hw/net/imx_fec.c                | 820 ++++++++++++++++++++++++++++++++++++++++
 include/hw/arm/imx.h            |   1 +
 4 files changed, 823 insertions(+)
 create mode 100644 hw/net/imx_fec.c
default-configs/arm-softmmu.mak +1 -0
index 74f1db3..d21ff7b 100644
@@ -28,6 +28,7 @@ CONFIG_SSI_M25P80=y
 CONFIG_LAN9118=y
 CONFIG_SMC91C111=y
 CONFIG_ALLWINNER_EMAC=y
+CONFIG_IMX_FEC=y
 CONFIG_DS1338=y
 CONFIG_PFLASH_CFI01=y
 CONFIG_PFLASH_CFI02=y
hw/net/Makefile.objs +1 -0
index 9880173..64d0449 100644
@@ -19,6 +19,7 @@ common-obj-$(CONFIG_XGMAC) += xgmac.o
 common-obj-$(CONFIG_MIPSNET) += mipsnet.o
 common-obj-$(CONFIG_XILINX_AXI) += xilinx_axienet.o
 common-obj-$(CONFIG_ALLWINNER_EMAC) += allwinner_emac.o
+common-obj-$(CONFIG_IMX_FEC) += imx_fec.o
 
 common-obj-$(CONFIG_CADENCE) += cadence_gem.o
 common-obj-$(CONFIG_STELLARIS_ENET) += stellaris_enet.o
hw/net/imx_fec.c new file +820 -0

820 lines not on this page · raw message

include/hw/arm/imx.h +1 -0
index ea9e093..558ba60 100644
@@ -30,5 +30,6 @@ void imx_timerg_create(const hwaddr addr,
                       qemu_irq irq,
                       DeviceState *ccm);
 
+DeviceState *imx_fec_create(int nic, const hwaddr base, qemu_irq irq);
 
 #endif /* IMX_H */
Signature · 1 line
2.1.4
#2 lore raw

PATCH v7 2/4 i.MX: Add I2C contoller emulator

In reply to Jean-Christophe Dubois

The slave mode is not implemented.

---

Changes since v1:
* use QOM cast
* run checkpatch on code
* added restrictin on MemoryRegionOps
* use DeviceClass::realise as init function

Changes since v2:
* use CamelCase for state type
* use extrac32() for bit manipilation.
* improve QOM cast
* separate regs definition in its own file (to be reused by qtest)

Changes since v3:
* More QOM cast.
* Rework GPL headers
* Add a constructor helper.
* fix reset()
* rework debug printf

Changes since v4:
* remove the constructor helper

Changes since v5:
* replace hw_error() with qemu_log_mask(LOG_GUEST_ERROR, ...)
* add qemu_log_mask(LOG_UNIMP, ...) for slave mode.
* small comment fixes.

Changes since v6:
* port to new memory API

 default-configs/arm-softmmu.mak |   2 +
 hw/i2c/Makefile.objs            |   1 +
 hw/i2c/imx_i2c.c                | 361 ++++++++++++++++++++++++++++++++++++++++
 hw/i2c/imx_i2c_regs.h           |  63 +++++++
 4 files changed, 427 insertions(+)
 create mode 100644 hw/i2c/imx_i2c.c
 create mode 100644 hw/i2c/imx_i2c_regs.h
default-configs/arm-softmmu.mak +2 -0
index d21ff7b..c6f509d 100644
@@ -99,6 +99,8 @@ CONFIG_ALLWINNER_A10_PIT=y
 CONFIG_ALLWINNER_A10_PIC=y
 CONFIG_ALLWINNER_A10=y
 
+CONFIG_IMX_I2C=y
+
 CONFIG_XIO3130=y
 CONFIG_IOH3420=y
 CONFIG_I82801B11=y
hw/i2c/Makefile.objs +1 -0
index 0f13060..aeb8f38 100644
@@ -4,4 +4,5 @@ common-obj-$(CONFIG_ACPI_X86) += smbus_ich9.o
 common-obj-$(CONFIG_APM) += pm_smbus.o
 common-obj-$(CONFIG_BITBANG_I2C) += bitbang_i2c.o
 common-obj-$(CONFIG_EXYNOS4) += exynos4210_i2c.o
+common-obj-$(CONFIG_IMX_I2C) += imx_i2c.o
 obj-$(CONFIG_OMAP) += omap_i2c.o
hw/i2c/imx_i2c.c new file +361 -0

361 lines not on this page · raw message

hw/i2c/imx_i2c_regs.h new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.1.4
#3 lore raw

PATCH v7 3/4 i.MX: Add i.MX25 3DS evaluation board support

In reply to Jean-Christophe Dubois

For now we support:
* timers (GPT and EPIT)
* serial ports
* ethernet (through the newly added FEC emulator)
* I2C (through the newly added I2C emulator)

---

Changes since v1:
* Added a ds1338 I2C device for qtest purpose.

Changes since v2:
* none

Changes since v3:
* Rework GPL header
* use I2C constructor helper.

Changes since v4:
* use sysbus_create_simple() instead of I2C constructor helper

Changes since v5:
* Add ds1338 only for qtest mode.
* small comment fixes.

Changes since v6:
* Allow for more than 4 serial if suppoted by Qemu.

 hw/arm/Makefile.objs |   1 +
 hw/arm/imx25_3ds.c   | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 274 insertions(+)
 create mode 100644 hw/arm/imx25_3ds.c
hw/arm/Makefile.objs +1 -0
index cf346c1..3ecb8b1 100644
@@ -5,6 +5,7 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
 obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
 obj-$(CONFIG_ACPI) += virt-acpi-build.o
 obj-y += netduino2.o
+obj-y += imx25_3ds.o
 obj-y += sysbus-fdt.o
 
 obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
hw/arm/imx25_3ds.c new file +273 -0

273 lines not on this page · raw message

Signature · 1 line
2.1.4
#4 lore raw

Re: [Qemu-devel] [PATCH v7 3/4] i.MX: Add i.MX25 3DS evaluation board support

Quoted 26 lines · Jean-Christophe Dubois

For now we support:
* timers (GPT and EPIT)
* serial ports
* ethernet (through the newly added FEC emulator)
* I2C (through the newly added I2C emulator)

---

Changes since v1:
* Added a ds1338 I2C device for qtest purpose.

Changes since v2:
* none

Changes since v3:
* Rework GPL header
* use I2C constructor helper.

Changes since v4:
* use sysbus_create_simple() instead of I2C constructor helper

Changes since v5:
* Add ds1338 only for qtest mode.
* small comment fixes.

Quoted 5 lines

Changes since v6:
* Allow for more than 4 serial if suppoted by Qemu.

 hw/arm/Makefile.objs |   1 +
 hw/arm/imx25_3ds.c   | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++

So the (new since v6) guideline with ARM SoCs is to split the SoC and machine models. This would give you two files. A SoC file for imx25 and board for 3ds.

I'm not 100% on the "3ds" board following some googling but is it really the PDK board? I found this:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=635baf6b40ebaef683abf87d677467cba71a0d50

and can find product info for PDK from there:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX25PDK

To see modern examples of split SoC/board, see stm32f205_soc wiith netduino2 or xlnx-zynqmp with xlnx-ep108 (all in hw/arm).

It seems the only board level feature you are implementing is this ds1338 which is not or the real board. So I guess qtest-only code can be left in the SoC model.

This would make your board level very similar to netduino2 (perhaps even slightly simpler).

Regards,
Peter

Quoted 298 lines
 2 files changed, 274 insertions(+)
 create mode 100644 hw/arm/imx25_3ds.c
hw/arm/Makefile.objs +1 -0
index cf346c1..3ecb8b1 100644
@@ -5,6 +5,7 @@ obj-y += omap_sx1.o palm.o realview.o spitz.o stellaris.o
 obj-y += tosa.o versatilepb.o vexpress.o virt.o xilinx_zynq.o z2.o
 obj-$(CONFIG_ACPI) += virt-acpi-build.o
 obj-y += netduino2.o
+obj-y += imx25_3ds.o
 obj-y += sysbus-fdt.o
 
 obj-y += armv7m.o exynos4210.o pxa2xx.o pxa2xx_gpio.o pxa2xx_pic.o
hw/arm/imx25_3ds.c new file +273 -1
new file mode 100644
index 0000000..f495f9a
@@ -0,0 +1,273 @@
+/*
+ * Copyright (c) 2013 Jean-Christophe Dubois
+ *
+ * 3Dstack Board System emulation.
+ *
+ * Based on hw/arm/kzm.c
+ *
+ * Copyright (c) 2008 OKL and 2011 NICTA
+ * Written by Hans at OK-Labs
+ * Updated by Peter Chubb.
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License as published by the
+ *  Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful, but WITHOUT
+ *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ *  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ *  for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "hw/sysbus.h"
+#include "exec/address-spaces.h"
+#include "hw/hw.h"
+#include "hw/arm/arm.h"
+#include "hw/devices.h"
+#include "net/net.h"
+#include "sysemu/sysemu.h"
+#include "hw/boards.h"
+#include "hw/char/serial.h"
+#include "hw/arm/imx.h"
+#include "hw/i2c/i2c.h"
+
+#include "sysemu/qtest.h"
+
+/* Memory map for 3D-Stack Emulation Baseboard:
+ * 0x00000000-0x00003fff 16k ROM              IGNORED
+ * 0x00004000-0x00403fff Reserved             IGNORED
+ * 0x00404000-0x00408fff 20k ROM              IGNORED
+ * 0x00409000-0x0fffffff Reserved             IGNORED
+ * 0x10000000-0x1fffffff Reserved             IGNORED
+ * 0x20000000-0x2fffffff Reserved             IGNORED
+ * 0x30000000-0x3fffffff Reserved             IGNORED
+ * 0x40000000-0x43efffff Reserved             IGNORED
+ * 0x43f00000-0x6fffffff I.MX25 Internal Register Space
+ *   0x43f00000 IO_AREA0
+ *   0x43f80000 I2C0                          EMULATED
+ *   0x43f84000 I2C2                          EMULATED
+ *   0x43f98000 I2C1                          EMULATED
+ *   0x43f90000 UART1                         EMULATED
+ *   0x43f94000 UART2                         EMULATED
+ *   0x43fb0000 UART4                         IGNORED
+ *   0x43fb4000 UART5                         IGNORED
+ *   0x5000c000 UART3                         EMULATED
+ *   0x50038000 FEC                           EMULATED
+ *   0x53f80000 CCM                           EMULATED
+ *   0x53f84000 GPT 4                         EMULATED
+ *   0x53f88000 GPT 3                         EMULATED
+ *   0x53f8c000 GPT 2                         EMULATED
+ *   0x53f90000 GPT 1                         EMULATED
+ *   0x53f94000 PIT 1                         EMULATED
+ *   0x53f98000 PIT 2                         EMULATED
+ *   0x53f9c000 GPIO-4                        EMULATED
+ *   0x53fa4000 GPIO-3                        EMULATED
+ *   0x53fcc000 GPIO-1                        EMULATED
+ *   0x53fd0000 GPIO-2                        EMULATED
+ *   0x68000000 ASIC                          EMULATED
+ * 0x78000000-0x7801ffff SRAM                 EMULATED
+ * 0x78020000-0x7fffffff SRAM Aliasing        EMULATED
+ * 0x80000000-0x87ffffff RAM + Alias          EMULATED
+ * 0x90000000-0x9fffffff RAM + Alias          EMULATED
+ * 0xa0000000-0xa7ffffff Flash                IGNORED
+ * 0xa8000000-0xafffffff Flash                IGNORED
+ * 0xb0000000-0xb1ffffff SRAM                 IGNORED
+ * 0xb2000000-0xb3ffffff SRAM                 IGNORED
+ * 0xb4000000-0xb5ffffff CS4                  IGNORED
+ * 0xb6000000-0xb8000fff Reserved             IGNORED
+ * 0xb8001000-0xb8001fff SDRAM CTRL reg       IGNORED
+ * 0xb8002000-0xb8002fff WEIM CTRL reg        IGNORED
+ * 0xb8003000-0xb8003fff M3IF CTRL reg        IGNORED
+ * 0xb8004000-0xb8004fff EMI CTRL reg         IGNORED
+ * 0xb8005000-0xbaffffff Reserved             IGNORED
+ * 0xbb000000-0xbb000fff NAND flash area buf  IGNORED
+ * 0xbb001000-0xbb0011ff NAND flash reserved  IGNORED
+ * 0xbb001200-0xbb001dff Reserved             IGNORED
+ * 0xbb001e00-0xbb001fff NAN flash CTRL reg   IGNORED
+ * 0xbb012000-0xbfffffff Reserved             IGNORED
+ * 0xc0000000-0xffffffff Reserved             IGNORED
+ */
+
+#define IMX25_SRAM_ADDRESS  (0x78000000)
+#define IMX25_SRAMSIZE      (128*1024)
+#define IMX25_CS_SRAMSIZE   (128*1024*1024)
+#define IMX25_3DS_ADDRESS   (0x80000000)
+#define IMX25_CS_RAMSIZE    (256*1024*1024)
+
+static struct arm_boot_info imx25_3ds_binfo = {
+    .loader_start = IMX25_3DS_ADDRESS,
+    .board_id = 1771,
+};
+
+static void imx25_3ds_init(MachineState *args)
+{
+    int i;
+    int serial_cnt = 0;
+    const ram_addr_t ram_size = args->ram_size;
+    const char *cpu_model = args->cpu_model;
+    const char *kernel_filename = args->kernel_filename;
+    const char *kernel_cmdline = args->kernel_cmdline;
+    const char *initrd_filename = args->initrd_filename;
+    ARMCPU *cpu;
+    DeviceState *pic_dev;
+    DeviceState *ccm, *i2c_dev;
+    MemoryRegion *address_space_mem = get_system_memory();
+    MemoryRegion *sram = g_new(MemoryRegion, 1);
+    MemoryRegion *sram_alias = g_new(MemoryRegion, 1);
+    static const struct {
+        hwaddr addr;
+        unsigned int irq;
+    } serial_table[] = {
+        { 0x43f90000, 45 },
+        { 0x43f94000, 32 },
+        { 0x5000c000, 18 },
+        { 0x50008000, 5  },
+        { 0x5002c000, 40 },
+        { 0, 0 }
+    };
+
+    if (!cpu_model) {
+        cpu_model = "arm926";
+    }
+
+    cpu = cpu_arm_init(cpu_model);
+    if (!cpu) {
+        fprintf(stderr, "Unable to find CPU definition\n");
+        exit(1);
+    }
+
+    if (ram_size > (2 * IMX25_CS_RAMSIZE)) {
+        fprintf(stderr, "i.MX25 can support only up to %d MB\n",
+                2 * IMX25_CS_RAMSIZE / (1024 * 1024));
+        exit(1);
+    }
+
+    /* create our main memory */
+    for (i = 0; i <= (ram_size / IMX25_CS_RAMSIZE); i++) {
+        ram_addr_t blk_size = ram_size - (IMX25_CS_RAMSIZE * i);
+        MemoryRegion *ram;
+        char ram_name[20];
+
+        if (blk_size > IMX25_CS_RAMSIZE) {
+            blk_size = IMX25_CS_RAMSIZE;
+        }
+
+        if (blk_size == 0) {
+            break;
+        }
+
+        sprintf(ram_name, "imx25.ram%d", i);
+
+        ram = g_new(MemoryRegion, 1);
+        memory_region_init_ram(ram, NULL, ram_name, blk_size, &error_abort);
+        vmstate_register_ram_global(ram);
+        memory_region_add_subregion(address_space_mem, IMX25_3DS_ADDRESS
+                                    + (IMX25_CS_RAMSIZE * i), ram);
+
+        /* Add ram alias */
+        if (blk_size < IMX25_CS_RAMSIZE) {
+            MemoryRegion *ram_alias = g_new(MemoryRegion, 1);
+            char alias_name[20];
+
+            sprintf(alias_name, "ram.alias%d", i);
+
+            memory_region_init_alias(ram_alias, NULL, alias_name, ram, 0,
+                                     IMX25_CS_RAMSIZE - blk_size);
+            memory_region_add_subregion(address_space_mem, IMX25_3DS_ADDRESS
+                                        + (IMX25_CS_RAMSIZE * i) + blk_size,
+                                        ram_alias);
+        }
+    }
+
+    /* create the sram area */
+    memory_region_init_ram(sram, NULL, "imx25.sram", IMX25_SRAMSIZE, &error_abort);
+    vmstate_register_ram_global(sram);
+    memory_region_add_subregion(address_space_mem, IMX25_SRAM_ADDRESS,
+                                sram);
+
+    /* add sram alias */
+    memory_region_init_alias(sram_alias, NULL, "sram.alias", sram, 0,
+                             IMX25_CS_SRAMSIZE - IMX25_SRAMSIZE);
+    memory_region_add_subregion(address_space_mem,
+                                IMX25_SRAM_ADDRESS + IMX25_SRAMSIZE,
+                                sram_alias);
+
+    /* add the PIC */
+    pic_dev = sysbus_create_varargs("imx_avic", 0x68000000,
+                                    qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ),
+                                    qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ),
+                                    NULL);
+
+    while (serial_table[serial_cnt].addr && (serial_cnt < MAX_SERIAL_PORTS)) {
+        /* add some serial lines */
+        imx_serial_create(serial_cnt, serial_table[serial_cnt].addr,
+                          qdev_get_gpio_in(pic_dev,
+                                           serial_table[serial_cnt].irq));
+        serial_cnt++;
+    }
+
+    ccm = sysbus_create_simple("imx_ccm", 0x53f80000, NULL);
+
+    /* add gpt timers */
+    imx_timerg_create(0x53f84000, qdev_get_gpio_in(pic_dev, 1), ccm);
+    imx_timerg_create(0x53f88000, qdev_get_gpio_in(pic_dev, 29), ccm);
+    imx_timerg_create(0x53f8c000, qdev_get_gpio_in(pic_dev, 53), ccm);
+    imx_timerg_create(0x53f90000, qdev_get_gpio_in(pic_dev, 54), ccm);
+
+    /* add epit timers */
+    imx_timerp_create(0x53f94000, qdev_get_gpio_in(pic_dev, 28), ccm);
+    imx_timerp_create(0x53f98000, qdev_get_gpio_in(pic_dev, 27), ccm);
+
+    imx_fec_create(0, 0x50038000, qdev_get_gpio_in(pic_dev, 57));
+
+    /* I2C 0 */
+    i2c_dev = sysbus_create_simple("imx.i2c", 0x43f80000,
+                                   qdev_get_gpio_in(pic_dev, 3));
+
+    /* add I2C 1 */
+    sysbus_create_simple("imx.i2c", 0x43f98000, qdev_get_gpio_in(pic_dev, 4));
+    /* add I2C 2 */
+    sysbus_create_simple("imx.i2c", 0x43f84000, qdev_get_gpio_in(pic_dev, 10));
+
+    imx25_3ds_binfo.ram_size = ram_size;
+    imx25_3ds_binfo.kernel_filename = kernel_filename;
+    imx25_3ds_binfo.kernel_cmdline = kernel_cmdline;
+    imx25_3ds_binfo.initrd_filename = initrd_filename;
+    imx25_3ds_binfo.nb_cpus = 1;
+
+    /*
+     * We test explicitly for qtest here as it is not done (yet?) in
+     * arm_load_kernel(). Without this the "make check" command would
+     * fail.
+     */
+
+    if (!qtest_enabled()) {
+        arm_load_kernel(cpu, &imx25_3ds_binfo);
+    } else {
+        /*
+         * This I2C device doesn't exist on the real board.
+         * We add it here (only on qtest usage) to be able to do a bit
+         * of simple qtest. See "make check" for details.
+         */
+        i2c_create_slave((I2CBus *)qdev_get_child_bus(i2c_dev, "i2c"),
+                         "ds1338", 0x68);
+
+    }
+}
+
+static QEMUMachine imx25_3ds_machine = {
+    .name = "imx25_3ds",
+    .desc = "ARM i.MX25 PDK board (ARM926)",
+    .init = imx25_3ds_init,
+};
+
+static void imx25_3ds_machine_init(void)
+{
+    qemu_register_machine(&imx25_3ds_machine);
+}
+
+machine_init(imx25_3ds_machine_init)
--

2.1.4

#5 lore raw

Re: [Qemu-devel] [PATCH v7 3/4] i.MX: Add i.MX25 3DS evaluation board support

Quoted 37 lines · Peter Crosthwaite
Quoted 26 lines · Jean-Christophe Dubois

For now we support:
* timers (GPT and EPIT)
* serial ports
* ethernet (through the newly added FEC emulator)
* I2C (through the newly added I2C emulator)

---

Changes since v1:
* Added a ds1338 I2C device for qtest purpose.

Changes since v2:
* none

Changes since v3:
* Rework GPL header
* use I2C constructor helper.

Changes since v4:
* use sysbus_create_simple() instead of I2C constructor helper

Changes since v5:
* Add ds1338 only for qtest mode.
* small comment fixes.

Quoted 5 lines

Changes since v6:
* Allow for more than 4 serial if suppoted by Qemu.

  hw/arm/Makefile.objs |   1 +
  hw/arm/imx25_3ds.c   | 273 +++++++++++++++++++++++++++++++++++++++++++++++++++

So the (new since v6) guideline with ARM SoCs is to split the SoC and machine models. This would give you two files. A SoC file for imx25 and board for 3ds.

Quoted 8 lines

I'm not 100% on the "3ds" board following some googling but is it really the PDK board? I found this:

http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=635baf6b40ebaef683abf87d677467cba71a0d50

and can find product info for PDK from there:

http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=IMX25PDK

Yes this is the board.

Quoted 3 lines

To see modern examples of split SoC/board, see stm32f205_soc wiith netduino2 or xlnx-zynqmp with xlnx-ep108 (all in hw/arm).

I'll look at it.

Quoted 4 lines

It seems the only board level feature you are implementing is this ds1338 which is not or the real board. So I guess qtest-only code can be left in the SoC model.

OK

Quoted 3 lines

This would make your board level very similar to netduino2 (perhaps even slightly simpler).

Yes, for now there is basically only the SOC supported in my case.

Quoted 3 lines

Regards,
Peter

Thanks for the feedback.

JC

#6 lore raw

PATCH v7 4/4 i.MX: Add qtest support for I2C device emulator

In reply to Jean-Christophe Dubois

This is using a ds1338 RTC chip on the i2c bus. This RTC chip is not present on the real board.

---

Changes since v1:
* not present on v1

Changes since v2:
* use a common header file for I2C regs definition

Changes since v3:
* rework GPL headers.

Changes since v4:
* none

Changes since v5:
* none

Changes since v6:
* none

 tests/Makefile         |   3 +
 tests/ds1338-test.c    |  75 ++++++++++++++++++
 tests/libqos/i2c-imx.c | 209 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/libqos/i2c.h     |   3 +
 4 files changed, 290 insertions(+)
 create mode 100644 tests/ds1338-test.c
 create mode 100644 tests/libqos/i2c-imx.c
tests/Makefile +3 -0
index c5e4744..93890a8 100644
@@ -193,6 +193,7 @@ check-qtest-sparc64-y = tests/endianness-test$(EXESUF)
 gcov-files-sparc-y += hw/timer/m48t59.c
 gcov-files-sparc64-y += hw/timer/m48t59.c
 check-qtest-arm-y = tests/tmp105-test$(EXESUF)
+check-qtest-arm-y = tests/ds1338-test$(EXESUF)
 gcov-files-arm-y += hw/misc/tmp105.c
 check-qtest-arm-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
@@ -342,6 +343,7 @@ libqos-pc-obj-y = $(libqos-obj-y) tests/libqos/pci-pc.o
 libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o
 libqos-pc-obj-y += tests/libqos/ahci.o
 libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
+libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
 libqos-usb-obj-y = $(libqos-pc-obj-y) tests/libqos/usb.o
 libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
 
@@ -356,6 +358,7 @@ tests/hd-geo-test$(EXESUF): tests/hd-geo-test.o
 tests/boot-order-test$(EXESUF): tests/boot-order-test.o $(libqos-obj-y)
 tests/bios-tables-test$(EXESUF): tests/bios-tables-test.o $(libqos-obj-y)
 tests/tmp105-test$(EXESUF): tests/tmp105-test.o $(libqos-omap-obj-y)
+tests/ds1338-test$(EXESUF): tests/ds1338-test.o $(libqos-imx-obj-y)
 tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y)
 tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
tests/ds1338-test.c new file +75 -0

75 lines not on this page · raw message

tests/libqos/i2c-imx.c new file +209 -0

209 lines not on this page · raw message

tests/libqos/i2c.h +3 -0
index 1ce9af4..c21f1dc 100644
@@ -27,4 +27,7 @@ void i2c_recv(I2CAdapter *i2c, uint8_t addr,
 /* libi2c-omap.c */
 I2CAdapter *omap_i2c_create(uint64_t addr);
 
+/* libi2c-imx.c */
+I2CAdapter *imx_i2c_create(uint64_t addr);
+
 #endif
Signature · 1 line
2.1.4