From patchwork Fri Jan 29 11:00:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 373322 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp2105500jam; Fri, 29 Jan 2021 03:28:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcJCeJgRfUHkjEfCExqTmmGbXOYppH2gN5P58KQCBjSYHMaPrLk6Anfk1BWubuoY45/pJt X-Received: by 2002:a25:738d:: with SMTP id o135mr5395691ybc.303.1611919698086; Fri, 29 Jan 2021 03:28:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611919698; cv=none; d=google.com; s=arc-20160816; b=LaZ32pNXHttGWTGezy8bhaURrRKVP5M/TKJ2rbodHXNNDbeXui4T/8+gcXkwIOk/uk OOAyHDOj0d5bwIGZkNCIeA3331ypmLi7ZiwpRn1vWYNWl6bC69m3FX2QBmr2FOtW1afH LykiJS7JOxlFtjvfP5hBUkgE/fHOFcGYd1qQlDKhRdCifxG0Fv42+lqT4icv8/I5IfDq PJa+H9RWXAixflwpejqBSYVY6KZx7sDTw65CfCpuUmc6qu7FaRrD2dIR+FplI2OHuExl 6eNz2QTea1HeLpW1ef1tbzgoIb77LRw7qJvM82Yj5iSHhqPiG74zL8uQRARl9nSNvFkR PsGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=CihYkdqAOfQwaocMGopB4Hac7Q9aRPC7UvcMr3MNgrY=; b=pSQ/7REI56j/NUkZOAK9M3s7+bopaYLmgBNNiXVnrPymabJs2z9GWZIozeL7CMgFQE L6JrGrVhy/Wwp3or5oU0Uu8wohe2Co0p+ss4+SsPaP3foIG7Twj78CZP40GWaf7IB3g4 kLrGDsGOMoi0L6+LnSqMDvHJhl4pmPoX3piOE091kgq9d4fNWTzlDsdESwQJn9ylt1bR W9H7HkZUDyn2JGuacSKvdfUxReSkTxELsz4p12aRTTlqwsaaDoREDSQUhpQzjJC/+1Se SnHkhFxm7zSjSxwHLyrWu0eFeKgiaY7LCguCQnvPVgC3J5MY++vhiN3QaCVSpXIqj8qX h8YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nEMnfzDn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x63si7461789ybh.326.2021.01.29.03.28.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 29 Jan 2021 03:28:18 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=nEMnfzDn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:36228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l5Rwn-0007qV-IO for patch@linaro.org; Fri, 29 Jan 2021 06:28:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l5RWK-00052l-Vr for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:57 -0500 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:43312) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l5RWB-000777-OL for qemu-devel@nongnu.org; Fri, 29 Jan 2021 06:00:56 -0500 Received: by mail-wr1-x429.google.com with SMTP id z6so8340420wrq.10 for ; Fri, 29 Jan 2021 03:00:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=CihYkdqAOfQwaocMGopB4Hac7Q9aRPC7UvcMr3MNgrY=; b=nEMnfzDnSh5bMnZ/bFq6ijVHflKOR2UyHnKSYZDh7aoIitgAqGuQFg6A3JevFJFd1h iC61HByDuwjDtUS0cplY/ca5hKoXi2wcZ5imZpCD5oJKUPtPYwZwB8euXLl7VHGrtRDm 4FQbes0fQroiNRpsnNotnc/1BAszVbrHm2wZ4x05UeVH+jVtau8hzDzx/Eg5BnM5+m0N C+qv4aucXGI8EHuY9rfj1eAlHNGRHHndO/jnFecx7lZXpl8TjxTmXPm/J0pEUjeeNzjG QbOix6BTL3s58KPF31okKYSf185vul/5o217gONOqcmNU+m2O1ioP1Kbb/l4jU7suHY0 fetw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CihYkdqAOfQwaocMGopB4Hac7Q9aRPC7UvcMr3MNgrY=; b=Homh4ieQZZqBu8dzVx2nA4aqmmvcQryWvF+3kb4d82aAjB/cDejox/oh1K3OqxCAlK qPbRDE1s/WmYv7qB29T8idWlzA1tOVHwihZup/jW4Opj36AI+RTpszhrTkMqN9Ztd67M gOS8+/Bwwh7Oo3uuBhE6f8MsNosH+bwacdkfVs5sDf7iui8js8B4qlzA4reKOJcIJiYe Gxtu587k01UQrGGwDXVCJvLZlFMfVk/Nls9zAUw0uXvmlb6tJ8fQXJOYwAVpzWUnmyJ/ Egx2OTyaK98D0xKMb1bWEmGuH7+07x5exIukfJ0DQLElmoDfUSszypcQrP5xC20uIoUp kPvQ== X-Gm-Message-State: AOAM531s7LPGPKr5WNLYxEECsLGiXeVWA/+0ScLuoIgBKI5kGlALSdWb kqR3G7K9ZLtoeE9ZvAFMXuZewqF9Xwd5EQ== X-Received: by 2002:adf:e80f:: with SMTP id o15mr3875134wrm.366.1611918046339; Fri, 29 Jan 2021 03:00:46 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id w20sm9268761wmm.12.2021.01.29.03.00.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Jan 2021 03:00:45 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 35/46] hw/arm/mps2-tz: Create and connect ARMSSE Clocks Date: Fri, 29 Jan 2021 11:00:01 +0000 Message-Id: <20210129110012.8660-36-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210129110012.8660-1-peter.maydell@linaro.org> References: <20210129110012.8660-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Create and connect the two clocks needed by the ARMSSE. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Luc Michel Tested-by: Philippe Mathieu-Daudé Message-id: 20210128114145.20536-15-peter.maydell@linaro.org Message-id: 20210121190622.22000-15-peter.maydell@linaro.org --- hw/arm/mps2-tz.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 2.20.1 diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c index 6a9eed9022a..7acdf490f28 100644 --- a/hw/arm/mps2-tz.c +++ b/hw/arm/mps2-tz.c @@ -62,6 +62,7 @@ #include "hw/net/lan9118.h" #include "net/net.h" #include "hw/core/split-irq.h" +#include "hw/qdev-clock.h" #include "qom/object.h" #define MPS2TZ_NUMIRQ 92 @@ -100,6 +101,8 @@ struct MPS2TZMachineState { qemu_or_irq uart_irq_orgate; DeviceState *lan9118; SplitIRQ cpu_irq_splitter[MPS2TZ_NUMIRQ]; + Clock *sysclk; + Clock *s32kclk; }; #define TYPE_MPS2TZ_MACHINE "mps2tz" @@ -110,6 +113,8 @@ OBJECT_DECLARE_TYPE(MPS2TZMachineState, MPS2TZMachineClass, MPS2TZ_MACHINE) /* Main SYSCLK frequency in Hz */ #define SYSCLK_FRQ 20000000 +/* Slow 32Khz S32KCLK frequency in Hz */ +#define S32KCLK_FRQ (32 * 1000) /* Create an alias of an entire original MemoryRegion @orig * located at @base in the memory map. @@ -396,6 +401,12 @@ static void mps2tz_common_init(MachineState *machine) exit(EXIT_FAILURE); } + /* These clocks don't need migration because they are fixed-frequency */ + mms->sysclk = clock_new(OBJECT(machine), "SYSCLK"); + clock_set_hz(mms->sysclk, SYSCLK_FRQ); + mms->s32kclk = clock_new(OBJECT(machine), "S32KCLK"); + clock_set_hz(mms->s32kclk, S32KCLK_FRQ); + object_initialize_child(OBJECT(machine), TYPE_IOTKIT, &mms->iotkit, mmc->armsse_type); iotkitdev = DEVICE(&mms->iotkit); @@ -403,6 +414,8 @@ static void mps2tz_common_init(MachineState *machine) OBJECT(system_memory), &error_abort); qdev_prop_set_uint32(iotkitdev, "EXP_NUMIRQ", MPS2TZ_NUMIRQ); qdev_prop_set_uint32(iotkitdev, "MAINCLK_FRQ", SYSCLK_FRQ); + qdev_connect_clock_in(iotkitdev, "MAINCLK", mms->sysclk); + qdev_connect_clock_in(iotkitdev, "S32KCLK", mms->s32kclk); sysbus_realize(SYS_BUS_DEVICE(&mms->iotkit), &error_fatal); /*