From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.2 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 C2816C388F7 for ; Thu, 22 Oct 2020 22:51:05 +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 DD588221EB for ; Thu, 22 Oct 2020 22:51:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QyGvFwkQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DD588221EB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:37840 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kVjQF-00060d-Kl for qemu-devel@archiver.kernel.org; Thu, 22 Oct 2020 18:51:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kVjOD-0004fi-TF; Thu, 22 Oct 2020 18:48:58 -0400 Received: from mail-oi1-x241.google.com ([2607:f8b0:4864:20::241]:36140) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kVjOB-0001Fk-MD; Thu, 22 Oct 2020 18:48:57 -0400 Received: by mail-oi1-x241.google.com with SMTP id u17so3689676oie.3; Thu, 22 Oct 2020 15:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vmNyYTPYs3JCdBF+ZIoTNHkWx5u56IceN7DMWiQxD8c=; b=QyGvFwkQDTqTCYQIsvVC3QWF/NZtntpXgmcV2rDmNJg4VpCMXrFi0DsM7Pouo/1CzV uqhVLnrNNqP9CkJukbeVIcFShA5SU1wku1Q7AQ4PviKS8ZCb6QQmCBrnOTDrS6ciYnbp t2AchNeS1XkcnnxqTKL5HZSFgOLhbzw/EtccYylNg8XjJiCzmsu+vlxlBr8jROVjA+Ev 5pmEoRiwKZoFIjivGDeGYoEktehhQbIosrTLWoVGNn84NSF6FuJd+KAeuKP+So1AyfJ+ a8IiTuwURDo3VhPUqmhAa8M2l1Q+eCePDoaw8GOfTEtAbc5QhvgQxVESpXrdJESngpQv /2kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=vmNyYTPYs3JCdBF+ZIoTNHkWx5u56IceN7DMWiQxD8c=; b=bdL4fbI6wR3x7FV0Mz6EOVLkEU9z50TE8WYj5MHVYIdewXzhOPeY9DeXk4aMbE0lFW TPSGcMaoUi3y9Q6gnFE0qRXYC28bBaBmk4ia/Am/WJNTw2IvCiKKVWRxHQKED8VLQkhp A1MGBGZ84toVt5m7LH4nxkllRq3fTxQ1Spw1ZJi0OfefxilImGQtB8vP7xErmsBpi8y1 ZPYrJdoKyavRxs8lvMVACHJ3jDXJ1e2RpH1Za8L3TmxwlENbENbS6nxtetEMwRFUGKNb zI88Nh8KhwDWbsaHPVJYQIzsbGATcftrl3zLhHGCMz/+8PxzYj+KAD434ctVYDyKOgQb oU2Q== X-Gm-Message-State: AOAM530Hs8KeEWsXtzGU8fi4lVDAn1b7h5M0NzLzI3+m1uI1dckXVUL7 yYR0NvC18H/W9WKqAictMtA= X-Google-Smtp-Source: ABdhPJzgC5PB/c7a8ZcfWHVtGPa25I9YtAKuf9t9AD4pRzOZRaVXWZrO1ih3xg0yCg0elo9dNE9/4A== X-Received: by 2002:aca:dec3:: with SMTP id v186mr2896672oig.141.1603406933497; Thu, 22 Oct 2020 15:48:53 -0700 (PDT) Received: from server.roeck-us.net ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id y194sm832132oie.22.2020.10.22.15.48.51 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Oct 2020 15:48:52 -0700 (PDT) Subject: Re: [PATCH v3 00/15] raspi: add the bcm2835 cprman clock manager To: =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Luc Michel , qemu-devel@nongnu.org References: <20201010135759.437903-1-luc@lmichel.fr> From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobL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F52zFO4bOWyovVAPncvV9eGA/vtnd3xEZXQiSt91kBSqK28yjxAqK/c3G6i7IX2rg6pzgqh hiH3/1qM2M/LSuqAv0Rwrt/k+pZXE+B4Ud42hwmMr0TfhNxG+X7YKvjKC+SjPjqp0CaztQ0H nsDLSLElVROxCd9m8CAUuHplgmR3seYCOrT4jriMFBtKNPtj2EE4DNV4s7k0Zy+6iRQ8G8ng QjsSqYJx8iAR8JRB7Gm2rQOMv8lSRdjva++GT0VLXtHULdlzg8VjDnFZ3lfz5PWEOeIMk7Rj trjv82EZtrhLuLjHRCaG50OOm0hwPSk1J64R8O3HjSLdertmw7eyAYOo4RuWJguYMg5DRnBk WkRwrSuCn7UG+qVWZeKEsFKFOkynOs3pVbcbq1pxbhk3TRWCGRU5JolI4ohy/7JV1TVbjiDI HP/aVnm6NC8of26P40Pg8EdAhajZnHHjA7FrJXsy3cyIGqvg9os4rNkUWmrCfLLsZDHD8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= Message-ID: <94d318b2-8b79-bfb5-25db-08de1029a156@roeck-us.net> Date: Thu, 22 Oct 2020 15:48:51 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::241; envelope-from=groeck7@gmail.com; helo=mail-oi1-x241.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NICE_REPLY_A=-0.107, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: Peter Maydell , Havard Skinnemoen , Andrew Baumann , Paul Zimmerman , Niek Linnenbank , qemu-arm@nongnu.org Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi, On 10/22/20 3:06 PM, Philippe Mathieu-Daudé wrote: > Cc'ing Guenter who had a similar patch and might be interested > to test :) > great. I think my patch doesn't work anymore since qemu 5.0 (at least not for raspi3), and it was pretty hackish anyway. I'll give the series a try. Guenter > patch 16/15 fixup: > https://www.mail-archive.com/qemu-devel@nongnu.org/msg752113.html > > On 10/10/20 3:57 PM, Luc Michel wrote: >> v2 -> v3: >>    - patch 03: moved clock_new definition to hw/core/clock.c [Phil] >>    - patch 03: commit message typo [Clement] >>    - patch 10: clarifications around the CM_CTL/CM_DIBV mux registers. >>                reg_cm replaced with reg_ctl and reg_div. Add some >>                comments for clarity. [Phil] >>    - patch 10: fixed update_mux_from_cm not matching the CM_DIV offset >>                correctly. [Phil] >>    - patch 11: replaced manual bitfield extraction with extract32 [Phil] >>    - patch 11: added a visual representation of CM_DIV for clarity [Phil] >>    - patch 11: added a missing return in clock_mux_update. >> >> v1 -> v2: >>    - patch 05: Added a comment about MMIO .valid constraints [Phil] >>    - patch 05: Added MMIO .impl [Phil] >>    - patch 05: Moved init_internal_clock to the public clock API, renamed >>      clock_new (new patch 03) [Phil] >>    - patch 11: use muldiv64 for clock mux frequency output computation [Phil] >>    - patch 11: add a check for null divisor (Phil: I dropped your r-b) >>    - Typos, formatting, naming, style [Phil] >> >> Patches without review: 03, 11, 13 >> >> Hi, >> >> This series add the BCM2835 CPRMAN clock manager peripheral to the >> Raspberry Pi machine. >> >> Patches 1-4 are preliminary changes, patches 5-13 are the actual >> implementation. >> >> The two last patches add a clock input to the PL011 and >> connect it to the CPRMAN. >> >> This series has been tested with Linux 5.4.61 (the current raspios >> version). It fixes the kernel Oops at boot time due to invalid UART >> clock value, and other warnings/errors here and there because of bad >> clocks or lack of CPRMAN. >> >> Here is the clock tree as seen by Linux when booted in QEMU: >> (/sys/kernel/debug/clk/clk_summary with some columns removed) >> >>                          enable  prepare >>     clock                 count    count          rate >> ----------------------------------------------------- >>   otg                         0        0     480000000 >>   osc                         5        5      19200000 >>      gp2                      1        1         32768 >>      tsens                    0        0       1920000 >>      otp                      0        0       4800000 >>      timer                    0        0       1000002 >>      pllh                     4        4     864000000 >>         pllh_pix_prediv       1        1       3375000 >>            pllh_pix           0        0        337500 >>         pllh_aux              1        1     216000000 >>            vec                0        0     108000000 >>         pllh_rcal_prediv      1        1       3375000 >>            pllh_rcal          0        0        337500 >>      plld                     3        3    2000000024 >>         plld_dsi1             0        0       7812501 >>         plld_dsi0             0        0       7812501 >>         plld_per              3        3     500000006 >>            gp1                1        1      25000000 >>            uart               1        2      47999625 >>         plld_core             2        2     500000006 >>            sdram              0        0     166666668 >>      pllc                     3        3    2400000000 >>         pllc_per              1        1    1200000000 >>            emmc               0        0     200000000 >>         pllc_core2            0        0       9375000 >>         pllc_core1            0        0       9375000 >>         pllc_core0            2        2    1200000000 >>            vpu                1        1     700000000 >>               aux_spi2        0        0     700000000 >>               aux_spi1        0        0     700000000 >>               aux_uart        0        0     700000000 >>               peri_image      0        0     700000000 >>      plla                     2        2    2250000000 >>         plla_ccp2             0        0       8789063 >>         plla_dsi0             0        0       8789063 >>         plla_core             1        1     750000000 >>            h264               0        0     250000000 >>            isp                0        0     250000000 >>   dsi1p                       0        0             0 >>   dsi0p                       0        0             0 >>   dsi1e                       0        0             0 >>   dsi0e                       0        0             0 >>   cam1                        0        0             0 >>   cam0                        0        0             0 >>   dpi                         0        0             0 >>   tec                         0        0             0 >>   smi                         0        0             0 >>   slim                        0        0             0 >>   gp0                         0        0             0 >>   dft                         0        0             0 >>   aveo                        0        0             0 >>   pcm                         0        0             0 >>   pwm                         0        0             0 >>   hsm                         0        0             0 >> >> It shows small differences with real hardware due other missing >> peripherals for which the driver turn the clock off (like tsens). >> >> Luc Michel (15): >>    hw/core/clock: provide the VMSTATE_ARRAY_CLOCK macro >>    hw/core/clock: trace clock values in Hz instead of ns >>    hw/core/clock: add the clock_new helper function >>    hw/arm/raspi: fix CPRMAN base address >>    hw/arm/raspi: add a skeleton implementation of the CPRMAN >>    hw/misc/bcm2835_cprman: add a PLL skeleton implementation >>    hw/misc/bcm2835_cprman: implement PLLs behaviour >>    hw/misc/bcm2835_cprman: add a PLL channel skeleton implementation >>    hw/misc/bcm2835_cprman: implement PLL channels behaviour >>    hw/misc/bcm2835_cprman: add a clock mux skeleton implementation >>    hw/misc/bcm2835_cprman: implement clock mux behaviour >>    hw/misc/bcm2835_cprman: add the DSI0HSCK multiplexer >>    hw/misc/bcm2835_cprman: add sane reset values to the registers >>    hw/char/pl011: add a clock input >>    hw/arm/bcm2835_peripherals: connect the UART clock >> >>   include/hw/arm/bcm2835_peripherals.h       |    5 +- >>   include/hw/arm/raspi_platform.h            |    5 +- >>   include/hw/char/pl011.h                    |    1 + >>   include/hw/clock.h                         |   18 + >>   include/hw/misc/bcm2835_cprman.h           |  210 ++++ >>   include/hw/misc/bcm2835_cprman_internals.h | 1019 ++++++++++++++++++++ >>   hw/arm/bcm2835_peripherals.c               |   15 +- >>   hw/char/pl011.c                            |   45 + >>   hw/core/clock.c                            |   21 +- >>   hw/misc/bcm2835_cprman.c                   |  808 ++++++++++++++++ >>   hw/char/trace-events                       |    1 + >>   hw/core/trace-events                       |    4 +- >>   hw/misc/meson.build                        |    1 + >>   hw/misc/trace-events                       |    5 + >>   14 files changed, 2146 insertions(+), 12 deletions(-) >>   create mode 100644 include/hw/misc/bcm2835_cprman.h >>   create mode 100644 include/hw/misc/bcm2835_cprman_internals.h >>   create mode 100644 hw/misc/bcm2835_cprman.c >>