lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 6 Dec 2019 12:39:51 +0800
From:   "Tanwar, Rahul" <rahul.tanwar@...ux.intel.com>
To:     Andy Shevchenko <andriy.shevchenko@...el.com>
Cc:     mturquette@...libre.com, sboyd@...nel.org, robh+dt@...nel.org,
        robhkernel.org@...le.fi.intel.com, mark.rutland@....com,
        linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
        qi-ming.wu@...el.com, yixin.zhu@...ux.intel.com,
        cheol.yong.kim@...el.com, rahul.tanwar@...el.com
Subject: Re: [PATCH v1 1/2] clk: intel: Add CGU clock driver for a new SoC


Hi Andy,

On 2/9/2019 8:24 PM, Andy Shevchenko wrote:
> On Mon, Sep 02, 2019 at 03:20:30PM +0300, Andy Shevchenko wrote:
>> On Mon, Sep 02, 2019 at 03:43:13PM +0800, Tanwar, Rahul wrote:
>>> On 28/8/2019 11:09 PM, Andy Shevchenko wrote:
>>>> On Wed, Aug 28, 2019 at 03:00:17PM +0800, Rahul Tanwar wrote:
>>>> Does val == 0 follows the table, i.e. makes div == 1?
>>> 0 val means output clock is ref clock i.e. div ==1. Agree that adding
>>> .val = 0, .div =1 entry will make it more clear & complete.
>>>
>>>>> +	{ .val = 0, .div = 1 },
>>>>> +	{ .val = 1, .div = 2 },
>>>>> +	{ .val = 2, .div = 3 },
>> 1
>>
>>>>> +	{ .val = 3, .div = 4 },
>>>>> +	{ .val = 4, .div = 5 },
>>>>> +	{ .val = 5, .div = 6 },
>> 1
>>
>>>>> +	{ .val = 6, .div = 8 },
>>>>> +	{ .val = 7, .div = 10 },
>>>>> +	{ .val = 8, .div = 12 },
>> 2
>>
>>>>> +	{ .val = 9, .div = 16 },
>>>>> +	{ .val = 10, .div = 20 },
>>>>> +	{ .val = 11, .div = 24 },
>> 4
>>
>>>>> +	{ .val = 12, .div = 32 },
>>>>> +	{ .val = 13, .div = 40 },
>>>>> +	{ .val = 14, .div = 48 },
>> 8
>>
>>>>> +	{ .val = 15, .div = 64 },
>> 16
>>
>>
>> So, now we see the pattern:
>>
>> 	div = val < 3 ? (val + 1) : (1 << ((val - 3) / 3));
> It's not complete, but I think you got the idea.
>
>> So, can we eliminate table?

In the desperation to eliminate table, below is what i can come up with:

        struct clk_div_table div_table[16];
        int i, j;

        for (i = 0; i < 16; i++)
                div_table[i].val = i;

        for (i = 0, j=0; i < 16; i+=3, j++) {
                div_table[i].div = (i == 0) ? (1 << j) : (1 << (j + 1));
                if (i == 15)
                        break;

                div_table[i + 1].div = (i == 0) ? ((1 << j) + 1) :
                                        (1 << (j + 1)) + (1 << (j - 1));
                div_table[i + 2].div = (3 << j);
        }

To me, table still looks a better approach. Also, table is more extendable &
consistent w.r.t. clk framework & other referenced clk drivers.

Whats your opinion ?

Regards,
Rahul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