linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Query: Clock driver requests mailbox channel
@ 2015-07-06 11:33 Leo Yan
  2015-07-07  5:24 ` Jassi Brar
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Yan @ 2015-07-06 11:33 UTC (permalink / raw)
  To: Russell King, Michael Turquette, Jassi Brar, linux-kernel

Hi all,

i'm working with one clock driver, which will invoke mailbox API to
request the mailbox channel and send message.

Usually clock driver will init with devicetree, below is the example:
CLK_OF_DECLARE(hi6220_clk_power, "hisilicon,hi6220-clock-power",
hi6220_clk_power_init);

Clock init function it will pass the pointer of struct device_node
but not the pointer of struct device. So finally it's difficult to
invoke mailbox API *mbox_request_channel()*, due it need use the
struct device to search DT's property "mboxes".

I want to find which is the best way to resolve this issue, so do you
suggest clock driver to manually register one device? Or can we add
one more API to request the mailbox channel directly with device_node?

Welcome any suggestion.

Thanks,
Leo Yan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query: Clock driver requests mailbox channel
  2015-07-06 11:33 Query: Clock driver requests mailbox channel Leo Yan
@ 2015-07-07  5:24 ` Jassi Brar
  2015-07-07 14:04   ` Leo Yan
  0 siblings, 1 reply; 5+ messages in thread
From: Jassi Brar @ 2015-07-07  5:24 UTC (permalink / raw)
  To: Leo Yan; +Cc: Russell King, Michael Turquette, Linux Kernel Mailing List

On Mon, Jul 6, 2015 at 5:03 PM, Leo Yan <leo.yan@linaro.org> wrote:
> Hi all,
>
> i'm working with one clock driver, which will invoke mailbox API to
> request the mailbox channel and send message.
>
> Usually clock driver will init with devicetree, below is the example:
> CLK_OF_DECLARE(hi6220_clk_power, "hisilicon,hi6220-clock-power",
> hi6220_clk_power_init);
>
> Clock init function it will pass the pointer of struct device_node
> but not the pointer of struct device. So finally it's difficult to
> invoke mailbox API *mbox_request_channel()*, due it need use the
> struct device to search DT's property "mboxes".
>
> I want to find which is the best way to resolve this issue, so do you
> suggest clock driver to manually register one device? Or can we add
> one more API to request the mailbox channel directly with device_node?
>
IIUC, such clocks (that require platform resources) should be
populated from the platform_device's probe()?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query: Clock driver requests mailbox channel
  2015-07-07  5:24 ` Jassi Brar
@ 2015-07-07 14:04   ` Leo Yan
  2015-07-08 16:54     ` Michael Turquette
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Yan @ 2015-07-07 14:04 UTC (permalink / raw)
  To: Jassi Brar; +Cc: Russell King, Michael Turquette, Linux Kernel Mailing List

On Tue, Jul 07, 2015 at 10:54:55AM +0530, Jassi Brar wrote:
> On Mon, Jul 6, 2015 at 5:03 PM, Leo Yan <leo.yan@linaro.org> wrote:
> > Hi all,
> >
> > i'm working with one clock driver, which will invoke mailbox API to
> > request the mailbox channel and send message.
> >
> > Usually clock driver will init with devicetree, below is the example:
> > CLK_OF_DECLARE(hi6220_clk_power, "hisilicon,hi6220-clock-power",
> > hi6220_clk_power_init);
> >
> > Clock init function it will pass the pointer of struct device_node
> > but not the pointer of struct device. So finally it's difficult to
> > invoke mailbox API *mbox_request_channel()*, due it need use the
> > struct device to search DT's property "mboxes".
> >
> > I want to find which is the best way to resolve this issue, so do you
> > suggest clock driver to manually register one device? Or can we add
> > one more API to request the mailbox channel directly with device_node?
> >
> IIUC, such clocks (that require platform resources) should be
> populated from the platform_device's probe()?

Thanks for response, Jassi. If we use general platform_device's probe()
function, then we can smoothly to get device poiner.

But if we use the method with CLK_OF_DECLARE, then i tried to get device
pointer with the function of_find_device_by_node(), it will return the
device pointer is NULL. But this is the common case in many clock drivers.

So i just wander if can provide another mailbox API for this case,
which will only need to pass device node pointer?

