From patchwork Thu Dec 17 00:43:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hao Wu X-Patchwork-Id: 11978827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9BFAC4361B for ; Thu, 17 Dec 2020 00:48:14 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5B9EE2376E for ; Thu, 17 Dec 2020 00:48:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5B9EE2376E Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kphSn-0007jb-DC for qemu-devel@archiver.kernel.org; Wed, 16 Dec 2020 19:48:13 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38460) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3JKraXwgKCucfdQJXcbQPXXPUN.LXVZNVd-MNeNUWXWPWd.XaP@flex--wuhaotsh.bounces.google.com>) id 1kphQA-000697-M0 for qemu-devel@nongnu.org; Wed, 16 Dec 2020 19:45:30 -0500 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]:52635) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3JKraXwgKCucfdQJXcbQPXXPUN.LXVZNVd-MNeNUWXWPWd.XaP@flex--wuhaotsh.bounces.google.com>) id 1kphQ7-0006pp-7W for qemu-devel@nongnu.org; Wed, 16 Dec 2020 19:45:30 -0500 Received: by mail-qt1-x84a.google.com with SMTP id t7so1726267qtn.19 for ; Wed, 16 Dec 2020 16:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=4YuCO3xnumkMk4n7ONOP0d547khMrm9sg+a9lN20uV4=; b=j21hStY5IpEbTPbxL7SIkKh12jluLLUdnnAuYB34Ccy1hJVUUqEW0TXq+gzPA7SJHV Ip6R6ur9Cfzi+It6NTXmCSKwb1o5uYmJxMuLhcq5+OY1qI6VneXMRCDDANnbo6SGc7YD TxT4owqCAQiHq1HYGmHCAiNRSElecTb68iIyYBpx2wnQzJiEIDq70UT0S1MPcZICF8Pm uvs2B1EQoN0WUuZ9uVDkmcuzYN3koXm0Spvm6133drqsABo/KObA4PAbS2TKeY8XbsEN yQ9QcfIVjuJ7wV2JlKncFATyWgP/cim9KxgpsN7rjbSnnXrBTQEaYGVU1dJ6hy+hRgHJ AyAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=4YuCO3xnumkMk4n7ONOP0d547khMrm9sg+a9lN20uV4=; b=EEz+iQeCeOiQYLPEHIhAPlXjh/0GEASgPLARMYnLS9p/xtCNPzO3xlB4/fUfb3NpC/ cLfBxOmU22ySnlZ52eqD90NaX45aOP46tM92jm+GWJGeWXMC3SuoifWOMZZAZyOvD0Fe 23C07MF9kPVEQqy06MdPf7giauTL2yOd62P7jNdH3X2fJSSh0l2Vko3wC7NBxfxEpxt5 MDJJ6wT81vEdgGt9ZDVFAGDDLTCKbGeUjQcN9yo9E6vUy+4AOHEVWQ5RssaiUtkUhNJ+ PZyMxe+FkFMHDPbK25dEgvkYwzsB4bPIzpkzfowCLlGpaomUze3eZqqb5XMeI4JLtbVc Yb2Q== X-Gm-Message-State: AOAM531dGc8kZEdkdu+APbtzqcezbwY8H2gaFopCsavLYK3sPJuF/vC3 ZiSnM2JAFMHTqykvdHFy/ESPBn3DFnJEaw== X-Google-Smtp-Source: ABdhPJwtsfgdJABOTgY79xg9gK4B9YTFtZrFbIJMrsNnCNjmq/XSEP5ERjdq2wjzgBKXHABjtXH8dSofBbXCfQ== X-Received: from mimik.c.googlers.com ([fda3:e722:ac3:10:7f:e700:c0a8:4e]) (user=wuhaotsh job=sendgmr) by 2002:a0c:9121:: with SMTP id q30mr46512244qvq.17.1608165924794; Wed, 16 Dec 2020 16:45:24 -0800 (PST) Date: Wed, 16 Dec 2020 16:43:43 -0800 Message-Id: <20201217004349.3740927-1-wuhaotsh@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.684.gfbc64c5ab5-goog Subject: [PATCH v4 0/6] Additional NPCM7xx devices To: peter.maydell@linaro.org Received-SPF: pass client-ip=2607:f8b0:4864:20::84a; envelope-from=3JKraXwgKCucfdQJXcbQPXXPUN.LXVZNVd-MNeNUWXWPWd.XaP@flex--wuhaotsh.bounces.google.com; helo=mail-qt1-x84a.google.com X-Spam_score_int: -95 X-Spam_score: -9.6 X-Spam_bar: --------- X-Spam_report: (-9.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, 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, USER_IN_DEF_DKIM_WL=-7.5 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: , Cc: minyard@acm.org, venture@google.com, qemu-devel@nongnu.org, hskinnemoen@google.com, wuhaotsh@google.com, kfting@nuvoton.com, qemu-arm@nongnu.org, Avi.Fishman@nuvoton.com, f4bug@amsat.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: Hao Wu X-Patchwork-Original-From: Hao Wu via From: Hao Wu This patch series include a few more NPCM7XX devices including - Analog Digital Converter (ADC) - Pulse Width Modulation (PWM) We also modified the CLK module to generate clock values using qdev_clock. These clocks are used to determine various clocks in NPCM7XX devices. Thank you for your review. Changes since v3: - Use type casting instead of accessing parent object in all devices. Changes since v2: - Split PWM test into a separate patch in the patch set - Add trace events for PWM's update_freq/update_duty - Add trace events for ioread/iowrite in ADC and PWM - Use timer_get_ns in hw/timer/npcm7xx_timer.c - Update commit message in ADC/PWM to mention qom-get/set method for usage - Fix typos Changes since v1: - We removed the IPMI and KCS related code from this patch set. Hao Wu (6): hw/misc: Add clock converter in NPCM7XX CLK module hw/timer: Refactor NPCM7XX Timer to use CLK clock hw/adc: Add an ADC module for NPCM7XX hw/misc: Add a PWM module for NPCM7XX hw/misc: Add QTest for NPCM7XX PWM Module hw/*: Use type casting for SysBusDevice in NPCM7XX docs/system/arm/nuvoton.rst | 4 +- hw/adc/meson.build | 1 + hw/adc/npcm7xx_adc.c | 321 +++++++++++++ hw/adc/trace-events | 5 + hw/arm/npcm7xx.c | 55 ++- hw/arm/npcm7xx_boards.c | 2 +- hw/mem/npcm7xx_mc.c | 2 +- hw/misc/meson.build | 1 + hw/misc/npcm7xx_clk.c | 797 ++++++++++++++++++++++++++++++- hw/misc/npcm7xx_gcr.c | 2 +- hw/misc/npcm7xx_pwm.c | 559 ++++++++++++++++++++++ hw/misc/npcm7xx_rng.c | 2 +- hw/misc/trace-events | 6 + hw/nvram/npcm7xx_otp.c | 2 +- hw/ssi/npcm7xx_fiu.c | 2 +- hw/timer/npcm7xx_timer.c | 25 +- include/hw/adc/npcm7xx_adc.h | 72 +++ include/hw/arm/npcm7xx.h | 4 + include/hw/misc/npcm7xx_clk.h | 146 +++++- include/hw/misc/npcm7xx_pwm.h | 106 ++++ include/hw/timer/npcm7xx_timer.h | 1 + meson.build | 1 + tests/qtest/meson.build | 4 +- tests/qtest/npcm7xx_adc-test.c | 400 ++++++++++++++++ tests/qtest/npcm7xx_pwm-test.c | 490 +++++++++++++++++++ 25 files changed, 2972 insertions(+), 38 deletions(-) create mode 100644 hw/adc/npcm7xx_adc.c create mode 100644 hw/adc/trace-events create mode 100644 hw/misc/npcm7xx_pwm.c create mode 100644 include/hw/adc/npcm7xx_adc.h create mode 100644 include/hw/misc/npcm7xx_pwm.h create mode 100644 tests/qtest/npcm7xx_adc-test.c create mode 100644 tests/qtest/npcm7xx_pwm-test.c