From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932795AbbFISoU (ORCPT ); Tue, 9 Jun 2015 14:44:20 -0400 Received: from mail-ie0-f181.google.com ([209.85.223.181]:33721 "EHLO mail-ie0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752723AbbFISoP (ORCPT ); Tue, 9 Jun 2015 14:44:15 -0400 MIME-Version: 1.0 In-Reply-To: <1433843400-24831-2-git-send-email-wxt@rock-chips.com> References: <1433843400-24831-1-git-send-email-wxt@rock-chips.com> <1433843400-24831-2-git-send-email-wxt@rock-chips.com> Date: Tue, 9 Jun 2015 11:16:56 -0700 X-Google-Sender-Auth: sWH_CltGgKw34_UvFFuCTS9lNRI Message-ID: Subject: Re: [PATCH v6 1/3] ARM: rockchip: fix the CPU soft reset From: Doug Anderson To: Caesar Wang Cc: Heiko Stuebner , Dmitry Torokhov , "open list:ARM/Rockchip SoC..." , Russell King , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Caesar, On Tue, Jun 9, 2015 at 2:49 AM, Caesar Wang wrote: > We need different orderings when turning a core on and turning a core > off. In one case we need to assert reset before turning power off. > In ther other case we need to turn power on and the deassert reset. > > In general, the correct flow is: > > CPU off: > reset_control_assert > regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), BIT(pd)) > wait_for_power_domain_to_turn_off > CPU on: > regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), 0) > wait_for_power_domain_to_turn_on > reset_control_deassert > > This is needed for stressing CPU up/down, as per: > cd /sys/devices/system/cpu/ > for i in $(seq 10000); do > echo "================= $i ============" > for j in $(seq 100); do > while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "000"" ]] > echo 0 > cpu1/online > echo 0 > cpu2/online > echo 0 > cpu3/online > done > while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "111" ]]; do > echo 1 > cpu1/online > echo 1 > cpu2/online > echo 1 > cpu3/online > done > done > done > > The following is reproducable log: > [34466.186812] PM: noirq suspend of devices complete after 0.669 msecs > [34466.186824] Disabling non-boot CPUs ... > [34466.187509] CPU1: shutdown > [34466.188672] CPU2: shutdown > [34473.736627] Kernel panic - not syncing:Watchdog detected hard LOCKUP on cpu 0 > ....... > or others similar log: > ....... > [ 4072.454453] CPU1: shutdown > [ 4072.504436] CPU2: shutdown > [ 4072.554426] CPU3: shutdown > [ 4072.577827] CPU1: Booted secondary processor > [ 4072.582611] CPU2: Booted secondary processor > > > Tested by cpu up/down scripts, the results told us need delay more time > before write the sram. The wait time is affected by many aspects > (e.g: cpu frequency, bootrom frequency, sram frequency, bus speed, ...). > > Although the cpus other than cpu0 will write the sram, the speedy is > no the same as cpu0, if the cpu0 early wake up, perhaps the other cpus > can't startup. As we know, the cpu0 can wake up when the cpu1/2/3 write > the 'sram+4/8' and send the sev. > Anyway..... > At the moment, 1ms delay will be happy work for cpu up/down scripts test. > > Signed-off-by: Caesar Wang > Reviewed-by: Doug Anderson Usually it's good to remove someone's "Reviewed-by" when you've made as many changes as you have. ...but in this case I am still happy with this patch, so I'll re-assert: Reviewed-by: Douglas Anderson From mboxrd@z Thu Jan 1 00:00:00 1970 From: Doug Anderson Subject: Re: [PATCH v6 1/3] ARM: rockchip: fix the CPU soft reset Date: Tue, 9 Jun 2015 11:16:56 -0700 Message-ID: References: <1433843400-24831-1-git-send-email-wxt@rock-chips.com> <1433843400-24831-2-git-send-email-wxt@rock-chips.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1433843400-24831-2-git-send-email-wxt@rock-chips.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Caesar Wang Cc: Russell King , Heiko Stuebner , Dmitry Torokhov , "linux-kernel@vger.kernel.org" , "open list:ARM/Rockchip SoC..." , "linux-arm-kernel@lists.infradead.org" List-Id: linux-rockchip.vger.kernel.org Caesar, On Tue, Jun 9, 2015 at 2:49 AM, Caesar Wang wrote: > We need different orderings when turning a core on and turning a core > off. In one case we need to assert reset before turning power off. > In ther other case we need to turn power on and the deassert reset. > > In general, the correct flow is: > > CPU off: > reset_control_assert > regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), BIT(pd)) > wait_for_power_domain_to_turn_off > CPU on: > regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), 0) > wait_for_power_domain_to_turn_on > reset_control_deassert > > This is needed for stressing CPU up/down, as per: > cd /sys/devices/system/cpu/ > for i in $(seq 10000); do > echo "================= $i ============" > for j in $(seq 100); do > while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "000"" ]] > echo 0 > cpu1/online > echo 0 > cpu2/online > echo 0 > cpu3/online > done > while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "111" ]]; do > echo 1 > cpu1/online > echo 1 > cpu2/online > echo 1 > cpu3/online > done > done > done > > The following is reproducable log: > [34466.186812] PM: noirq suspend of devices complete after 0.669 msecs > [34466.186824] Disabling non-boot CPUs ... > [34466.187509] CPU1: shutdown > [34466.188672] CPU2: shutdown > [34473.736627] Kernel panic - not syncing:Watchdog detected hard LOCKUP on cpu 0 > ....... > or others similar log: > ....... > [ 4072.454453] CPU1: shutdown > [ 4072.504436] CPU2: shutdown > [ 4072.554426] CPU3: shutdown > [ 4072.577827] CPU1: Booted secondary processor > [ 4072.582611] CPU2: Booted secondary processor > > > Tested by cpu up/down scripts, the results told us need delay more time > before write the sram. The wait time is affected by many aspects > (e.g: cpu frequency, bootrom frequency, sram frequency, bus speed, ...). > > Although the cpus other than cpu0 will write the sram, the speedy is > no the same as cpu0, if the cpu0 early wake up, perhaps the other cpus > can't startup. As we know, the cpu0 can wake up when the cpu1/2/3 write > the 'sram+4/8' and send the sev. > Anyway..... > At the moment, 1ms delay will be happy work for cpu up/down scripts test. > > Signed-off-by: Caesar Wang > Reviewed-by: Doug Anderson Usually it's good to remove someone's "Reviewed-by" when you've made as many changes as you have. ...but in this case I am still happy with this patch, so I'll re-assert: Reviewed-by: Douglas Anderson From mboxrd@z Thu Jan 1 00:00:00 1970 From: dianders@chromium.org (Doug Anderson) Date: Tue, 9 Jun 2015 11:16:56 -0700 Subject: [PATCH v6 1/3] ARM: rockchip: fix the CPU soft reset In-Reply-To: <1433843400-24831-2-git-send-email-wxt@rock-chips.com> References: <1433843400-24831-1-git-send-email-wxt@rock-chips.com> <1433843400-24831-2-git-send-email-wxt@rock-chips.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Caesar, On Tue, Jun 9, 2015 at 2:49 AM, Caesar Wang wrote: > We need different orderings when turning a core on and turning a core > off. In one case we need to assert reset before turning power off. > In ther other case we need to turn power on and the deassert reset. > > In general, the correct flow is: > > CPU off: > reset_control_assert > regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), BIT(pd)) > wait_for_power_domain_to_turn_off > CPU on: > regmap_update_bits(pmu, PMU_PWRDN_CON, BIT(pd), 0) > wait_for_power_domain_to_turn_on > reset_control_deassert > > This is needed for stressing CPU up/down, as per: > cd /sys/devices/system/cpu/ > for i in $(seq 10000); do > echo "================= $i ============" > for j in $(seq 100); do > while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "000"" ]] > echo 0 > cpu1/online > echo 0 > cpu2/online > echo 0 > cpu3/online > done > while [[ "$(cat cpu1/online)$(cat cpu2/online)$(cat cpu3/online)" != "111" ]]; do > echo 1 > cpu1/online > echo 1 > cpu2/online > echo 1 > cpu3/online > done > done > done > > The following is reproducable log: > [34466.186812] PM: noirq suspend of devices complete after 0.669 msecs > [34466.186824] Disabling non-boot CPUs ... > [34466.187509] CPU1: shutdown > [34466.188672] CPU2: shutdown > [34473.736627] Kernel panic - not syncing:Watchdog detected hard LOCKUP on cpu 0 > ....... > or others similar log: > ....... > [ 4072.454453] CPU1: shutdown > [ 4072.504436] CPU2: shutdown > [ 4072.554426] CPU3: shutdown > [ 4072.577827] CPU1: Booted secondary processor > [ 4072.582611] CPU2: Booted secondary processor > > > Tested by cpu up/down scripts, the results told us need delay more time > before write the sram. The wait time is affected by many aspects > (e.g: cpu frequency, bootrom frequency, sram frequency, bus speed, ...). > > Although the cpus other than cpu0 will write the sram, the speedy is > no the same as cpu0, if the cpu0 early wake up, perhaps the other cpus > can't startup. As we know, the cpu0 can wake up when the cpu1/2/3 write > the 'sram+4/8' and send the sev. > Anyway..... > At the moment, 1ms delay will be happy work for cpu up/down scripts test. > > Signed-off-by: Caesar Wang > Reviewed-by: Doug Anderson Usually it's good to remove someone's "Reviewed-by" when you've made as many changes as you have. ...but in this case I am still happy with this patch, so I'll re-assert: Reviewed-by: Douglas Anderson