From patchwork Fri Mar 22 15:58:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 781856 Delivered-To: patch@linaro.org Received: by 2002:adf:cf01:0:b0:33e:7753:30bd with SMTP id o1csp1420668wrj; Fri, 22 Mar 2024 08:59:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV8zKsTD7jBdhMv+Sha3epveBFAAztj5K4hpNPuwmM7zDjvq8kv2/1SGdIvUXR654fU/Z3BH4GAQLwfcyNeJU7p X-Google-Smtp-Source: AGHT+IHae5nDNesq+onE5YWJZhSaYw6DB/jAUizlTriaFKUPZW697ziGsBxEwxZ8+9tGRx69rPCH X-Received: by 2002:a05:620a:f14:b0:78a:205e:f72b with SMTP id v20-20020a05620a0f1400b0078a205ef72bmr3291219qkl.28.1711123170303; Fri, 22 Mar 2024 08:59:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1711123170; cv=none; d=google.com; s=arc-20160816; b=zUAbYzNdyKL6zVRVNWx2Y1S3guZm4c1Mm+U6Oy2OUXBWD7GEnhwSmzKAjTBUyAt/el BtwNUhvIkh/h9cz4B2mgGvIkbiLQjxmcLOydo/NN1Orvm+kk0KEidGTEdVsLQOYs5WhD wc98t2EGtH7KihXy11y+i1xVy4OC4cKhQwTKr9ZpJUy/mHK5g6+t33uUtdnclBtLMZ5n yD2k/lE9LH+/8CpsDGacuD7f0Xep/K35EQD5wAuTnT/Liy/g0o28nwW/sI8vziOkiNFA mKP8ZDokctzZpuUZxsIWX2yiDR7BoLimr4zDxPX4nKMZjVdpgsH36yCFKaqFlb/oHcuT 9R1w== 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:cc:to :from:dkim-signature; bh=UxjY8qQEnjtbAhkgYiOeCHJsc+3HFQ5wgndLMK/z5QQ=; fh=ehv+kQt6ZRcwDkQ1XgUh3GNAfxStVE1Rl0SRcGWy25Y=; b=QnT3i1m4QJdPDdnwNjJFqI7dqx/7Mb7koMlYfd+aQ57tGxEoMIMdGB/rhidERXWZ/8 ATyqeKzWyYC539/C64hecr4QzQdp/jniDX9hsDTrmzAjVX4jzd+kROqZulM86pFUbFlL sOR5CBJPiPY1jvc5j8qzFosiPW6JzfqT/YFZshN2Oc2Wf4M9iWcmSt9Y9SntQ3czwOY4 Ay/PE0pFCWaQGheqQT7e+tgFA61e9wq6+TUw2HBWvL07XS5VoR6P1cCzUBQKiGcpT9Yv xohxVimjBIgZEgvQXq7acdT/DhrzAjinethXPQ8zOU7rrsmakg8on4lZuXEibaTe6rmz 2ufw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R8r5hRY6; 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 l11-20020ae9f00b000000b00787ec0dffa0si2214954qkg.447.2024.03.22.08.59.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Mar 2024 08:59:30 -0700 (PDT) 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=R8r5hRY6; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rnhHt-0001Cj-GC; Fri, 22 Mar 2024 11:58:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rnhHq-0001Av-TH for qemu-devel@nongnu.org; Fri, 22 Mar 2024 11:58:31 -0400 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rnhHo-0005eQ-E4 for qemu-devel@nongnu.org; Fri, 22 Mar 2024 11:58:30 -0400 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2d228a132acso31043861fa.0 for ; Fri, 22 Mar 2024 08:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711123106; x=1711727906; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UxjY8qQEnjtbAhkgYiOeCHJsc+3HFQ5wgndLMK/z5QQ=; b=R8r5hRY6gwbZVFB1TBsELt667RJ6iOqB98kN5CMLlnMD5ufnNEOZArHovNoWw7R63I wO9L/NLD0TNQSiE/lGgYYwH8D5IXPMyu3wT8yhPj0Qffl96HmY5E3rMo97+wmY+8oyqS RCInRUQNNJoUuBxyfmkRL503TD1fcSoTVmjwRrZmheak9oq84i2nJzGFbjPtOSeCdgIi +VeThnHK/yL8Mui08oaJui16LH1ROUnxT8NRnXEsaaC3pQJ9ftZUKbv33wHQnYJTaS0U wSkjynO3Vk2z2MujaDaaWP3M8NeAtNCEAtlyk6/I4itHa4fuSv4R5Rb+5TecmGKoU1Xm aIHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711123106; x=1711727906; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UxjY8qQEnjtbAhkgYiOeCHJsc+3HFQ5wgndLMK/z5QQ=; b=Vp2BoLZM6gzbFXRJKd1piwyh2NkSsRECoEqN7IyZWzeUeXG4PnDHRNlsWIUMT4kE/v q4en2dvuCmgarkcBPEbP1k+NEZpI3lQMTgJXbIfbzED6fZyJr354gNo+OK1iGp8E3bSe 0W9sc7I6BWDHpzE/D1+HPet2rbWdvjDxJTi9DqKaz9a5Axmv7VpW9vyjaLX1YmQLHUxN KSklVWTimC+M/66JY+6aJxzVDvmaagwWC0wA7jWQUpHlnZFQqr963nGs14XXGHJvukEO X6LFpjT38XuG297VTJgWQK/mw5kFeSw79KyxG5GIuRy7XTdjXOCR4cpd+1YmxdNhEfQR OH2Q== X-Gm-Message-State: AOJu0YyrIU/RGfaVLzvNwUA7NnI9BfarlEjoQeGAeBZLY7UfdiWml0ny CHbkXOkSIhdaiX8wHmKAHZ+EYMUn0jMKd+0TGFcDNp0omjf2fLlB7NpYilp9iXmAITmml+kPDFu G X-Received: by 2002:a2e:8ed1:0:b0:2d4:74c5:2cd3 with SMTP id e17-20020a2e8ed1000000b002d474c52cd3mr2166352ljl.41.1711123106159; Fri, 22 Mar 2024 08:58:26 -0700 (PDT) Received: from m1x-phil.lan ([176.176.178.251]) by smtp.gmail.com with ESMTPSA id h11-20020a05600c350b00b0041477e76ec6sm3486777wmq.2.2024.03.22.08.58.24 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 22 Mar 2024 08:58:25 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Luc Michel , Luc Michel , Damien Hedde , =?utf-8?q?In=C3=A8s_Varhol?= , Arnaud Minier , qemu-arm@nongnu.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-9.0 2/2] hw/misc/stm32l4x5_rcc: Propagate period when enabling a clock Date: Fri, 22 Mar 2024 16:58:10 +0100 Message-ID: <20240322155810.5733-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240322155810.5733-1-philmd@linaro.org> References: <20240322155810.5733-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::22a; envelope-from=philmd@linaro.org; helo=mail-lj1-x22a.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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 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-bounces+patch=linaro.org@nongnu.org From: Arnaud Minier The "clock_set_mul_div" function doesn't propagate the clock period to the children if it is changed (e.g. by enabling/disabling a clock multiplexer). This was overlooked during the implementation due to late changes. This commit propagates the change if the multiplier or divider changes. Fixes: ec7d83acbd ("hw/misc/stm32l4x5_rcc: Add an internal clock multiplexer object") Signed-off-by: Arnaud Minier Signed-off-by: Inès Varhol Message-ID: <20240317103918.44375-2-arnaud.minier@telecom-paris.fr> [PMD: Check clock_set_mul_div() return value] Signed-off-by: Philippe Mathieu-Daudé --- hw/misc/stm32l4x5_rcc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/misc/stm32l4x5_rcc.c b/hw/misc/stm32l4x5_rcc.c index bc2d63528b..7ad628b296 100644 --- a/hw/misc/stm32l4x5_rcc.c +++ b/hw/misc/stm32l4x5_rcc.c @@ -59,7 +59,10 @@ static void clock_mux_update(RccClockMuxState *mux, bool bypass_source) freq_multiplier = mux->divider; } - clock_set_mul_div(mux->out, freq_multiplier, mux->multiplier); + if (clock_set_mul_div(mux->out, freq_multiplier, mux->multiplier)) { + clock_propagate(mux->out); + } + clock_update(mux->out, clock_get(current_source)); src_freq = clock_get_hz(current_source);