From patchwork Sat Jan 30 01:01:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 8169231 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 E6226BEEE5 for ; Sat, 30 Jan 2016 01:06:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03D9C2038D for ; Sat, 30 Jan 2016 01:06:09 +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 E20B320381 for ; Sat, 30 Jan 2016 01:06:07 +0000 (UTC) Received: from localhost ([::1]:37206 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPJzL-0000a8-5o for patchwork-qemu-devel@patchwork.kernel.org; Fri, 29 Jan 2016 20:06:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55204) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPJxK-0005Rk-UL for qemu-devel@nongnu.org; Fri, 29 Jan 2016 20:04:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aPJxF-0008BI-Tp for qemu-devel@nongnu.org; Fri, 29 Jan 2016 20:04:02 -0500 Received: from mail-sn1nam02on0070.outbound.protection.outlook.com ([104.47.36.70]:57449 helo=NAM02-SN1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aPJxF-0008Ap-O1 for qemu-devel@nongnu.org; Fri, 29 Jan 2016 20:03:57 -0500 Received: from SN1NAM02FT051.eop-nam02.prod.protection.outlook.com (10.152.72.51) by SN1NAM02HT240.eop-nam02.prod.protection.outlook.com (10.152.72.185) with Microsoft SMTP Server (TLS) id 15.1.355.15; Sat, 30 Jan 2016 01:03:55 +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 SN1NAM02FT051.mail.protection.outlook.com (10.152.73.103) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Sat, 30 Jan 2016 01:03:55 +0000 Received: from 172-16-1-203.xilinx.com ([172.16.1.203]:45535 helo=xsj-tvapsmtp02.xilinx.com) by xsj-tvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1aPJxC-0002Nx-Pr; Fri, 29 Jan 2016 17:03:54 -0800 Received: from [127.0.0.1] (port=52754 helo=tsj-smtp-dlp1.xlnx.xilinx.com) by xsj-tvapsmtp02.xilinx.com with esmtp (Exim 4.63) (envelope-from ) id 1aPJxC-0002v9-Lr; Fri, 29 Jan 2016 17:03:54 -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 u0U0wHB3022113; Fri, 29 Jan 2016 16:58:18 -0800 Received: from [172.19.74.182] (port=50000 helo=xsjalistai50.xlnx.xilinx.com) by xsj-tvapsmtp02 with esmtp (Exim 4.63) (envelope-from ) id 1aPJxB-0002v6-RC; Fri, 29 Jan 2016 17:03:53 -0800 From: Alistair Francis To: , , Date: Fri, 29 Jan 2016 17:01:18 -0800 Message-ID: <6d2f570bf004bc93fc9170634ffcce1f1bad692b.1454115217.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/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)(189002)(199003)(2201001)(4326007)(5003600100002)(92566002)(76176999)(33646002)(19580395003)(118296001)(48376002)(86362001)(2906002)(50226001)(87936001)(11100500001)(189998001)(47776003)(36756003)(5003940100001)(6806005)(50466002)(5001960100002)(1220700001)(2950100001)(106466001)(105606002)(229853001)(19580405001)(3470700001)(5001770100001)(77096005)(1096002)(64026002)(85426001)(50986999)(586003)(5008740100001)(71366001)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1NAM02HT240; H:xsj-tvapsmtpgw01; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e7b730e4-a7a8-4edd-5b24-08d329113a44 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1NAM02HT240; X-Microsoft-Antispam-PRVS: <389e4ea06dbd48ce825e6d8c86e5bf74@SN1NAM02HT240.eop-nam02.prod.protection.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13018025)(13017025)(13015025)(8121501046)(13024025)(13023025)(5005006)(3002001)(10201501046); SRVR:SN1NAM02HT240; BCL:0; PCL:0; RULEID:; SRVR:SN1NAM02HT240; X-Forefront-PRVS: 083751FCA6 X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2016 01:03:55.4988 (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: SN1NAM02HT240 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.36.70 Cc: edgar.iglesias@xilinx.com, edgar.iglesias@gmail.com, crosthwaitepeter@gmail.com, afaerber@suse.de, alistair.francis@xilinx.com Subject: [Qemu-devel] [PATCH v3 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]; +};