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


Groups > linux.kernel > #1353445 > unrolled thread

Export clocks_calc_mult_shift() function

Started byMurali Karicheri <m-karicheri2@ti.com>
First post2016-03-08 23:30 +0100
Last post2016-03-14 16:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Export clocks_calc_mult_shift() function Murali Karicheri <m-karicheri2@ti.com> - 2016-03-08 23:30 +0100
    Re: Export clocks_calc_mult_shift() function John Stultz <john.stultz@linaro.org> - 2016-03-09 00:00 +0100
    Re: Export clocks_calc_mult_shift() function Murali Karicheri <m-karicheri2@ti.com> - 2016-03-14 16:30 +0100

#1353445 — Export clocks_calc_mult_shift() function

FromMurali Karicheri <m-karicheri2@ti.com>
Date2016-03-08 23:30 +0100
SubjectExport clocks_calc_mult_shift() function
Message-ID<rayiC-7ah-11@gated-at.bofh.it>
Hi,

I found a patch posted sometime back to export the clocksource
function clocks_calc_mult_shift() so that it can be called by
drivers that are dynamically loadable. I have not seen any
comment against this. Wondering why this is not merged. We require
this function exported for use in our driver as well. Can you merge
the patch please. Or do you suggest me to repost the same?

http://lkml.iu.edu/hypermail/linux/kernel/1502.2/01641.html

Thanks

-- 
Murali Karicheri
Linux Kernel, Keystone

[toc] | [next] | [standalone]


#1353469

FromJohn Stultz <john.stultz@linaro.org>
Date2016-03-09 00:00 +0100
Message-ID<rayLE-7lC-21@gated-at.bofh.it>
In reply to#1353445
On Wed, Mar 9, 2016 at 5:25 AM, Murali Karicheri <m-karicheri2@ti.com> wrote:
> Hi,
>
> I found a patch posted sometime back to export the clocksource
> function clocks_calc_mult_shift() so that it can be called by
> drivers that are dynamically loadable. I have not seen any
> comment against this. Wondering why this is not merged. We require
> this function exported for use in our driver as well. Can you merge
> the patch please. Or do you suggest me to repost the same?

Why would the clocksource driver need to calculate the hz/shift value
instead of using the clocksource_register_hz/khz functions?

thanks
-john

[toc] | [prev] | [next] | [standalone]


#1357362

FromMurali Karicheri <m-karicheri2@ti.com>
Date2016-03-14 16:30 +0100
Message-ID<rcCBt-5C6-29@gated-at.bofh.it>
In reply to#1353445
On 03/08/2016 05:25 PM, Murali Karicheri wrote:
> Hi,
> 
> I found a patch posted sometime back to export the clocksource
> function clocks_calc_mult_shift() so that it can be called by
> drivers that are dynamically loadable. I have not seen any
> comment against this. Wondering why this is not merged. We require
> this function exported for use in our driver as well. Can you merge
> the patch please. Or do you suggest me to repost the same?
> 
> http://lkml.iu.edu/hypermail/linux/kernel/1502.2/01641.html
> 
> Thanks
> 
John,

Some reason, your response didn't make into my inbox. So I am 
reproducing it below.

>Why would the clocksource driver need to calculate the hz/shift value
>instead of using the clocksource_register_hz/khz functions?
>
>thanks
>-john

John,

In this use case, the timestamp for Tx/Rx is generated by a firmware
that attach the timestamp raw count to the packet meta data when the
same is received from the Packet Accelerator h/w at the ingress.
We need to convert this raw count value to nano second and use a code
like this.

/* Convert a raw PA timer count to nanoseconds
 */
static inline u64 tstamp_raw_to_ns(struct pa_core_device *core_dev, u32 lo,
                                   u32 hi)
{
        u32 mult = core_dev->timestamp_info.mult;
        u32 shift = core_dev->timestamp_info.shift;
        u64 result;

        /* Minimize overflow errors by doing this in pieces */
        result  = ((u64)lo * mult) >> shift;
        result += ((u64)hi << (32 - shift)) * mult;

        return result;
}

The mult, shift values are obtained using the existing clocks_calc_mult_shift()
that will not work, if our driver is built as a dynamically loadable module
as the symbol is not exported. 

Is there an alternative way of doing this without exporting this function. 
clocksource_register_hz/khz() can't help in this, right?

-- 
Murali Karicheri
Linux Kernel, Keystone

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web