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

Merge tag 'regmap-3.11' of git://git.infradead.org/users/jcooper/linux into next/soc

mvebu register map changes for v3.11

This series removes the hardcoded register base address for mvebu.

Depends:
- mvebu/fixes-non-critical (up to tags/fixes-non-3.11-1)
- mvebu/cleanup (up to tags/cleanup-3.11-3)

* tag 'regmap-3.11' of git://git.infradead.org/users/jcooper/linux:
arm: mvebu: disable DEBUG_LL/EARLY_PRINTK in defconfig
arm: mvebu: add another earlyprintk Kconfig option
arm: mvebu: don't hardcode the physical address for mvebu-mbus
arm: mvebu: don't hardcode a physical address in headsmp.S
arm: mvebu: remove hardcoded static I/O mapping
arm: mvebu: move cache and mvebu-mbus initialization later
arm: mvebu: avoid hardcoded virtual address in coherency code
arm: mvebu: remove dependency of SMP init on static I/O mapping
arm: mvebu: fix length of Ethernet registers area in .dtsi
arm: mvebu: fix length of SATA registers area in .dtsi
arm: mvebu: mark functions of armada-370-xp.c as static
ARM: mvebu: Remove init_irq declaration in machine description
ARM: Orion: Remove redundant init_dma_coherent_pool_size()

Signed-off-by: Olof Johansson <olof@lixom.net>

