Linux experts,
I have rewritten a driver for Silicon Labs SI5338 programmable clock chip. The
original driver was written by Andrey (CC'ed), but was floatingn outside of the
kernel. The driver was written to use sysfs as the interface, not the common
clock framework. I wonder if I have to rewrite the driver following common clock
framework. One concern is to support a feature to accept ClockBuilder (TM)
output on sysfs. I don't see sysfs support on common clock framework. Please
correct me if I am wrong.
If not using common clock framework is acceptable, I would like to send a RFC
patch for review.
Regards,
York
On Tue, May 26, 2015 at 12:12:11PM -0700, York Sun wrote:
> Linux experts,
>
> I have rewritten a driver for Silicon Labs SI5338 programmable clock chip. The
> original driver was written by Andrey (CC'ed), but was floatingn outside of the
> kernel. The driver was written to use sysfs as the interface, not the common
> clock framework. I wonder if I have to rewrite the driver following common clock
> framework. One concern is to support a feature to accept ClockBuilder (TM)
> output on sysfs. I don't see sysfs support on common clock framework. Please
> correct me if I am wrong.
>
> If not using common clock framework is acceptable, I would like to send a RFC
> patch for review.
>
My original driver for si570 was rejected because it didn't support the clock
framework, so you might face an uphill battle.
SI provides a document for SI5338 describing how to configure it without
using clockbuilder [1]. Can that be used to implement generic code which
doesn't need clockbuilder ?
Guenter
---
[1] https://www.silabs.com/Support%20Documents/TechnicalDocs/Si5338-RM.pdf
On 05/26/2015 03:38 PM, Guenter Roeck wrote:
> On Tue, May 26, 2015 at 12:12:11PM -0700, York Sun wrote:
>> Linux experts,
>>
>> I have rewritten a driver for Silicon Labs SI5338 programmable clock chip. The
>> original driver was written by Andrey (CC'ed), but was floatingn outside of the
>> kernel. The driver was written to use sysfs as the interface, not the common
>> clock framework. I wonder if I have to rewrite the driver following common clock
>> framework. One concern is to support a feature to accept ClockBuilder (TM)
>> output on sysfs. I don't see sysfs support on common clock framework. Please
>> correct me if I am wrong.
>>
>> If not using common clock framework is acceptable, I would like to send a RFC
>> patch for review.
>>
> My original driver for si570 was rejected because it didn't support the clock
> framework, so you might face an uphill battle.
>
> SI provides a document for SI5338 describing how to configure it without
> using clockbuilder [1]. Can that be used to implement generic code which
> doesn't need clockbuilder ?
>
The driver is capable to handle the user's input and enable the clocks. Removing
the support of importing is a step back. At least it is a feature I am using. I
believe Andrey also used this feature when the driver was first drafted.
That being said, my application relies on setting multiple clock chips on a PCIe
device. That means I cannot put the configuration into device tree. There may be
a way to fill device tree, but I am not ready to explore yet. Without a sysfs
interface, can I change the configuration for each clock?
I also found COMMON_CLK is a bool, not tristate. It is only selected by others.
Is there a reason for doing so? My current platform (P1022DS) doesn't have
CONFIG_COMMON_CLK enabled.
York
Michael,
Can you give me some guidance here?
On 05/26/2015 05:20 PM, York Sun wrote:
>
>
> On 05/26/2015 03:38 PM, Guenter Roeck wrote:
>> On Tue, May 26, 2015 at 12:12:11PM -0700, York Sun wrote:
>>> Linux experts,
>>>
>>> I have rewritten a driver for Silicon Labs SI5338 programmable clock chip. The
>>> original driver was written by Andrey (CC'ed), but was floatingn outside of the
>>> kernel. The driver was written to use sysfs as the interface, not the common
>>> clock framework. I wonder if I have to rewrite the driver following common clock
>>> framework. One concern is to support a feature to accept ClockBuilder (TM)
>>> output on sysfs. I don't see sysfs support on common clock framework. Please
>>> correct me if I am wrong.
>>>
>>> If not using common clock framework is acceptable, I would like to send a RFC
>>> patch for review.
>>>
>> My original driver for si570 was rejected because it didn't support the clock
>> framework, so you might face an uphill battle.
>>
>> SI provides a document for SI5338 describing how to configure it without
>> using clockbuilder [1]. Can that be used to implement generic code which
>> doesn't need clockbuilder ?
>>
>
> The driver is capable to handle the user's input and enable the clocks. Removing
> the support of importing is a step back. At least it is a feature I am using. I
> believe Andrey also used this feature when the driver was first drafted.
>
> That being said, my application relies on setting multiple clock chips on a PCIe
> device. That means I cannot put the configuration into device tree. There may be
> a way to fill device tree, but I am not ready to explore yet. Without a sysfs
> interface, can I change the configuration for each clock?
>
> I also found COMMON_CLK is a bool, not tristate. It is only selected by others.
> Is there a reason for doing so? My current platform (P1022DS) doesn't have
> CONFIG_COMMON_CLK enabled.
>
If converting my driver to common clock framework, I need to find a way to
configure the clocks without recompiling the kernel. I will have about 30 clock
chips (with different frequency) on multiple PCIe cards.
York
Michael,
I have rewritten the driver to use CCF. It will be sent for review when ready.
I have some questions, hoping you can shed some light on them.
Q1: What does of_clk_add_provider do?
I read the code and comment. It registers a clock provider for a node. How is it
used after registration?
Q2: What do you suggest to name multiple clocks on PCIe (FPGA) cards?
I will have multiple cards with multiple clock chips on each. The clock driver
can handle clocks on each chip. Is it recommended to create unique names by the
driver? Is there any example to follow?
Q3: Is there a guideline or an API to create sub folder under debugfs "clk"?
Thanks a lot.
York