diff options
author | Felix Fietkau <nbd@openwrt.org> | 2015-03-13 02:59:27 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-03-13 02:59:27 +0000 |
commit | f458d11655228237e890b87f62f9a1cc61b6ab61 (patch) | |
tree | 9838c23daa76943fc67e46b624823ace2a6cfc69 | |
parent | cdabe30755db20740cb383617a1c739da6b2a300 (diff) | |
download | upstream-f458d11655228237e890b87f62f9a1cc61b6ab61.tar.gz upstream-f458d11655228237e890b87f62f9a1cc61b6ab61.tar.bz2 upstream-f458d11655228237e890b87f62f9a1cc61b6ab61.zip |
atheros: v3.18: rework early initialization
Do not use prom_init() callback, do memory initialization in
plat_mem_setup() callback and move serial port configuration to
arch_initcall stage.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
SVN-Revision: 44715
-rw-r--r-- | target/linux/atheros/patches-3.18/100-board.patch | 71 | ||||
-rw-r--r-- | target/linux/atheros/patches-3.18/105-ar2315_pci.patch | 20 |
2 files changed, 40 insertions, 51 deletions
diff --git a/target/linux/atheros/patches-3.18/100-board.patch b/target/linux/atheros/patches-3.18/100-board.patch index 1e39990a2b..2099514523 100644 --- a/target/linux/atheros/patches-3.18/100-board.patch +++ b/target/linux/atheros/patches-3.18/100-board.patch @@ -314,7 +314,7 @@ +} --- /dev/null +++ b/arch/mips/ath25/prom.c -@@ -0,0 +1,40 @@ +@@ -0,0 +1,26 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive @@ -332,24 +332,10 @@ + */ + +#include <linux/init.h> -+#include <generated/autoconf.h> -+#include <linux/kernel.h> -+#include <linux/string.h> -+#include <linux/mm.h> -+#include <linux/bootmem.h> -+ +#include <asm/bootinfo.h> -+#include <asm/addrspace.h> -+#include "ar5312.h" -+#include "ar2315.h" -+#include "devices.h" + +void __init prom_init(void) +{ -+ if (is_ar5312()) -+ ar5312_prom_init(); -+ else -+ ar2315_prom_init(); +} + +void __init prom_free_prom_memory(void) @@ -1486,7 +1472,7 @@ +#endif /* __ASM_MACH_ATH25_AR5312_REGS_H */ --- /dev/null +++ b/arch/mips/ath25/ar5312.c -@@ -0,0 +1,450 @@ +@@ -0,0 +1,449 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive @@ -1904,8 +1890,7 @@ + mips_hpt_frequency = ar5312_cpu_frequency() / 2; +} + -+void __init -+ar5312_prom_init(void) ++void __init ar5312_plat_mem_setup(void) +{ + u32 memsize, memcfg, bank0AC, bank1AC; + u32 devid; @@ -1923,20 +1908,20 @@ + devid >>= AR5312_REV_WMAC_MIN_S; + devid &= AR5312_REV_CHIP; + ath25_board.devid = (u16)devid; -+} + -+void __init ar5312_plat_mem_setup(void) -+{ + /* Clear any lingering AHB errors */ + ar231x_read_reg(AR5312_PROCADDR); + ar231x_read_reg(AR5312_DMAADDR); + ar231x_write_reg(AR5312_WD_CTRL, AR5312_WD_CTRL_IGNORE_EXPIRATION); + + _machine_restart = ar5312_restart; ++} ++ ++void __init ar5312_arch_init(void) ++{ + ath25_serial_setup(AR5312_UART0, AR5312_MISC_IRQ_UART0, + ar5312_sys_frequency()); +} -+ --- /dev/null +++ b/arch/mips/ath25/ar2315.c @@ -0,0 +1,401 @@ @@ -2294,10 +2279,11 @@ + mips_hpt_frequency = ar2315_cpu_frequency() / 2; +} + -+void __init -+ar2315_prom_init(void) ++void __init ar2315_plat_mem_setup(void) +{ -+ u32 memsize, memcfg, devid; ++ u32 memsize, memcfg; ++ u32 devid; ++ u32 config; + + memcfg = ar231x_read_reg(AR2315_MEM_CFG); + memsize = 1 + ((memcfg & SDRAM_DATA_WIDTH_M) >> SDRAM_DATA_WIDTH_S); @@ -2324,11 +2310,6 @@ + break; + } + ath25_board.devid = devid; -+} -+ -+void __init ar2315_plat_mem_setup(void) -+{ -+ u32 config; + + /* Clear any lingering AHB errors */ + config = read_c0_config(); @@ -2338,6 +2319,10 @@ + ar231x_write_reg(AR2315_WDC, AR2315_WDC_IGNORE_EXPIRATION); + + _machine_restart = ar2315_restart; ++} ++ ++void __init ar2315_arch_init(void) ++{ + ath25_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0, + ar2315_apb_frequency()); +} @@ -2352,8 +2337,8 @@ +void ar2315_arch_init_irq(void); +void ar2315_init_devices(void); +void ar2315_plat_time_init(void); -+void ar2315_prom_init(void); +void ar2315_plat_mem_setup(void); ++void ar2315_arch_init(void); + +#else + @@ -2369,11 +2354,11 @@ +{ +} + -+static inline void ar2315_prom_init(void) ++static inline void ar2315_plat_mem_setup(void) +{ +} + -+static inline void ar2315_plat_mem_setup(void) ++static inline void ar2315_arch_init(void) +{ +} + @@ -2391,8 +2376,8 @@ +void ar5312_arch_init_irq(void); +void ar5312_init_devices(void); +void ar5312_plat_time_init(void); -+void ar5312_prom_init(void); +void ar5312_plat_mem_setup(void); ++void ar5312_arch_init(void); + +#else + @@ -2408,11 +2393,11 @@ +{ +} + -+static inline void ar5312_prom_init(void) ++static inline void ar5312_plat_mem_setup(void) +{ +} + -+static inline void ar5312_plat_mem_setup(void) ++static inline void ar5312_arch_init(void) +{ +} + @@ -2504,7 +2489,7 @@ +#endif --- /dev/null +++ b/arch/mips/ath25/devices.c -@@ -0,0 +1,180 @@ +@@ -0,0 +1,192 @@ +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/serial.h> @@ -2685,3 +2670,15 @@ +} + +device_initcall(ath25_register_devices); ++ ++static int __init ath25_arch_init(void) ++{ ++ if (is_ar5312()) ++ ar5312_arch_init(); ++ else ++ ar2315_arch_init(); ++ ++ return 0; ++} ++ ++arch_initcall(ath25_arch_init); diff --git a/target/linux/atheros/patches-3.18/105-ar2315_pci.patch b/target/linux/atheros/patches-3.18/105-ar2315_pci.patch index 6a370f4701..2a4d7abd30 100644 --- a/target/linux/atheros/patches-3.18/105-ar2315_pci.patch +++ b/target/linux/atheros/patches-3.18/105-ar2315_pci.patch @@ -382,22 +382,14 @@ else if (pending & CAUSEF_IP2) do_IRQ(AR2315_IRQ_MISC_INTRS); else if (pending & CAUSEF_IP7) -@@ -428,3 +432,18 @@ void __init ar2315_plat_mem_setup(void) +@@ -427,4 +431,10 @@ void __init ar2315_arch_init(void) + { ath25_serial_setup(AR2315_UART0, AR2315_MISC_IRQ_UART0, ar2315_apb_frequency()); - } + +#ifdef CONFIG_PCI_AR2315 -+static int __init ar2315_pci_init(void) -+{ -+ struct platform_device *pdev; -+ -+ if (!is_ar2315() || ath25_soc != ATH25_SOC_AR2315) -+ return -ENODEV; -+ -+ pdev = platform_device_register_simple("ar2315-pci", -1, NULL, 0); -+ -+ return pdev ? 0 : -ENODEV; -+} -+arch_initcall(ar2315_pci_init); ++ if (ath25_soc == ATH25_SOC_AR2315) { ++ platform_device_register_simple("ar2315-pci", -1, NULL, 0); ++ } +#endif + } |