+110 -84
+28 -2
arch/arm/Kconfig.debug
··· 303 303 their output to the serial port on MSM 8960 devices. 304 304 305 305 config DEBUG_MVEBU_UART 306 - bool "Kernel low-level debugging messages via MVEBU UART" 306 + bool "Kernel low-level debugging messages via MVEBU UART (old bootloaders)" 307 307 depends on ARCH_MVEBU 308 308 help 309 309 Say Y here if you want kernel low-level debugging support 310 310 on MVEBU based platforms. 311 + 312 + This option should be used with the old bootloaders 313 + that left the internal registers mapped at 314 + 0xd0000000. As of today, this is the case on 315 + platforms such as the Globalscale Mirabox or the 316 + Plathome OpenBlocks AX3, when using the original 317 + bootloader. 318 + 319 + If the wrong DEBUG_MVEBU_UART* option is selected, 320 + when u-boot hands over to the kernel, the system 321 + silently crashes, with no serial output at all. 322 + 323 + config DEBUG_MVEBU_UART_ALTERNATE 324 + bool "Kernel low-level debugging messages via MVEBU UART (new bootloaders)" 325 + depends on ARCH_MVEBU 326 + help 327 + Say Y here if you want kernel low-level debugging support 328 + on MVEBU based platforms. 329 + 330 + This option should be used with the new bootloaders 331 + that remap the internal registers at 0xf1000000. 332 + 333 + If the wrong DEBUG_MVEBU_UART* option is selected, 334 + when u-boot hands over to the kernel, the system 335 + silently crashes, with no serial output at all. 311 336 312 337 config DEBUG_NOMADIK_UART 313 338 bool "Kernel low-level debugging messages via NOMADIK UART" ··· 657 632 DEBUG_IMX51_UART || \ 658 633 DEBUG_IMX53_UART ||\ 659 634 DEBUG_IMX6Q_UART 660 - default "debug/mvebu.S" if DEBUG_MVEBU_UART 635 + default "debug/mvebu.S" if DEBUG_MVEBU_UART || \ 636 + DEBUG_MVEBU_UART_ALTERNATE 661 637 default "debug/mxs.S" if DEBUG_IMX23_UART || DEBUG_IMX28_UART 662 638 default "debug/nomadik.S" if DEBUG_NOMADIK_UART 663 639 default "debug/omap2plus.S" if DEBUG_OMAP2PLUS_UART
+3 -3
arch/arm/boot/dts/armada-370-xp.dtsi
··· 80 80 81 81 sata@a0000 { 82 82 compatible = "marvell,orion-sata"; 83 - reg = <0xa0000 0x2400>; 83 + reg = <0xa0000 0x5000>; 84 84 interrupts = <55>; 85 85 clocks = <&gateclk 15>, <&gateclk 30>; 86 86 clock-names = "0", "1"; ··· 96 96 97 97 ethernet@70000 { 98 98 compatible = "marvell,armada-370-neta"; 99 - reg = <0x70000 0x2500>; 99 + reg = <0x70000 0x4000>; 100 100 interrupts = <8>; 101 101 clocks = <&gateclk 4>; 102 102 status = "disabled"; ··· 104 104 105 105 ethernet@74000 { 106 106 compatible = "marvell,armada-370-neta"; 107 - reg = <0x74000 0x2500>; 107 + reg = <0x74000 0x4000>; 108 108 interrupts = <10>; 109 109 clocks = <&gateclk 3>; 110 110 status = "disabled";
+1 -1
arch/arm/boot/dts/armada-xp-mv78460.dtsi
··· 107 107 108 108 ethernet@34000 { 109 109 compatible = "marvell,armada-370-neta"; 110 - reg = <0x34000 0x2500>; 110 + reg = <0x34000 0x4000>; 111 111 interrupts = <14>; 112 112 clocks = <&gateclk 1>; 113 113 status = "disabled";
+1 -1
arch/arm/boot/dts/armada-xp.dtsi
··· 88 88 89 89 ethernet@30000 { 90 90 compatible = "marvell,armada-370-neta"; 91 - reg = <0x30000 0x2500>; 91 + reg = <0x30000 0x4000>; 92 92 interrupts = <12>; 93 93 clocks = <&gateclk 2>; 94 94 status = "disabled";
-2
arch/arm/configs/mvebu_defconfig
··· 100 100 # CONFIG_DEBUG_BUGVERBOSE is not set 101 101 CONFIG_DEBUG_INFO=y 102 102 CONFIG_DEBUG_USER=y 103 - CONFIG_DEBUG_LL=y 104 - CONFIG_EARLY_PRINTK=y
+5
arch/arm/include/debug/mvebu.S
··· 11 11 * published by the Free Software Foundation. 12 12 */ 13 13 14 + #ifdef CONFIG_DEBUG_MVEBU_UART_ALTERNATE 15 + #define ARMADA_370_XP_REGS_PHYS_BASE 0xf1000000 16 + #else 14 17 #define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 18 + #endif 19 + 15 20 #define ARMADA_370_XP_REGS_VIRT_BASE 0xfec00000 16 21 17 22 .macro addruart, rp, rv, tmp
+31 -30
arch/arm/mach-mvebu/armada-370-xp.c
··· 15 15 #include <linux/kernel.h> 16 16 #include <linux/init.h> 17 17 #include <linux/clk-provider.h> 18 + #include <linux/of_address.h> 18 19 #include <linux/of_platform.h> 19 20 #include <linux/io.h> 20 21 #include <linux/time-armada-370-xp.h> 21 22 #include <linux/dma-mapping.h> 22 23 #include <linux/mbus.h> 23 - #include <linux/irqchip.h> 24 24 #include <asm/hardware/cache-l2x0.h> 25 25 #include <asm/mach/arch.h> 26 26 #include <asm/mach/map.h> ··· 29 29 #include "common.h" 30 30 #include "coherency.h" 31 31 32 - static struct map_desc armada_370_xp_io_desc[] __initdata = { 33 - { 34 - .virtual = (unsigned long) ARMADA_370_XP_REGS_VIRT_BASE, 35 - .pfn = __phys_to_pfn(ARMADA_370_XP_REGS_PHYS_BASE), 36 - .length = ARMADA_370_XP_REGS_SIZE, 37 - .type = MT_DEVICE, 38 - }, 39 - }; 40 - 41 - void __init armada_370_xp_map_io(void) 32 + static void __init armada_370_xp_map_io(void) 42 33 { 43 - iotable_init(armada_370_xp_io_desc, ARRAY_SIZE(armada_370_xp_io_desc)); 34 + debug_ll_io_init(); 44 35 } 45 36 46 - void __init armada_370_xp_timer_and_clk_init(void) 47 - { 48 - of_clk_init(NULL); 49 - armada_370_xp_timer_init(); 50 - } 37 + /* 38 + * This initialization will be replaced by a DT-based 39 + * initialization once the mvebu-mbus driver gains DT support. 40 + */ 51 41 52 - void __init armada_370_xp_init_early(void) 42 + #define ARMADA_370_XP_MBUS_WINS_OFFS 0x20000 43 + #define ARMADA_370_XP_MBUS_WINS_SIZE 0x100 44 + #define ARMADA_370_XP_SDRAM_WINS_OFFS 0x20180 45 + #define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20 46 + 47 + static void __init armada_370_xp_mbus_init(void) 53 48 { 54 49 char *mbus_soc_name; 50 + struct device_node *dn; 51 + const __be32 mbus_wins_offs = cpu_to_be32(ARMADA_370_XP_MBUS_WINS_OFFS); 52 + const __be32 sdram_wins_offs = cpu_to_be32(ARMADA_370_XP_SDRAM_WINS_OFFS); 55 53 56 - /* 57 - * This initialization will be replaced by a DT-based 58 - * initialization once the mvebu-mbus driver gains DT support. 59 - */ 60 54 if (of_machine_is_compatible("marvell,armada370")) 61 55 mbus_soc_name = "marvell,armada370-mbus"; 62 56 else 63 57 mbus_soc_name = "marvell,armadaxp-mbus"; 64 58 65 - mvebu_mbus_init(mbus_soc_name, 66 - ARMADA_370_XP_MBUS_WINS_BASE, 67 - ARMADA_370_XP_MBUS_WINS_SIZE, 68 - ARMADA_370_XP_SDRAM_WINS_BASE, 69 - ARMADA_370_XP_SDRAM_WINS_SIZE); 59 + dn = of_find_node_by_name(NULL, "internal-regs"); 60 + BUG_ON(!dn); 70 61 62 + mvebu_mbus_init(mbus_soc_name, 63 + of_translate_address(dn, &mbus_wins_offs), 64 + ARMADA_370_XP_MBUS_WINS_SIZE, 65 + of_translate_address(dn, &sdram_wins_offs), 66 + ARMADA_370_XP_SDRAM_WINS_SIZE); 67 + } 68 + 69 + static void __init armada_370_xp_timer_and_clk_init(void) 70 + { 71 + of_clk_init(NULL); 72 + armada_370_xp_timer_init(); 73 + coherency_init(); 74 + armada_370_xp_mbus_init(); 71 75 #ifdef CONFIG_CACHE_L2X0 72 76 l2x0_of_init(0, ~0UL); 73 77 #endif ··· 80 76 static void __init armada_370_xp_dt_init(void) 81 77 { 82 78 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); 83 - coherency_init(); 84 79 } 85 80 86 81 static const char * const armada_370_xp_dt_compat[] = { ··· 91 88 .smp = smp_ops(armada_xp_smp_ops), 92 89 .init_machine = armada_370_xp_dt_init, 93 90 .map_io = armada_370_xp_map_io, 94 - .init_early = armada_370_xp_init_early, 95 - .init_irq = irqchip_init, 96 91 .init_time = armada_370_xp_timer_and_clk_init, 97 92 .restart = mvebu_restart, 98 93 .dt_compat = armada_370_xp_dt_compat,
-10
arch/arm/mach-mvebu/armada-370-xp.h
··· 15 15 #ifndef __MACH_ARMADA_370_XP_H 16 16 #define __MACH_ARMADA_370_XP_H 17 17 18 - #define ARMADA_370_XP_REGS_PHYS_BASE 0xd0000000 19 - #define ARMADA_370_XP_REGS_VIRT_BASE IOMEM(0xfec00000) 20 - #define ARMADA_370_XP_REGS_SIZE SZ_1M 21 - 22 - /* These defines can go away once mvebu-mbus has a DT binding */ 23 - #define ARMADA_370_XP_MBUS_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20000) 24 - #define ARMADA_370_XP_MBUS_WINS_SIZE 0x100 25 - #define ARMADA_370_XP_SDRAM_WINS_BASE (ARMADA_370_XP_REGS_PHYS_BASE + 0x20180) 26 - #define ARMADA_370_XP_SDRAM_WINS_SIZE 0x20 27 - 28 18 #ifdef CONFIG_SMP 29 19 #include <linux/cpumask.h> 30 20
+22 -22
arch/arm/mach-mvebu/coherency.c
··· 25 25 #include <linux/dma-mapping.h> 26 26 #include <linux/platform_device.h> 27 27 #include <asm/smp_plat.h> 28 + #include <asm/cacheflush.h> 28 29 #include "armada-370-xp.h" 29 30 30 - /* 31 - * Some functions in this file are called very early during SMP 32 - * initialization. At that time the device tree framework is not yet 33 - * ready, and it is not possible to get the register address to 34 - * ioremap it. That's why the pointer below is given with an initial 35 - * value matching its virtual mapping 36 - */ 37 - static void __iomem *coherency_base = ARMADA_370_XP_REGS_VIRT_BASE + 0x20200; 31 + unsigned long __cpuinitdata coherency_phys_base; 32 + static void __iomem *coherency_base; 38 33 static void __iomem *coherency_cpu_base; 39 34 40 35 /* Coherency fabric registers */ ··· 41 46 {.compatible = "marvell,coherency-fabric"}, 42 47 { /* end of list */ }, 43 48 }; 44 - 45 - #ifdef CONFIG_SMP 46 - int coherency_get_cpu_count(void) 47 - { 48 - int reg, cnt; 49 - 50 - reg = readl(coherency_base + COHERENCY_FABRIC_CFG_OFFSET); 51 - cnt = (reg & 0xF) + 1; 52 - 53 - return cnt; 54 - } 55 - #endif 56 49 57 50 /* Function defined in coherency_ll.S */ 58 51 int ll_set_cpu_coherent(void __iomem *base_addr, unsigned int hw_cpu_id); ··· 126 143 127 144 np = of_find_matching_node(NULL, of_coherency_table); 128 145 if (np) { 146 + struct resource res; 129 147 pr_info("Initializing Coherency fabric\n"); 148 + of_address_to_resource(np, 0, &res); 149 + coherency_phys_base = res.start; 150 + /* 151 + * Ensure secondary CPUs will see the updated value, 152 + * which they read before they join the coherency 153 + * fabric, and therefore before they are coherent with 154 + * the boot CPU cache. 155 + */ 156 + sync_cache_w(&coherency_phys_base); 130 157 coherency_base = of_iomap(np, 0); 131 158 coherency_cpu_base = of_iomap(np, 1); 132 159 set_cpu_coherent(cpu_logical_map(smp_processor_id()), 0); 133 - bus_register_notifier(&platform_bus_type, 134 - &mvebu_hwcc_platform_nb); 135 160 } 136 161 137 162 return 0; 138 163 } 164 + 165 + static int __init coherency_late_init(void) 166 + { 167 + bus_register_notifier(&platform_bus_type, 168 + &mvebu_hwcc_platform_nb); 169 + return 0; 170 + } 171 + 172 + postcore_initcall(coherency_late_init);
-4
arch/arm/mach-mvebu/coherency.h
··· 14 14 #ifndef __MACH_370_XP_COHERENCY_H 15 15 #define __MACH_370_XP_COHERENCY_H 16 16 17 - #ifdef CONFIG_SMP 18 - int coherency_get_cpu_count(void); 19 - #endif 20 - 21 17 int set_cpu_coherent(int cpu_id, int smp_group_id); 22 18 int coherency_init(void); 23 19
+2
arch/arm/mach-mvebu/common.h
··· 15 15 #ifndef __ARCH_MVEBU_COMMON_H 16 16 #define __ARCH_MVEBU_COMMON_H 17 17 18 + #define ARMADA_XP_MAX_CPUS 4 19 + 18 20 void mvebu_restart(char mode, const char *cmd); 19 21 20 22 void armada_370_xp_init_irq(void);
+8 -8
arch/arm/mach-mvebu/headsmp.S
··· 21 21 #include <linux/linkage.h> 22 22 #include <linux/init.h> 23 23 24 - /* 25 - * At this stage the secondary CPUs don't have acces yet to the MMU, so 26 - * we have to provide physical addresses 27 - */ 28 - #define ARMADA_XP_CFB_BASE 0xD0020200 29 - 30 24 __CPUINIT 31 25 32 26 /* ··· 29 35 * startup 30 36 */ 31 37 ENTRY(armada_xp_secondary_startup) 38 + /* Get coherency fabric base physical address */ 39 + adr r0, 1f 40 + ldr r1, [r0] 41 + ldr r0, [r0, r1] 32 42 33 43 /* Read CPU id */ 34 44 mrc p15, 0, r1, c0, c0, 5 35 45 and r1, r1, #0xF 36 46 37 47 /* Add CPU to coherency fabric */ 38 - ldr r0, =ARMADA_XP_CFB_BASE 39 - 40 48 bl ll_set_cpu_coherent 41 49 b secondary_startup 42 50 43 51 ENDPROC(armada_xp_secondary_startup) 52 + 53 + .align 2 54 + 1: 55 + .long coherency_phys_base - .
+9 -1
arch/arm/mach-mvebu/platsmp.c
··· 88 88 89 89 static void __init armada_xp_smp_init_cpus(void) 90 90 { 91 + struct device_node *np; 91 92 unsigned int i, ncores; 92 - ncores = coherency_get_cpu_count(); 93 + 94 + np = of_find_node_by_name(NULL, "cpus"); 95 + if (!np) 96 + panic("No 'cpus' node found\n"); 97 + 98 + ncores = of_get_child_count(np); 99 + if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS) 100 + panic("Invalid number of CPUs in DT\n"); 93 101 94 102 /* Limit possible CPUs to defconfig */ 95 103 if (ncores > nr_cpu_ids) {