From patchwork Tue Feb 9 22:15:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 8266141 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 669F5BEEE5 for ; Tue, 9 Feb 2016 22:24:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 81CEE2022D for ; Tue, 9 Feb 2016 22:24:55 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id 7149720218 for ; Tue, 9 Feb 2016 22:24:54 +0000 (UTC) Received: from localhost ([::1]:33000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTGiL-0006kz-QY for patchwork-qemu-devel@patchwork.kernel.org; Tue, 09 Feb 2016 17:24:53 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTGbc-0004LN-9t for qemu-devel@nongnu.org; Tue, 09 Feb 2016 17:17:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTGbX-0001Ct-Fg for qemu-devel@nongnu.org; Tue, 09 Feb 2016 17:17:56 -0500 Received: from mail-bl2nam02on0041.outbound.protection.outlook.com ([104.47.38.41]:4659 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTGbX-0001CX-As for qemu-devel@nongnu.org; Tue, 09 Feb 2016 17:17:51 -0500 Received: from BL2NAM02FT060.eop-nam02.prod.protection.outlook.com (10.152.76.51) by BL2NAM02HT241.eop-nam02.prod.protection.outlook.com (10.152.76.218) with Microsoft SMTP Server (TLS) id 15.1.409.7; Tue, 9 Feb 2016 22:17:49 +0000 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=xilinx.com; linaro.org; dkim=none (message not signed) header.d=none; linaro.org; dmarc=none action=none header.from=xilinx.com; Received-SPF: Fail (protection.outlook.com: domain of xilinx.com does not designate 149.199.60.96 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.96; helo=xsj-tvapsmtpgw01; Received: from xsj-tvapsmtpgw01 (149.199.60.96) by BL2NAM02FT060.mail.protection.outlook.com (10.152.76.124) with Microsoft SMTP Server (TLS) id 15.1.409.7 via Frontend Transport; Tue, 9 Feb 2016 22:17:49 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:35466 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1aTGbU-0002n1-Ps; Tue, 09 Feb 2016 14:17:48 -0800 Received: from [127.0.0.1] (port=42685 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1aTGbU-0007cu-KO; Tue, 09 Feb 2016 14:17:48 -0800 Received: from xsj-tvapsmtp02 (xsj-tvapsmtp02.xilinx.com [172.16.1.203]) by tsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id u19MC8Om011653; Tue, 9 Feb 2016 14:12:08 -0800 Received: from [172.19.74.182] (port=49740 helo=xsjalistai50.xlnx.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1aTGbT-0007cr-Pb; Tue, 09 Feb 2016 14:17:47 -0800 From: Alistair Francis To: , Date: Tue, 9 Feb 2016 14:15:12 -0800 Message-ID: <16b5818831c705479a32a2f6a72deb7a140b413e.1455055858.git.alistair.francis@xilinx.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-MML: disable X-TM-AS-Product-Ver: IMSS-7.1.0.1679-8.0.0.1202-22054.006 X-TM-AS-Result: No--14.359-7.0-31-10 X-imss-scan-details: No--14.359-7.0-31-10 X-TMASE-MatchedRID: Is2GNMrStgUdLPf4wYvhgfnCl+sgkNd7/3SuiWnIBLsvM0Gdq0fzqSvR mSs3bLLrtlzui8kfp9+gGOZ3m2LY59UMAwTDOBnsyeVujmXuYYWbehqUVUiCs5wsUqEjZnPrMra J67wznLF/bbuVYO8sq8UupOCgZGwrMFOP0oNW5ntLxLYX2WS874TqWr4ruO2HIXhictBPoqv6WY 1kIqgZYRt7CSgcXvDxKAJ2mIeXy58eh2nHejoauzCIlN/eSPB9wLlnHU0okA1K1m2DIZ1cs0tAX M9SV3yZg+kZP0QrlEONfRPX9m9ebaw41/zmBTg0JXKk/roE/RBeu73mFK6GNJ0j8OKRnVQ8Aitv bsFmgfKTDejSiSYPEngzl+/kA+7LIaVPgU+koVEZexXWjVVC3ArefVId6fzVvDa284z78yfppfx NgiuPW9icCqxSCM5RHX4qwBWZhmKt6MuPUarmUV4SsF49N47AM9g+YfdqJKFcqp+TPafLLqPFjJ EFr+olwXCBO/GKkVqOhzOa6g8KrRinLA9UtT/l1MAf99MqUx05IdylduVVZB8sNYdHLFBlyKaLt vGPajk= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.96; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(2950100001)(6806005)(1220700001)(11100500001)(5008740100001)(87936001)(5003940100001)(105606002)(47776003)(5003600100002)(2906002)(1096002)(50226001)(118296001)(36756003)(5001960100002)(106466001)(77096005)(92566002)(48376002)(4326007)(189998001)(19580405001)(50986999)(586003)(64026002)(229853001)(33646002)(76176999)(50466002)(86362001)(85426001)(5001770100001)(19580395003)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2NAM02HT241; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: af5bbdab-ebb6-4d8a-86fe-08d3319ed8a8 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BL2NAM02HT241; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13023025)(13015025)(5005006)(8121501046)(13024025)(13017025)(10201501046)(3002001); SRVR:BL2NAM02HT241; BCL:0; PCL:0; RULEID:; SRVR:BL2NAM02HT241; X-Forefront-PRVS: 08476BC6EF X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Feb 2016 22:17:49.5607 (UTC) 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.96]; Helo=[xsj-tvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2NAM02HT241 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.41 Cc: edgar.iglesias@xilinx.com, alistair.francis@xilinx.com, crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com, alex.bennee@linaro.org, afaerber@suse.de, fred.konrad@greensocs.com Subject: [Qemu-devel] [PATCH v4 15/16] misc: Introduce ZynqMP IOU SLCR X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Crosthwaite IOU = I/O Unit SLCR = System Level Control Registers This IP is a misc collections of control registers that switch various properties of system IPs. Currently the only thing implemented is the SD_SLOTTYPE control (implemented as a GPIO output). Signed-off-by: Peter Crosthwaite Signed-off-by: Alistair Francis --- hw/misc/Makefile.objs | 1 + hw/misc/xlnx-zynqmp-iou-slcr.c | 113 +++++++++++++++++++++++++++++++++ include/hw/misc/xlnx-zynqmp-iou-slcr.h | 47 ++++++++++++++ 3 files changed, 161 insertions(+) create mode 100644 hw/misc/xlnx-zynqmp-iou-slcr.c create mode 100644 include/hw/misc/xlnx-zynqmp-iou-slcr.h diff --git a/hw/misc/Makefile.objs b/hw/misc/Makefile.objs index ea6cd3c..eef3e40 100644 --- a/hw/misc/Makefile.objs +++ b/hw/misc/Makefile.objs @@ -41,6 +41,7 @@ obj-$(CONFIG_RASPI) += bcm2835_property.o obj-$(CONFIG_SLAVIO) += slavio_misc.o obj-$(CONFIG_ZYNQ) += zynq_slcr.o obj-$(CONFIG_ZYNQ) += zynq-xadc.o +obj-$(CONFIG_ZYNQ) += xlnx-zynqmp-iou-slcr.o obj-$(CONFIG_STM32F2XX_SYSCFG) += stm32f2xx_syscfg.o obj-$(CONFIG_PVPANIC) += pvpanic.o diff --git a/hw/misc/xlnx-zynqmp-iou-slcr.c b/hw/misc/xlnx-zynqmp-iou-slcr.c new file mode 100644 index 0000000..35b989c --- /dev/null +++ b/hw/misc/xlnx-zynqmp-iou-slcr.c @@ -0,0 +1,113 @@ +/* + * Xilinx ZynqMP IOU System Level Control Registers (SLCR) + * + * Copyright (c) 2013 Xilinx Inc + * Copyright (c) 2013 Peter Crosthwaite + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "hw/misc/xlnx-zynqmp-iou-slcr.h" + +#ifndef XLNX_ZYNQMP_IOU_SLCR_ERR_DEBUG +#define XLNX_ZYNQMP_IOU_SLCR_ERR_DEBUG 0 +#endif + +REG32(SD_SLOTTYPE, 0x310) + #define R_SD_SLOTTYPE_RSVD 0xffff7ffe + +static const RegisterAccessInfo xlnx_zynqmp_iou_slcr_regs_info[] = { + { .name = "SD Slot TYPE", .decode.addr = A_SD_SLOTTYPE, + .rsvd = R_SD_SLOTTYPE_RSVD, + .gpios = (RegisterGPIOMapping []) { + { .name = "SD0_SLOTTYPE", .bit_pos = 0 }, + { .name = "SD1_SLOTTYPE", .bit_pos = 15 }, + {}, + } + } + /* FIXME: Complete device model */ +}; + +static void xlnx_zynqmp_iou_slcr_reset(DeviceState *dev) +{ + XlnxZynqMPIOUSLCR *s = XLNX_ZYNQMP_IOU_SLCR(dev); + int i; + + for (i = 0; i < XLNX_ZYNQ_MP_IOU_SLCR_R_MAX; ++i) { + register_reset(&s->regs_info[i]); + } +} + +static const MemoryRegionOps xlnx_zynqmp_iou_slcr_ops = { + .read = register_read_memory_le, + .write = register_write_memory_le, + .endianness = DEVICE_LITTLE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 4, + } +}; + +static void xlnx_zynqmp_iou_slcr_init(Object *obj) +{ + XlnxZynqMPIOUSLCR *s = XLNX_ZYNQMP_IOU_SLCR(obj); + + memory_region_init(&s->iomem, obj, "MMIO", XLNX_ZYNQ_MP_IOU_SLCR_R_MAX * 4); + register_init_block32(DEVICE(obj), xlnx_zynqmp_iou_slcr_regs_info, + ARRAY_SIZE(xlnx_zynqmp_iou_slcr_regs_info), + s->regs_info, s->regs, &s->iomem, + &xlnx_zynqmp_iou_slcr_ops, + XLNX_ZYNQMP_IOU_SLCR_ERR_DEBUG); + sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); +} + +static const VMStateDescription vmstate_xlnx_zynqmp_iou_slcr = { + .name = "xlnx_zynqmp_iou_slcr", + .version_id = 1, + .minimum_version_id = 1, + .minimum_version_id_old = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32_ARRAY(regs, XlnxZynqMPIOUSLCR, + XLNX_ZYNQ_MP_IOU_SLCR_R_MAX), + VMSTATE_END_OF_LIST(), + } +}; + +static void xlnx_zynqmp_iou_slcr_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->reset = xlnx_zynqmp_iou_slcr_reset; + dc->vmsd = &vmstate_xlnx_zynqmp_iou_slcr; +} + +static const TypeInfo xlnx_zynqmp_iou_slcr_info = { + .name = TYPE_XLNX_ZYNQMP_IOU_SLCR, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(XlnxZynqMPIOUSLCR), + .class_init = xlnx_zynqmp_iou_slcr_class_init, + .instance_init = xlnx_zynqmp_iou_slcr_init, +}; + +static void xlnx_zynqmp_iou_slcr_register_types(void) +{ + type_register_static(&xlnx_zynqmp_iou_slcr_info); +} + +type_init(xlnx_zynqmp_iou_slcr_register_types) diff --git a/include/hw/misc/xlnx-zynqmp-iou-slcr.h b/include/hw/misc/xlnx-zynqmp-iou-slcr.h new file mode 100644 index 0000000..1a3f7e9 --- /dev/null +++ b/include/hw/misc/xlnx-zynqmp-iou-slcr.h @@ -0,0 +1,47 @@ +/* + * Xilinx ZynqMP IOU system level control registers (SLCR) + * + * Copyright (c) 2013 Xilinx Inc + * Copyright (c) 2013 Peter Crosthwaite + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +#include "hw/sysbus.h" +#include "hw/register.h" + +#define TYPE_XLNX_ZYNQMP_IOU_SLCR "xlnx_zynqmp-iou-slcr" + +#define XLNX_ZYNQMP_IOU_SLCR(obj) \ + OBJECT_CHECK(XlnxZynqMPIOUSLCR, (obj), TYPE_XLNX_ZYNQMP_IOU_SLCR) + +#define XLNX_ZYNQ_MP_IOU_SLCR_R_MAX (0x314/4) + +typedef struct XlnxZynqMPIOUSLCR XlnxZynqMPIOUSLCR; + +struct XlnxZynqMPIOUSLCR { + /*< private >*/ + SysBusDevice busdev; + + /*< public >*/ + MemoryRegion iomem; + + uint32_t regs[XLNX_ZYNQ_MP_IOU_SLCR_R_MAX]; + RegisterInfo regs_info[XLNX_ZYNQ_MP_IOU_SLCR_R_MAX]; +};