From patchwork Tue Jan 19 22:35:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 8065351 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AB6DD9F96D for ; Tue, 19 Jan 2016 22:41:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C16402052A for ; Tue, 19 Jan 2016 22:41:15 +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 874AA2045E for ; Tue, 19 Jan 2016 22:41:14 +0000 (UTC) Received: from localhost ([::1]:39494 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLexd-0006Vw-Tj for patchwork-qemu-devel@patchwork.kernel.org; Tue, 19 Jan 2016 17:41:13 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49901) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLeua-00014G-2Q for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:38:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLeuW-0003vj-RV for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:38:04 -0500 Received: from mail-bl2nam02on0071.outbound.protection.outlook.com ([104.47.38.71]:57888 helo=NAM02-BL2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLeuW-0003vY-Mk for qemu-devel@nongnu.org; Tue, 19 Jan 2016 17:38:00 -0500 Received: from BL2NAM02FT003.eop-nam02.prod.protection.outlook.com (10.152.76.59) by BL2NAM02HT190.eop-nam02.prod.protection.outlook.com (10.152.76.151) with Microsoft SMTP Server (TLS) id 15.1.355.15; Tue, 19 Jan 2016 22:37:59 +0000 Authentication-Results: spf=fail (sender IP is 149.199.60.96) smtp.mailfrom=xilinx.com; suse.de; dkim=none (message not signed) header.d=none; suse.de; 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 BL2NAM02FT003.mail.protection.outlook.com (10.152.76.204) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Tue, 19 Jan 2016 22:37:58 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:34497 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1aLeuT-0008RF-Ku; Tue, 19 Jan 2016 14:37:57 -0800 Received: from [127.0.0.1] (port=41715 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1aLeuT-0007iH-Gn; Tue, 19 Jan 2016 14:37:57 -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 u0JMWOlo015303; Tue, 19 Jan 2016 14:32:24 -0800 Received: from [172.19.74.182] (port=39734 helo=xsjalistai50.xlnx.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1aLeuS-0007iE-Om; Tue, 19 Jan 2016 14:37:56 -0800 From: Alistair Francis To: Date: Tue, 19 Jan 2016 14:35:30 -0800 Message-ID: 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/GKkVqOhzOa6g8KrST8CbRiCAg/qdzy85OtcDbdvOe8TwmBaVjWD3kQJPkk9za7m SUQV5A= X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:149.199.60.96; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(19580405001)(2351001)(92566002)(2950100001)(5008740100001)(586003)(11100500001)(77096005)(1220700001)(105606002)(33646002)(110136002)(1096002)(4326007)(6806005)(81156007)(229853001)(19580395003)(64026002)(50466002)(87936001)(48376002)(106466001)(71366001)(2906002)(5003940100001)(189998001)(36756003)(47776003)(85426001)(5003600100002)(50226001)(5001960100002)(50986999)(86362001)(118296001)(76176999)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2NAM02HT190; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; PTR:unknown-60-96.xilinx.com; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 8a125481-a3c5-427b-1704-08d321212e74 X-Exchange-Antispam-Report-Test: UriScan:; BCL:0; PCL:0; RULEID:; SRVR:BL2NAM02HT190; UriScan:(192813158149592); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13015025)(5005006)(13017025)(13023025)(13024025)(8121501046)(13018025)(520078)(3002001)(10201501046); SRVR:BL2NAM02HT190; BCL:0; PCL:0; RULEID:; SRVR:BL2NAM02HT190; X-Forefront-PRVS: 0826B2F01B X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jan 2016 22:37:58.3400 (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: BL2NAM02HT190 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.38.71 Cc: edgar.iglesias@xilinx.com, peter.maydell@linaro.org, alistair.francis@xilinx.com, crosthwaitepeter@gmail.com, edgar.iglesias@gmail.com, afaerber@suse.de Subject: [Qemu-devel] [PATCH v2 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 d4765c2..6e01250 100644 --- a/hw/misc/Makefile.objs +++ b/hw/misc/Makefile.objs @@ -39,6 +39,7 @@ obj-$(CONFIG_OMAP) += omap_tap.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]; +};