From patchwork Wed Feb 28 22:32:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 10250049 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 0E0FE60212 for ; Wed, 28 Feb 2018 22:38:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E922B28C1D for ; Wed, 28 Feb 2018 22:38:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDAF828C3A; Wed, 28 Feb 2018 22:38:29 +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=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, 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 0693528C1B for ; Wed, 28 Feb 2018 22:38:28 +0000 (UTC) Received: from localhost ([::1]:47430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erAMl-00025C-Fz for patchwork-qemu-devel@patchwork.kernel.org; Wed, 28 Feb 2018 17:38:27 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1erALH-0000pM-VN for qemu-devel@nongnu.org; Wed, 28 Feb 2018 17:36:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1erALF-0008Mp-Ub for qemu-devel@nongnu.org; Wed, 28 Feb 2018 17:36:55 -0500 Received: from mail-cys01nam02on060d.outbound.protection.outlook.com ([2a01:111:f400:fe45::60d]:61645 helo=NAM02-CY1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1erALF-0008Ky-9Q for qemu-devel@nongnu.org; Wed, 28 Feb 2018 17:36:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=1Y9kx/xz8L8zQqsjDtucGbEWqLt6S7AyPffF6xfninc=; b=37sGWL3w+yodcBesUayWdNsIslmKv4LqAQraJEIsdrRRPd6sWCvLDkEL7Z60/L51r95wiqLRLoR5jPZfZ0l5feE9TcZYGp/37a+hp0QAZYgpIOQqqoprYRK14mZ5t9Rf7rwIAm0fohPgvXVP7RpL8ZjcN+IIUg3XgXQ5USpiBOE= Received: from SN4PR0201CA0014.namprd02.prod.outlook.com (2603:10b6:803:2b::24) by MWHPR02MB2272.namprd02.prod.outlook.com (2603:10b6:300:5b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.527.15; Wed, 28 Feb 2018 22:36:50 +0000 Received: from SN1NAM02FT018.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::203) by SN4PR0201CA0014.outlook.office365.com (2603:10b6:803:2b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.527.15 via Frontend Transport; Wed, 28 Feb 2018 22:36:50 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.100) smtp.mailfrom=xilinx.com; gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.100 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.100; helo=xsj-pvapsmtpgw02; Received: from xsj-pvapsmtpgw02 (149.199.60.100) by SN1NAM02FT018.mail.protection.outlook.com (10.152.72.122) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.527.18 via Frontend Transport; Wed, 28 Feb 2018 22:36:50 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66]:56046 helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw02 with esmtp (Exim 4.63) (envelope-from ) id 1erALB-0003OM-MO; Wed, 28 Feb 2018 14:36:49 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1erALB-0005pS-Jz; Wed, 28 Feb 2018 14:36:49 -0800 Received: from xsj-pvapsmtp01 (maildrop.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id w1SMal1b003549; Wed, 28 Feb 2018 14:36:47 -0800 Received: from [172.19.2.220] (helo=xsjalistai50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1erAL8-0005ol-UD; Wed, 28 Feb 2018 14:36:46 -0800 From: Alistair Francis To: , , Date: Wed, 28 Feb 2018 14:32:08 -0800 Message-ID: <938a6b79c658dcdba39ed5b7f5a36806b25b655f.1519856998.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.2.0.1013-23620.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.100; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(39860400002)(376002)(396003)(346002)(39380400002)(2980300002)(438002)(189003)(199004)(48376002)(36386004)(4326008)(50466002)(478600001)(39060400002)(2906002)(356003)(118296001)(305945005)(76176011)(7696005)(51416003)(47776003)(36756003)(63266004)(5660300001)(9786002)(8676002)(81156014)(81166006)(50226002)(8936002)(16586007)(316002)(575784001)(110136005)(54906003)(2201001)(2950100002)(106466001)(186003)(106002)(77096007)(6666003)(336011)(26005)(107986001)(5001870100001)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR02MB2272; H:xsj-pvapsmtpgw02; FPR:; SPF:Pass; PTR:xapps1.xilinx.com,unknown-60-100.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT018; 1:6djvH1yqELVKIMqEBB1eOs6QtfpCJU7rBXIKuyPBm5QhJMF+DyCgye9qSYCFFcnsNKm14dpRdN6KLnYK9LQFQL9/dF56POxKwEyatgCzLRR3ktYVH22eEtTQ/8Fm1tSl MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6a4ee1b4-4d7d-4660-0d3e-08d57efbc283 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(4534165)(4627221)(201703031133081)(201702281549075)(5600026)(4604075)(4608076)(2017052603307)(7153060); SRVR:MWHPR02MB2272; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB2272; 3:DshUPSS7MT5CED4sGvguMI8VX5skX6wxFqoJyzr7Q3blUNs6zBsgJkxap//rZW357bFXxponqlUoTq6S2KHIdQkUlzwpmc89lIXp9fHy2cjZdLQISzPPdhU+lbA+OaP4JnlrwJ/fwPn83T08nodakUPyHhlwnQp5JexdDZbeuhyAkdiFsBO8J+WnJose+BDXjGKBxy2EMAKIrMxAIODy7sQ15Mkjyga/qbvL/9o6m/nJEo8d6eUwMdS7arM9Zrd6I0Npp1gwp1O7mp3+qWqt8wYzNinoy4oKXUC/g4AHnfPXLJSmY+nyQXuOiqNSprIvqnIgogozu9cINVxo8R2v6U5qX3LcscB368Ufk8CenwE=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T2aHFj+elb1mKJoK5ZbqrN2Jjt8FSpEssi9AhhziB1yIjNmfSl7pp7LAVdGub6b6xG/bdrIuCILv5y7dRp+pN3gPohyxIiBEZKewSH X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040501)(2401047)(8121501046)(5005006)(10201501046)(93006095)(93004095)(3231220)(944501220)(52105095)(3002001)(6055026)(6041288)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123560045)(6072148)(201708071742011); SRVR:MWHPR02MB2272; BCL:0; PCL:0; RULEID:; SRVR:MWHPR02MB2272; X-Microsoft-Exchange-Diagnostics: 1; MWHPR02MB2272; 4:2Qktbe8dzDPt39Kx1TjatsOzy7UuixNNrzpMXBLzew4I1o8YknTX4H8SDnBapVL4gzt8MEZkpp0/VWhl3e3W9bkFpwyxxeSQcEjHJveSZ1FWl2KTlKCQ1Y9+G4uFb3ywgj+u64y/O253Ex/4m+7z2x6aERjvgYvq+DIro1F/wrpCDip0o2V0lQoKrAjB6t05p62U5bHLCZsR3R3vAb28nhbs+4blvLRJKB3T8xzUS7R6mOziClAPTZTr+O5zKDvQ332Ufu5bhj9DWU5N5SrDPROcI9ZJxYWcUJxldyxONjfIZXjuXi4ZVvBloCaAytO2OCLlAZKX2MDriLg54UbCfv8lfItcGBn1lEuiXjq5ikE= X-Forefront-PRVS: 0597911EE1 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR02MB2272; 23:rR1zzxZIWLI498a1sQYg0K05jirId3sISzK3Dmj33?= =?us-ascii?Q?Cf0jI/yxcruVQwQ4PJ3Br/VnyCMTpYjF27d0KQliuQT8KE76n2J31bfQ64b3?= =?us-ascii?Q?QHC611yntSCH6i2+DRGNe0EnNVYOdgwR344khi0x1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luIY8dtCjS+z+lQKQNVN9MsucKdZSl3QnABAfbM SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Feb 2018 22:36:50.4302 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a4ee1b4-4d7d-4660-0d3e-08d57efbc283 X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.100]; Helo=[xsj-pvapsmtpgw02] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR02MB2272 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe45::60d Subject: [Qemu-devel] [PATCH v2 5/5] xlnx-zynqmp-pmu: Connect the IOMOD GPI/GPO devices 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: alistair23@gmail.com, alistair.francis@xilinx.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Alistair Francis Reviewed-by: Philippe Mathieu-Daudé --- hw/microblaze/xlnx-zynqmp-pmu.c | 77 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 75 insertions(+), 2 deletions(-) diff --git a/hw/microblaze/xlnx-zynqmp-pmu.c b/hw/microblaze/xlnx-zynqmp-pmu.c index 35a2314ffb..fa5f0bfcf1 100644 --- a/hw/microblaze/xlnx-zynqmp-pmu.c +++ b/hw/microblaze/xlnx-zynqmp-pmu.c @@ -27,6 +27,7 @@ #include "hw/intc/xlnx-zynqmp-ipi.h" #include "hw/intc/xlnx-pmu-iomod-intc.h" #include "hw/timer/xlnx-pmu-iomod-pit.h" +#include "hw/gpio/xlnx-pmu-iomod-gp.h" /* Define the PMU device */ @@ -43,6 +44,9 @@ #define XLNX_ZYNQMP_PMU_NUM_IPIS 4 #define XLNX_ZYNQMP_PMU_NUM_PITS 4 +#define XLNX_ZYNQMP_PMU_NUM_IOMOD_GPIS 4 +#define XLNX_ZYNQMP_PMU_NUM_IOMOD_GPOS 4 + static const uint64_t ipi_addr[XLNX_ZYNQMP_PMU_NUM_IPIS] = { 0xFF340000, 0xFF350000, 0xFF360000, 0xFF370000, }; @@ -57,6 +61,17 @@ static const uint64_t pit_irq[XLNX_ZYNQMP_PMU_NUM_PITS] = { 3, 4, 5, 6, }; +static const uint64_t iomod_gpi_addr[XLNX_ZYNQMP_PMU_NUM_IOMOD_GPIS] = { + 0xFFD40020, 0xFFD40024, 0xFFD40028, 0xFFD4002C, +}; +static const uint64_t iomod_gpi_irq[XLNX_ZYNQMP_PMU_NUM_IOMOD_GPIS] = { + 11, 12, 13, 14, +}; + +static const uint64_t iomod_gpo_addr[XLNX_ZYNQMP_PMU_NUM_IOMOD_GPOS] = { + 0xFFD40010, 0xFFD40014, 0xFFD40018, 0xFFD4001C, +}; + typedef struct XlnxZynqMPPMUSoCState { /*< private >*/ DeviceState parent_obj; @@ -156,6 +171,8 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine) MemoryRegion *pmu_rom = g_new(MemoryRegion, 1); MemoryRegion *pmu_ram = g_new(MemoryRegion, 1); XlnxZynqMPIPI *ipi[XLNX_ZYNQMP_PMU_NUM_IPIS]; + XlnxPMUIOGPIO *iomod_gpi[XLNX_ZYNQMP_PMU_NUM_IOMOD_GPIS]; + XlnxPMUIOGPIO *iomod_gpo[XLNX_ZYNQMP_PMU_NUM_IOMOD_GPOS]; XlnxPMUPIT *pit[XLNX_ZYNQMP_PMU_NUM_PITS]; qemu_irq irq[32]; qemu_irq tmp_irq; @@ -197,10 +214,60 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine) sysbus_connect_irq(SYS_BUS_DEVICE(ipi[i]), 0, irq[ipi_irq[i]]); } + /* Create and connect the IOMOD GPI device */ + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IOMOD_GPIS; i++) { + iomod_gpi[i] = g_new0(XlnxPMUIOGPIO, 1); + object_initialize(iomod_gpi[i], sizeof(XlnxPMUIOGPIO), + TYPE_XLNX_ZYNQMP_IOMOD_GPIO); + qdev_set_parent_bus(DEVICE(iomod_gpi[i]), sysbus_get_default()); + } + + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IOMOD_GPIS; i++) { + object_property_set_bool(OBJECT(iomod_gpi[i]), true, "input", + &error_abort); + object_property_set_uint(OBJECT(iomod_gpi[i]), 0x20, "size", + &error_abort); + object_property_set_bool(OBJECT(iomod_gpi[i]), true, "realized", + &error_abort); + sysbus_mmio_map(SYS_BUS_DEVICE(iomod_gpi[i]), 0, iomod_gpi_addr[i]); + sysbus_connect_irq(SYS_BUS_DEVICE(iomod_gpi[i]), 0, + irq[iomod_gpi_irq[i]]); + /* The other GPIO lines connect to the ARM side of the SoC. When we + * have a way to model MicroBlaze QEMU and ARM QEMU together we can + * connect the GPIO lines. + */ + } + + /* Create and connect the IOMOD GPO device */ + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IOMOD_GPOS; i++) { + iomod_gpo[i] = g_new0(XlnxPMUIOGPIO, 1); + object_initialize(iomod_gpo[i], sizeof(XlnxPMUIOGPIO), + TYPE_XLNX_ZYNQMP_IOMOD_GPIO); + qdev_set_parent_bus(DEVICE(iomod_gpo[i]), sysbus_get_default()); + } + + for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_IOMOD_GPOS; i++) { + object_property_set_bool(OBJECT(iomod_gpo[i]), false, "input", + &error_abort); + if (i) { + object_property_set_uint(OBJECT(iomod_gpo[i]), 0x20, "size", + &error_abort); + } else { + object_property_set_uint(OBJECT(iomod_gpo[i]), 0x09, "size", + &error_abort); + } + object_property_set_uint(OBJECT(iomod_gpo[i]), 0x00, "gpo-init", + &error_abort); + object_property_set_bool(OBJECT(iomod_gpo[i]), true, "realized", + &error_abort); + sysbus_mmio_map(SYS_BUS_DEVICE(iomod_gpo[i]), 0, iomod_gpo_addr[i]); + } + /* Create and connect the IOMOD PIT devices */ for (i = 0; i < XLNX_ZYNQMP_PMU_NUM_PITS; i++) { pit[i] = g_new0(XlnxPMUPIT, 1); - object_initialize(pit[i], sizeof(XlnxPMUPIT), TYPE_XLNX_ZYNQMP_IOMODULE_PIT); + object_initialize(pit[i], sizeof(XlnxPMUPIT), + TYPE_XLNX_ZYNQMP_IOMODULE_PIT); qdev_set_parent_bus(DEVICE(pit[i]), sysbus_get_default()); } @@ -219,7 +286,13 @@ static void xlnx_zynqmp_pmu_init(MachineState *machine) tmp_irq = qdev_get_gpio_in_named(DEVICE(pit[2]), "ps_hit_in", 0); qdev_connect_gpio_out_named(DEVICE(pit[3]), "ps_hit_out", 0, tmp_irq); - /* TODO: PIT0 and PIT2 "ps_config" GPIO goes to The GPO1 device. */ + /* GP01 goes into PIT0 */ + tmp_irq = qdev_get_gpio_in_named(DEVICE(pit[0]), "ps_config", 0); + qdev_connect_gpio_out(DEVICE(iomod_gpo[1]), 2, tmp_irq); + + /* GP01 goes into PIT2 */ + tmp_irq = qdev_get_gpio_in_named(DEVICE(pit[2]), "ps_config", 0); + qdev_connect_gpio_out(DEVICE(iomod_gpo[1]), 6, tmp_irq); /* Load the kernel */ microblaze_load_kernel(&pmu->cpu, XLNX_ZYNQMP_PMU_RAM_ADDR,