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

Merge tag 'ux500-cleanup-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson into next/cleanup

Merge "Ux500 cleanups for the v4.2 merge window" from Linus Walleij:

* tag 'ux500-cleanup-v4.2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson:
ARM: ux500: delete static resource defines
ARM: ux500: rename ux500_map_io
ARM: ux500: look up PRCMU resource from DT
ARM: ux500: kill off L2CC static map
ARM: ux500: get rid of SCU and backupram static maps
ARM: ux500: get rid of static GIC dist base
ARM: ux500: get SCU base from device tree
ARM: ux500: remap BB offset dynamically
ARM: ux500: remove static maps from platsmp
ARM: ux500: delete UART static map

+59 -89
+10 -1
arch/arm/mach-ux500/cache-l2x0.c
··· 6 6 7 7 #include <linux/io.h> 8 8 #include <linux/of.h> 9 + #include <linux/of_address.h> 9 10 10 11 #include <asm/hardware/cache-l2x0.h> 11 12 ··· 16 15 static int __init ux500_l2x0_unlock(void) 17 16 { 18 17 int i; 19 - void __iomem *l2x0_base = __io_address(U8500_L2CC_BASE); 18 + struct device_node *np; 19 + void __iomem *l2x0_base; 20 + 21 + np = of_find_compatible_node(NULL, NULL, "arm,pl310-cache"); 22 + l2x0_base = of_iomap(np, 0); 23 + of_node_put(np); 24 + if (!l2x0_base) 25 + return -ENODEV; 20 26 21 27 /* 22 28 * Unlock Data and Instruction Lock if locked. Ux500 U-Boot versions ··· 38 30 writel_relaxed(0x0, l2x0_base + L2X0_LOCKDOWN_WAY_I_BASE + 39 31 i * L2X0_LOCKDOWN_STRIDE); 40 32 } 33 + iounmap(l2x0_base); 41 34 return 0; 42 35 } 43 36
+7 -42
arch/arm/mach-ux500/cpu-db8500.c
··· 43 43 .legacy_offset = DB8500_PRCMU_LEGACY_OFFSET, 44 44 }; 45 45 46 - /* minimum static i/o mapping required to boot U8500 platforms */ 47 - static struct map_desc u8500_uart_io_desc[] __initdata = { 48 - __IO_DEV_DESC(U8500_UART0_BASE, SZ_4K), 49 - __IO_DEV_DESC(U8500_UART2_BASE, SZ_4K), 50 - }; 51 - 52 - /* U8500 and U9540 common io_desc */ 53 - static struct map_desc u8500_common_io_desc[] __initdata = { 54 - /* SCU base also covers GIC CPU BASE and TWD with its 4K page */ 55 - __IO_DEV_DESC(U8500_SCU_BASE, SZ_4K), 56 - __IO_DEV_DESC(U8500_GIC_DIST_BASE, SZ_4K), 57 - __IO_DEV_DESC(U8500_L2CC_BASE, SZ_4K), 58 - __IO_DEV_DESC(U8500_BACKUPRAM0_BASE, SZ_8K), 59 - }; 60 - 61 - /* U8500 IO map specific description */ 62 - static struct map_desc u8500_io_desc[] __initdata = { 63 - __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K), 64 - __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K), 65 - 66 - }; 67 - 68 - /* U9540 IO map specific description */ 69 - static struct map_desc u9540_io_desc[] __initdata = { 70 - __IO_DEV_DESC(U8500_PRCMU_BASE, SZ_4K + SZ_8K), 71 - __IO_DEV_DESC(U8500_PRCMU_TCDM_BASE, SZ_4K + SZ_8K), 72 - }; 73 - 74 46 static void __init u8500_map_io(void) 75 47 { 76 - /* 77 - * Map the UARTs early so that the DEBUG_LL stuff continues to work. 78 - */ 79 - iotable_init(u8500_uart_io_desc, ARRAY_SIZE(u8500_uart_io_desc)); 80 - 81 - ux500_map_io(); 82 - 83 - iotable_init(u8500_common_io_desc, ARRAY_SIZE(u8500_common_io_desc)); 84 - 85 - if (cpu_is_ux540_family()) 86 - iotable_init(u9540_io_desc, ARRAY_SIZE(u9540_io_desc)); 87 - else 88 - iotable_init(u8500_io_desc, ARRAY_SIZE(u8500_io_desc)); 48 + debug_ll_io_init(); 49 + ux500_setup_id(); 89 50 } 90 51 91 52 /* ··· 75 114 76 115 static const char *db8500_read_soc_id(void) 77 116 { 78 - void __iomem *uid = __io_address(U8500_BB_UID_BASE); 117 + void __iomem *uid; 79 118 119 + uid = ioremap(U8500_BB_UID_BASE, 0x20); 120 + if (!uid) 121 + return NULL; 80 122 /* Throw these device-specific numbers into the entropy pool */ 81 123 add_device_randomness(uid, 0x14); 82 124 return kasprintf(GFP_KERNEL, "%08x%08x%08x%08x%08x", 83 125 readl((u32 *)uid+0), 84 126 readl((u32 *)uid+1), readl((u32 *)uid+2), 85 127 readl((u32 *)uid+3), readl((u32 *)uid+4)); 128 + iounmap(uid); 86 129 } 87 130 88 131 static struct device * __init db8500_soc_device_init(void)
+13 -7
arch/arm/mach-ux500/cpu.c
··· 16 16 #include <linux/stat.h> 17 17 #include <linux/of.h> 18 18 #include <linux/of_irq.h> 19 + #include <linux/of_address.h> 19 20 #include <linux/irq.h> 20 21 #include <linux/irqchip.h> 21 22 #include <linux/irqchip/arm-gic.h> ··· 53 52 */ 54 53 void __init ux500_init_irq(void) 55 54 { 55 + struct device_node *np; 56 + struct resource r; 57 + 56 58 gic_set_irqchip_flags(IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND); 57 59 irqchip_init(); 60 + np = of_find_compatible_node(NULL, NULL, "stericsson,db8500-prcmu"); 61 + of_address_to_resource(np, 0, &r); 62 + of_node_put(np); 63 + if (!r.start) { 64 + pr_err("could not find PRCMU base resource\n"); 65 + return; 66 + } 67 + prcmu_early_init(r.start, r.end-r.start); 68 + ux500_pm_init(r.start, r.end-r.start); 58 69 59 70 /* 60 71 * Init clocks here so that they are available for system timer 61 72 * initialization. 62 73 */ 63 74 if (cpu_is_u8500_family()) { 64 - prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 65 - ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 66 - 67 75 u8500_of_clk_init(U8500_CLKRST1_BASE, 68 76 U8500_CLKRST2_BASE, 69 77 U8500_CLKRST3_BASE, 70 78 U8500_CLKRST5_BASE, 71 79 U8500_CLKRST6_BASE); 72 80 } else if (cpu_is_u9540()) { 73 - prcmu_early_init(U8500_PRCMU_BASE, SZ_8K - 1); 74 - ux500_pm_init(U8500_PRCMU_BASE, SZ_8K - 1); 75 81 u9540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE, 76 82 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE, 77 83 U8500_CLKRST6_BASE); 78 84 } else if (cpu_is_u8540()) { 79 - prcmu_early_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1); 80 - ux500_pm_init(U8500_PRCMU_BASE, SZ_8K + SZ_4K - 1); 81 85 u8540_clk_init(U8500_CLKRST1_BASE, U8500_CLKRST2_BASE, 82 86 U8500_CLKRST3_BASE, U8500_CLKRST5_BASE, 83 87 U8500_CLKRST6_BASE);
+1 -1
arch/arm/mach-ux500/id.c
··· 72 72 * DB9540 0x413fc090 0xFFFFDBF4 0x009540xx 73 73 */ 74 74 75 - void __init ux500_map_io(void) 75 + void __init ux500_setup_id(void) 76 76 { 77 77 unsigned int cpuid = read_cpuid_id(); 78 78 unsigned int asicid = 0;
+14 -21
arch/arm/mach-ux500/platsmp.c
··· 16 16 #include <linux/device.h> 17 17 #include <linux/smp.h> 18 18 #include <linux/io.h> 19 + #include <linux/of.h> 20 + #include <linux/of_address.h> 19 21 20 22 #include <asm/cacheflush.h> 21 23 #include <asm/smp_plat.h> ··· 27 25 28 26 #include "db8500-regs.h" 29 27 #include "id.h" 28 + 29 + static void __iomem *scu_base; 30 + static void __iomem *backupram; 30 31 31 32 /* This is called from headsmp.S to wakeup the secondary core */ 32 33 extern void u8500_secondary_startup(void); ··· 44 39 pen_release = val; 45 40 smp_wmb(); 46 41 sync_cache_w(&pen_release); 47 - } 48 - 49 - static void __iomem *scu_base_addr(void) 50 - { 51 - if (cpu_is_u8500_family() || cpu_is_ux540_family()) 52 - return __io_address(U8500_SCU_BASE); 53 - else 54 - ux500_unknown_soc(); 55 - 56 - return NULL; 57 42 } 58 43 59 44 static DEFINE_SPINLOCK(boot_lock); ··· 99 104 100 105 static void __init wakeup_secondary(void) 101 106 { 102 - void __iomem *backupram; 103 - 104 - if (cpu_is_u8500_family() || cpu_is_ux540_family()) 105 - backupram = __io_address(U8500_BACKUPRAM0_BASE); 106 - else 107 - ux500_unknown_soc(); 108 - 109 107 /* 110 108 * write the address of secondary startup into the backup ram register 111 109 * at offset 0x1FF4, then write the magic number 0xA1FEED01 to the ··· 123 135 */ 124 136 static void __init ux500_smp_init_cpus(void) 125 137 { 126 - void __iomem *scu_base = scu_base_addr(); 127 138 unsigned int i, ncores; 139 + struct device_node *np; 128 140 129 - ncores = scu_base ? scu_get_core_count(scu_base) : 1; 141 + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); 142 + scu_base = of_iomap(np, 0); 143 + of_node_put(np); 144 + if (!scu_base) 145 + return; 146 + backupram = ioremap(U8500_BACKUPRAM0_BASE, SZ_8K); 147 + ncores = scu_get_core_count(scu_base); 130 148 131 149 /* sanity check */ 132 150 if (ncores > nr_cpu_ids) { ··· 147 153 148 154 static void __init ux500_smp_prepare_cpus(unsigned int max_cpus) 149 155 { 150 - 151 - scu_enable(scu_base_addr()); 156 + scu_enable(scu_base); 152 157 wakeup_secondary(); 153 158 } 154 159
+13 -2
arch/arm/mach-ux500/pm.c
··· 15 15 #include <linux/io.h> 16 16 #include <linux/suspend.h> 17 17 #include <linux/platform_data/arm-ux500-pm.h> 18 + #include <linux/of.h> 19 + #include <linux/of_address.h> 18 20 19 21 #include "db8500-regs.h" 20 22 #include "pm_domains.h" ··· 44 42 #define PRCM_ARMITVAL127TO96 (prcmu_base + 0x26C) 45 43 46 44 static void __iomem *prcmu_base; 45 + static void __iomem *dist_base; 47 46 48 47 /* This function decouple the gic from the prcmu */ 49 48 int prcmu_gic_decouple(void) ··· 91 88 { 92 89 u32 pr; /* Pending register */ 93 90 u32 er; /* Enable register */ 94 - void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE); 95 91 int i; 96 92 97 93 /* 5 registers. STI & PPI not skipped */ ··· 145 143 int prcmu_copy_gic_settings(void) 146 144 { 147 145 u32 er; /* Enable register */ 148 - void __iomem *dist_base = __io_address(U8500_GIC_DIST_BASE); 149 146 int i; 150 147 151 148 /* We skip the STI and PPI */ ··· 180 179 181 180 void __init ux500_pm_init(u32 phy_base, u32 size) 182 181 { 182 + struct device_node *np; 183 + 183 184 prcmu_base = ioremap(phy_base, size); 184 185 if (!prcmu_base) { 185 186 pr_err("could not remap PRCMU for PM functions\n"); 186 187 return; 187 188 } 189 + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-gic"); 190 + dist_base = of_iomap(np, 0); 191 + of_node_put(np); 192 + if (!dist_base) { 193 + pr_err("could not remap GIC dist base for PM functions\n"); 194 + return; 195 + } 196 + 188 197 /* 189 198 * On watchdog reboot the GIC is in some cases decoupled. 190 199 * This will make sure that the GIC is correctly configured.
+1 -15
arch/arm/mach-ux500/setup.h
··· 18 18 19 19 void ux500_restart(enum reboot_mode mode, const char *cmd); 20 20 21 - void __init ux500_map_io(void); 21 + void __init ux500_setup_id(void); 22 22 23 23 extern void __init ux500_init_irq(void); 24 24 25 25 extern struct device *ux500_soc_device_init(const char *soc_id); 26 26 27 27 extern void ux500_timer_init(void); 28 - 29 - #define __IO_DEV_DESC(x, sz) { \ 30 - .virtual = IO_ADDRESS(x), \ 31 - .pfn = __phys_to_pfn(x), \ 32 - .length = sz, \ 33 - .type = MT_DEVICE, \ 34 - } 35 - 36 - #define __MEM_DEV_DESC(x, sz) { \ 37 - .virtual = IO_ADDRESS(x), \ 38 - .pfn = __phys_to_pfn(x), \ 39 - .length = sz, \ 40 - .type = MT_MEMORY_RWX, \ 41 - } 42 28 43 29 extern struct smp_operations ux500_smp_ops; 44 30 extern void ux500_cpu_die(unsigned int cpu);