Return-Path: Subject: Re: [PATCH v2 0/2] clk: qcom: MISC RCG changes for SDM845 To: Stephen Boyd Cc: Michael Turquette , Andy Gross , David Brown , Rajendra Nayak , Odelu Kukatla , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org References: <1514877987-8082-1-git-send-email-anischal@codeaurora.org> <20180102181306.GF7997@codeaurora.org> From: "Nischal, Amit" Message-ID: <56647bd2-a046-f6aa-ed27-1d806240f7a0@codeaurora.org> Date: Wed, 3 Jan 2018 20:14:00 +0530 MIME-Version: 1.0 In-Reply-To: <20180102181306.GF7997@codeaurora.org> Content-Type: multipart/alternative; boundary="------------1EA751EED075CFD0C53F6E73" List-ID: This is a multi-part message in MIME format. --------------1EA751EED075CFD0C53F6E73 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 1/2/2018 11:43 PM, Stephen Boyd wrote: > On 01/02, Amit Nischal wrote: >> Changes in v2: >> * Changed usage of clk_hw_is_prepared() to __clk_is_enabled() >> in clk_rcg2_shared_ops to fix build test error. > Please change it to read the hardware directly and not use > __clk_is_enabled() or clk_hw_is_prepared(). > Hi Stephen, Thanks for the review the change. Here intention is to know the software status of the RCG instead of HW status and we have intentionally not defined the 'is_enabled' ops for clk_rcg2_shared_ops. This clk_rcg2_shared_ops are only applicable for the RCGs with shared branches across different subsystems. Reason for using the same is mentioned below. When RCG gets enabled by other subsystem (outside the Application processor subsystem):   In this case when RCG gets enabled by branch clock managed by   other subsystem(outside the Application processor subsystem)   and if we check HW statusof RCG in clk_rcg2_shared_set_rate()   instead of checking its software statusthen it will give the   status as ENABLED without overlying software knowingits status   and during source switch, update configuration will get fail as   newparent will be indisabled state.   In above scenario, clock framework will not enable the new   parent beforeconfiguration update as enable and prepare counts   are zero for RCG clockand clk_set_rate() will follow below path.   clk_rcg2_shared_set_rate()   __clk_set_parent_before()-->New parent will be disabled as prepare count = 0   clk_change_rate()   clk_set_rate() So solution of this problem is as follows and same is explained in the commit text of https://patchwork.kernel.org/patch/10139985/ 1. If software status of the RCG is disabled(enable/prepare counts are 0)    then just cache or store the rate in current_freq variable and if    softwarestatus is enabled then follow the normal update procedure. 2. Set the rate and switch to new source onlyin clk_rcg2_shared_enable()    i.e. during RCG enable sequence. This will make surethat required    parents are already in enable state before configuration updateand    RCG switch will happen successfully every time. In past, We have encountered similar RCG update configuration failure issues for somedisplay RCGs, where there are two branch clocks, one is controlled by application processor subsystem and another one controlled by othersubsystem. So to handle such cases, we need clk_rcg2_shared_ops. --------------1EA751EED075CFD0C53F6E73 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit



On 1/2/2018 11:43 PM, Stephen Boyd wrote:
On 01/02, Amit Nischal wrote:
Changes in v2:
* Changed usage of clk_hw_is_prepared() to __clk_is_enabled()
  in clk_rcg2_shared_ops to fix build test error.
Please change it to read the hardware directly and not use
__clk_is_enabled() or clk_hw_is_prepared().

Hi Stephen,

Thanks for the review the change.

Here intention is to know the software status of the RCG instead of
HW status and we have intentionally not defined the 'is_enabled'
ops for clk_rcg2_shared_ops. This clk_rcg2_shared_ops are only
applicable for the RCGs with shared branches across different
subsystems.
Reason for using the
same is mentioned below.

When RCG gets enabled by other subsystem (outside the Application
processor subsystem):
  In this case when RCG gets enabled by branch clock managed by
  other subsystem
(outside the Application processor subsystem)
  and if we check HW status
of RCG in clk_rcg2_shared_set_rate()
  instead of checking its software status
then it will give the
  status as ENABLED without overlying software knowing
its status
  and during source switch, update configuration will get fail as
  new
parent will be in disabled state.
  
  In above scenario, clock framework will not enable the new
  parent before
configuration update as enable and prepare counts
  are zero for RCG clock
and clk_set_rate() will follow below path.
  
  clk_rcg2_shared_set_rate()
  __clk_set_parent_before()-->New parent will be disabled as prepare count = 0
  clk_change_rate()
  clk_set_rate()

So solution of this problem is as follows and same is explained in the
commit text of https://patchwork.kernel.org/patch/10139985/
1. If software status of the RCG is disabled(enable/prepare counts are 0)
   then just cache or store the rate in current_freq variable and if
   software
status is enabled then follow the normal update procedure.
  
2. Set the rate and switch to new source only in clk_rcg2_shared_enable()
   i.e. during RCG enable sequence. This will make sure
that required
   parents are already in enable state before configuration update
and
   RCG switch will happen successfully every time.

 

In past, We have encountered similar RCG update configuration failure issues
for some display RCGs, where there are two branch clocks, one is controlled by
application processor subsystem and another one controlled by other subsystem.
So to handle such cases, we need clk_rcg2_shared_ops.
--------------1EA751EED075CFD0C53F6E73--