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

Merge tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC fixes from Olof Johansson:
"Again, a batch that's been sitting a couple of weeks, mostly because
I anticipated a bit more material but it didn't show up -- which is
good.

These are all your garden variety fixes for ARM platforms.

The most visible issue fixed here is probably the SMP reset issue on
OMAP, the rest are minor stuff"

* tag 'armsoc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
arm64: allwinner: a64: add pmu0 regs for USB PHY
ARM: OMAP2+: omap_device: Sync omap_device and pm_runtime after probe defer
reset: add exported __reset_control_get, return NULL if optional
ARM: orion5x: only call into phylib when available
ARM: omap2+: Revert omap-smp.c changes resetting CPU1 during boot
ARM: dts: am335x-evmsk: adjust mmc2 param to allow suspend
ARM: dts: ti: fix PCI bus dtc warnings
ARM: dts: am335x-baltos: disable EEE for Atheros 8035 PHY
ARM: dts: OMAP3: Fix MFG ID EEPROM
ARM: sun8i: a33: add operating-points-v2 property to all nodes
ARM: sun8i: a33: remove highest OPP to fix CPU crashes

+154 -41
+2
arch/arm/boot/dts/am335x-baltos.dtsi
··· 371 371 372 372 phy1: ethernet-phy@1 { 373 373 reg = <7>; 374 + eee-broken-100tx; 375 + eee-broken-1000t; 374 376 }; 375 377 }; 376 378
+1
arch/arm/boot/dts/am335x-evmsk.dts
··· 672 672 ti,non-removable; 673 673 bus-width = <4>; 674 674 cap-power-off-card; 675 + keep-power-in-suspend; 675 676 pinctrl-names = "default"; 676 677 pinctrl-0 = <&mmc2_pins>; 677 678
+2
arch/arm/boot/dts/dra7.dtsi
··· 283 283 device_type = "pci"; 284 284 ranges = <0x81000000 0 0 0x03000 0 0x00010000 285 285 0x82000000 0 0x20013000 0x13000 0 0xffed000>; 286 + bus-range = <0x00 0xff>; 286 287 #interrupt-cells = <1>; 287 288 num-lanes = <1>; 288 289 linux,pci-domain = <0>; ··· 320 319 device_type = "pci"; 321 320 ranges = <0x81000000 0 0 0x03000 0 0x00010000 322 321 0x82000000 0 0x30013000 0x13000 0 0xffed000>; 322 + bus-range = <0x00 0xff>; 323 323 #interrupt-cells = <1>; 324 324 num-lanes = <1>; 325 325 linux,pci-domain = <1>;
+1 -1
arch/arm/boot/dts/logicpd-torpedo-som.dtsi
··· 121 121 &i2c3 { 122 122 clock-frequency = <400000>; 123 123 at24@50 { 124 - compatible = "at24,24c02"; 124 + compatible = "atmel,24c64"; 125 125 readonly; 126 126 reg = <0x50>; 127 127 };
+6 -6
arch/arm/boot/dts/sun8i-a33.dtsi
··· 66 66 opp-microvolt = <1200000>; 67 67 clock-latency-ns = <244144>; /* 8 32k periods */ 68 68 }; 69 - 70 - opp@1200000000 { 71 - opp-hz = /bits/ 64 <1200000000>; 72 - opp-microvolt = <1320000>; 73 - clock-latency-ns = <244144>; /* 8 32k periods */ 74 - }; 75 69 }; 76 70 77 71 cpus { ··· 75 81 operating-points-v2 = <&cpu0_opp_table>; 76 82 }; 77 83 84 + cpu@1 { 85 + operating-points-v2 = <&cpu0_opp_table>; 86 + }; 87 + 78 88 cpu@2 { 79 89 compatible = "arm,cortex-a7"; 80 90 device_type = "cpu"; 81 91 reg = <2>; 92 + operating-points-v2 = <&cpu0_opp_table>; 82 93 }; 83 94 84 95 cpu@3 { 85 96 compatible = "arm,cortex-a7"; 86 97 device_type = "cpu"; 87 98 reg = <3>; 99 + operating-points-v2 = <&cpu0_opp_table>; 88 100 }; 89 101 }; 90 102
+1
arch/arm/mach-omap2/common.h
··· 270 270 extern int omap4_mpuss_init(void); 271 271 extern int omap4_enter_lowpower(unsigned int cpu, unsigned int power_state); 272 272 extern int omap4_hotplug_cpu(unsigned int cpu, unsigned int power_state); 273 + extern u32 omap4_get_cpu1_ns_pa_addr(void); 273 274 #else 274 275 static inline int omap4_enter_lowpower(unsigned int cpu, 275 276 unsigned int power_state)
+1 -1
arch/arm/mach-omap2/omap-hotplug.c
··· 50 50 omap4_hotplug_cpu(cpu, PWRDM_POWER_OFF); 51 51 52 52 if (omap_secure_apis_support()) 53 - boot_cpu = omap_read_auxcoreboot0(); 53 + boot_cpu = omap_read_auxcoreboot0() >> 9; 54 54 else 55 55 boot_cpu = 56 56 readl_relaxed(base + OMAP_AUX_CORE_BOOT_0) >> 5;
+18 -4
arch/arm/mach-omap2/omap-mpuss-lowpower.c
··· 64 64 #include "prm-regbits-44xx.h" 65 65 66 66 static void __iomem *sar_base; 67 + static u32 old_cpu1_ns_pa_addr; 67 68 68 69 #if defined(CONFIG_PM) && defined(CONFIG_SMP) 69 70 ··· 212 211 static void __init save_l2x0_context(void) 213 212 {} 214 213 #endif 214 + 215 + u32 omap4_get_cpu1_ns_pa_addr(void) 216 + { 217 + return old_cpu1_ns_pa_addr; 218 + } 215 219 216 220 /** 217 221 * omap4_enter_lowpower: OMAP4 MPUSS Low Power Entry Function ··· 466 460 void __init omap4_mpuss_early_init(void) 467 461 { 468 462 unsigned long startup_pa; 463 + void __iomem *ns_pa_addr; 469 464 470 - if (!(cpu_is_omap44xx() || soc_is_omap54xx())) 465 + if (!(soc_is_omap44xx() || soc_is_omap54xx())) 471 466 return; 472 467 473 468 sar_base = omap4_get_sar_ram_base(); 474 469 475 - if (cpu_is_omap443x()) 470 + /* Save old NS_PA_ADDR for validity checks later on */ 471 + if (soc_is_omap44xx()) 472 + ns_pa_addr = sar_base + CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 473 + else 474 + ns_pa_addr = sar_base + OMAP5_CPU1_WAKEUP_NS_PA_ADDR_OFFSET; 475 + old_cpu1_ns_pa_addr = readl_relaxed(ns_pa_addr); 476 + 477 + if (soc_is_omap443x()) 476 478 startup_pa = __pa_symbol(omap4_secondary_startup); 477 - else if (cpu_is_omap446x()) 479 + else if (soc_is_omap446x()) 478 480 startup_pa = __pa_symbol(omap4460_secondary_startup); 479 481 else if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE) 480 482 startup_pa = __pa_symbol(omap5_secondary_hyp_startup); 481 483 else 482 484 startup_pa = __pa_symbol(omap5_secondary_startup); 483 485 484 - if (cpu_is_omap44xx()) 486 + if (soc_is_omap44xx()) 485 487 writel_relaxed(startup_pa, sar_base + 486 488 CPU1_WAKEUP_NS_PA_ADDR_OFFSET); 487 489 else
-1
arch/arm/mach-omap2/omap-smc.S
··· 94 94 ldr r12, =0x103 95 95 dsb 96 96 smc #0 97 - mov r0, r0, lsr #9 98 97 ldmfd sp!, {r2-r12, pc} 99 98 ENDPROC(omap_read_auxcoreboot0)
+76 -14
arch/arm/mach-omap2/omap-smp.c
··· 21 21 #include <linux/io.h> 22 22 #include <linux/irqchip/arm-gic.h> 23 23 24 + #include <asm/sections.h> 24 25 #include <asm/smp_scu.h> 25 26 #include <asm/virt.h> 26 27 ··· 41 40 42 41 #define OMAP5_CORE_COUNT 0x2 43 42 43 + #define AUX_CORE_BOOT0_GP_RELEASE 0x020 44 + #define AUX_CORE_BOOT0_HS_RELEASE 0x200 45 + 44 46 struct omap_smp_config { 45 47 unsigned long cpu1_rstctrl_pa; 46 48 void __iomem *cpu1_rstctrl_va; 47 49 void __iomem *scu_base; 50 + void __iomem *wakeupgen_base; 48 51 void *startup_addr; 49 52 }; 50 53 ··· 145 140 static struct clockdomain *cpu1_clkdm; 146 141 static bool booted; 147 142 static struct powerdomain *cpu1_pwrdm; 148 - void __iomem *base = omap_get_wakeupgen_base(); 149 143 150 144 /* 151 145 * Set synchronisation state between this boot processor ··· 159 155 * A barrier is added to ensure that write buffer is drained 160 156 */ 161 157 if (omap_secure_apis_support()) 162 - omap_modify_auxcoreboot0(0x200, 0xfffffdff); 158 + omap_modify_auxcoreboot0(AUX_CORE_BOOT0_HS_RELEASE, 159 + 0xfffffdff); 163 160 else 164 - writel_relaxed(0x20, base + OMAP_AUX_CORE_BOOT_0); 161 + writel_relaxed(AUX_CORE_BOOT0_GP_RELEASE, 162 + cfg.wakeupgen_base + OMAP_AUX_CORE_BOOT_0); 165 163 166 164 if (!cpu1_clkdm && !cpu1_pwrdm) { 167 165 cpu1_clkdm = clkdm_lookup("mpu1_clkdm"); ··· 267 261 set_cpu_possible(i, true); 268 262 } 269 263 264 + /* 265 + * For now, just make sure the start-up address is not within the booting 266 + * kernel space as that means we just overwrote whatever secondary_startup() 267 + * code there was. 268 + */ 269 + static bool __init omap4_smp_cpu1_startup_valid(unsigned long addr) 270 + { 271 + if ((addr >= __pa(PAGE_OFFSET)) && (addr <= __pa(__bss_start))) 272 + return false; 273 + 274 + return true; 275 + } 276 + 277 + /* 278 + * We may need to reset CPU1 before configuring, otherwise kexec boot can end 279 + * up trying to use old kernel startup address or suspend-resume will 280 + * occasionally fail to bring up CPU1 on 4430 if CPU1 fails to enter deeper 281 + * idle states. 282 + */ 283 + static void __init omap4_smp_maybe_reset_cpu1(struct omap_smp_config *c) 284 + { 285 + unsigned long cpu1_startup_pa, cpu1_ns_pa_addr; 286 + bool needs_reset = false; 287 + u32 released; 288 + 289 + if (omap_secure_apis_support()) 290 + released = omap_read_auxcoreboot0() & AUX_CORE_BOOT0_HS_RELEASE; 291 + else 292 + released = readl_relaxed(cfg.wakeupgen_base + 293 + OMAP_AUX_CORE_BOOT_0) & 294 + AUX_CORE_BOOT0_GP_RELEASE; 295 + if (released) { 296 + pr_warn("smp: CPU1 not parked?\n"); 297 + 298 + return; 299 + } 300 + 301 + cpu1_startup_pa = readl_relaxed(cfg.wakeupgen_base + 302 + OMAP_AUX_CORE_BOOT_1); 303 + cpu1_ns_pa_addr = omap4_get_cpu1_ns_pa_addr(); 304 + 305 + /* Did the configured secondary_startup() get overwritten? */ 306 + if (!omap4_smp_cpu1_startup_valid(cpu1_startup_pa)) 307 + needs_reset = true; 308 + 309 + /* 310 + * If omap4 or 5 has NS_PA_ADDR configured, CPU1 may be in a 311 + * deeper idle state in WFI and will wake to an invalid address. 312 + */ 313 + if ((soc_is_omap44xx() || soc_is_omap54xx()) && 314 + !omap4_smp_cpu1_startup_valid(cpu1_ns_pa_addr)) 315 + needs_reset = true; 316 + 317 + if (!needs_reset || !c->cpu1_rstctrl_va) 318 + return; 319 + 320 + pr_info("smp: CPU1 parked within kernel, needs reset (0x%lx 0x%lx)\n", 321 + cpu1_startup_pa, cpu1_ns_pa_addr); 322 + 323 + writel_relaxed(1, c->cpu1_rstctrl_va); 324 + readl_relaxed(c->cpu1_rstctrl_va); 325 + writel_relaxed(0, c->cpu1_rstctrl_va); 326 + } 327 + 270 328 static void __init omap4_smp_prepare_cpus(unsigned int max_cpus) 271 329 { 272 - void __iomem *base = omap_get_wakeupgen_base(); 273 330 const struct omap_smp_config *c = NULL; 274 331 275 332 if (soc_is_omap443x()) ··· 350 281 /* Must preserve cfg.scu_base set earlier */ 351 282 cfg.cpu1_rstctrl_pa = c->cpu1_rstctrl_pa; 352 283 cfg.startup_addr = c->startup_addr; 284 + cfg.wakeupgen_base = omap_get_wakeupgen_base(); 353 285 354 286 if (soc_is_dra74x() || soc_is_omap54xx()) { 355 287 if ((__boot_cpu_mode & MODE_MASK) == HYP_MODE) ··· 369 299 if (cfg.scu_base) 370 300 scu_enable(cfg.scu_base); 371 301 372 - /* 373 - * Reset CPU1 before configuring, otherwise kexec will 374 - * end up trying to use old kernel startup address. 375 - */ 376 - if (cfg.cpu1_rstctrl_va) { 377 - writel_relaxed(1, cfg.cpu1_rstctrl_va); 378 - readl_relaxed(cfg.cpu1_rstctrl_va); 379 - writel_relaxed(0, cfg.cpu1_rstctrl_va); 380 - } 302 + omap4_smp_maybe_reset_cpu1(&cfg); 381 303 382 304 /* 383 305 * Write the address of secondary startup routine into the ··· 381 319 omap_auxcoreboot_addr(__pa_symbol(cfg.startup_addr)); 382 320 else 383 321 writel_relaxed(__pa_symbol(cfg.startup_addr), 384 - base + OMAP_AUX_CORE_BOOT_1); 322 + cfg.wakeupgen_base + OMAP_AUX_CORE_BOOT_1); 385 323 } 386 324 387 325 const struct smp_operations omap4_smp_ops __initconst = {
+8
arch/arm/mach-omap2/omap_device.c
··· 222 222 dev_err(dev, "failed to idle\n"); 223 223 } 224 224 break; 225 + case BUS_NOTIFY_BIND_DRIVER: 226 + od = to_omap_device(pdev); 227 + if (od && (od->_state == OMAP_DEVICE_STATE_ENABLED) && 228 + pm_runtime_status_suspended(dev)) { 229 + od->_driver_status = BUS_NOTIFY_BIND_DRIVER; 230 + pm_runtime_set_active(dev); 231 + } 232 + break; 225 233 case BUS_NOTIFY_ADD_DEVICE: 226 234 if (pdev->dev.of_node) 227 235 omap_device_build_from_dt(pdev);
+1
arch/arm/mach-orion5x/Kconfig
··· 6 6 select GPIOLIB 7 7 select MVEBU_MBUS 8 8 select PCI 9 + select PHYLIB if NETDEVICES 9 10 select PLAT_ORION_LEGACY 10 11 help 11 12 Support for the following Marvell Orion 5x series SoCs:
+5
arch/arm/plat-orion/common.c
··· 468 468 eth_data, &orion_ge11); 469 469 } 470 470 471 + #ifdef CONFIG_ARCH_ORION5X 471 472 /***************************************************************************** 472 473 * Ethernet switch 473 474 ****************************************************************************/ ··· 480 479 { 481 480 struct mdio_board_info *bd; 482 481 unsigned int i; 482 + 483 + if (!IS_BUILTIN(CONFIG_PHYLIB)) 484 + return; 483 485 484 486 for (i = 0; i < ARRAY_SIZE(d->port_names); i++) 485 487 if (!strcmp(d->port_names[i], "cpu")) ··· 497 493 498 494 mdiobus_register_board_info(&orion_ge00_switch_board_info, 1); 499 495 } 496 + #endif 500 497 501 498 /***************************************************************************** 502 499 * I2C
+2
arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi
··· 179 179 usbphy: phy@01c19400 { 180 180 compatible = "allwinner,sun50i-a64-usb-phy"; 181 181 reg = <0x01c19400 0x14>, 182 + <0x01c1a800 0x4>, 182 183 <0x01c1b800 0x4>; 183 184 reg-names = "phy_ctrl", 185 + "pmu0", 184 186 "pmu1"; 185 187 clocks = <&ccu CLK_USB_PHY0>, 186 188 <&ccu CLK_USB_PHY1>;
+16 -6
drivers/reset/core.c
··· 275 275 } 276 276 EXPORT_SYMBOL_GPL(reset_control_status); 277 277 278 - static struct reset_control *__reset_control_get( 278 + static struct reset_control *__reset_control_get_internal( 279 279 struct reset_controller_dev *rcdev, 280 280 unsigned int index, bool shared) 281 281 { ··· 308 308 return rstc; 309 309 } 310 310 311 - static void __reset_control_put(struct reset_control *rstc) 311 + static void __reset_control_put_internal(struct reset_control *rstc) 312 312 { 313 313 lockdep_assert_held(&reset_list_mutex); 314 314 ··· 377 377 } 378 378 379 379 /* reset_list_mutex also protects the rcdev's reset_control list */ 380 - rstc = __reset_control_get(rcdev, rstc_id, shared); 380 + rstc = __reset_control_get_internal(rcdev, rstc_id, shared); 381 381 382 382 mutex_unlock(&reset_list_mutex); 383 383 384 384 return rstc; 385 385 } 386 386 EXPORT_SYMBOL_GPL(__of_reset_control_get); 387 + 388 + struct reset_control *__reset_control_get(struct device *dev, const char *id, 389 + int index, bool shared, bool optional) 390 + { 391 + if (dev->of_node) 392 + return __of_reset_control_get(dev->of_node, id, index, shared, 393 + optional); 394 + 395 + return optional ? NULL : ERR_PTR(-EINVAL); 396 + } 397 + EXPORT_SYMBOL_GPL(__reset_control_get); 387 398 388 399 /** 389 400 * reset_control_put - free the reset controller ··· 407 396 return; 408 397 409 398 mutex_lock(&reset_list_mutex); 410 - __reset_control_put(rstc); 399 + __reset_control_put_internal(rstc); 411 400 mutex_unlock(&reset_list_mutex); 412 401 } 413 402 EXPORT_SYMBOL_GPL(reset_control_put); ··· 428 417 if (!ptr) 429 418 return ERR_PTR(-ENOMEM); 430 419 431 - rstc = __of_reset_control_get(dev ? dev->of_node : NULL, 432 - id, index, shared, optional); 420 + rstc = __reset_control_get(dev, id, index, shared, optional); 433 421 if (!IS_ERR(rstc)) { 434 422 *ptr = rstc; 435 423 devres_add(dev, ptr);
+14 -8
include/linux/reset.h
··· 15 15 struct reset_control *__of_reset_control_get(struct device_node *node, 16 16 const char *id, int index, bool shared, 17 17 bool optional); 18 + struct reset_control *__reset_control_get(struct device *dev, const char *id, 19 + int index, bool shared, 20 + bool optional); 18 21 void reset_control_put(struct reset_control *rstc); 19 22 struct reset_control *__devm_reset_control_get(struct device *dev, 20 23 const char *id, int index, bool shared, ··· 75 72 return optional ? NULL : ERR_PTR(-ENOTSUPP); 76 73 } 77 74 75 + static inline struct reset_control *__reset_control_get( 76 + struct device *dev, const char *id, 77 + int index, bool shared, bool optional) 78 + { 79 + return optional ? NULL : ERR_PTR(-ENOTSUPP); 80 + } 81 + 78 82 static inline struct reset_control *__devm_reset_control_get( 79 83 struct device *dev, const char *id, 80 84 int index, bool shared, bool optional) ··· 112 102 #ifndef CONFIG_RESET_CONTROLLER 113 103 WARN_ON(1); 114 104 #endif 115 - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false, 116 - false); 105 + return __reset_control_get(dev, id, 0, false, false); 117 106 } 118 107 119 108 /** ··· 140 131 static inline struct reset_control *reset_control_get_shared( 141 132 struct device *dev, const char *id) 142 133 { 143 - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true, 144 - false); 134 + return __reset_control_get(dev, id, 0, true, false); 145 135 } 146 136 147 137 static inline struct reset_control *reset_control_get_optional_exclusive( 148 138 struct device *dev, const char *id) 149 139 { 150 - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, false, 151 - true); 140 + return __reset_control_get(dev, id, 0, false, true); 152 141 } 153 142 154 143 static inline struct reset_control *reset_control_get_optional_shared( 155 144 struct device *dev, const char *id) 156 145 { 157 - return __of_reset_control_get(dev ? dev->of_node : NULL, id, 0, true, 158 - true); 146 + return __reset_control_get(dev, id, 0, true, true); 159 147 } 160 148 161 149 /**