Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1471618pxb; Thu, 7 Oct 2021 08:26:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYcdvkh+g0saIdAXI8S9Tt+VPR0iEqTPNiqVn1ZKT6sAo9sJS0hOJosO4zCGesUyKReYkC X-Received: by 2002:a17:90a:a41:: with SMTP id o59mr3865875pjo.243.1633620405794; Thu, 07 Oct 2021 08:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633620405; cv=none; d=google.com; s=arc-20160816; b=s1pWAnuYgk8cRAzp09zTsAswB72hmQmqYMIxxi7z+ytLZh0cs3Pxs1oNVfCFaQzD5s zk/s6OIrMmo4nFV1Vcuwbg0+CjKMaUm0PhoTYRjECmyeVlLemlmp3qYthA83JZ0rdfFs uHgMw00oFxZt2PJktaVTZ1dRAorEOk6VdhFoQRTVe4zGE80ucV/iAtpeHyWB4GkubM/L rrKVMa84qmYw571KMIXQoja3EJRN+DtqG5Ynfic7Bd+VqdmHk2sBtzf30Qx3dSxPhHFw D/5YjYVVLV76Rehed+AGcnj2L6ZHmHEH8On4pmlBNfQ5Edg4rqUsjiQvaDFsxjw7yUMC QyUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Krx/RE5Q090YFSPrNb2kptmWYEjJXXHETZ206yHqC3I=; b=W4AlmImYHfzNXlyFxZcq/H9+c/YQ6VIn/xp7yf/0jhPMnOamimWg/WJD8vq+4eYcPV 483B1QD5La2X77wUJreMJ4gv8dJggZEJfJYMp8LY0UurlSV6zCPwBsiNil2I7LgoJi6j RejupKkTK2Xwgzd2d2gf39TJMt6jc2jphzsgsyeCq9KnPHhVCTbBYWAE6zCUnndfHnRj /nEoxxQ3aCCQnuopO/UdGcL7ravh0Q8NDhCLiW0OWlk7u29LRKuijH9jCfcytIUlRQE5 OsN8qMPD4fIZxf0AMw/BOp8Kvo1gMgq3SJiP7nGD4VzcDd8PW+8yohuMkIrV8btc2X45 LAwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uH6uF9HP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si7923098pfg.199.2021.10.07.08.26.31; Thu, 07 Oct 2021 08:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uH6uF9HP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241224AbhJGMKQ (ORCPT + 99 others); Thu, 7 Oct 2021 08:10:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:49848 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241188AbhJGMJ7 (ORCPT ); Thu, 7 Oct 2021 08:09:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B7F6B6125F; Thu, 7 Oct 2021 12:08:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1633608485; bh=v8jqFyirqmb+/8LYtAwzXPhvJSkgU1UvuVdFnoMXPxk=; h=From:To:Cc:Subject:Date:From; b=uH6uF9HPF4Q9hdU90Zfy9kNGND+3Gn/Oj3R6AByUpLz96GRJLpSa9p3u1+3NAYWCV VohFmXTJJbkOgSyMk+WT/bCTAv4oQVkD7VCThxjEMbEDdgEVCeKJemzDhm68pryusS KrnwsR3wkeVqInDuq7SyptFFUHuhgxsuGkvgp9Saef4e1jizwU3Q44Zj1MakcRw0gT W32ag8dK3Y/4+p8RNexFDKG6BLeuX6KMgK3KqmvYDw9cqkDIwb03+47ApmQv58cYpE lbgTaDVxqVdY+oKdi1aovb/tTUsQBev8zpZmsWMGihD0xnKvF2jnFaGBRsAEQ9FcZ8 NHZSKCPkmS1Wg== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1mYSBv-005QSt-JI; Thu, 07 Oct 2021 14:08:03 +0200 From: Mauro Carvalho Chehab To: Michael Turquette , Stephen Boyd Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , Manivannan Sadhasivam , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] clk: fix the need of booking clk_ignore_unused=true on embedded devs Date: Thu, 7 Oct 2021 14:06:53 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, the only way to boot a Kernel with drivers built as modules on embedded devices like HiKey 970 is to pass clk_ignore_unused=true as a modprobe parameter. There are two separate issues: 1. the clk's core calls clk_disable_unused() too early. By the time this function is called, only the builtin drivers were already probed/initialized. Drivers built as modules will only be probed afterwards. This cause a race condition and boot instability, as the clk core will try to disable clocks while the drivers built as modules are still being probed and initialized. I suspect that the same problem used to happen at the regulator's core, as there's a code that waits for 30 seconds before disabling unused regulators; 2. there are some gate clocks defined at HiKey 970 that should always be on, as otherwise the system will hang, or the filesystem I/O will stop. Ps.: I submitted already 3 or 4 versions of patches for HiKey 970 clock, but they're all unreliable, due to the race conditions at the clk core due to (1). Patch 1 solves the issue with the clk core. Patch 2 solves the HiKey 970 specific issues. Mauro Carvalho Chehab (2): clk: wait for extra time before disabling unused clocks clk: clk-hi3670: mark some clocks as CLK_IS_CRITICAL drivers/clk/clk.c | 51 +++++++++++++++++++----------- drivers/clk/hisilicon/clk-hi3670.c | 24 +++++++------- 2 files changed, 44 insertions(+), 31 deletions(-) -- 2.31.1