From: Stephen Boyd <sboyd@codeaurora.org>
To: James Liao <jamesjj.liao@mediatek.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>,
Mike Turquette <mturquette@linaro.org>,
srv_heupstream@mediatek.com, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Henry Chen <henryc.chen@mediatek.com>,
Ricky Liang <jcliang@chromium.org>,
Rob Herring <robh+dt@kernel.org>,
linux-mediatek@lists.infradead.org,
Sascha Hauer <kernel@pengutronix.de>,
Matthias Brugger <matthias.bgg@gmail.com>,
Yingjoe Chen <yingjoe.chen@mediatek.com>,
Eddie Huang <eddie.huang@mediatek.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 0/5] Add Mediatek MT8173 subsystem clocks support
Date: Fri, 5 Jun 2015 17:59:12 -0700 [thread overview]
Message-ID: <20150606005912.GC29237@codeaurora.org> (raw)
In-Reply-To: <1433468737.14416.7.camel@mtksdaap41>
On 06/05, James Liao wrote:
> Hi Stephen,
>
> On Thu, 2015-06-04 at 14:02 -0700, Stephen Boyd wrote:
> > On 05/29, Sascha Hauer wrote:
> > > Yes. I previously got the impression that the subsystem clocks are not
> > > directly associated to the larbs, but needed to be handled by the larb
> > > code due to some side effect. Now that I saw that the larbs are directly
> > > in the subsystem register space it all makes sense.
> > >
> > > Note that the way Mediatek SoCs are designed around sub modules is bit
> > > unusual and does not fit very well in the Linux directory structure.
> > > Normally SoCs have a single clocks controller which controls all clocks
> > > in the SoC. Then you often have a reset controller providing reset lines
> > > in the SoC. In this case it's clear that the clk driver goes to
> > > drivers/clk/, the reset controller driver to drivers/reset/. Mediatek
> > > SoCs instead have several blocks, each with its own clock and reset
> > > controller. Splitting each block up into parts in drivers/clk/ and
> > > drivers/reset/ leads to quite a code fragmentation.
> > > This is my opinion, it would be great to hear something from others.
> > > Matthias? I'd like to avoid running into a direction that is not
> > > acceptable in the end.
> >
> > We already have drivers registering clocks and resets under
> > drivers/clk, so it's not unheard of. An alternative solution is
> > to make child devices for the clock part and the reset part at
> > runtime in the toplevel driver for the vencsys device (don't do
> > any sort of DT description for this) and use regmap to mediate
> > the register accesses and locking. That way we can put the clk
> > driver in drivers/clk/, the reset driver in drivers/reset, etc.
> > so that logically related code is grouped.
>
> I have a question about the alternative way you mentioned. Currently
> clock providers and consumers describe what clocks they will provide /
> consume in device tree. If we don't describe vencsys clocks in device
> tree, how to get vencsys clocks for drivers that need to control them?
>
Perhaps an example would be best. In DT we would have:
vencsys: vencsys@10000 {
compatible = "mtk,vencsys";
reg = <0x10000 0x1000>;
#clock-cells = <1>;
#reset-cells = <1>;
};
myconsumer@12000 {
compatible = "mtk,vencsys";
reg = <0x12000 0x100>;
clocks = <&vencsys 10>;
clock-names = "core";
};
(Or are the consumers only children of the subsystem?
It's not clear to me)
And then in the mtk,vencsys driver we would create a platform
device named something like "mtk-vencsys-clk" and assign the
of_node of the device to be the of_node that is assigned to the
mtk,vencsys device.
static int vencsys_probe(struct platform_device *pdev)
{
int ret;
struct device_node *np = pdev->dev.of_node;
struct platform_device *clk_pdev;
clk_pdev = platform_device_alloc("mtk-vencsys-clk", -1);
clk_pdev->dev.of_node = of_node;
ret = platform_device_add(clk_pdev);
if (ret)
return ret;
}
Then we could put a mtk-vencsys-clk driver in drivers/clk/ that
does the clk driver part...
static int clk_vencsys_probe(struct platform_device *pdev)
{
int ret;
struct device_node *np = pdev->dev.of_node;
struct regmap *regmap;
ret = of_clk_add_provider(np, of_clk_src_onecell_get, ..);
if (ret)
return ret;
regmap = dev_get_regmap(pdev->dev.parent, NULL);
}
And similar things could be done for the reset driver.
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
next prev parent reply other threads:[~2015-06-06 0:59 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-21 7:12 [PATCH 0/5] Add Mediatek MT8173 subsystem clocks support James Liao
[not found] ` <1432192376-6712-1-git-send-email-jamesjj.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-05-21 7:12 ` [PATCH 1/5] clk: mediatek: Fix apmixedsys clock registration James Liao
2015-05-26 7:42 ` Sascha Hauer
2015-06-04 21:07 ` Stephen Boyd
2015-05-21 7:12 ` [PATCH 2/5] clk: mediatek: mt8173: Fix enabling of critical clocks James Liao
2015-05-26 7:46 ` Sascha Hauer
[not found] ` <20150526074608.GE6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-26 8:36 ` James Liao
2015-05-21 7:12 ` [PATCH 3/5] dt-bindings: ARM: Mediatek: Document devicetree bindings for clock controllers James Liao
[not found] ` <1432192376-6712-4-git-send-email-jamesjj.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-05-26 7:56 ` Sascha Hauer
[not found] ` <20150526075643.GF6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-26 8:55 ` James Liao
2015-05-26 11:08 ` Sascha Hauer
2015-05-27 6:12 ` Yong Wu
2015-05-27 7:27 ` Sascha Hauer
[not found] ` <20150527072759.GS6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-28 5:14 ` Yong Wu
2015-05-21 7:12 ` [PATCH 4/5] clk: mediatek: Add subsystem clocks of MT8173 James Liao
[not found] ` <1432192376-6712-5-git-send-email-jamesjj.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-05-22 4:22 ` Daniel Kurtz
2015-05-22 6:03 ` James Liao
2015-06-12 17:09 ` Matthias Brugger
2015-06-15 2:10 ` James Liao
2015-05-21 7:12 ` [PATCH 5/5] clk: mediatek: Add USB clock support in MT8173 APMIXEDSYS James Liao
[not found] ` <1432192376-6712-6-git-send-email-jamesjj.liao-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-05-26 8:05 ` Sascha Hauer
[not found] ` <20150526080516.GG6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-26 9:11 ` James Liao
2015-05-26 9:41 ` Sascha Hauer
[not found] ` <20150526094140.GH6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-26 9:58 ` James Liao
2015-05-28 13:24 ` [PATCH 0/5] Add Mediatek MT8173 subsystem clocks support Sascha Hauer
[not found] ` <20150528132452.GI26575-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-05-29 2:47 ` James Liao
2015-05-29 6:23 ` Sascha Hauer
[not found] ` <20150529062345.GY6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-06-04 21:02 ` Stephen Boyd
[not found] ` <20150604210212.GM676-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-05 1:45 ` James Liao
2015-06-06 0:59 ` Stephen Boyd [this message]
[not found] ` <20150606005912.GC29237-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-08 7:27 ` James Liao
2015-06-08 7:48 ` Sascha Hauer
[not found] ` <20150608074858.GK6325-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-06-11 23:52 ` Stephen Boyd
[not found] ` <20150611235212.GI29640-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-12 17:05 ` Matthias Brugger
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=20150606005912.GC29237@codeaurora.org \
--to=sboyd@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=eddie.huang@mediatek.com \
--cc=henryc.chen@mediatek.com \
--cc=jamesjj.liao@mediatek.com \
--cc=jcliang@chromium.org \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mturquette@linaro.org \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=srv_heupstream@mediatek.com \
--cc=yingjoe.chen@mediatek.com \
/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).