* [PATCH -next] xtensa: Fix build error due to missing include file
@ 2016-07-24 0:24 Guenter Roeck
2016-07-24 0:45 ` Max Filippov
0 siblings, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2016-07-24 0:24 UTC (permalink / raw)
To: Chris Zankel
Cc: Max Filippov, linux-xtensa, linux-kernel, Guenter Roeck,
Kefeng Wang, Rob Herring
Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate
with default match table") dropped various include files from
arch/xtensa/kernel/setup.c. This results in the following build error.
arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’:
arch/xtensa/kernel/setup.c:213:2: error:
implicit declaration of function ‘of_read_ulong’
Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table")
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
I would suggest to merge this patch into the commit causing the problem
if possible.
arch/xtensa/kernel/setup.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/xtensa/kernel/setup.c b/arch/xtensa/kernel/setup.c
index 18af563110a1..6f68c6045a70 100644
--- a/arch/xtensa/kernel/setup.c
+++ b/arch/xtensa/kernel/setup.c
@@ -23,6 +23,7 @@
#include <linux/kernel.h>
#include <linux/percpu.h>
#include <linux/cpu.h>
+#include <linux/of.h>
#include <linux/of_fdt.h>
#if defined(CONFIG_VGA_CONSOLE) || defined(CONFIG_DUMMY_CONSOLE)
--
2.5.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-24 0:24 [PATCH -next] xtensa: Fix build error due to missing include file Guenter Roeck @ 2016-07-24 0:45 ` Max Filippov 2016-07-24 6:00 ` Guenter Roeck 0 siblings, 1 reply; 11+ messages in thread From: Max Filippov @ 2016-07-24 0:45 UTC (permalink / raw) To: Guenter Roeck Cc: Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang, Rob Herring On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> wrote: > Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate > with default match table") dropped various include files from > arch/xtensa/kernel/setup.c. This results in the following build error. > > arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: > arch/xtensa/kernel/setup.c:213:2: error: > implicit declaration of function ‘of_read_ulong’ > > Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table") > Cc: Kefeng Wang <wangkefeng.wang@huawei.com> > Cc: Rob Herring <robh@kernel.org> > Signed-off-by: Guenter Roeck <linux@roeck-us.net> > --- > I would suggest to merge this patch into the commit causing the problem > if possible. > > arch/xtensa/kernel/setup.c | 1 + > 1 file changed, 1 insertion(+) Acked-by: Max Filippov <jcmvbkbc@gmail.com> -- Thanks. -- Max ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-24 0:45 ` Max Filippov @ 2016-07-24 6:00 ` Guenter Roeck 2016-07-24 14:20 ` Max Filippov 0 siblings, 1 reply; 11+ messages in thread From: Guenter Roeck @ 2016-07-24 6:00 UTC (permalink / raw) To: Max Filippov Cc: Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang, Rob Herring On 07/23/2016 05:45 PM, Max Filippov wrote: > On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> wrote: >> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >> with default match table") dropped various include files from >> arch/xtensa/kernel/setup.c. This results in the following build error. >> >> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: >> arch/xtensa/kernel/setup.c:213:2: error: >> implicit declaration of function ‘of_read_ulong’ >> >> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table") >> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> >> Cc: Rob Herring <robh@kernel.org> >> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >> --- >> I would suggest to merge this patch into the commit causing the problem >> if possible. >> >> arch/xtensa/kernel/setup.c | 1 + >> 1 file changed, 1 insertion(+) > > Acked-by: Max Filippov <jcmvbkbc@gmail.com> > Heads up: xtensa images build after this patch, but the image that previously failed to build (generic_kc705_defconfig) doesn't boot, at least not with qemu. I don't know if this is caused by 69d99e6c0d621f or by some other patch. Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-24 6:00 ` Guenter Roeck @ 2016-07-24 14:20 ` Max Filippov 2016-07-24 15:18 ` Rob Herring 0 siblings, 1 reply; 11+ messages in thread From: Max Filippov @ 2016-07-24 14:20 UTC (permalink / raw) To: Guenter Roeck Cc: Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang, Rob Herring On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> wrote: > On 07/23/2016 05:45 PM, Max Filippov wrote: >> >> On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> wrote: >>> >>> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >>> with default match table") dropped various include files from >>> arch/xtensa/kernel/setup.c. This results in the following build error. >>> >>> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: >>> arch/xtensa/kernel/setup.c:213:2: error: >>> implicit declaration of function ‘of_read_ulong’ >>> >>> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >>> with default match table") >>> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> >>> Cc: Rob Herring <robh@kernel.org> >>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>> --- >>> I would suggest to merge this patch into the commit causing the problem >>> if possible. >>> >>> arch/xtensa/kernel/setup.c | 1 + >>> 1 file changed, 1 insertion(+) >> >> >> Acked-by: Max Filippov <jcmvbkbc@gmail.com> >> > > Heads up: xtensa images build after this patch, but the image that > previously failed to build (generic_kc705_defconfig) doesn't boot, > at least not with qemu. I don't know if this is caused by 69d99e6c0d621f > or by some other patch. It seems to be booting, but serial console is non-functional. With commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate with default match table") I see the following message during boot: [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not defined Reverting that commit fixes serial console for me. Any suggestions on what might go wrong? -- Thanks. -- Max ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-24 14:20 ` Max Filippov @ 2016-07-24 15:18 ` Rob Herring 2016-07-24 16:27 ` Guenter Roeck 0 siblings, 1 reply; 11+ messages in thread From: Rob Herring @ 2016-07-24 15:18 UTC (permalink / raw) To: Max Filippov Cc: Guenter Roeck, Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang On Sun, Jul 24, 2016 at 9:20 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: > On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> wrote: >> On 07/23/2016 05:45 PM, Max Filippov wrote: >>> >>> On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> wrote: >>>> >>>> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >>>> with default match table") dropped various include files from >>>> arch/xtensa/kernel/setup.c. This results in the following build error. >>>> >>>> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: >>>> arch/xtensa/kernel/setup.c:213:2: error: >>>> implicit declaration of function ‘of_read_ulong’ >>>> >>>> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >>>> with default match table") >>>> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> >>>> Cc: Rob Herring <robh@kernel.org> >>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>>> --- >>>> I would suggest to merge this patch into the commit causing the problem >>>> if possible. >>>> >>>> arch/xtensa/kernel/setup.c | 1 + >>>> 1 file changed, 1 insertion(+) >>> >>> >>> Acked-by: Max Filippov <jcmvbkbc@gmail.com> >>> >> >> Heads up: xtensa images build after this patch, but the image that >> previously failed to build (generic_kc705_defconfig) doesn't boot, >> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f >> or by some other patch. > > It seems to be booting, but serial console is non-functional. > With commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate > with default match table") I see the following message during boot: > > [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not defined > > Reverting that commit fixes serial console for me. > Any suggestions on what might go wrong? Probably the init order changed somehow and deferred probe is not supported correctly. Rob ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-24 15:18 ` Rob Herring @ 2016-07-24 16:27 ` Guenter Roeck 2016-07-25 8:07 ` Max Filippov 0 siblings, 1 reply; 11+ messages in thread From: Guenter Roeck @ 2016-07-24 16:27 UTC (permalink / raw) To: Rob Herring, Max Filippov Cc: Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang On 07/24/2016 08:18 AM, Rob Herring wrote: > On Sun, Jul 24, 2016 at 9:20 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: >> On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> wrote: >>> On 07/23/2016 05:45 PM, Max Filippov wrote: >>>> >>>> On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> wrote: >>>>> >>>>> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >>>>> with default match table") dropped various include files from >>>>> arch/xtensa/kernel/setup.c. This results in the following build error. >>>>> >>>>> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: >>>>> arch/xtensa/kernel/setup.c:213:2: error: >>>>> implicit declaration of function ‘of_read_ulong’ >>>>> >>>>> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >>>>> with default match table") >>>>> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> >>>>> Cc: Rob Herring <robh@kernel.org> >>>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>>>> --- >>>>> I would suggest to merge this patch into the commit causing the problem >>>>> if possible. >>>>> >>>>> arch/xtensa/kernel/setup.c | 1 + >>>>> 1 file changed, 1 insertion(+) >>>> >>>> >>>> Acked-by: Max Filippov <jcmvbkbc@gmail.com> >>>> >>> >>> Heads up: xtensa images build after this patch, but the image that >>> previously failed to build (generic_kc705_defconfig) doesn't boot, >>> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f >>> or by some other patch. >> >> It seems to be booting, but serial console is non-functional. >> With commit 69d99e6c0d621f ("xtensa: Remove unnecessary of_platform_populate >> with default match table") I see the following message during boot: >> >> [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not defined >> >> Reverting that commit fixes serial console for me. >> Any suggestions on what might go wrong? > > Probably the init order changed somehow and deferred probe is not > supported correctly. > While the message is due to -EPROBE_DEFER (and there should really be no message in this case), I suspect that the underlying problem is that of_clk_init() is now called way too early, before the clock source is fully initialized. Specifically, the call now happens before the message "clocksource: Switched to clocksource ccount", which at least looks suspicious. If I move of_clk_init() back into xtensa_device_probe(), to be called as device_initcall(), everything is fine. Guenter ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-24 16:27 ` Guenter Roeck @ 2016-07-25 8:07 ` Max Filippov 2016-07-25 13:22 ` Rob Herring 2016-07-25 20:51 ` Guenter Roeck 0 siblings, 2 replies; 11+ messages in thread From: Max Filippov @ 2016-07-25 8:07 UTC (permalink / raw) To: Guenter Roeck Cc: Rob Herring, Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang [-- Attachment #1: Type: text/plain, Size: 3123 bytes --] On Sun, Jul 24, 2016 at 7:27 PM, Guenter Roeck <linux@roeck-us.net> wrote: > On 07/24/2016 08:18 AM, Rob Herring wrote: >> >> On Sun, Jul 24, 2016 at 9:20 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: >>> >>> On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> >>> wrote: >>>> >>>> On 07/23/2016 05:45 PM, Max Filippov wrote: >>>>> >>>>> >>>>> On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> >>>>> wrote: >>>>>> >>>>>> >>>>>> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary >>>>>> of_platform_populate >>>>>> with default match table") dropped various include files from >>>>>> arch/xtensa/kernel/setup.c. This results in the following build error. >>>>>> >>>>>> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: >>>>>> arch/xtensa/kernel/setup.c:213:2: error: >>>>>> implicit declaration of function ‘of_read_ulong’ >>>>>> >>>>>> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary >>>>>> of_platform_populate >>>>>> with default match table") >>>>>> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> >>>>>> Cc: Rob Herring <robh@kernel.org> >>>>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>>>>> --- >>>>>> I would suggest to merge this patch into the commit causing the >>>>>> problem >>>>>> if possible. >>>>>> >>>>>> arch/xtensa/kernel/setup.c | 1 + >>>>>> 1 file changed, 1 insertion(+) >>>>> >>>>> >>>>> >>>>> Acked-by: Max Filippov <jcmvbkbc@gmail.com> >>>>> >>>> >>>> Heads up: xtensa images build after this patch, but the image that >>>> previously failed to build (generic_kc705_defconfig) doesn't boot, >>>> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f >>>> or by some other patch. >>> >>> >>> It seems to be booting, but serial console is non-functional. >>> With commit 69d99e6c0d621f ("xtensa: Remove unnecessary >>> of_platform_populate >>> with default match table") I see the following message during boot: >>> >>> [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not >>> defined >>> >>> Reverting that commit fixes serial console for me. >>> Any suggestions on what might go wrong? >> >> >> Probably the init order changed somehow and deferred probe is not >> supported correctly. >> > > While the message is due to -EPROBE_DEFER (and there should really be no > message > in this case), I suspect that the underlying problem is that of_clk_init() > is > now called way too early, before the clock source is fully initialized. > Specifically, the call now happens before the message "clocksource: Switched > to clocksource ccount", which at least looks suspicious. > > If I move of_clk_init() back into xtensa_device_probe(), to be called as > device_initcall(), everything is fine. The problem is in the way the main clock on xtfpga platform is set up: it is done by updating corresponding OF node's clock-frequency attribute and that must happen before the of_clk_init call. Looks like it's time to create a clock provider for xtfpga boards, something like the one attached. -- Thanks. -- Max [-- Attachment #2: 0001-xtensa-xtfpga-add-clock-provider.patch --] [-- Type: text/x-patch, Size: 2605 bytes --] From 8aa959869060cb5ffbc06c4c25cfb0e6d81bc8b4 Mon Sep 17 00:00:00 2001 From: Max Filippov <jcmvbkbc@gmail.com> Date: Mon, 25 Jul 2016 10:58:10 +0300 Subject: [PATCH] xtensa: xtfpga: add clock provider Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> --- arch/xtensa/boot/dts/xtfpga.dtsi | 11 ++++++----- arch/xtensa/platforms/xtfpga/setup.c | 32 ++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi index cd45f9c..b49b5d4 100644 --- a/arch/xtensa/boot/dts/xtfpga.dtsi +++ b/arch/xtensa/boot/dts/xtfpga.dtsi @@ -36,11 +36,6 @@ }; clocks { - osc: main-oscillator { - #clock-cells = <0>; - compatible = "fixed-clock"; - }; - clk54: clk54 { #clock-cells = <0>; compatible = "fixed-clock"; @@ -54,6 +49,12 @@ compatible = "simple-bus"; ranges = <0x00000000 0xf0000000 0x10000000>; + osc: main-oscillator { + reg = <0x0d020004 0x4>; + #clock-cells = <0>; + compatible = "cdns,xtfpga-clock"; + }; + serial0: serial@0d050020 { device_type = "serial"; compatible = "ns16550a"; diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c index b509d1f..24f22e8 100644 --- a/arch/xtensa/platforms/xtfpga/setup.c +++ b/arch/xtensa/platforms/xtfpga/setup.c @@ -26,6 +26,8 @@ #include <linux/console.h> #include <linux/delay.h> #include <linux/of.h> +#include <linux/clk-provider.h> +#include <linux/of_address.h> #include <asm/timex.h> #include <asm/processor.h> @@ -135,14 +137,36 @@ static void __init update_local_mac(struct device_node *node) of_update_property(node, newmac); } +static void __init xtfpga_clk_setup(struct device_node *np) +{ + void __iomem *base = of_iomap(np, 0); + struct clk *clk; + u32 freq; + + if (!base) { + pr_err("%s: invalid address\n", np->name); + return; + } + + freq = __raw_readl(base); + clk = clk_register_fixed_rate(NULL, np->name, NULL, 0, freq); + + if (IS_ERR(clk)) { + pr_err("%s: clk registration failed\n", np->name); + return; + } + + if (of_clk_add_provider(np, of_clk_src_simple_get, clk)) { + pr_err("%s: clk provider registration failed\n", np->name); + return; + } +} +CLK_OF_DECLARE(xtfpga_clk, "cdns,xtfpga-clock", xtfpga_clk_setup); + static int __init machine_setup(void) { - struct device_node *clock; struct device_node *eth = NULL; - for_each_node_by_name(clock, "main-oscillator") - update_clock_frequency(clock); - if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) update_local_mac(eth); return 0; -- 2.1.4 ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-25 8:07 ` Max Filippov @ 2016-07-25 13:22 ` Rob Herring 2016-07-25 20:02 ` Max Filippov 2016-07-25 20:51 ` Guenter Roeck 1 sibling, 1 reply; 11+ messages in thread From: Rob Herring @ 2016-07-25 13:22 UTC (permalink / raw) To: Max Filippov Cc: Guenter Roeck, Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang On Mon, Jul 25, 2016 at 3:07 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: > On Sun, Jul 24, 2016 at 7:27 PM, Guenter Roeck <linux@roeck-us.net> wrote: >> On 07/24/2016 08:18 AM, Rob Herring wrote: >>> >>> On Sun, Jul 24, 2016 at 9:20 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: >>>> >>>> On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> >>>> wrote: >>>>> >>>>> On 07/23/2016 05:45 PM, Max Filippov wrote: >>>>>> >>>>>> >>>>>> On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> >>>>>> wrote: >>>>>>> >>>>>>> >>>>>>> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary >>>>>>> of_platform_populate >>>>>>> with default match table") dropped various include files from >>>>>>> arch/xtensa/kernel/setup.c. This results in the following build error. >>>>>>> >>>>>>> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: >>>>>>> arch/xtensa/kernel/setup.c:213:2: error: >>>>>>> implicit declaration of function ‘of_read_ulong’ >>>>>>> >>>>>>> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary >>>>>>> of_platform_populate >>>>>>> with default match table") >>>>>>> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> >>>>>>> Cc: Rob Herring <robh@kernel.org> >>>>>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> >>>>>>> --- >>>>>>> I would suggest to merge this patch into the commit causing the >>>>>>> problem >>>>>>> if possible. >>>>>>> >>>>>>> arch/xtensa/kernel/setup.c | 1 + >>>>>>> 1 file changed, 1 insertion(+) >>>>>> >>>>>> >>>>>> >>>>>> Acked-by: Max Filippov <jcmvbkbc@gmail.com> >>>>>> >>>>> >>>>> Heads up: xtensa images build after this patch, but the image that >>>>> previously failed to build (generic_kc705_defconfig) doesn't boot, >>>>> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f >>>>> or by some other patch. >>>> >>>> >>>> It seems to be booting, but serial console is non-functional. >>>> With commit 69d99e6c0d621f ("xtensa: Remove unnecessary >>>> of_platform_populate >>>> with default match table") I see the following message during boot: >>>> >>>> [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not >>>> defined >>>> >>>> Reverting that commit fixes serial console for me. >>>> Any suggestions on what might go wrong? >>> >>> >>> Probably the init order changed somehow and deferred probe is not >>> supported correctly. >>> >> >> While the message is due to -EPROBE_DEFER (and there should really be no >> message >> in this case), I suspect that the underlying problem is that of_clk_init() >> is >> now called way too early, before the clock source is fully initialized. >> Specifically, the call now happens before the message "clocksource: Switched >> to clocksource ccount", which at least looks suspicious. >> >> If I move of_clk_init() back into xtensa_device_probe(), to be called as >> device_initcall(), everything is fine. > > The problem is in the way the main clock on xtfpga platform is set up: > it is done by updating corresponding OF node's clock-frequency attribute > and that must happen before the of_clk_init call. > Looks like it's time to create a clock provider for xtfpga boards, something > like the one attached. I don't think we should require a DT update to fix this. I think we should revert all but the removing of of_platform_populate line for now. Rob ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-25 13:22 ` Rob Herring @ 2016-07-25 20:02 ` Max Filippov 0 siblings, 0 replies; 11+ messages in thread From: Max Filippov @ 2016-07-25 20:02 UTC (permalink / raw) To: Rob Herring Cc: Guenter Roeck, Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang On Mon, Jul 25, 2016 at 4:22 PM, Rob Herring <robh@kernel.org> wrote: > On Mon, Jul 25, 2016 at 3:07 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: >> On Sun, Jul 24, 2016 at 7:27 PM, Guenter Roeck <linux@roeck-us.net> wrote: >>> On 07/24/2016 08:18 AM, Rob Herring wrote: >>>> On Sun, Jul 24, 2016 at 9:20 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: >>>>> On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> >>>>> wrote: >>>>>> Heads up: xtensa images build after this patch, but the image that >>>>>> previously failed to build (generic_kc705_defconfig) doesn't boot, >>>>>> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f >>>>>> or by some other patch. >>>>> >>>>> It seems to be booting, but serial console is non-functional. >>>>> With commit 69d99e6c0d621f ("xtensa: Remove unnecessary >>>>> of_platform_populate >>>>> with default match table") I see the following message during boot: >>>>> >>>>> [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not >>>>> defined >>>>> >>>>> Reverting that commit fixes serial console for me. >>>>> Any suggestions on what might go wrong? >>>> >>>> Probably the init order changed somehow and deferred probe is not >>>> supported correctly. >>> >>> While the message is due to -EPROBE_DEFER (and there should really be no >>> message >>> in this case), I suspect that the underlying problem is that of_clk_init() >>> is >>> now called way too early, before the clock source is fully initialized. >>> Specifically, the call now happens before the message "clocksource: Switched >>> to clocksource ccount", which at least looks suspicious. >>> >>> If I move of_clk_init() back into xtensa_device_probe(), to be called as >>> device_initcall(), everything is fine. >> >> The problem is in the way the main clock on xtfpga platform is set up: >> it is done by updating corresponding OF node's clock-frequency attribute >> and that must happen before the of_clk_init call. >> Looks like it's time to create a clock provider for xtfpga boards, something >> like the one attached. > > I don't think we should require a DT update to fix this. I think we > should revert all but the removing of of_platform_populate line for > now. Fine with me too. Should I send the revert? -- Thanks. -- Max ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-25 8:07 ` Max Filippov 2016-07-25 13:22 ` Rob Herring @ 2016-07-25 20:51 ` Guenter Roeck 2016-07-25 22:24 ` Max Filippov 1 sibling, 1 reply; 11+ messages in thread From: Guenter Roeck @ 2016-07-25 20:51 UTC (permalink / raw) To: Max Filippov Cc: Rob Herring, Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang On Mon, Jul 25, 2016 at 11:07:00AM +0300, Max Filippov wrote: > On Sun, Jul 24, 2016 at 7:27 PM, Guenter Roeck <linux@roeck-us.net> wrote: > > On 07/24/2016 08:18 AM, Rob Herring wrote: > >> > >> On Sun, Jul 24, 2016 at 9:20 AM, Max Filippov <jcmvbkbc@gmail.com> wrote: > >>> > >>> On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> > >>> wrote: > >>>> > >>>> On 07/23/2016 05:45 PM, Max Filippov wrote: > >>>>> > >>>>> > >>>>> On Sun, Jul 24, 2016 at 3:24 AM, Guenter Roeck <linux@roeck-us.net> > >>>>> wrote: > >>>>>> > >>>>>> > >>>>>> Commit 69d99e6c0d621f ("xtensa: Remove unnecessary > >>>>>> of_platform_populate > >>>>>> with default match table") dropped various include files from > >>>>>> arch/xtensa/kernel/setup.c. This results in the following build error. > >>>>>> > >>>>>> arch/xtensa/kernel/setup.c: In function ‘xtensa_dt_io_area’: > >>>>>> arch/xtensa/kernel/setup.c:213:2: error: > >>>>>> implicit declaration of function ‘of_read_ulong’ > >>>>>> > >>>>>> Fixes: 69d99e6c0d621f ("xtensa: Remove unnecessary > >>>>>> of_platform_populate > >>>>>> with default match table") > >>>>>> Cc: Kefeng Wang <wangkefeng.wang@huawei.com> > >>>>>> Cc: Rob Herring <robh@kernel.org> > >>>>>> Signed-off-by: Guenter Roeck <linux@roeck-us.net> > >>>>>> --- > >>>>>> I would suggest to merge this patch into the commit causing the > >>>>>> problem > >>>>>> if possible. > >>>>>> > >>>>>> arch/xtensa/kernel/setup.c | 1 + > >>>>>> 1 file changed, 1 insertion(+) > >>>>> > >>>>> > >>>>> > >>>>> Acked-by: Max Filippov <jcmvbkbc@gmail.com> > >>>>> > >>>> > >>>> Heads up: xtensa images build after this patch, but the image that > >>>> previously failed to build (generic_kc705_defconfig) doesn't boot, > >>>> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f > >>>> or by some other patch. > >>> > >>> > >>> It seems to be booting, but serial console is non-functional. > >>> With commit 69d99e6c0d621f ("xtensa: Remove unnecessary > >>> of_platform_populate > >>> with default match table") I see the following message during boot: > >>> > >>> [ 6.375284] of_serial fd050020.serial: clk or clock-frequency not > >>> defined > >>> > >>> Reverting that commit fixes serial console for me. > >>> Any suggestions on what might go wrong? > >> > >> > >> Probably the init order changed somehow and deferred probe is not > >> supported correctly. > >> > > > > While the message is due to -EPROBE_DEFER (and there should really be no > > message > > in this case), I suspect that the underlying problem is that of_clk_init() > > is > > now called way too early, before the clock source is fully initialized. > > Specifically, the call now happens before the message "clocksource: Switched > > to clocksource ccount", which at least looks suspicious. > > > > If I move of_clk_init() back into xtensa_device_probe(), to be called as > > device_initcall(), everything is fine. > > The problem is in the way the main clock on xtfpga platform is set up: > it is done by updating corresponding OF node's clock-frequency attribute > and that must happen before the of_clk_init call. > Looks like it's time to create a clock provider for xtfpga boards, something > like the one attached. > > -- > Thanks. > -- Max > From 8aa959869060cb5ffbc06c4c25cfb0e6d81bc8b4 Mon Sep 17 00:00:00 2001 > From: Max Filippov <jcmvbkbc@gmail.com> > Date: Mon, 25 Jul 2016 10:58:10 +0300 > Subject: [PATCH] xtensa: xtfpga: add clock provider > > Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> In case you want to apply this patch: Tested-by: Guenter Roeck <linux@roeck-us.net> > --- > arch/xtensa/boot/dts/xtfpga.dtsi | 11 ++++++----- > arch/xtensa/platforms/xtfpga/setup.c | 32 ++++++++++++++++++++++++++++---- > 2 files changed, 34 insertions(+), 9 deletions(-) > > diff --git a/arch/xtensa/boot/dts/xtfpga.dtsi b/arch/xtensa/boot/dts/xtfpga.dtsi > index cd45f9c..b49b5d4 100644 > --- a/arch/xtensa/boot/dts/xtfpga.dtsi > +++ b/arch/xtensa/boot/dts/xtfpga.dtsi > @@ -36,11 +36,6 @@ > }; > > clocks { > - osc: main-oscillator { > - #clock-cells = <0>; > - compatible = "fixed-clock"; > - }; > - > clk54: clk54 { > #clock-cells = <0>; > compatible = "fixed-clock"; > @@ -54,6 +49,12 @@ > compatible = "simple-bus"; > ranges = <0x00000000 0xf0000000 0x10000000>; > > + osc: main-oscillator { > + reg = <0x0d020004 0x4>; > + #clock-cells = <0>; > + compatible = "cdns,xtfpga-clock"; > + }; > + > serial0: serial@0d050020 { > device_type = "serial"; > compatible = "ns16550a"; > diff --git a/arch/xtensa/platforms/xtfpga/setup.c b/arch/xtensa/platforms/xtfpga/setup.c > index b509d1f..24f22e8 100644 > --- a/arch/xtensa/platforms/xtfpga/setup.c > +++ b/arch/xtensa/platforms/xtfpga/setup.c > @@ -26,6 +26,8 @@ > #include <linux/console.h> > #include <linux/delay.h> > #include <linux/of.h> > +#include <linux/clk-provider.h> > +#include <linux/of_address.h> > > #include <asm/timex.h> > #include <asm/processor.h> > @@ -135,14 +137,36 @@ static void __init update_local_mac(struct device_node *node) > of_update_property(node, newmac); > } > > +static void __init xtfpga_clk_setup(struct device_node *np) > +{ > + void __iomem *base = of_iomap(np, 0); > + struct clk *clk; > + u32 freq; > + > + if (!base) { > + pr_err("%s: invalid address\n", np->name); > + return; > + } > + > + freq = __raw_readl(base); > + clk = clk_register_fixed_rate(NULL, np->name, NULL, 0, freq); > + > + if (IS_ERR(clk)) { > + pr_err("%s: clk registration failed\n", np->name); > + return; > + } > + > + if (of_clk_add_provider(np, of_clk_src_simple_get, clk)) { > + pr_err("%s: clk provider registration failed\n", np->name); > + return; > + } > +} > +CLK_OF_DECLARE(xtfpga_clk, "cdns,xtfpga-clock", xtfpga_clk_setup); > + > static int __init machine_setup(void) > { > - struct device_node *clock; > struct device_node *eth = NULL; > > - for_each_node_by_name(clock, "main-oscillator") > - update_clock_frequency(clock); > - > if ((eth = of_find_compatible_node(eth, NULL, "opencores,ethoc"))) > update_local_mac(eth); > return 0; > -- > 2.1.4 > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH -next] xtensa: Fix build error due to missing include file 2016-07-25 20:51 ` Guenter Roeck @ 2016-07-25 22:24 ` Max Filippov 0 siblings, 0 replies; 11+ messages in thread From: Max Filippov @ 2016-07-25 22:24 UTC (permalink / raw) To: Guenter Roeck Cc: Rob Herring, Chris Zankel, linux-xtensa@linux-xtensa.org, LKML, Kefeng Wang On Mon, Jul 25, 2016 at 11:51 PM, Guenter Roeck <linux@roeck-us.net> wrote: > On Mon, Jul 25, 2016 at 11:07:00AM +0300, Max Filippov wrote: >> >>> On Sun, Jul 24, 2016 at 9:00 AM, Guenter Roeck <linux@roeck-us.net> >> >>> wrote: >> >>>> >> >>>> Heads up: xtensa images build after this patch, but the image that >> >>>> previously failed to build (generic_kc705_defconfig) doesn't boot, >> >>>> at least not with qemu. I don't know if this is caused by 69d99e6c0d621f >> >>>> or by some other patch. >> >> The problem is in the way the main clock on xtfpga platform is set up: >> it is done by updating corresponding OF node's clock-frequency attribute >> and that must happen before the of_clk_init call. >> Looks like it's time to create a clock provider for xtfpga boards, something >> like the one attached. >> >> From 8aa959869060cb5ffbc06c4c25cfb0e6d81bc8b4 Mon Sep 17 00:00:00 2001 >> From: Max Filippov <jcmvbkbc@gmail.com> >> Date: Mon, 25 Jul 2016 10:58:10 +0300 >> Subject: [PATCH] xtensa: xtfpga: add clock provider >> >> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> > > In case you want to apply this patch: > > Tested-by: Guenter Roeck <linux@roeck-us.net> Thanks. I'll definitely get back to it in this release cycle. -- Max ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-07-25 22:24 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-07-24 0:24 [PATCH -next] xtensa: Fix build error due to missing include file Guenter Roeck 2016-07-24 0:45 ` Max Filippov 2016-07-24 6:00 ` Guenter Roeck 2016-07-24 14:20 ` Max Filippov 2016-07-24 15:18 ` Rob Herring 2016-07-24 16:27 ` Guenter Roeck 2016-07-25 8:07 ` Max Filippov 2016-07-25 13:22 ` Rob Herring 2016-07-25 20:02 ` Max Filippov 2016-07-25 20:51 ` Guenter Roeck 2016-07-25 22:24 ` Max Filippov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox