Re: [net-next,v2] net: ethernet: rtsn: Add support for Renesas Ethernet-TSN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Andrew,

Thanks for your feedback, I really appreciate your effort reviewing this 
work.

On 2024-05-08 16:00:21 +0200, Andrew Lunn wrote:
> > I agree it's odd and I will try to find out.
> > 
> > If I remove all pm_ calls and the include of pm_runtime.h register reads 
> > from the device do no longer works, so operating the device fails. Even 
> > if I dig out the root cause for this, is there any harm in keeping the 
> > pm_ operations in the initial entablement?
> 
> It suggests something is broken. Do we want to merge broken code?

Of course I do not want broken code merged. I was curious if you knew of 
any harmful side effect of of using pm_ functions I was unaware of.

> 
> Once we understand the root cause maybe then we can decide it is O.K.

The root cause is that the module clock is not enabled without some 
action. If I remove all pm_ calls as well as the inclusion of 
linux/pm_runtime.h. The tsn module clock is left disabled after probe 
completes.

    # grep . /sys/kernel/debug/clk/tsn/*
    /sys/kernel/debug/clk/tsn/clk_accuracy:0
    /sys/kernel/debug/clk/tsn/clk_duty_cycle:1/2
    /sys/kernel/debug/clk/tsn/clk_enable_count:0
    /sys/kernel/debug/clk/tsn/clk_flags:CLK_SET_RATE_PARENT
    /sys/kernel/debug/clk/tsn/clk_max_rate:18446744073709551615
    /sys/kernel/debug/clk/tsn/clk_min_rate:0
    /sys/kernel/debug/clk/tsn/clk_notifier_count:0
    /sys/kernel/debug/clk/tsn/clk_parent:s0d4_hsc
    /sys/kernel/debug/clk/tsn/clk_phase:0
    /sys/kernel/debug/clk/tsn/clk_prepare_count:1
    /sys/kernel/debug/clk/tsn/clk_protect_count:0
    /sys/kernel/debug/clk/tsn/clk_rate:199999992

As the clock is disabled trying to operate the device is not possible.

The clock can either be enabled by the pm_ calls as show or be replaced 
by an explicit clk_enable(), like this (the other pm_ related 
calls/includes are of course also removed).

    -       pm_runtime_enable(&pdev->dev);
    -       pm_runtime_get_sync(&pdev->dev);
    +       clk_enable(priv->clk);

Either of the two methods leaves the module clock running and the driver 
can operate the device.

    # grep . /sys/kernel/debug/clk/tsn/*
    /sys/kernel/debug/clk/tsn/clk_accuracy:0
    /sys/kernel/debug/clk/tsn/clk_duty_cycle:1/2
    /sys/kernel/debug/clk/tsn/clk_enable_count:1
    /sys/kernel/debug/clk/tsn/clk_flags:CLK_SET_RATE_PARENT
    /sys/kernel/debug/clk/tsn/clk_max_rate:18446744073709551615
    /sys/kernel/debug/clk/tsn/clk_min_rate:0
    /sys/kernel/debug/clk/tsn/clk_notifier_count:0
    /sys/kernel/debug/clk/tsn/clk_parent:s0d4_hsc
    /sys/kernel/debug/clk/tsn/clk_phase:0
    /sys/kernel/debug/clk/tsn/clk_prepare_count:1
    /sys/kernel/debug/clk/tsn/clk_protect_count:0
    /sys/kernel/debug/clk/tsn/clk_rate:199999992

I would prefer to keep the pm_ operations, but if you prefer I can 
switch to using clk_enable().

-- 
Kind Regards,
Niklas Söderlund




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux