Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: ux500: consolidate base platform files

The cpu.c and cache-l2x0.c files hold only two or three simple
functions each, and they are all called from the machine
descriptors, so we can just move them all into the same file
for simplicity and consistency.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Arnd Bergmann and committed by
Linus Walleij
a16729ea 18a99278

+88 -139
+1 -2
arch/arm/mach-ux500/Makefile
··· 2 2 # Makefile for the linux kernel, U8500 machine. 3 3 # 4 4 5 - obj-y := cpu.o pm.o 6 - obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o 5 + obj-y := pm.o 7 6 obj-$(CONFIG_UX500_SOC_DB8500) += cpu-db8500.o 8 7 obj-$(CONFIG_MACH_MOP500) += board-mop500-audio.o 9 8 obj-$(CONFIG_SMP) += platsmp.o
-60
arch/arm/mach-ux500/cache-l2x0.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2011 3 - * 4 - * License terms: GNU General Public License (GPL) version 2 5 - */ 6 - 7 - #include <linux/io.h> 8 - #include <linux/of.h> 9 - #include <linux/of_address.h> 10 - 11 - #include <asm/outercache.h> 12 - #include <asm/hardware/cache-l2x0.h> 13 - 14 - #include "db8500-regs.h" 15 - 16 - static int __init ux500_l2x0_unlock(void) 17 - { 18 - int i; 19 - struct device_node *np; 20 - void __iomem *l2x0_base; 21 - 22 - np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache"); 23 - l2x0_base = of_iomap(np, 0); 24 - of_node_put(np); 25 - if (!l2x0_base) 26 - return -ENODEV; 27 - 28 - /* 29 - * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions 30 - * apparently locks both caches before jumping to the kernel. The 31 - * l2x0 core will not touch the unlock registers if the l2x0 is 32 - * already enabled, so we do it right here instead. The PL310 has 33 - * 8 sets of registers, one per possible CPU. 34 - */ 35 - for (i = 0; i < 8; i++) { 36 - writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE + 37 - i * L2X0_LOCKDOWN_STRIDE); 38 - writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE + 39 - i * L2X0_LOCKDOWN_STRIDE); 40 - } 41 - iounmap(l2x0_base); 42 - return 0; 43 - } 44 - 45 - static void ux500_l2c310_write_sec(unsigned long val, unsigned reg) 46 - { 47 - /* 48 - * We can't write to secure registers as we are in non-secure 49 - * mode, until we have some SMI service available. 50 - */ 51 - } 52 - 53 - void __init ux500_l2x0_init(void) 54 - { 55 - /* Unlock before init */ 56 - ux500_l2x0_unlock(); 57 - outer_cache.write_sec = ux500_l2c310_write_sec; 58 - 59 - return 0; 60 - }
+87
arch/arm/mach-ux500/cpu-db8500.c
··· 12 12 #include <linux/init.h> 13 13 #include <linux/device.h> 14 14 #include <linux/amba/bus.h> 15 + #include <linux/init.h> 15 16 #include <linux/interrupt.h> 16 17 #include <linux/irq.h> 18 + #include <linux/irqchip.h> 19 + #include <linux/irqchip/arm-gic.h> 20 + #include <linux/mfd/dbx500-prcmu.h> 21 + #include <linux/platform_data/arm-ux500-pm.h> 17 22 #include <linux/platform_device.h> 18 23 #include <linux/io.h> 19 24 #include <linux/of.h> 25 + #include <linux/of_address.h> 20 26 #include <linux/of_platform.h> 21 27 #include <linux/perf/arm_pmu.h> 22 28 #include <linux/regulator/machine.h> 23 29 30 + #include <asm/outercache.h> 31 + #include <asm/hardware/cache-l2x0.h> 24 32 #include <asm/mach/map.h> 33 + #include <asm/mach/arch.h> 25 34 26 35 #include "setup.h" 27 36 28 37 #include "board-mop500.h" 29 38 #include "db8500-regs.h" 39 + 40 + static int __init ux500_l2x0_unlock(void) 41 + { 42 + int i; 43 + struct device_node *np; 44 + void __iomem *l2x0_base; 45 + 46 + np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache"); 47 + l2x0_base = of_iomap(np, 0); 48 + of_node_put(np); 49 + if (!l2x0_base) 50 + return -ENODEV; 51 + 52 + /* 53 + * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions 54 + * apparently locks both caches before jumping to the kernel. The 55 + * l2x0 core will not touch the unlock registers if the l2x0 is 56 + * already enabled, so we do it right here instead. The PL310 has 57 + * 8 sets of registers, one per possible CPU. 58 + */ 59 + for (i = 0; i < 8; i++) { 60 + writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_D_BASE + 61 + i * L2X0_LOCKDOWN_STRIDE); 62 + writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE + 63 + i * L2X0_LOCKDOWN_STRIDE); 64 + } 65 + iounmap(l2x0_base); 66 + return 0; 67 + } 68 + 69 + static void ux500_l2c310_write_sec(unsigned long val, unsigned reg) 70 + { 71 + /* 72 + * We can't write to secure registers as we are in non-secure 73 + * mode, until we have some SMI service available. 74 + */ 75 + } 76 + 77 + /* 78 + * FIXME: Should we set up the GPIO domain here? 79 + * 80 + * The problem is that we cannot put the interrupt resources into the platform 81 + * device until the irqdomain has been added. Right now, we set the GIC interrupt 82 + * domain from init_irq(), then load the gpio driver from 83 + * core_initcall(nmk_gpio_init) and add the platform devices from 84 + * arch_initcall(customize_machine). 85 + * 86 + * This feels fragile because it depends on the gpio device getting probed 87 + * _before_ any device uses the gpio interrupts. 88 + */ 89 + static void __init ux500_init_irq(void) 90 + { 91 + struct device_node *np; 92 + struct resource r; 93 + 94 + irqchip_init(); 95 + np = of_find_compatible_node(NULL, NULL, "stericsson,db8500-prcmu"); 96 + of_address_to_resource(np, 0, &r); 97 + of_node_put(np); 98 + if (!r.start) { 99 + pr_err("could not find PRCMU base resource\n"); 100 + return; 101 + } 102 + prcmu_early_init(r.start, r.end-r.start); 103 + ux500_pm_init(r.start, r.end-r.start); 104 + 105 + /* Unlock before init */ 106 + ux500_l2x0_unlock(); 107 + outer_cache.write_sec = ux500_l2c310_write_sec; 108 + } 109 + 110 + static void ux500_restart(enum reboot_mode mode, const char *cmd) 111 + { 112 + local_irq_disable(); 113 + local_fiq_disable(); 114 + 115 + prcmu_system_reset(0); 116 + } 30 117 31 118 /* 32 119 * The PMU IRQ lines of two cores are wired together into a single interrupt.
-67
arch/arm/mach-ux500/cpu.c
··· 1 - /* 2 - * Copyright (C) ST-Ericsson SA 2010 3 - * 4 - * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson 5 - * Author: Lee Jones <lee.jones@linaro.org> for ST-Ericsson 6 - * License terms: GNU General Public License (GPL) version 2 7 - */ 8 - 9 - #include <linux/platform_device.h> 10 - #include <linux/io.h> 11 - #include <linux/mfd/dbx500-prcmu.h> 12 - #include <linux/sys_soc.h> 13 - #include <linux/err.h> 14 - #include <linux/slab.h> 15 - #include <linux/stat.h> 16 - #include <linux/of.h> 17 - #include <linux/of_irq.h> 18 - #include <linux/of_address.h> 19 - #include <linux/irq.h> 20 - #include <linux/irqchip.h> 21 - #include <linux/irqchip/arm-gic.h> 22 - #include <linux/platform_data/arm-ux500-pm.h> 23 - 24 - #include <asm/mach/map.h> 25 - 26 - #include "setup.h" 27 - 28 - #include "board-mop500.h" 29 - #include "db8500-regs.h" 30 - 31 - void ux500_restart(enum reboot_mode mode, const char *cmd) 32 - { 33 - local_irq_disable(); 34 - local_fiq_disable(); 35 - 36 - prcmu_system_reset(0); 37 - } 38 - 39 - /* 40 - * FIXME: Should we set up the GPIO domain here? 41 - * 42 - * The problem is that we cannot put the interrupt resources into the platform 43 - * device until the irqdomain has been added. Right now, we set the GIC interrupt 44 - * domain from init_irq(), then load the gpio driver from 45 - * core_initcall(nmk_gpio_init) and add the platform devices from 46 - * arch_initcall(customize_machine). 47 - * 48 - * This feels fragile because it depends on the gpio device getting probed 49 - * _before_ any device uses the gpio interrupts. 50 - */ 51 - void __init ux500_init_irq(void) 52 - { 53 - struct device_node *np; 54 - struct resource r; 55 - 56 - irqchip_init(); 57 - np = of_find_compatible_node(NULL, NULL, "stericsson,db8500-prcmu"); 58 - of_address_to_resource(np, 0, &r); 59 - of_node_put(np); 60 - if (!r.start) { 61 - pr_err("could not find PRCMU base resource\n"); 62 - return; 63 - } 64 - prcmu_early_init(r.start, r.end-r.start); 65 - ux500_pm_init(r.start, r.end-r.start); 66 - ux500_l2x0_init(); 67 - }
-10
arch/arm/mach-ux500/setup.h
··· 11 11 #ifndef __ASM_ARCH_SETUP_H 12 12 #define __ASM_ARCH_SETUP_H 13 13 14 - #include <asm/mach/arch.h> 15 - #include <linux/init.h> 16 - 17 - 18 - void ux500_l2x0_init(void); 19 - 20 - void ux500_restart(enum reboot_mode mode, const char *cmd); 21 - 22 - extern void __init ux500_init_irq(void); 23 - 24 14 extern void ux500_cpu_die(unsigned int cpu); 25 15 26 16 #endif /* __ASM_ARCH_SETUP_H */