Rebased from upstream / out of band repository.
[librecmc/librecmc.git] / target / linux / ar71xx / patches-4.14 / 604-MIPS-ath79-no-of.patch
1 --- a/arch/mips/Kconfig
2 +++ b/arch/mips/Kconfig
3 @@ -203,7 +203,6 @@ config ATH79
4         select SYS_SUPPORTS_BIG_ENDIAN
5         select SYS_SUPPORTS_MIPS16
6         select SYS_SUPPORTS_ZBOOT_UART_PROM
7 -       select USE_OF
8         help
9           Support for the Atheros AR71XX/AR724X/AR913X SoCs.
10  
11 --- a/arch/mips/ath79/setup.c
12 +++ b/arch/mips/ath79/setup.c
13 @@ -196,16 +196,20 @@ unsigned int get_c0_compare_int(void)
14  
15  void __init plat_mem_setup(void)
16  {
17 +#ifdef CONFIG_OF
18         unsigned long fdt_start;
19 +#endif
20  
21         set_io_port_base(KSEG1);
22  
23 +#ifdef CONFIG_OF
24         /* Get the position of the FDT passed by the bootloader */
25         fdt_start = fw_getenvl("fdt_start");
26         if (fdt_start)
27                 __dt_setup_arch((void *)KSEG0ADDR(fdt_start));
28         else if (fw_passed_dtb)
29                 __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb));
30 +#endif
31  
32         if (mips_machtype != ATH79_MACH_GENERIC_OF) {
33                 ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE,
34 @@ -301,17 +305,21 @@ static int __init ath79_setup(void)
35  
36  arch_initcall(ath79_setup);
37  
38 +#ifdef CONFIG_OF
39  void __init device_tree_init(void)
40  {
41         unflatten_and_copy_device_tree();
42  }
43 +#endif
44  
45  MIPS_MACHINE(ATH79_MACH_GENERIC,
46              "Generic",
47              "Generic AR71XX/AR724X/AR913X based board",
48              NULL);
49  
50 +#ifdef CONFIG_OF
51  MIPS_MACHINE(ATH79_MACH_GENERIC_OF,
52              "DTB",
53              "Generic AR71XX/AR724X/AR913X based board (DT)",
54              NULL);
55 +#endif
56 --- a/arch/mips/ath79/clock.c
57 +++ b/arch/mips/ath79/clock.c
58 @@ -32,10 +32,12 @@
59  #define AR724X_BASE_FREQ       40000000
60  
61  static struct clk *clks[ATH79_CLK_END];
62 +#ifdef CONFIG_OF
63  static struct clk_onecell_data clk_data = {
64         .clks = clks,
65         .clk_num = ARRAY_SIZE(clks),
66  };
67 +#endif
68  
69  static struct clk *__init ath79_add_sys_clkdev(
70         const char *id, unsigned long rate)