devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: xuejiancheng <xuejiancheng@huawei.com>
To: Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Rob Herring <robh+dt@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>,
	Russell King - ARM Linux <linux@arm.linux.org.uk>,
	Kevin Hilman <khilman@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
	Olof Johansson <olof@lixom.net>, Wei Xu <xuwei5@hisilicon.com>,
	Haojian Zhuang <haojian.zhuang@linaro.org>,
	Zhangfei Gao <zhangfei.gao@linaro.org>,
	Bintian Wang <bintian.wang@huawei.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	linux-clk <linux-clk@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	yanhaifeng@hisilicon.com, yanghongwei@hisilicon.com
Subject: Re: [PATCH v5 1/6] clk: hisilicon: add CRG driver for hi3519 soc
Date: Fri, 22 Jan 2016 16:50:27 +0800	[thread overview]
Message-ID: <56A1ED53.60309@huawei.com> (raw)
In-Reply-To: <CAAObsKBbUaGi-ZWg+Y-OCq=xVOgBJroMTVsqP2JpVHPQWcM4=w@mail.gmail.com>

On 2016/1/20 14:38, Tomeu Vizoso wrote:
> On 19 January 2016 at 19:20, Rob Herring <robh+dt@kernel.org> wrote:
>> On Fri, Jan 15, 2016 at 1:57 AM, xuejiancheng <xuejiancheng@huawei.com> wrote:
>>>
>>> On 2016/1/14 21:16, xuejiancheng wrote:
>>>> Hi Mike,
>>>>
>>>> On 2016/1/14 2:57, Michael Turquette wrote:
>>>>> Quoting xuejiancheng (2016-01-12 19:03:01)
>>>>>> Hi Stephen,
>>>>>>    Thank you very much for your reply.
>>>>>>
>>>>>> On 2016/1/13 6:12, Stephen Boyd wrote:
>>>>>>> On 01/08, Jiancheng Xue wrote:
>>>>>>>> diff --git a/drivers/clk/hisilicon/Kconfig b/drivers/clk/hisilicon/Kconfig
>>>>>>>> index e434854..b6baebf 100644
>>>>>>>> --- a/drivers/clk/hisilicon/Kconfig
>>>>>>>> +++ b/drivers/clk/hisilicon/Kconfig
>>>>>>>> @@ -1,3 +1,10 @@
>>>>>>>> +config COMMON_CLK_HI3519
>>>>>>>> +    tristate "Clock Driver for Hi3519"
>>>>>>>
>>>>>>> It looks like this has to be bool. Otherwise it needs to be a
>>>>>>> platform driver and the hisilicon APIs need to be exported and
>>>>>>> lose their __init markings.
>>>>>>>
>>>>>> Yes,it's a problem. I will fix it in next version. Thank you.
>>>>>
>>>>> The best solution would be to make this clock driver a real platform
>>>>> driver.
>>>>>
>>>> Now the work clock of the clocksource timer-sp804 is provided by this driver. So
>>>> it need to be registered early by CLK_OF_DECLARE. If the timer clock is treated
>>>> as a fixed-clock provider, this driver can be implemented as a platform driver.
>>>> Then the crg device must be registered before other clock consumer devices.Accordingly
>>>> the crg device node must be written above all other clock consumer devices node in dts files.
>>>> I think it is also a dependence.
>>>>
>>>> Can you help me understand why it is better to make this driver a platform driver?
>>>> Thank you very much!
>>>>
>>> arch_initcall(customize_machine)
>>> -->of_platform_populate
>>>    -->of_platform_bus_create
>>>      -->of_amba_device_create
>>>         -->amba_device_add
>>>            -->amba_get_enable_pclk
>>> The call sequence above shows that the clock of the amba device must be registered before
>>> amba_device_add. The clock of "arm,pl011" uart is registered in the probe function of the
>>> platform driver "hi3519-crg". So the platform device "hi3519-crg" must be created before
>>> the amba device "arm,pl011" uart.
>>
>> It is a problem, but Tomeu had a fix to support deferred probes here.
>> That was part of the on-demand probing series, but maybe it needs to
>> be applied separately if we are moving clock drivers to platform
>> drivers.
> 
> Hi,
> 
> Marek Szyprowski has kindly taken those two patches as part of a series of him:
> 
> http://lkml.kernel.org/g/1450868368-5650-1-git-send-email-m.szyprowski@samsung.com
> 
> I think it would be great if you could test them and report.
> 
Hi Tomeu,

