From patchwork Mon Nov 6 15:48:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Smirnov X-Patchwork-Id: 10043813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D797E60247 for ; Mon, 6 Nov 2017 16:09:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA79029230 for ; Mon, 6 Nov 2017 16:09:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDEF629279; Mon, 6 Nov 2017 16:09:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 137E829230 for ; Mon, 6 Nov 2017 16:09:34 +0000 (UTC) Received: from localhost ([::1]:48890 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBjxt-0007Wc-Uk for patchwork-qemu-devel@patchwork.kernel.org; Mon, 06 Nov 2017 11:09:33 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34136) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eBjeB-0007eW-Qe for qemu-devel@nongnu.org; Mon, 06 Nov 2017 10:49:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eBjeA-0000qD-FK for qemu-devel@nongnu.org; Mon, 06 Nov 2017 10:49:11 -0500 Received: from mail-pg0-x241.google.com ([2607:f8b0:400e:c05::241]:43188) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eBje1-0000ij-DW; Mon, 06 Nov 2017 10:49:01 -0500 Received: by mail-pg0-x241.google.com with SMTP id s75so8527542pgs.0; Mon, 06 Nov 2017 07:49:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CGPk7Ng1tIwV5S1MJFlEkA0gMhnET7XjfyWWWjY3dVQ=; b=UA7S/cdcLzOiLN16spc4qXDdlcmM4J6mjaQSEdqiTDm8JWPpSuvxFK9mFYWfkDMHLm 0Gty0T+0kK2cWx6PNbdMOkzwP/3BztNreN2CVXk/UATLdYPQyQ1iBo7DU02DmTqTJoGq Aw87r3D+NE2BnfbrXgQFmF1Dk7WuYQ3VpGIK09dszyLPsUESyCbv/i9CPbpbdEDN+quf UIR1POHUbZ31ucVNw3sJn5H41AtEV5aaSszFo2NUiCK3apaWhd/JfYV+fOdPH4EaQAA3 jMFqQUtwHLZbcXhItH7j08Br74FrXKBJZ0i/dEt7oEjk7Lrs0E1wloBgagyuYSyhTWsE 2+nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CGPk7Ng1tIwV5S1MJFlEkA0gMhnET7XjfyWWWjY3dVQ=; b=oSDRhGgAKRtMzoJI7hCA1H04lxpVVK9xQNyFh0WnjG7xhn9GfBxwkYalHzYN5n3r8v f6obSG1ir6FBZoEI/lnjgOHK0QcHxhPbsiX2pyC4eEGrbOtrRO87fzOpS4txGcztmhfU Uhc6TQqZYKPOAtI3J40ZLwwc1GITMmJcLK0gMIl96yj9dR3Iwv/+3VDX4RHNeCx9pT7Z 62REXAnG8835EZ6JZ7OQrP1FpriAMsPcD1gGRUGEsDUCzAswXvNXonuka6zN48db8wFl fd/EHoJ61R8yOPDB+lEKPVxARAG0UO6JT/FnX7XkF1MzPKxTVeU6I2KU7SgIDG2AQ+D5 7+/Q== X-Gm-Message-State: AMCzsaUgGDs2xbIjBZjqnyoLSX+QDSY1wrNDO+jsAW2DjCffjb5nKX+M jeE/Zga+2Gapfmu/uzAQuWUvdgsjs2w= X-Google-Smtp-Source: ABhQp+S4WuzsxZhXrGClvGS5ZdLXCLPYLuOOk/g0TTshRpGJSTjvSANftaIVMnqim9txG4psrFTR8A== X-Received: by 10.84.128.72 with SMTP id 66mr14840683pla.250.1509983340156; Mon, 06 Nov 2017 07:49:00 -0800 (PST) Received: from squirtle.lan (c-24-22-235-96.hsd1.wa.comcast.net. [24.22.235.96]) by smtp.gmail.com with ESMTPSA id x1sm22719590pfh.113.2017.11.06.07.48.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 06 Nov 2017 07:48:59 -0800 (PST) From: Andrey Smirnov To: qemu-arm@nongnu.org Date: Mon, 6 Nov 2017 07:48:11 -0800 Message-Id: <20171106154813.19936-29-andrew.smirnov@gmail.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171106154813.19936-1-andrew.smirnov@gmail.com> References: <20171106154813.19936-1-andrew.smirnov@gmail.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::241 Subject: [Qemu-devel] [PATCH v3 28/30] i.MX: Add code to emulate i.MX LCD block X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Andrey Smirnov , Jason Wang , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org, yurovsky@gmail.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add basic i.MX LCD block emulation code needed to boot Linux guest. Cc: Peter Maydell Cc: Jason Wang Cc: Philippe Mathieu-Daudé Cc: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Cc: yurovsky@gmail.com Signed-off-by: Andrey Smirnov --- hw/display/Makefile.objs | 2 ++ hw/display/imx_lcdif.c | 71 ++++++++++++++++++++++++++++++++++++++++++ include/hw/display/imx_lcdif.h | 16 ++++++++++ 3 files changed, 89 insertions(+) create mode 100644 hw/display/imx_lcdif.c create mode 100644 include/hw/display/imx_lcdif.h diff --git a/hw/display/Makefile.objs b/hw/display/Makefile.objs index 551c050a6a..a7b34be231 100644 --- a/hw/display/Makefile.objs +++ b/hw/display/Makefile.objs @@ -41,3 +41,5 @@ virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS) virtio-gpu-3d.o-libs += $(VIRGL_LIBS) obj-$(CONFIG_DPCD) += dpcd.o obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.o + +obj-$(CONFIG_IMX) += imx_lcdif.o diff --git a/hw/display/imx_lcdif.c b/hw/display/imx_lcdif.c new file mode 100644 index 0000000000..1d7ad4a77b --- /dev/null +++ b/hw/display/imx_lcdif.c @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2017, Impinj, Inc. + * + * i.MX LCD block emulation code + * + * Author: Andrey Smirnov + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hw/display/imx_lcdif.h" +#include "qemu/log.h" + +static uint64_t imx_lcdif_read(void *opaque, hwaddr offset, + unsigned size) +{ + return 0; +} + +static void imx_lcdif_write(void *opaque, hwaddr offset, + uint64_t value, unsigned size) +{ +} + +static const struct MemoryRegionOps imx_lcdif_ops = { + .read = imx_lcdif_read, + .write = imx_lcdif_write, + .endianness = DEVICE_NATIVE_ENDIAN, + .impl = { + .min_access_size = 4, + .max_access_size = 4, + .unaligned = false, + }, +}; + +static void imx_lcdif_init(Object *obj) +{ + SysBusDevice *sd = SYS_BUS_DEVICE(obj); + IMXLCDState *s = IMX_LCDIF(obj); + + memory_region_init_io(&s->iomem, + obj, + &imx_lcdif_ops, + s, + TYPE_IMX_LCDIF ".iomem", + 0x10000); + sysbus_init_mmio(sd, &s->iomem); +} + +static void imx_lcdif_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->desc = "i.MX LCD Controller"; +} + +static const TypeInfo imx_lcdif_info = { + .name = TYPE_IMX_LCDIF, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(IMXLCDState), + .instance_init = imx_lcdif_init, + .class_init = imx_lcdif_class_init, +}; + +static void imx_lcdif_register_type(void) +{ + type_register_static(&imx_lcdif_info); +} +type_init(imx_lcdif_register_type) diff --git a/include/hw/display/imx_lcdif.h b/include/hw/display/imx_lcdif.h new file mode 100644 index 0000000000..51985d3054 --- /dev/null +++ b/include/hw/display/imx_lcdif.h @@ -0,0 +1,16 @@ +#ifndef IMX_LCDIF_H +#define IMX_LCDIF_H + +#include "hw/sysbus.h" + +typedef struct IMXLCDState { + /*< private >*/ + SysBusDevice parent_obj; + + MemoryRegion iomem; +} IMXLCDState; + +#define TYPE_IMX_LCDIF "imx:lcdif" +#define IMX_LCDIF(obj) OBJECT_CHECK(IMXLCDState, (obj), TYPE_IMX_LCDIF) + +#endif /* IMX_LCDIF_H */