Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1344607 > unrolled thread

Re: [PATCH v12 4/4] Watchdog: introduce ARM SBSA watchdog driver

Started byTimur Tabi <timur@codeaurora.org>
First post2016-02-26 20:30 +0100
Last post2016-02-28 15:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v12 4/4] Watchdog: introduce ARM SBSA watchdog driver Timur Tabi <timur@codeaurora.org> - 2016-02-26 20:30 +0100
    Re: [PATCH v12 4/4] Watchdog: introduce ARM SBSA watchdog driver Fu Wei <fu.wei@linaro.org> - 2016-02-28 15:10 +0100

#1344607 — Re: [PATCH v12 4/4] Watchdog: introduce ARM SBSA watchdog driver

FromTimur Tabi <timur@codeaurora.org>
Date2016-02-26 20:30 +0100
SubjectRe: [PATCH v12 4/4] Watchdog: introduce ARM SBSA watchdog driver
Message-ID<r6wfo-7YK-1@gated-at.bofh.it>
fu.wei@linaro.org wrote:
> +	if (action) {
> +		irq = platform_get_irq(pdev, 0);
> +		if (irq < 0) {
> +			action = 0;
> +			dev_warn(dev, "unable to get ws0 interrupt.\n");
> +		} else {
> +			if (devm_request_irq(dev, irq, sbsa_gwdt_interrupt, 0,
> +					     pdev->name, gwdt)) {
> +				action = 0;
> +				dev_warn(dev, "unable to request IRQ %d.\n",
> +					 irq);
> +			}
> +		}
> +		if (!action)
> +			dev_warn(dev, "falling back to signle stage mode.\n");
> +	}
> +
> +	/*
> +	 * Get the frequency of system counter from the cp15 interface of ARM
> +	 * Generic timer. We don't need to check it, because if it returns "0",
> +	 * system would panic in very early stage.
> +	 */
> +	gwdt->clk = arch_timer_get_cntfrq();
> +	gwdt->refresh_base = rf_base;
> +	gwdt->control_base = cf_base;

I think you need to ping the watchdog before enabling the interrupt, in 
case there is a pending interrupt.  This just happened to me in testing, 
so I recommend this:

> 	/*
> 	 * Get the frequency of system counter from the cp15 interface of ARM
> 	 * Generic timer. We don't need to check it, because if it returns "0",
> 	 * system would panic in very early stage.
> 	 */
> 	gwdt->clk = arch_timer_get_cntfrq();
> 	gwdt->refresh_base = rf_base;
> 	gwdt->control_base = cf_base;
>
> 	if (action) {
> 		irq = platform_get_irq(pdev, 0);
> 		if (irq < 0) {
> 			action = 0;
> 			dev_warn(dev, "unable to get ws0 interrupt.\n");
> 		} else {
> 			sbsa_gwdt_keepalive(&gwdt->wdd);
> 			if (devm_request_irq(dev, irq, sbsa_gwdt_interrupt, 0,
> 					     pdev->name, gwdt)) {
> 				action = 0;
> 				dev_warn(dev, "unable to request IRQ %d.\n",
> 					 irq);
> 			}
> 		}
> 		if (!action)
> 			dev_warn(dev, "falling back to single stage mode.\n");
> 	}

In fact, I think you need to move the "if (action) {" block near the end 
of sbsa_gwdt_probe().  We don't want to enable the interrupt until the 
watchdog is fully initialized.

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
Forum, a Linux Foundation collaborative project.

[toc] | [next] | [standalone]


#1345273

FromFu Wei <fu.wei@linaro.org>
Date2016-02-28 15:10 +0100
Message-ID<r7acN-3wY-7@gated-at.bofh.it>
In reply to#1344607
Hi Timur,

On 27 February 2016 at 03:27, Timur Tabi <timur@codeaurora.org> wrote:
> fu.wei@linaro.org wrote:
>>
>> +       if (action) {
>> +               irq = platform_get_irq(pdev, 0);
>> +               if (irq < 0) {
>> +                       action = 0;
>> +                       dev_warn(dev, "unable to get ws0 interrupt.\n");
>> +               } else {
>> +                       if (devm_request_irq(dev, irq,
>> sbsa_gwdt_interrupt, 0,
>> +                                            pdev->name, gwdt)) {
>> +                               action = 0;
>> +                               dev_warn(dev, "unable to request IRQ
>> %d.\n",
>> +                                        irq);
>> +                       }
>> +               }
>> +               if (!action)
>> +                       dev_warn(dev, "falling back to signle stage
>> mode.\n");
>> +       }
>> +
>> +       /*
>> +        * Get the frequency of system counter from the cp15 interface of
>> ARM
>> +        * Generic timer. We don't need to check it, because if it returns
>> "0",
>> +        * system would panic in very early stage.
>> +        */
>> +       gwdt->clk = arch_timer_get_cntfrq();
>> +       gwdt->refresh_base = rf_base;
>> +       gwdt->control_base = cf_base;
>
>
> I think you need to ping the watchdog before enabling the interrupt, in case
> there is a pending interrupt.  This just happened to me in testing, so I
> recommend this:
>
>>         /*
>>          * Get the frequency of system counter from the cp15 interface of
>> ARM
>>          * Generic timer. We don't need to check it, because if it returns
>> "0",
>>          * system would panic in very early stage.
>>          */
>>         gwdt->clk = arch_timer_get_cntfrq();
>>         gwdt->refresh_base = rf_base;
>>         gwdt->control_base = cf_base;
>>
>>         if (action) {
>>                 irq = platform_get_irq(pdev, 0);
>>                 if (irq < 0) {
>>                         action = 0;
>>                         dev_warn(dev, "unable to get ws0 interrupt.\n");
>>                 } else {
>>                         sbsa_gwdt_keepalive(&gwdt->wdd);
>>                         if (devm_request_irq(dev, irq,
>> sbsa_gwdt_interrupt, 0,
>>                                              pdev->name, gwdt)) {
>>                                 action = 0;
>>                                 dev_warn(dev, "unable to request IRQ
>> %d.\n",
>>                                          irq);
>>                         }
>>                 }
>>                 if (!action)
>>                         dev_warn(dev, "falling back to single stage
>> mode.\n");
>>         }
>
>
> In fact, I think you need to move the "if (action) {" block near the end of
> sbsa_gwdt_probe().  We don't want to enable the interrupt until the watchdog
> is fully initialized.
>

Good point! Thanks for your testing :-)

Will post v14 for this change.

> --
> Qualcomm Innovation Center, Inc.
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum, a Linux Foundation collaborative project.



-- 
Best regards,

Fu Wei
Software Engineer
Red Hat Software (Beijing) Co.,Ltd.Shanghai Branch
Ph: +86 21 61221326(direct)
Ph: +86 186 2020 4684 (mobile)
Room 1512, Regus One Corporate Avenue,Level 15,
One Corporate Avenue,222 Hubin Road,Huangpu District,
Shanghai,China 200021

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web