From: York Sun <yorksun-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
To: Sebastian Hesselbarth
<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Guenter Roeck <linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>,
mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
andrey-MoRZu3FOBbXQT0dZR+AlfA@public.gmane.org,
rabeeh-UBr1pzP51AyaMJb+Lgu22Q@public.gmane.org
Subject: Re: clock driver
Date: Wed, 27 May 2015 09:46:02 -0700 [thread overview]
Message-ID: <5565F4CA.4080105@freescale.com> (raw)
In-Reply-To: <5565F40E.70805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On 05/27/2015 09:42 AM, Sebastian Hesselbarth wrote:
> On 27.05.2015 17:07, York Sun wrote:
>> On 05/27/2015 12:09 AM, Sebastian Hesselbarth wrote:
> [...]
>>> Also, why should a user ever be able to mess with the clocks? If you
>>> allow a user to change the clock rate of any output, you have to
>>> consider that he will likely be able to crash your system easily.
>>>
>>> As long as you cannot give a clear requirement for user-configurable
>>> clocks - especially in the detail of the driver you mentioned -
>>> mainline kernel is not the place for such a driver.
>>
>> This driver I am proposing supports SI5338 in a generic way. It can take device
>> tree as its default configuration. However I am using it differently, explained
>> in detail below.
> [...]
>>> (a) Clocks are limited to the PCI card and only need a limited set of
>>> configurable clocks. You should add functions to load the registers
>>> with either the full register map or parts of it in a table based
>>> approach. You don't expose the clocks with CCF but deal with rate
>>> change requests internally in the PCI driver. You could also consider
>>> to have the initial clock configuration as part of some firmware blob
>>> you request with the PCI driver.
>>
>> That's right. I only need to change a small portion of the configuration, such
>> as frequency, but keeping the reset the same, including output driver voltage,
>> input clock, etc.
> [...]
>> My application has a host SoC booting up Linux. Then the clocks on PCIe (FPGA)
>> cards get initialized with their clocks. The clocks are not used by host SoC, so
>> setting the wrong clocks doesn't crash the system. Each PCIe card has up to four
>> clock chips (with four clocks on each chip). It is required for users to be able
>> to change the clocks after system boots up.
>
> Consider a userspace configurable clock driver, load the FPGA design
> which depends on a specific frequency generated by Si5338 and let the
> user mess with your sysfs files - that will certainly crash your system.
>
> Still, I do not see any requirement for a clock driver for that use
> case. You have to load the FPGA design or at least configure it to
> use the Si5338 generated clocks _after_ configuring Si5338. You'll
> have to have a user interface for FPGA bitfile loading, so you can
> add another one for the clock generator config.
>
>> I wrote my driver for the PCIe cards so the clocks can be initialized using the
>> data provided. But changing the clocks, or initializing with another set of
>> configuration requires an interface. There are many ways to solve this. I would
>> like to keep the clock driver generic so it can be reused. It looks like CCF may
>> not be the best fit for such driver. What is an acceptable way to write this
>> driver so it can be in the mainline kernel, or other maintained projects (I am
>> not aware of any though)?
>
> IMHO "generic" as in a generic mainline kernel clock driver just means
> that other _drivers_ can request any clock rate from that chip. If you
> want to write a CCF driver for Si5338, you'll have to make your PCIe
> driver request that clock and hide the userspace configuration within
> your PCIe driver.
>
> Adding userspace interfaces to generic CCF clock drivers will not happen
> just because messing with the clocks will break a running system. As I
> said before, AFAIKS i2c-dev should give you enough of an interface to
> configure the clock generator from userspace.
>
Sebastian,
Thanks for the insight. Looks like I should give up upstreaming this driver. I
will find other ways to make this driver available if anyone wants to use it.
York
next prev parent reply other threads:[~2015-05-27 16:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-26 19:12 clock driver York Sun
[not found] ` <5564C58B.9050400-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-26 22:38 ` Guenter Roeck
[not found] ` <20150526223829.GA26454-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2015-05-27 0:20 ` York Sun
[not found] ` <55650DBA.5000304-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-27 0:32 ` York Sun
[not found] ` <5565108D.2020502-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-27 7:09 ` Sebastian Hesselbarth
2015-05-27 15:07 ` York Sun
2015-05-27 16:42 ` Sebastian Hesselbarth
[not found] ` <5565F40E.70805-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-27 16:46 ` York Sun [this message]
[not found] ` <5565F4CA.4080105-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-27 17:09 ` Guenter Roeck
2015-05-27 17:10 ` York Sun
2015-05-27 17:30 ` Michael Turquette
2015-05-27 17:45 ` York Sun
[not found] ` <556602BC.6040203-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
2015-05-27 18:15 ` Guenter Roeck
[not found] ` <20150527181521.GA19448-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org>
2015-05-27 18:24 ` York Sun
2015-05-27 18:54 ` Guenter Roeck
2015-05-27 18:58 ` York Sun
[not found] ` <14d96cd6d64.f62a1a09739217.9114963256886461171@elphel.com>
[not found] ` <14d96cd6d64.f62a1a09739217.9114963256886461171-MoRZu3FOBbXQT0dZR+AlfA@public.gmane.org>
2015-05-27 23:08 ` Guenter Roeck
2015-05-27 23:58 ` andrey
[not found] ` <14d97d05f05.c0c23a8c778110.9087956443203424916-MoRZu3FOBbXQT0dZR+AlfA@public.gmane.org>
2015-05-28 0:10 ` Guenter Roeck
2015-05-28 0:29 ` andrey
[not found] ` <14d97ec12ae.121e65c4b780118.1307005790953163680-MoRZu3FOBbXQT0dZR+AlfA@public.gmane.org>
2015-05-28 6:11 ` Michael Turquette
2015-05-28 15:24 ` York Sun
2015-06-10 0:40 ` York Sun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5565F4CA.4080105@freescale.com \
--to=yorksun-kzfg59tc24xl57midrcfdg@public.gmane.org \
--cc=andrey-MoRZu3FOBbXQT0dZR+AlfA@public.gmane.org \
--cc=lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-0h96xk9xTtrk1uMJSBkQmQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mturquette-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=rabeeh-UBr1pzP51AyaMJb+Lgu22Q@public.gmane.org \
--cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).