{"id":814332,"url":"http://patchwork.ozlabs.org/api/patches/814332/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505494753-10837-6-git-send-email-sundeep.lkml@gmail.com/","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<1505494753-10837-6-git-send-email-sundeep.lkml@gmail.com>","list_archive_url":null,"date":"2017-09-15T16:59:13","name":"[Qemu,devel,v9,5/5] msf2: Add Emcraft's Smartfusion2 SOM kit","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"c19817ca8d8b39ab2e523225534cd1dfa339af16","submitter":{"id":64324,"url":"http://patchwork.ozlabs.org/api/people/64324/?format=json","name":"sundeep subbaraya","email":"sundeep.lkml@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/qemu-devel/patch/1505494753-10837-6-git-send-email-sundeep.lkml@gmail.com/mbox/","series":[{"id":3336,"url":"http://patchwork.ozlabs.org/api/series/3336/?format=json","web_url":"http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3336","date":"2017-09-15T16:59:10","name":"Add support for Smartfusion2 SoC","version":9,"mbox":"http://patchwork.ozlabs.org/series/3336/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/814332/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/814332/checks/","tags":{},"related":[],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"n74JuqvV\"; dkim-atps=neutral"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xv1sL6C6hz9s7m\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSat, 16 Sep 2017 03:01:58 +1000 (AEST)","from localhost ([::1]:54287 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dsu04-0006lk-V5\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 13:01:57 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:50019)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dstxw-0005Tb-Bu\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 12:59:45 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <sundeep.lkml@gmail.com>) id 1dstxu-00045X-Ms\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 12:59:44 -0400","from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:37158)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)\n\t(Exim 4.71) (envelope-from <sundeep.lkml@gmail.com>)\n\tid 1dstxu-00044y-F8; Fri, 15 Sep 2017 12:59:42 -0400","by mail-pg0-x242.google.com with SMTP id v5so1604612pgn.4;\n\tFri, 15 Sep 2017 09:59:42 -0700 (PDT)","from localhost.localdomain ([124.123.70.3])\n\tby smtp.gmail.com with ESMTPSA id\n\ts17sm3111350pgq.25.2017.09.15.09.59.38\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tFri, 15 Sep 2017 09:59:40 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=AdIG7nc3m2isE/SNOgcC6OjeDhxBRC4mXkpx+TEE+ms=;\n\tb=n74JuqvVRa2KWv0QnlvhO4GIPsiWmVnnAu98pdLrriI2JexMsjDFIhUCaRelePV5nZ\n\tQ1X+de+MmNCJRXSIObvzsZ8McByix640WrwkZODsgLT1PDCWNoywuy7DMmNViiD4cfuH\n\tjeFYZn2G5fIE/zA2vcsnqZjlBH7XDqbzRSChyk1W2JtpWEKp+1DYWN8k7oijNV1ND8mv\n\tVhId9SpQRm5rNOrQcuM+RKEDgfPFixdKze+aHsuNgzZ8qL6NM46UwPiTSbVLtdZsKWEL\n\t4VGLgy/scj+juniqLWcDBgVynssGLHNPOsdZ5gYOJBEDs7myd9RkCEX5X0tTzMrH2gjP\n\tkiiA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=AdIG7nc3m2isE/SNOgcC6OjeDhxBRC4mXkpx+TEE+ms=;\n\tb=cZ7OAkHlvFkeJJV0sE+5tETRrCMjRi0RG+KyP2S2sbLFsfFwrkJVnkdjEOX3rtg/3P\n\tgc2cgGUPMT1f3/ugPQ8A2iPullw4f9q1N7i+OGITfC6fscmGAaGTzEijDJPNUqE4WiRd\n\tB7jwx+dlcfs7iefMBxsuG8Y87nKHTa5wvm+Eay74A30/z8PYYCHlwQu2fPYDlUXbTw6F\n\tc8CKHfPiKAq6f0NwydUW+QLa7CJpUcf+pQQCZz4P/AM7a7Q2UNjmNWppGeKhbQE2QmSz\n\tLfsKDEJPLt/WF9Y9wBrwY7IkGL5AP9GY3fXQqE9yn4slFPd5djl9aBnlLOx5xDB6CQcB\n\t7IQg==","X-Gm-Message-State":"AHPjjUh8XWR27+wsx9SG/xft1beOb8lAtmtYSvfCHIM7+YNS6mihEL2D\n\t5A0cs+y/avOtImFf","X-Google-Smtp-Source":"ADKCNb5W35v3THL4xIUnvdnUM0gDy64ciNhKdXh91lI1JQaIAjZDdtdpADdKX6PGvxl4m4TGEhcuMQ==","X-Received":"by 10.84.132.35 with SMTP id 32mr17235151ple.170.1505494781296; \n\tFri, 15 Sep 2017 09:59:41 -0700 (PDT)","From":"Subbaraya Sundeep <sundeep.lkml@gmail.com>","To":"qemu-devel@nongnu.org,\n\tqemu-arm@nongnu.org","Date":"Fri, 15 Sep 2017 22:29:13 +0530","Message-Id":"<1505494753-10837-6-git-send-email-sundeep.lkml@gmail.com>","X-Mailer":"git-send-email 2.5.0","In-Reply-To":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>","References":"<1505494753-10837-1-git-send-email-sundeep.lkml@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit","X-detected-operating-system":"by eggs.gnu.org: Genre and OS details not\n\trecognized.","X-Received-From":"2607:f8b0:400e:c05::242","Subject":"[Qemu-devel] [Qemu devel v9 PATCH 5/5] msf2: Add Emcraft's\n\tSmartfusion2 SOM kit","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"peter.maydell@linaro.org, Subbaraya Sundeep <sundeep.lkml@gmail.com>,\n\tf4bug@amsat.org, alistair23@gmail.com, crosthwaite.peter@gmail.com","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"},"content":"Emulated Emcraft's Smartfusion2 System On Module starter\nkit.\n\nSigned-off-by: Subbaraya Sundeep <sundeep.lkml@gmail.com>\nReviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>\n---\n hw/arm/Makefile.objs |  2 +-\n hw/arm/msf2-som.c    | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 95 insertions(+), 1 deletion(-)\n create mode 100644 hw/arm/msf2-som.c","diff":"diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs\nindex df36a03..e81a7dc 100644\n--- a/hw/arm/Makefile.objs\n+++ b/hw/arm/Makefile.objs\n@@ -19,4 +19,4 @@ obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o\n obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o\n obj-$(CONFIG_ASPEED_SOC) += aspeed_soc.o aspeed.o\n obj-$(CONFIG_MPS2) += mps2.o\n-obj-$(CONFIG_MSF2) += msf2-soc.o\n+obj-$(CONFIG_MSF2) += msf2-soc.o msf2-som.o\ndiff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c\nnew file mode 100644\nindex 0000000..d395696\n--- /dev/null\n+++ b/hw/arm/msf2-som.c\n@@ -0,0 +1,94 @@\n+/*\n+ * SmartFusion2 SOM starter kit(from Emcraft) emulation.\n+ *\n+ * Copyright (c) 2017 Subbaraya Sundeep <sundeep.lkml@gmail.com>\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy\n+ * of this software and associated documentation files (the \"Software\"), to deal\n+ * in the Software without restriction, including without limitation the rights\n+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+ * copies of the Software, and to permit persons to whom the Software is\n+ * furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in\n+ * all copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n+ * THE SOFTWARE.\n+ */\n+\n+#include \"qemu/osdep.h\"\n+#include \"qapi/error.h\"\n+#include \"hw/boards.h\"\n+#include \"hw/arm/arm.h\"\n+#include \"exec/address-spaces.h\"\n+#include \"qemu/cutils.h\"\n+#include \"hw/arm/msf2-soc.h\"\n+\n+#define DDR_BASE_ADDRESS      0xA0000000\n+#define DDR_SIZE              (64 * M_BYTE)\n+\n+#define M2S010_ENVM_SIZE      (256 * K_BYTE)\n+#define M2S010_ESRAM_SIZE     (64 * K_BYTE)\n+\n+static void emcraft_sf2_s2s010_init(MachineState *machine)\n+{\n+    DeviceState *dev;\n+    DeviceState *spi_flash;\n+    MSF2State *soc;\n+    DriveInfo *dinfo = drive_get_next(IF_MTD);\n+    qemu_irq cs_line;\n+    SSIBus *spi_bus;\n+    MemoryRegion *sysmem = get_system_memory();\n+    MemoryRegion *ddr = g_new(MemoryRegion, 1);\n+\n+    memory_region_init_ram(ddr, NULL, \"ddr-ram\", DDR_SIZE,\n+                           &error_fatal);\n+    memory_region_add_subregion(sysmem, DDR_BASE_ADDRESS, ddr);\n+\n+    dev = qdev_create(NULL, TYPE_MSF2_SOC);\n+    qdev_prop_set_string(dev, \"part-name\", \"M2S010\");\n+    qdev_prop_set_uint64(dev, \"eNVM-size\", M2S010_ENVM_SIZE);\n+    qdev_prop_set_uint64(dev, \"eSRAM-size\", M2S010_ESRAM_SIZE);\n+\n+    /*\n+     * CPU clock and peripheral clocks(APB0, APB1)are configurable\n+     * in Libero. CPU clock is divided by APB0 and APB1 divisors for\n+     * peripherals. Emcraft's SoM kit comes with these settings by default.\n+     */\n+    qdev_prop_set_uint32(dev, \"m3clk\", 142 * 1000000);\n+    qdev_prop_set_uint32(dev, \"apb0div\", 2);\n+    qdev_prop_set_uint32(dev, \"apb1div\", 2);\n+\n+    object_property_set_bool(OBJECT(dev), true, \"realized\", &error_fatal);\n+\n+    soc = MSF2_SOC(dev);\n+\n+    /* Attach SPI flash to SPI0 controller */\n+    spi_bus = (SSIBus *)qdev_get_child_bus(dev, \"spi0\");\n+    spi_flash = ssi_create_slave_no_init(spi_bus, \"s25sl12801\");\n+    qdev_prop_set_uint8(spi_flash, \"spansion-cr2nv\", 1);\n+    if (dinfo) {\n+        qdev_prop_set_drive(spi_flash, \"drive\", blk_by_legacy_dinfo(dinfo),\n+                                    &error_fatal);\n+    }\n+    qdev_init_nofail(spi_flash);\n+    cs_line = qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0);\n+    sysbus_connect_irq(SYS_BUS_DEVICE(&soc->spi[0]), 1, cs_line);\n+\n+    armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,\n+                       soc->envm_size);\n+}\n+\n+static void emcraft_sf2_machine_init(MachineClass *mc)\n+{\n+    mc->desc = \"SmartFusion2 SOM kit from Emcraft (M2S010)\";\n+    mc->init = emcraft_sf2_s2s010_init;\n+}\n+\n+DEFINE_MACHINE(\"emcraft-sf2\", emcraft_sf2_machine_init)\n","prefixes":["Qemu","devel","v9","5/5"]}