I have applied the patch "https://lkml.org/lkml/2015/12/23/105" and tested on my hi3519-demb board.
It works even if the apb_pclk is registered later than the amba-pl011 device being registered.

But I think it is a problem if amba_read_periphid() returns -ENOMEM or -ENODEV when apb_pclk is available.
In this condition,amba_match() returns a non zero value which means the driver and device matches
and the amba_probe() will be called, but amba_device->periphid remains as 0. Then amba_lookup() called in
amba_probe() will return a null id pointer.The null pointer will be passed to amba_driver->probe() and
this may cause a segment fault.

Regards,

Jiancheng

> Thanks,
> 
> Tomeu
> 
> .
> 


  reply	other threads:[~2016-01-22  8:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  2:16 [PATCH v5 0/6] ARM: hisi: Add initial support including clock driver for Hi3519 soc Jiancheng Xue
2016-01-08  2:16 ` [PATCH v5 1/6] clk: hisilicon: add CRG driver for hi3519 soc Jiancheng Xue
2016-01-09  6:24   ` kbuild test robot
2016-01-09 15:33   ` Rob Herring
2016-01-11  3:47     ` xuejiancheng
2016-01-12 22:12   ` Stephen Boyd
2016-01-13  3:03     ` xuejiancheng
2016-01-13 18:57       ` Michael Turquette
2016-01-14 13:16         ` xuejiancheng
2016-01-15  7:57           ` xuejiancheng
2016-01-19 18:20             ` Rob Herring
2016-01-20  6:38               ` Tomeu Vizoso
2016-01-22  8:50                 ` xuejiancheng [this message]
2016-01-22  9:55                   ` Tomeu Vizoso
2016-01-08  2:16 ` [PATCH v5 2/6] ARM: hisi: add compatible string for Hi3519 soc Jiancheng Xue
2016-01-08  2:16 ` [PATCH v5 4/6] ARM: debug: add hi3519 debug uart Jiancheng Xue
2016-01-08 15:08   ` Russell King - ARM Linux
2016-01-11  2:32     ` xuejiancheng
2016-01-08  2:16 ` [PATCH v5 5/6] mfd: dt-bindings: add device tree bindings for Hi3519 sysctrl Jiancheng Xue
2016-01-08 21:04   ` Rob Herring
2016-01-11  5:48   ` Lee Jones
2016-01-11  7:50     ` xuejiancheng
2016-01-11  8:55       ` Lee Jones
2016-01-12  1:35         ` xuejiancheng
2016-01-12  7:41           ` Lee Jones
2016-01-12  8:17             ` xuejiancheng
2016-01-12  8:39               ` Lee Jones
2016-01-12  9:28                 ` xuejiancheng
2016-01-12 22:51                   ` Arnd Bergmann
2016-01-13  9:08                     ` xuejiancheng
2016-01-13 10:00                       ` Arnd Bergmann
2016-01-25 14:26                     ` Lee Jones
2016-01-25 14:45                       ` Arnd Bergmann
     [not found] ` <1452219400-32478-1-git-send-email-xuejiancheng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-01-08  2:16   ` [PATCH v5 3/6] ARM: config: hisi: enable CONFIG_RESET_CONTROLLER Jiancheng Xue
2016-01-08  2:16   ` [PATCH v5 6/6] ARM: dts: add dts files for Hi3519 Jiancheng Xue
     [not found]     ` <1452219400-32478-7-git-send-email-xuejiancheng-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2016-01-08 15:10       ` Russell King - ARM Linux
2016-01-11  2:05         ` xuejiancheng

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=56A1ED53.60309@huawei.com \
    --to=xuejiancheng@huawei.com \
    --cc=arnd@arndb.de \
    --cc=bintian.wang@huawei.com \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=haojian.zhuang@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=khilman@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=mturquette@baylibre.com \
    --cc=olof@lixom.net \
    --cc=p.zabel@pengutronix.de \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=tomeu.vizoso@collabora.com \
    --cc=xuwei5@hisilicon.com \
    --cc=yanghongwei@hisilicon.com \
    --cc=yanhaifeng@hisilicon.com \
    --cc=zhangfei.gao@linaro.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).