xtensa: Fix build error due to missing include file
Subsystems (2)
PATCH 1/1 xtensa: Fix build error due to missing include file
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’
---
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(+)
arch/xtensa/kernel/setup.c +1 -0
@@ -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 )
Signature · 1 line
2.5.0
Quoted 12 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") dropped various include files fromarch/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 <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Quoted 6 lines
---
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(+)
Signature · 2 lines
Thanks. -- Max
Quoted 17 lines · Max Filippov
Quoted 16 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") dropped various include files fromarch/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 <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
I would suggest to merge this patch into the commit causing the problem if possible.
Quoted 5 lines
Quoted 2 lines
arch/xtensa/kernel/setup.c | 1 + 1 file changed, 1 insertion(+)Acked-by Max Filippov <[email protected]>
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
Max Filippov
maintainerQuoted 25 lines · Guenter Roeck
Quoted 24 lines · Max Filippov
Quoted 20 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") dropped various include files fromarch/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_populatewith default match table")
Cc Kefeng Wang <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
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(+)
Quoted 7 lines
Quoted 2 lines
Acked-by Max Filippov <[email protected]>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 by69d99e6c0d621for 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?
Signature · 2 lines
Thanks. -- Max
Rob Herring
maintainerQuoted 34 lines · Max Filippov
Quoted 25 lines · Guenter Roeck
Quoted 24 lines · Max Filippov
Quoted 20 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") dropped various include files fromarch/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_populatewith default match table")
Cc Kefeng Wang <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
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(+)Quoted 7 lines
Quoted 2 lines
Acked-by Max Filippov <[email protected]>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 by69d99e6c0d621for by some other patch.
Quoted 8 lines
It seems to be booting, but serial console is non-functional. With commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") I see the following message during boot:[ 6.375284] of_serial fd050020.serial: clk or clock-frequency not definedReverting 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
Quoted 39 lines · Rob Herring
Quoted 38 lines · Max Filippov
Quoted 25 lines · Guenter Roeck
Quoted 24 lines · Max Filippov
Quoted 20 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") dropped various include files fromarch/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_populatewith default match table")
Cc Kefeng Wang <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
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(+)Quoted 7 lines
Quoted 2 lines
Acked-by Max Filippov <[email protected]>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 by69d99e6c0d621for by some other patch.It seems to be booting, but serial console is non-functional. With commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populatewith default match table") I see the following message during boot:
Quoted 8 lines
Quoted 4 lines
[ 6.375284] of_serial fd050020.serial: clk or clock-frequency not definedReverting 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
Max Filippov
maintainerQuoted 72 lines · Guenter Roeck
Quoted 55 lines · Rob Herring
Quoted 53 lines · Max Filippov
Quoted 33 lines · Guenter Roeck
Quoted 31 lines · Max Filippov
Quoted 24 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") dropped various include files fromarch/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 <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
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(+)Quoted 7 lines
Quoted 2 lines
Acked-by Max Filippov <[email protected]>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 by69d99e6c0d621for by some other patch.It seems to be booting, but serial console is non-functional. With commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") I see the following message during boot:[ 6.375284] of_serial fd050020.serial: clk or clock-frequency notdefined
Quoted 7 lines
Quoted 2 lines
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 thatof_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.
Quoted 2 lines
If I move
of_clk_init()back intoxtensa_device_probe(), to be called asdevice_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.
Signature · 2 lines
Thanks. -- Max
From 8aa959869060cb5ffbc06c4c25cfb0e6d81bc8b4 Mon Sep 17 00:00:00 2001
From: Max Filippov <[email protected]>
Date: Mon, 25 Jul 2016 10:58:10 +0300
Subject: [PATCH] xtensa: xtfpga: add clock provider
--- arch/xtensa/boot/dts/xtfpga.dtsi | 11 ++++++----- arch/xtensa/platforms/xtfpga/setup.c | 32 ++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-)
arch/xtensa/boot/dts/xtfpga.dtsi +6 -5
@@ -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";
arch/xtensa/platforms/xtfpga/setup.c +28 -4
@@ -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 ;
Signature · 1 line
2.1.4
Rob Herring
maintainerQuoted 73 lines · Max Filippov
Quoted 72 lines · Guenter Roeck
Quoted 55 lines · Rob Herring
Quoted 53 lines · Max Filippov
Quoted 33 lines · Guenter Roeck
Quoted 31 lines · Max Filippov
Quoted 24 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") dropped various include files fromarch/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 <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
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(+)Quoted 7 lines
Quoted 2 lines
Acked-by Max Filippov <[email protected]>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 by69d99e6c0d621for by some other patch.It seems to be booting, but serial console is non-functional. With commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") I see the following message during boot:[ 6.375284] of_serial fd050020.serial: clk or clock-frequency notdefined
Quoted 7 lines
Quoted 2 lines
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 thatof_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.
Quoted 8 lines
Quoted 2 lines
If I move
of_clk_init()back intoxtensa_device_probe(), to be called asdevice_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 theof_clk_initcall.
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
Max Filippov
maintainerQuoted 42 lines · Rob Herring
Quoted 32 lines · Max Filippov
Quoted 31 lines · Guenter Roeck
Quoted 13 lines · Rob Herring
Quoted 12 lines · Max Filippov
Quoted 4 lines · Guenter Roeck
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 by69d99e6c0d621for by some other patch.It seems to be booting, but serial console is non-functional. With commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") I see the following message during boot:Quoted 8 lines
Quoted 5 lines
[ 6.375284] of_serial fd050020.serial: clk or clock-frequency notdefined
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 thatof_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.Quoted 8 lines
Quoted 2 lines
If I move
of_clk_init()back intoxtensa_device_probe(), to be called asdevice_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 theof_clk_initcall.
Looks like it's time to create a clock provider for xtfpga boards, something like the one attached.
Quoted 3 lines
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_populateline for now.
Fine with me too. Should I send the revert?
Signature · 2 lines
Thanks. -- Max
Guenter Roeck
Tested-byQuoted 73 lines · Max Filippov
Quoted 72 lines · Guenter Roeck
Quoted 55 lines · Rob Herring
Quoted 53 lines · Max Filippov
Quoted 33 lines · Guenter Roeck
Quoted 31 lines · Max Filippov
Quoted 24 lines · Guenter Roeck
Commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") dropped various include files fromarch/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 <[email protected]>Cc Rob Herring <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
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(+)Quoted 7 lines
Quoted 2 lines
Acked-by Max Filippov <[email protected]>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 by69d99e6c0d621for by some other patch.It seems to be booting, but serial console is non-functional. With commit
69d99e6c0d621f("xtensa: Remove unnecessaryof_platform_populate
with default match table") I see the following message during boot:[ 6.375284] of_serial fd050020.serial: clk or clock-frequency notdefined
Quoted 7 lines
Quoted 2 lines
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 thatof_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.
Quoted 19 lines
Quoted 2 lines
If I move
of_clk_init()back intoxtensa_device_probe(), to be called asdevice_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 theof_clk_initcall.
Looks like it's time to create a clock provider for xtfpga boards, something like the one attached.Signature · 9 lines
Thanks. -- Max From 8aa959869060cb5ffbc06c4c25cfb0e6d81bc8b4 Mon Sep 17 00:00:00 2001 From: Max Filippov <[email protected]> Date: Mon, 25 Jul 2016 10:58:10 +0300 Subject: [PATCH] xtensa: xtfpga: add clock provider Signed-off-by: Max Filippov <[email protected]>
In case you want to apply this patch:
Quoted 91 lines
--- arch/xtensa/boot/dts/xtfpga.dtsi | 11 ++++++----- arch/xtensa/platforms/xtfpga/setup.c | 32 ++++++++++++++++++++++++++++---- 2 files changed, 34 insertions(+), 9 deletions(-)arch/xtensa/boot/dts/xtfpga.dtsi +6
-5@@ -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";arch/xtensa/platforms/xtfpga/setup.c +28
-4@@ -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 ;Signature · 1 line
2.1.4
Max Filippov
maintainerQuoted 20 lines · Guenter Roeck
Quoted 19 lines · Max Filippov
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines · Guenter Roeck
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 by69d99e6c0d621for 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 theof_clk_initcall.
Looks like it's time to create a clock provider for xtfpga boards, something like the one attached.From
8aa959869060cb5ffbc06c4c25cfb0e6d81bc8b4Mon Sep 17 00:00:00 2001
From: Max Filippov <[email protected]>
Date: Mon, 25 Jul 2016 10:58:10 +0300
Subject: [PATCH] xtensa: xtfpga: add clock provider
Quoted 5 lines
Quoted 1 line
Signed-off-by Max Filippov <[email protected]>In case you want to apply this patch:
Tested-by Guenter Roeck <[email protected]>
Thanks. I'll definitely get back to it in this release cycle.
-- Max