fd47b775f03d8cc68050bba990f78f497eb9a131
[openwrt/openwrt.git] / target / linux / ath79 / patches-4.14 / 0027-MIPS-ath79-drop-mips_machine-support.patch
1 From e03edbc8e68063b3fca7457fa048d8abe0045f1f Mon Sep 17 00:00:00 2001
2 From: John Crispin <john@phrozen.org>
3 Date: Tue, 6 Mar 2018 10:15:54 +0100
4 Subject: [PATCH 27/27] MIPS: ath79: drop mips_machine support
5
6 Signed-off-by: John Crispin <john@phrozen.org>
7 ---
8 arch/mips/Kconfig | 1 -
9 arch/mips/ath79/machtypes.h | 28 -----------------
10 arch/mips/ath79/setup.c | 74 ++++++---------------------------------------
11 3 files changed, 10 insertions(+), 93 deletions(-)
12 delete mode 100644 arch/mips/ath79/machtypes.h
13
14 Index: linux-4.14.18/arch/mips/Kconfig
15 ===================================================================
16 --- linux-4.14.18.orig/arch/mips/Kconfig
17 +++ linux-4.14.18/arch/mips/Kconfig
18 @@ -196,7 +196,6 @@ config ATH79
19 select COMMON_CLK
20 select CLKDEV_LOOKUP
21 select IRQ_MIPS_CPU
22 - select MIPS_MACHINE
23 select SYS_HAS_CPU_MIPS32_R2
24 select SYS_HAS_EARLY_PRINTK
25 select SYS_SUPPORTS_32BIT_KERNEL
26 Index: linux-4.14.18/arch/mips/ath79/machtypes.h
27 ===================================================================
28 --- linux-4.14.18.orig/arch/mips/ath79/machtypes.h
29 +++ /dev/null
30 @@ -1,28 +0,0 @@
31 -/*
32 - * Atheros AR71XX/AR724X/AR913X machine type definitions
33 - *
34 - * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
35 - * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
36 - *
37 - * This program is free software; you can redistribute it and/or modify it
38 - * under the terms of the GNU General Public License version 2 as published
39 - * by the Free Software Foundation.
40 - */
41 -
42 -#ifndef _ATH79_MACHTYPE_H
43 -#define _ATH79_MACHTYPE_H
44 -
45 -#include <asm/mips_machine.h>
46 -
47 -enum ath79_mach_type {
48 - ATH79_MACH_GENERIC_OF = -1, /* Device tree board */
49 - ATH79_MACH_GENERIC = 0,
50 - ATH79_MACH_AP121, /* Atheros AP121 reference board */
51 - ATH79_MACH_AP136_010, /* Atheros AP136-010 reference board */
52 - ATH79_MACH_AP81, /* Atheros AP81 reference board */
53 - ATH79_MACH_DB120, /* Atheros DB120 reference board */
54 - ATH79_MACH_PB44, /* Atheros PB44 reference board */
55 - ATH79_MACH_UBNT_XM, /* Ubiquiti Networks XM board rev 1.0 */
56 -};
57 -
58 -#endif /* _ATH79_MACHTYPE_H */
59 Index: linux-4.14.18/arch/mips/ath79/setup.c
60 ===================================================================
61 --- linux-4.14.18.orig/arch/mips/ath79/setup.c
62 +++ linux-4.14.18/arch/mips/ath79/setup.c
63 @@ -32,7 +32,6 @@
64 #include <asm/mach-ath79/ath79.h>
65 #include <asm/mach-ath79/ar71xx_regs.h>
66 #include "common.h"
67 -#include "machtypes.h"
68
69 #define ATH79_SYS_TYPE_LEN 64
70
71 @@ -235,25 +234,21 @@ void __init plat_mem_setup(void)
72 else if (fw_passed_dtb)
73 __dt_setup_arch((void *)KSEG0ADDR(fw_passed_dtb));
74
75 - if (mips_machtype != ATH79_MACH_GENERIC_OF) {
76 - ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE,
77 - AR71XX_RESET_SIZE);
78 - ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
79 - AR71XX_PLL_SIZE);
80 - ath79_detect_sys_type();
81 - ath79_ddr_ctrl_init();
82 + ath79_reset_base = ioremap_nocache(AR71XX_RESET_BASE,
83 + AR71XX_RESET_SIZE);
84 + ath79_pll_base = ioremap_nocache(AR71XX_PLL_BASE,
85 + AR71XX_PLL_SIZE);
86 + ath79_detect_sys_type();
87 + ath79_ddr_ctrl_init();
88
89 - detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);
90 -
91 - /* OF machines should use the reset driver */
92 - _machine_restart = ath79_restart;
93 - }
94 + detect_memory_region(0, ATH79_MEM_SIZE_MIN, ATH79_MEM_SIZE_MAX);
95
96 + _machine_restart = ath79_restart;
97 _machine_halt = ath79_halt;
98 pm_power_off = ath79_halt;
99 }
100
101 -static void __init ath79_of_plat_time_init(void)
102 +void __init plat_time_init(void)
103 {
104 struct device_node *np;
105 struct clk *clk;
106 @@ -283,62 +278,12 @@ static void __init ath79_of_plat_time_in
107 clk_put(clk);
108 }
109
110 -void __init plat_time_init(void)
111 -{
112 - unsigned long cpu_clk_rate;
113 - unsigned long ahb_clk_rate;
114 - unsigned long ddr_clk_rate;
115 - unsigned long ref_clk_rate;
116 -
117 - if (IS_ENABLED(CONFIG_OF) && mips_machtype == ATH79_MACH_GENERIC_OF) {
118 - ath79_of_plat_time_init();
119 - return;
120 - }
121 -
122 - ath79_clocks_init();
123 -
124 - cpu_clk_rate = ath79_get_sys_clk_rate("cpu");
125 - ahb_clk_rate = ath79_get_sys_clk_rate("ahb");
126 - ddr_clk_rate = ath79_get_sys_clk_rate("ddr");
127 - ref_clk_rate = ath79_get_sys_clk_rate("ref");
128 -
129 - pr_info("Clocks: CPU:%lu.%03luMHz, DDR:%lu.%03luMHz, AHB:%lu.%03luMHz, Ref:%lu.%03luMHz\n",
130 - cpu_clk_rate / 1000000, (cpu_clk_rate / 1000) % 1000,
131 - ddr_clk_rate / 1000000, (ddr_clk_rate / 1000) % 1000,
132 - ahb_clk_rate / 1000000, (ahb_clk_rate / 1000) % 1000,
133 - ref_clk_rate / 1000000, (ref_clk_rate / 1000) % 1000);
134 -
135 - mips_hpt_frequency = cpu_clk_rate / 2;
136 -}
137 -
138 void __init arch_init_irq(void)
139 {
140 irqchip_init();
141 }
142
143 -static int __init ath79_setup(void)
144 -{
145 - if (mips_machtype == ATH79_MACH_GENERIC_OF)
146 - return 0;
147 -
148 - mips_machine_setup();
149 -
150 - return 0;
151 -}
152 -
153 -arch_initcall(ath79_setup);
154 -
155 void __init device_tree_init(void)
156 {
157 unflatten_and_copy_device_tree();
158 }
159 -
160 -MIPS_MACHINE(ATH79_MACH_GENERIC,
161 - "Generic",
162 - "Generic AR71XX/AR724X/AR913X based board",
163 - NULL);
164 -
165 -MIPS_MACHINE(ATH79_MACH_GENERIC_OF,
166 - "DTB",
167 - "Generic AR71XX/AR724X/AR913X based board (DT)",
168 - NULL);
169 Index: linux-4.14.18/arch/mips/ath79/clock.c
170 ===================================================================
171 --- linux-4.14.18.orig/arch/mips/ath79/clock.c
172 +++ linux-4.14.18/arch/mips/ath79/clock.c
173 @@ -26,7 +26,6 @@
174 #include <asm/mach-ath79/ath79.h>
175 #include <asm/mach-ath79/ar71xx_regs.h>
176 #include "common.h"
177 -#include "machtypes.h"
178
179 #define AR71XX_BASE_FREQ 40000000
180 #define AR724X_BASE_FREQ 40000000