Thanks,
Leo Yan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query: Clock driver requests mailbox channel
  2015-07-07 14:04   ` Leo Yan
@ 2015-07-08 16:54     ` Michael Turquette
  2015-07-10  6:08       ` Leo Yan
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Turquette @ 2015-07-08 16:54 UTC (permalink / raw)
  To: Leo Yan, Jassi Brar
  Cc: Russell King <linux@arm.linux.org.uk>,
	Linux Kernel Mailing List, linux-clk, sboyd

Cc'ing linux-clk and Stephen Boyd

Quoting Leo Yan (2015-07-07 07:04:25)
> On Tue, Jul 07, 2015 at 10:54:55AM +0530, Jassi Brar wrote:
> > On Mon, Jul 6, 2015 at 5:03 PM, Leo Yan <leo.yan@linaro.org> wrote:
> > > Hi all,
> > >
> > > i'm working with one clock driver, which will invoke mailbox API to
> > > request the mailbox channel and send message.
> > >
> > > Usually clock driver will init with devicetree, below is the example:
> > > CLK_OF_DECLARE(hi6220_clk_power, "hisilicon,hi6220-clock-power",
> > > hi6220_clk_power_init);
> > >
> > > Clock init function it will pass the pointer of struct device_node
> > > but not the pointer of struct device. So finally it's difficult to
> > > invoke mailbox API *mbox_request_channel()*, due it need use the
> > > struct device to search DT's property "mboxes".
> > >
> > > I want to find which is the best way to resolve this issue, so do you
> > > suggest clock driver to manually register one device? Or can we add
> > > one more API to request the mailbox channel directly with device_node?
> > >
> > IIUC, such clocks (that require platform resources) should be
> > populated from the platform_device's probe()?
> 
> Thanks for response, Jassi. If we use general platform_device's probe()
> function, then we can smoothly to get device poiner.
> 
> But if we use the method with CLK_OF_DECLARE, then i tried to get device
> pointer with the function of_find_device_by_node(), it will return the
> device pointer is NULL. But this is the common case in many clock drivers.

Using platform_device is the right approach. Stephen has been trying to
encourage use of that and discourage use of CLK_OF_DECLARE where
possible.

If your clock driver needs to register some early clocks then perhaps
those can be handled separately with CLK_OF_DECLARE and the rest can be
managed through a proper platform_driver?

> 
> So i just wander if can provide another mailbox API for this case,
> which will only need to pass device node pointer?

I can't comment on the mailbox API question, but I think the Right Thing
is to use a platform_driver for your clock driver, which would solve
your particular issue. This is something we are encouraging in Clock
Land ;)

Regards,
Mike

> 
> Thanks,
> Leo Yan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Query: Clock driver requests mailbox channel
  2015-07-08 16:54     ` Michael Turquette
@ 2015-07-10  6:08       ` Leo Yan
  0 siblings, 0 replies; 5+ messages in thread
From: Leo Yan @ 2015-07-10  6:08 UTC (permalink / raw)
  To: Michael Turquette
  Cc: Jassi Brar, Russell King <linux@arm.linux.org.uk>,
	Linux Kernel Mailing List, linux-clk, sboyd

On Wed, Jul 08, 2015 at 09:54:29AM -0700, Michael Turquette wrote:
> Cc'ing linux-clk and Stephen Boyd
> 
> Quoting Leo Yan (2015-07-07 07:04:25)
> > On Tue, Jul 07, 2015 at 10:54:55AM +0530, Jassi Brar wrote:
> > > On Mon, Jul 6, 2015 at 5:03 PM, Leo Yan <leo.yan@linaro.org> wrote:
> > > > Hi all,
> > > >
> > > > i'm working with one clock driver, which will invoke mailbox API to
> > > > request the mailbox channel and send message.
> > > >
> > > > Usually clock driver will init with devicetree, below is the example:
> > > > CLK_OF_DECLARE(hi6220_clk_power, "hisilicon,hi6220-clock-power",
> > > > hi6220_clk_power_init);
> > > >
> > > > Clock init function it will pass the pointer of struct device_node
> > > > but not the pointer of struct device. So finally it's difficult to
> > > > invoke mailbox API *mbox_request_channel()*, due it need use the
> > > > struct device to search DT's property "mboxes".
> > > >
> > > > I want to find which is the best way to resolve this issue, so do you
> > > > suggest clock driver to manually register one device? Or can we add
> > > > one more API to request the mailbox channel directly with device_node?
> > > >
> > > IIUC, such clocks (that require platform resources) should be
> > > populated from the platform_device's probe()?
> > 
> > Thanks for response, Jassi. If we use general platform_device's probe()
> > function, then we can smoothly to get device poiner.
> > 
> > But if we use the method with CLK_OF_DECLARE, then i tried to get device
> > pointer with the function of_find_device_by_node(), it will return the
> > device pointer is NULL. But this is the common case in many clock drivers.
> 
> Using platform_device is the right approach. Stephen has been trying to
> encourage use of that and discourage use of CLK_OF_DECLARE where
> possible.
> 
> If your clock driver needs to register some early clocks then perhaps
> those can be handled separately with CLK_OF_DECLARE and the rest can be
> managed through a proper platform_driver?

> > So i just wander if can provide another mailbox API for this case,
> > which will only need to pass device node pointer?
> 
> I can't comment on the mailbox API question, but I think the Right Thing
> is to use a platform_driver for your clock driver, which would solve
> your particular issue. This is something we are encouraging in Clock
> Land ;)

Got it and thanks for clarification. i will change to use platform_driver.
Looks like i can refer some examples in the folder drivers/clk/qcom. ;)

Thanks,
Leo Yan

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-07-10  6:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-06 11:33 Query: Clock driver requests mailbox channel Leo Yan
2015-07-07  5:24 ` Jassi Brar
2015-07-07 14:04   ` Leo Yan
2015-07-08 16:54     ` Michael Turquette
2015-07-10  6:08       ` Leo Yan

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).